#making-mods-general

1 messages · Page 223 of 1

rough lintel
#

on a related note, what is a good resource for c# learning in relation to sdv code? i have such a hard time relating(?? any of my knowledge to sdv because i just cant read other peoples code

rancid musk
#

Finally, Better Chests. The first android exclusive mod.

rough lintel
#

while i love ca, i genuinely feel like an idiot trying to figure out where he does things 💀

calm nebula
#

Maybe I'll make that workout tracker in android smapi

#

I have been bitching that there isn't a workout tracker I like

rough lintel
lucid iron
tawny ore
lucid iron
#

After that it's really just using a specific set of libraries

tawny ore
#

It's something I'm pretty well-practiced in since I've had to take over codebases at my job, and it's always a pain trying to understand what other people's intentions are.

rough lintel
#

i mean i know c# but reading ca’s code makes me want to fall down and not get back up 😭

#

yeah

tawny ore
#

It's like you have to understand, wth they were thinking when they wrote that

lucid iron
#

I have Strong and Vaguely Justified Opinions about code style so i trip over other people's code a lot

rough lintel
#

parsing his code makes me feel like a beginner bc im like Huh. What. How

teal bridge
#

Not all of SDV is CA's code, that's part of why it's sometimes so hard to understand.

#

(not the entire reason why, but part of it)

lucid iron
#

And there's ppl out there with a equally Strong set of opinions completely opposite of mine

tawny ore
#

Sometimes it's difficult for me to understand at my own code after not looking at it for long enough

rough lintel
#

me hanging out in Game1.cs like 😼

teal bridge
#

I don't have opinions about code, only stone cold facts.

lucid iron
#

Game1.cs is apparently a big ol partial in the real source

#

The fact that u r read decompile further complicate things

rough lintel
#

Game1 is the load bearing rock

#

love that for the rock

lucid iron
#

*big ol partial as in, it's several presumably more organized files

#

Each supplying some portion of Game1

rancid musk
#

A bunch of stuff in the Stardew decompile is way different from the original code, because the compiler Does Things™️ and there's no good way to decompile that back into what CA actually wrote

teal bridge
#

Game1 is undoubtedly a lot more readable in the original source, but methods like Update and pressUseToolButton are special in and of themselves.

rough lintel
#

you’ve heard of Game1, now introducing… Game2

rancid musk
#

Like, it does crazy weird optimizations for some switch statements on strings, as an example

uncut viper
teal bridge
#

You never gave me the impression of having particularly strong opinions on those things.

brittle pasture
#

not sure I hate that more or the string interpolation

uncut viper
#

on code style? i do. it just rarely comes up because I'm rarely working in someone else's code

calm nebula
rancid musk
#

String interpolation in the decomp is way better now that I pushed for updated ILSpy

lucid iron
#

No i think u r fine button Dokkan

calm nebula
#

I am not fucking making a workout tracker in android smapi

rough lintel
rough lintel
lucid iron
#

||its casey, spacecore very scary and doesn't use nullable||

lusty elm
teal bridge
#

Well, some of us do chafe when we see things like ridiculous indentation patterns, don't know if that's you or just others.

rancid musk
teal bridge
#

But that's not really "code style" so much as... I don't know, like making your bed?

rough lintel
#

me indenting five hundred times

tawny ore
rough lintel
#

NO i’m just intimidated by button 😭 also hey button whats good

uncut viper
#

howdy hey

lucid iron
#

Don't look at my generic crimes idk what a oop is anymore

uncut viper
#

i try not to be intimidating it just clashes with my also strong opinions on how people should answer questions/teach new modders is all

brittle pasture
#

speaking of android, if hypotheticaly I have to reference an android-specific function for an android-specific patch would I need IL so the compiler that builds against the PC version doesn't cry and beat me up

rancid musk
# rough lintel me indenting five hundred times

Allow me to introduce my innovative new way to indent my code ```cs
static int Fib(int x) {
if (x == 0) return 0;
int prev = 0;
int next = 1;
for (int i = 1; i < x; i++) {
int sum = prev + next;
prev = next;
next = sum;
}
return next;
}

teal bridge
#

Of all the people here, I think Pathos has the weirdest code style to me. Not weird as in inherently bad (it is style after all), but unusual and foreign.

brittle pasture
#

(or reflection)

rough lintel
#

pathos’ code is so easy to read for me what

#

i eat it up like cereal

lucid iron
teal bridge
lucid iron
#

Reflection or just write in a way that works both sides yea

rancid musk
tawny ore
calm nebula
teal bridge
lucid iron
#

I can't imagine doing 2nd build just for phone

rancid musk
lucid iron
teal bridge
#

Haha, you'll have to blame me for that too.

tawny ore
#

That's probably related a certain belief in limiting the surface area of dependencies. It's not so bad if we had a good DI framework to handle all of that stuff.

teal bridge
#

I find statics fine in mods but stay far away from them in framework/library code.

uncut viper
#

im glad no one looks through my repos enough to know what they don't like about my style and vice versa with me and theirs, ignorance is bliss SDVpuffersmile

teal bridge
#

And they're fine in mods because (a) they're generally siloed (if you reflect on them, that's your problem, not mine) and (b) everything they do is single threaded.

rough lintel
#

im not Built like you guys….

rough lintel
tawny ore
#

Just think about reading and understanding anyone else's codebase is like exercising that skill

#

That's ultimately what it takes to become an effective C# modder, imo

teal bridge
uncut viper
#

i stand on the shoulders of giants or however the saying goes

lucid iron
#

Yeah i wouldn't worry too much about nitpickings

tawny ore
#

I snoop on everyone's repos

lucid iron
#

It's a game mod, make it work first

lucid iron
#

Pretty comes later

light jasper
rancid musk
rough lintel
#

ive read atra’s code, i found it slightly more difficult to parse but i could understand it well :’D

light jasper
rough lintel
#

i like everyones code ur all clear coders muah

tawny ore
teal bridge
tawny ore
#

It's almost poetic

rough lintel
#

abt to change my vs font to be obnoxious cursive for the real coding challenge

#

challenge: code a mod in wingdings 🏌️

teal bridge
#

Well, one good thing about centered code is that you don't need to use a monospace font.

calm nebula
#

I should hide my repo better

tawny ore
#

My VS is rainbows and ligatures, and I know some people would hate that

light jasper
#

plsno atra I steal so much code from you

rough lintel
#

atra noooo ur fertilizer …. i want to read it….

calm nebula
#

I'm glad my professional side is on gitlab

rancid musk
# rough lintel abt to change my vs font to be obnoxious cursive for the real coding challenge
𝓼𝓽𝓪𝓽𝓲𝓬 𝓲𝓷𝓽 𝓕𝓲𝓫(𝓲𝓷𝓽 𝔁) {
    𝓲𝓯 (𝔁 == 0)
        𝓻𝓮𝓽𝓾𝓻𝓷 0;
    𝓲𝓷𝓽 𝓹𝓻𝓮𝓿 = 0;
    𝓲𝓷𝓽 𝓷𝓮𝔁𝓽 = 1;
    𝓯𝓸𝓻 (𝓲𝓷𝓽 𝓲 = 1; 𝓲 < 𝔁; 𝓲++) {
        𝓲𝓷𝓽 𝓼𝓾𝓶 = 𝓹𝓻𝓮𝓿 + 𝓷𝓮𝔁𝓽;
        𝓹𝓻𝓮𝓿 = 𝓷𝓮𝔁𝓽;
        𝓷𝓮𝔁𝓽 = 𝓼𝓾𝓶;
    }
    𝓻𝓮𝓽𝓾𝓻𝓷 𝓷𝓮𝔁𝓽;
}```
calm nebula
#

Khloe I can't

#

I'm so sorry

calm nebula
#

I respect your life choices but no

teal bridge
#

That's not really cursive, what is that Brush Script or something?

rough lintel
#

me when i code

light jasper
uncut viper
brittle pasture
#

To everyone here worried that their code might have been read, I'm here to tell you you no longer have to worry

Because I most definitely read it

tawny ore
#

I mean I do occassionally refresh the mod dump

uncut viper
#

selph if you've never brought it up then I'm just gonna have to assume that means you were so in awe of my code that it left you speechless

rough lintel
rancid musk
#

real coders use 3 different IDEs and a bunch of terminal windows

uncut viper
#

i used eclipse once maybe 13 years ago and wouldn't recommend the experience

teal bridge
#

I would rather use vi (literal vi, not even vim) than Eclipse.

calm nebula
rancid musk
#

(It's possible I have VS, VSCode, Notepad++, and Rider all open right now.)

lusty elm
#

You've heard of camelCase and PascalCase, but have you heard of igPayatinLayaseCay. (Pig Latin Case)

brittle pasture
#

ah Eclipse my bel-, well, you were there

uncut viper
#

are you counting npp as an ide or a terminal window there

tawny ore
#

I have been using VS and VSCodium side-by-side lately just because there are some things that are nicer to edit with VSCode extensions

brittle pasture
#

neither beloved nor beloathed

calm nebula
#

I use vim at work

teal bridge
#

I wonder why kebab-case isn't a more popular coding style.

tawny ore
#

Particularly markdown is a much more pleasant experience in VSCode

calm nebula
#

||we have nothing else installed||

tawny ore
#

I wOnDeR wHy ThIs IsN't A mOrE pOpUlAr CoDiNg StYlE Mock

rough lintel
#

hey thats that spongebob meme!

rancid musk
rough lintel
#

i May be silly

calm nebula
#

I hate you

tawny ore
#

It just keeps on getting worse

calm nebula
#

We are gonna stop using mod manifest builder if you keep that up

brittle pasture
rough lintel
#

oh!

rough lintel
#

okay swag thats what i thought, just had to make sure

lucid iron
#

They are sync'd in multiplayer and per instance of crop (or whatever thing)

rough lintel
lucid iron
#

It's convenient

rough lintel
#

yippee

teal bridge
#

Khloe is obviously very bored right now, somebody file some bug reports on Better Crafting to brighten things up.

brittle pasture
#

its purpose is to allow mods to store any data they want without having to deal with serialization/mp syncing

lucid iron
#

Hmmm

rancid musk
#

I'm waiting for a very big project to compile lol

tawny ore
#

There is that whole unsolved mutex thing...

rancid musk
#

... what unsolved mutex thing?

uncut viper
#

aren't you supposed to be foam sword fighting on office chairs when waiting for compiling

tawny ore
#

Isn't ticking chests in unloaded locations for farmhands still a white whale?

rough lintel
#

OH oh that reminds me too. what feels more legible when appending the tier onto seeds? example is for silver star seeds

“Silver Turnip Seeds”
“(draw actual silver star) Turnip Seeds”
“Level 2 Turnip Seeds”
“Turnip Seeds Lv2”

rancid musk
#

That's why I have spooky action, to force some things to tick

rough lintel
#

or maybe “Turnip Seeds (Silver)”…. ergh i dont like that one

tawny ore
#

My answer to that was to just make them global

brittle pasture
#

fourth option doesnt mess with sorting, I think

lusty elm
#

How many Tiers Do you have?

rough lintel
#

its regular, silver, gold, iridium “tier”

#

but the “tier” is just quality

tawny ore
#

Do objects normally represent their quality in the display name?

rough lintel
#

of the seedbag

#

they dont, idt

teal bridge
#

Foam swords are a myth. Goating is totally real, though.

#

(That was a reply to Button above)

rough lintel
#

but for these seeds to signify visually what they can grow, i felt i needed a universal indicator of some kind

uncut viper
#

is the star icon not that indicator?

lusty elm
#

normally its just a symbol in the corner, If you can draw a silver star i think that works best

rough lintel
#

well i mean when planted

#

if you hover over it

tawny ore
teal bridge
#

Yes, thanks for the tip. If only there were a way to do it retroactively, after the message has already been typed, which there isn't.

uncut viper
lucid iron
uncut viper
#

(/j)

lusty elm
rough lintel
#

yeah i was thinking i’d have to do informant compat

tawny ore
#

My preference is that anyone who wishes to address me tags everyone, but this server doesn't allow that unfortunately

teal bridge
#

You've heard of no-ping, but what about only-ping?

rough lintel
#

or add an item that lets u see quality of a plant when equipped…. haha….

uncut viper
#

i think if i had to choose one way to force people to be consistent about it i would actually choose only ping

rough lintel
#

magnifying glass rune factory i love you…

lusty elm
#

I have seen people with always @ me, in their name

tawny ore
teal bridge
#

(That's a riff on onlyhello, btw, but I'm not obnoxious enough to actually do it here)

rancid musk
brittle pasture
brittle ledge
rancid musk
#

Good news, that thing finished compiling so I can theoretically do work now

#

(That is also bad news)

brittle ledge
#

Ah, another one for the "I am checking Discord while I wait for my work task to run" crowd?

tawny ore
#

Hate to be on topic for a second, but the vanilla Machine data model only supports a single drop, does anyone know?

calm nebula
#

Does it not do random item ids

tawny ore
#

Random picks one from the list with equal chance

brittle ledge
#

Yeah, it can do that.

light jasper
brittle ledge
#

LFL uses it.

rough lintel
#

was mostly some sort of “vanilla” failsafe in case someone doesnt have uiis or informant installed (which is a very low amt of people)

#

eh fuck it informant/uiis now necessary

calm nebula
#

Seed maker is c#

tawny ore
light jasper
#

ah

#

well then

#

ig there's your answer?

tawny ore
#

Yeah that's fine. This mod was a PFM mod but I'm trying to update it using only CP and vanilla data models.

#

So I guess it's getting nerfed.

light jasper
#

rip

rough lintel
#

hehe…. i would know….

#

😎

calm nebula
#

I think you're telling me we need a weighted item query

light jasper
#

finished my frog mod, now I need another project...
too bad I don't have a big project that I'm avoiding my rewrite of

brittle pasture
#

you can do weight with machines, the output supports multiple entries where one gets picked

#

so have one with RANDOM: 0.3 or something

tawny ore
#

Yeah, outputitems can do that, but the field within an output item has RandomItemId which does equal chances

teal bridge
#

Didn't you already have a bunch done on the UIIS rewrite?

light jasper
#

@tawny ore yk what I miss? I really miss the filter you had in BetterChests where only certain items could go in. Convenient Inventory just doesn't have the same type of thing, it only works with stuff that's already in the chest

teal bridge
#

I thought there were even screenshots and stuff.

brittle pasture
#

right
I had that thought about a weighted item query before, when I was making a version of LOCATION_FISH usable in machines for MTF

light jasper
tawny ore
teal bridge
#

I'm not sure whether to interpret that as high or low in your opinion.

uncut viper
#

just steal the UI from one of the various minecraft pipe mods, of course

brittle pasture
#

right now you can use the weighted, location-accurate version which will only ever return one item (meaning you can't do filters on it), or use the unweighted version which returns every fish, but you can filter it

#

theoretically you can make a weighted item query by stuffing the output with duplicate entries, but wehh math

teal bridge
tawny ore
#

Yeah I don't plan on recreating that

#

But I don't know yet what I do plan to create

#

I want something better than individually selecting items

calm nebula
#

Make users learn sql

rancid musk
#

make users learn linq

teal bridge
#

Ah, fair enough. For me one of the challenges is always the iconography, there are no icons for things like categories or context tags or whatever and SDV is heavily dependent on that kind of visual style.

tawny ore
#

But not as convoluted as a whole search parser which is what the last one did

uncut viper
#

give them the ITEM_ GSQs

light jasper
teal bridge
#

If you're willing to go for just text, though, it seems fairly straightforward.

brittle pasture
#

cant wait to store my fish "; DROP TABLE Fish" in my fishing chest

tawny ore
#

An earlier version of filtering was literally just search text, and I got a flood of complaints that it was confusing and not flexible enough

teal bridge
#

I wouldn't do just search text, yeah. Item categories would be a start. Context tags are likely a bit mysterious to players since they don't have friendly names, but they are very useful for that type of thing.

brittle pasture
#

tbh the best option that will guarantee you maximum nexus user satisfaction is probably a manually curated category screen

#

text scary

teal bridge
#

You can probably do a hacky category thing by just picking a representative item from that category and displaying it as an icon (and don't even bother with a name, since categories technically don't have them; you could add manually-named tooltips but if a mod adds its own category then that'll break down)

light jasper
# teal bridge I'm not sure whether to interpret that as high or low in your opinion.

idk either way it's just a lot of thinking about how I want everything to mesh together that's the burnout part for me.
the point was more like I've already been gutting the thing lol. more than half the new modules are done, just agonizing over how to do some parts in a way that'll make me feel good about maintaining it because right now there are parts from like 1.3 that haven't been touched in years

tawny ore
#

That's what I'm basically thinking is there needs to be a visual (UI) way to select things like category, quality, etc.

#

Various item properties

rancid musk
#

I don't get a lot of complaints about the filtering rules in Better Crafting but I"m also not sure many players actually do anything beyond use the defaults.

tawny ore
#

But that's what I'm stuck on is an intuitive UI for that

lucid iron
teal bridge
brittle pasture
#

I split them by mod (which I just use text search)

lucid iron
#

It would be nice if that updated as i craft things but not big deal

teal bridge
#

Don't know if that's inspiring or demotivating.

tawny ore
#

I rewrite my mods all the time, but that's only because an idiot wrote them

lucid iron
#

For chest filtering i think category + quality gets me a long way

rough lintel
lucid iron
#

Then maybe uh, mod id prefix?

light jasper
lucid iron
#

So i can put my wag butter in a different chest than my cornucopia butter and a third chest for my vmv butter

lusty elm
teal bridge
#

Meh, in my case I don't think an idiot wrote 0.2.x, just someone who was still pretty new to modding, and doing it when there were fewer tools around for doing it "right".

tawny ore
lucid iron
#

No that'd be confusing they r all called butter

tawny ore
#

brb, I'll just make AE2 for SDV

light jasper
#

I thought about doing that

lucid iron
#

More seriously these big artisan good mods tend to have like

light jasper
#

but then automate and better crafting existed

lucid iron
#

Their own system of recipes

brittle pasture
lucid iron
#

What is AE2

tawny ore
#

I mean... tell me this storage doesn't make sense to you?

light jasper
#

very fun

#

also the code for it is some wizardry

tawny ore
#

And it's super easy to setup too

teal bridge
light jasper
#

people who say channels are too hard just aren't trying

#

get good

lucid iron
#

275k ender pearl bolbonfire

light jasper
#

not enough ender pearl

tawny ore
#

Amateur numbers

uncut viper
brittle pasture
#

random thought - just copy factorio and implement logistic junimos

uncut viper
#

i thought that was Junimatic

light jasper
#

oh I've thought of something that bothers me that I can make a mod for

lucid iron
#

Logistic dorf sentries

uncut viper
#

(ive never tried junimatic)

light jasper
#

unless it already exists

lucid iron
#

Little dorf bots that carry stuff

light jasper
#

Junimo Hut Sprinklers

brittle pasture
#

junimatic is just the "bring items to/from machines" part of logistic bots

tawny ore
#

Where is that liquid coming from, and is that water?

light jasper
#

no, like they water the area around the hut because they fucking ALWAYS screw up my sprinkler layout

uncut viper
#

its grape juice

teal bridge
#

Not functional or anything, just to add some flavor as the amount of shipping ramps up.

brittle pasture
#

I'm imagining a system where you don't care which of your 13 chests you're putting your 3 butters, just that they are present somewhere, and a junimo can dig them out and give them to you on demand

light jasper
#

I'm on github looking at the applied energistics 2 code rn and it's still just as fucking crazy as ever

tawny ore
light jasper
#

oh trueeee

teal bridge
#

Also they should only take up 1 tile.

light jasper
#

brb making every junimo hut a pocket dimension

tawny ore
#

Are you just making Junimatic with a few more steps?

#

Junimatic should become a framework so that you can code those guys to do your bidding

light jasper
#

fuck

brittle pasture
#

they water, they hoe, they shake fruit trees, they plant seeds, they even grow and chop trees

#

personally I don't use it anymore since it's a bit too much, but the option's there

teal bridge
#

This is starting to sound a little disturbing.

rancid musk
tawny ore
#

SDV as an RTS using Junimos, when?

brittle pasture
#

can't break game balance, I said as I vroom around in a tractor

light jasper
#

Compact Machines in SDV

#

I mean ig that's just sheds though

rancid musk
#

Compact Machines is just a shed definitely

brittle pasture
light jasper
calm nebula
#

I have opinions on not making the game easier

#

Instead I just don't play the game

brittle pasture
light jasper
tawny ore
#

I do timed mod installations so that I don't skip the early grind

lucid iron
#

What if u make like

#

Little junimo houses that go on sprinklers

brittle pasture
#

the only "cheaty" mod I use are Junimatic, Tractor and Time Speed, and it's mainly to reduce late game tedium

true coyote
#

How do you go about adding i18n for the config/what shows in gmcm? Someone asked for translations of that for my fence mod

lucid iron
#

I did always wonder how harvesting could possibly make sense

light jasper
uncut viper
#

sorry, yeah, selph's link

#

(unless you werent sure how to do i18n in the first place, in which case, both links SDVpufferthumbsup)

true coyote
#

Thank you both!

#

Yep just selphs will do SDVpufferheart

brittle pasture
#

I don't have much farming space, time speed is more so I can experience more of the expansions' content

#

even then I only add 2 extra seconds

tawny ore
#

I have CJB Cheats solely for the purpose of 2x walking speed

light jasper
#

Faster Path Speed

#

pave the entire valley

brittle pasture
#

aka time everywhere's the same speed as in the skull caverns (which remain the same)

tawny ore
#

Although I have done cheatless playthroughs where I just have to constantly drink coffee to get my desired speed

lucid iron
#

Just like irl

lusty elm
#

(I use Faster Path Speed and bump up the base speed a tick, when on my maps at least)

brittle pasture
tawny ore
#

I'm not big on using teleportation much other than farm to/from island, so I typically bring my horse everywhere anyway

tame orchid
#

A lil follow up on this, because I don't want to step on any toes... so say instead of replacing Clint, I have a mod that introduces a new NPC, what's the vibe on adding dialogue to other NPCs added from mods (i.e. SVE's Susan) that talk about the new character? I think it would help immersion but adding dialogue to someone else's character might be frowned upon?

brittle pasture
#

yes, always check permissions

#

I think flashshifter's perms for SVE is fairly open?

calm nebula
brittle pasture
#

so I think you can for SVE's Susan, but don't take my word for it, and check the others' permissions

tame orchid
#

Got it, I'll check. Thanks!

rough lintel
#

OUUUUU im so excited to postfix after work i’m so excited

#

i know exactly what i have to do and that makes me pleased as cheese

#

(i say this and then as soon as i get home i will suddenly forget how programming works)

lusty elm
#

I forget how it works like 10 minutes after i remind myself, its why i struggle with it so much i think, my memory is amazing at concepts, bad at definitions and specifics.

rough lintel
#

so excited i said i was excited teice

rough lintel
#

once i have the proper variables i can plug it into my logic but half the time i write code in my head like “if this is true, set that value” but i dont know what This or That explicitly is when i think it

#

actuslly thats an easy statement nevermind ignore that ik what that is 😔😔😔

lusty elm
#

My brain is also really good at spacial mapping, mazes, structural layouts, that kind of thing, probably why i took to mapping like a fish to water.

rough lintel
#

yeah your maps are NUTS

#

i cant map worth a damn unless its uniquely square

#

and then when it comes to decor, i have a bad habit of sticking everything in corners

#

i cannot fathom the idea of something being in the middle with no barriers

rancid musk
rough lintel
#

mood

#

i planned out the crop quality overhaul thing at work on scratch paper like a madman

lusty elm
#

Yeah, ADHD brain is like arguing with a toddler trying to get it to do chores, except its your own brain, and you want to get it done, but have to convince your own brain of that.

rough lintel
#

drastically overcomplicating it in prose but in code its like “check this… uh huh… ok assign”

light jasper
lusty elm
#

and then sometimes the toddler gets obsessed and only wants to do one thing, and will throw a fit if it doesnt get to do it.

shadow pagoda
#

@latent mauve #making-mods-general message pinging you bc of this message since it's part of the same convo. I just realized how many checks it would be to check if one shop is open (seed shop) that I assume it would be better to just to make the dynamic check now. Though I have to admit this is very confusing as I am still very new to modding this game, and I don't understand how the game works internally. I'm unsure if you guys are suggesting the same thing. I will assume you are right now, but if I'm wrong, please let me know. This is the psudeocode I have rn. The comments with 3 / are things I'm confused about. Apologies for the abundance of questions, but I feel lost with what I assumed would be a simple thing to do.

public static bool ShopOpen(Dictionary<string, ShopData> shopData, string shopId)
{
    ShopData shop = shopData[shopId];
    //todo find all OpenShop tile actions in the game, check whether they are behind locked doors
    
    ///what exactly are OpenShop tile actions? I tried look at perform action through the code, and I don't understand it

    //todo if they got no conditions or an open/ close time then great thats it

    /// but how do I check if a shop is open? I'm looking at the "SeedShop" object, and I don't see any condition variable in that specific object. But I do for "Owner"
    if (shop.Owners.Any(owner => owner.Condition)) ///how do I make to make this string a bool?
    {

    }

    //todo if they got a npc rectangle then you need to do the fun business of figuring out when the npc will be there(using schedules) and whether they would be valid owner today

    ///how do I parse the schedules to make sure it's the correct day and time?
    ///wdym by "valid owner"?
    ///I figure an npc rectangle is position of the npc, but how I check 1. who the correct owner is 2. where that exact spot is (besides trial and error)?

    return false;
}
lucid iron
#

[[modding:maps]]

lucid iron
#

OpenShop is a tile action used for modded shops to open a shop

#

Vanilla shops don't necessarily use these: they often have CarpenterShop and such instead

tawny ore
#

I know from earlier that you want to know if they're open, and what they have in stock, right?

shadow pagoda
#

Currently I am trying to get all the shops that sell a specific item (parametrized) and then filter out the shops that are closed at the game's current time. I then want to know which one sells the item the cheapest, which I can do simply with a linq query

tawny ore
#

Okay, so for that you probably don't need to know the tile action necessarily

#

The tile action is what launches the shop when the player clicks on that tile

lucid iron
#

The tile action can have open close time and npc rect though

rancid musk
#

Going from a tile action to "is this map accessible at this specific time of day" sounds horrible, lol

lucid iron
#

Which determines whether shop's open

#

Honestly if i was doing this mod i'd skip part where i check "can player go to the tile"

brittle pasture
#

flood filling time SDVpufferwoke

rancid musk
#

Ah right, you can include the times in OpenShop

#

I was thinking that only accepted a shop id for some reason

lucid iron
#

Graph theory beckons thee

latent mauve
#

Unrelated to the current discussion, but just for my future knowledge if I decide to see how far I can go with just CP and Tiled to make a post-perfection farm based on the unused content in 1.6.9: is there an easily accessible token that returns the player's exact current currency?

#

I know there is a GSQ looking for if it matches between a provided min and max but that's the closest I could find

lucid iron
#

It'd have to be a cp token

#

I don't see ons such token

latent mauve
#

Yeah, I didn't either, which is why I was wondering if anyone knew of one that I just missed or that wasn't documented somehow

shadow pagoda
#

I currently don't have a modded shop in order to test this, nor do I plan for the first version of my mod to support modded shops. I would preferably like to focus on vanilla for now, and then maybe I can add support later. I'll move on to the "owner" condition, though I'm confused on what those conditions even mean as I'm unsure hy some shops have multiple "owner" objects.

latent mauve
#

The Owner name is usually the most important thing there, I think. If there is an actual NPC name there (or Any) and that is the current Owner block that is being used (has a Condition that returns true), then that's where the NPC rectangle comes into play

#

AnyOrNone means you can disregard the NPC rectangle

shadow pagoda
#

so these are the owners for the seed shop. With on name being "None" and the other being "Pierre". Do I just ignore the "None" and just focus on Pierre's location to check if his shop is open?

tawny ore
#

None is what is selected when the shop is closed

shadow pagoda
# shadow pagoda <@86858632104284160> https://discord.com/channels/137344473976799233/15610969005...

Ok, but where is current owner set? Currently I just have access to ShopData object that shares the shodId. I assume I need another object to know who the "current owner" is, but I'm unsure of what that is. I looked at SeedShop ShopLocation and didn't find anything relevant there. That leaves me with GameLocation, and the only thing I see that may be useful is performAction, but from what I'm understanding from previous messages, that not what I want. Or it's a lot of effort in order use it

tawny ore
#

Look at Utility.TryOpenShopMenu

#

A lot of the places where a shop is opened ends up calling that, and it includes some owner logic

rough lintel
#

alright babes vs time

#

lets postfix this hoe

tender bloom
#

Are you messing with tools? 👀

tawny ore
#

New mod idea, Super Hoe. I don't know what it does yet, but I just want to call it that.

lucid iron
#

You can use hoe to do everything

#

Hoe down tree hoe that rock hoe your spouse instead of kiss

rough lintel
#

i mostly meant hoe as in "the thing i am working on"

#

slang is such... an interesting thing

#

but no im about to postfix crop.cs and hoedirt

tawny ore
#

Super Hoe just makes your farmer do this while using it

calm nebula
#

Oh that song

#

We used to listen to that song

rough lintel
#

ok, coders
cropQuality = MathHelper.Clamp(cropQuality, data?.HarvestMinQuality ?? 0, data?.HarvestMaxQuality ?? cropQuality);
the data prefix... what is it. do i need to include it when i set HarvestMinQuality?

uncut viper
#

look above that in the code to find where the data variable is being assigned

#

presumably just a call to crop.GetData

rough lintel
#

ah

uncut viper
#

i dont know which method you eventually decided on, didnt matt (or someone?) suggest simply postfixing GetData

rough lintel
#

so when i do this i stil prefix it with data? or do i just...

  ???.HarvestMinQuality = 1;
  ???.HarvestMaxQuality = 2;```
tawny ore
#

Yeah you can basically change the data it returns so that you override the Min/Max quality

rough lintel
#

uh he suggested line 578

#

which is what i posted

uncut viper
#

that was before the getdata suggestion i think

tawny ore
#

So instead of doing (whatever min/max) the data model would normally return, you just reassign it to the desired values.

uncut viper
#

but yes if you were to transpile crop.harvest you would need the data part. "HarvestMinQuality" doesnt exist on its own, its a property of the crop data

#

but you should just postfix GetData in all likelihood

rough lintel
#

ok now i dont know what to do anymore SDVpufferclueless lol

#

back to square one

uncut viper
#

look at Crop.GetData()

#

you can change what data is before Crop.harvest gets it

#

or what the values inside it are

#

within Crop.GetData() you have access to the crop, its Data/Crops data (obv), and the HoeDirt that it is on

rough lintel
#

ohhhhhhhhhhh

#

i see

uncut viper
#

i dont remember what you were doing to track what quality seeds were planted

tawny ore
#

What I didn't account for is that GetData is on the Crop and Crops don't have mod data

brittle pasture
#

(just brainstorming but I wonder if it's "better" to return a new instance of the modified crop data instead of modifying in place. I know ultimately it doesn't matter and modifying in place is better performance but it still feels weird modifying what's supposed to be read only data)

tawny ore
#

So we're back to thinking about how to remember the quality of the seed planted

brittle pasture
#

wdym crops have mod data

uncut viper
#

HoeDirt does though

rough lintel
uncut viper
#

oh and yeah so do Crops

tawny ore
#

Oh you're right crops do, oops

uncut viper
calm nebula
#

No but you're modifying the original instance and actually changing the data

#

I had thoughts about this too

uncut viper
#

are you? i was under the assumption it was making a new CropData

#

further down the line

rough lintel
#

uh

uncut viper
#

i didnt look into it too far

rough lintel
#

i dont know what im even doing if im being honest

#

LMAO. so i dont know

#

i mean, i do know what i want to do, i just am a little foggy on the ... "proper how"

tawny ore
#

Something like this:

private static void Crop_GetData_postfix(Crop __instance, ref CropData __result)
{
    if (!__instance.modData.TryGetValue("YourMod.Id_Quality", out var quality))
    {
        return;
    }

    switch (quality)
    {
        case "Silver":
            __result.HarvestMaxQuality = 1;
            __result.HarvestMinQuality = 1;
            return;

        case "Gold":
            __result.HarvestMaxQuality = 2;
            __result.HarvestMinQuality = 2;
            return;

        case "Iridium":
            __result.HarvestMaxQuality = 4;
            __result.HarvestMinQuality = 4;
            
            return;
    }
}
uncut viper
#

i thought that was why previously planted crops wouldnt benefit from patch updates, but i might be misremembering that

tawny ore
#

Where you've already saved mod data to the crop for your quality, and depending on that quality you're changing the min/max to whatever you want the crop quality to be

calm nebula
#

But getdata refers to the single global data instance

brittle pasture
#

yeah when you change cropdata for one you'll change for all, that's why I'm worried

#

even though ultimately it probably doesnt matter

tawny ore
#

You're right, this is using Game1.cropData so you should clone

uncut viper
#

oh... maybe my confusion is just carrying a misconception from when i did something similar for GiantCrop

#

which does just call DataLoader every time lmao

rough lintel
#

how would i clone

tawny ore
#

Would it be a sin to DeepClone here?

calm nebula
brittle pasture
#

tbh I think you dont have to worry about it for now and work on getting your postfix on GetData working first

rough lintel
#

SDVpuffersweats bokay

tawny ore
#

I mean if you want to clone, you can do this, but I don't know if that's bad:

private static void Crop_GetData_postfix(Crop __instance, ref CropData __result)
{
    if (!__instance.modData.TryGetValue("YourMod.Id_Quality", out var quality))
    {
        return;
    }

    __result = __result.DeepClone();

    switch (quality)
    {
        case "Silver":
            __result.HarvestMaxQuality = 1;
            __result.HarvestMinQuality = 1;
            return;

        case "Gold":
            __result.HarvestMaxQuality = 2;
            __result.HarvestMinQuality = 2;
            return;

        case "Iridium":
            __result.HarvestMaxQuality = 4;
            __result.HarvestMinQuality = 4;
            
            return;
    }
}
rough lintel
#

what is "deep clone" exactly

tawny ore
#

Makes an identical copy so that you can change the harvest quality without affecting all crops

rough lintel
#

is this a harmony thing

uncut viper
#

no

rough lintel
#

damn they aint go over this in college 😔 but ok noted

uncut viper
#

(dont overuse it)

lucid mulch
tawny ore
#

There's a "cost" to doing deep clones and it's easily abused

rough lintel
#

so to further complicate this, if i wanted to calc quality based on farming level, will the game still do that? it'll just clamp the values in Harvest later?

tawny ore
#

Most of the time I've seen people use DeepClone here in making mods, it's been the wrong usecase

rough lintel
#

like this is just a check to see the seed type

#

and then it fixes the crop quality

#

right

#

or seed tier whatever the wordage

tawny ore
rough lintel
#

ah okay

#

based on the quality that i will set in hoeDirt

tawny ore
#

Because it'll get the data, then apply that calculation which forces it to the quality you want it to be

rough lintel
#

based on the seed quality

#

right

lucid mulch
#

the only time to date I've gone anywhere near deepclone it was for an earlier attempt for map caching because maps are mutated so heavily a cache needs to be deep cloned to not be mutated itself

tawny ore
#

Only I sort of mislead you because GetData is on the Crop instance, so it's probably better if you assign quality to the Crop's mod data instead of the hoe dirt.

rough lintel
#

assign the seed quality?

light jasper
#

@tawny ore a custom bush isn't a TerrainFeature right? since it doesn't exist on HoeDirt?

tawny ore
#

That's right

#

Or rather, a CustomBush is a Terrain Feature

#

But it's not on HoeDirt

rough lintel
#

just to be stupidly clear: we assign the seed quality in the crop's mod data, right

lucid iron
#

a bush is a terrainfeature of type Bush

tawny ore
rough lintel
#

oh so i n- okay

#

i should store that... in the crop data?

#

and NOT the dirt

tawny ore
#

No CropData is a shared thing by all crops of the same type

#

You need to store it on the mod data for the specific crop instance

uncut viper
#

Crop modData, not to be confused with CropData

rough lintel
#

thank you for that button i thought i was just stupid

#

LMAO

#

okay okay okay now i can cook

tawny ore
#

Look at HoeDirt.plant that's when the Crop is created, and it's the last time you'll know what the seed quality was (is when that's called)

lucid iron
#

i have great temptation to name mod StardewQL despite lack of desire to actually make SQL in sdv

rough lintel
#

ok swag

lucid mulch
#

modData is data tied to instances of things, CustomFields is data tied to the "blueprint" of that thing.
For stuff that doesn't do instances like a Location or something, the only other characteristic between them is CustomFields is mutatable via asset pipeline directly and so content patcher can do it

lucid iron
#

locations do instance tho

lucid mulch
#

entries in Data/Locations don't have multiple instances*

rough lintel
#

i shall cook the rest of the way and return if i have questions

#

thank u for the start

light jasper
#

and the farm computer supposedly iterates terrainfeatures

tawny ore
#

I'm assuming FarmComputer works for Tea Bushes

uncut viper
#

it does, and checks that they are HoeDirts

tawny ore
#

Does it?

/// <summary>Get the number of crops currently planted in a greenhouse within this location.</summary>
public int? getTotalGreenhouseCropsReadyForHarvest()
{
if (Game1.MasterPlayer.mailReceived.Contains("ccPantry"))
{
    int amount = 0;
    foreach (TerrainFeature value in Game1.RequireLocation("Greenhouse").terrainFeatures.Values)
    {
        if (value is HoeDirt dirt && dirt.readyForHarvest())
        {
            amount++;
        }
    }
    return amount;
}
return null;
}
#

Looks like it's only checking for HoeDirt, and not other terrain feature

uncut viper
#

is that in response to me bc thats what i said isnt it

tawny ore
#

What I'm saying is that this logic wouldn't count tea bushes, and thus wouldn't count CustomBushes either

#

Since CustomBush are just modded tea bushes

uncut viper
#

probably not

#

ive never checked a computer when ive had tea bushes

light jasper
#

don't mind me I'm just blind... I read terrainFeatures and then stopped reading.

#

either way, mind if I make a PR for it? it bothers me

tawny ore
#

So that's why because it's hardcoded to HoeDirt

light jasper
#

I need to know when my grapes are done

tawny ore
#

I don't have any more releases planned for the 1.x branch of Custom Bush since it's relatively "stable" at this point. I've been doing a rework to support Medium and Large bushes.

uncut viper
#

isnt this also a problem with the computer and not custom bush anyway

tawny ore
uncut viper
#

good for hiding spots

light jasper
#

very green

light jasper
#

yay open source 😆

tawny ore
#

I'll add that to 2.0. Which I suppose is also a vanilla fix.

lucid iron
#

what if you make like

#

better farm computer

#

ppl can use it to SELECT COUNT(Bush) IN Greenhouse WHERE CanHarvest=true

tawny ore
#

nah, Worse Farm Computer. It's just a guy whose like,

How many crops are ready?
I dunno, maybe more than 5 or something.

light jasper
#

I mean even if it said "at least 1" I'd still be happy lmao

#

I check that thing religiously

uncut viper
#

the current computer also only works for the singular Greenhouse

#

and not additional greenhousi

lucid iron
#

a silly idea i had once is like

tawny ore
#

Instead of a computer, I'll make an immersive info mod that just makes the Greenhouse glow whenever anything is ready in it.

#

I'll call it Obvious Indicators

lucid iron
#

make a fancy stardewui for farm computer

#

and let you link up computers

tawny ore
#

Glowing Greenhouse with a big Exclamation mark over it

uncut viper
#

i wont download it if its anything short of implementing linux within the farmcomputer

lucid iron
#

no its gonna run Plan 9

light jasper
#

brb porting hannah montana linux to stardew valley

shadow pagoda
#

I swear I saw a static method in order to check a GSQ given just the string condition, but I'm unable to find that now. Does anyone know the name of the method I'm looking for?

tawny ore
uncut viper
#

i would download glowing greenhouse if it had a config option to make it flash rave colours and play a muffled version of caramelldansen

tawny ore
calm nebula
shadow pagoda
#

thank you

calm nebula
#

And only because the thought predated stardewui

#

You should do it. Hint hint

uncut viper
lucid iron
#

well 1.6 added the farm computer for current location

#

so the "no stardewui" version would be pretty simple matter of adding 2 buttons to cycle locations

tawny ore
uncut viper
#

and no gradual transitions between colours

light jasper
#

oh yeah

#

make that shit ugly

uncut viper
light jasper
uncut viper
#

could even repurpose my existing muffle-the-audio mod code to make it become normal dansen after you walk inside

lucid iron
uncut viper
#

i dont usually have any sensitivity to flashing lights or anything but this video is pushing the envelope

scarlet quarry
tawny ore
scarlet quarry
#

SDVpufferheart you're too sweet

gritty hazel
#

if im just trying to add a new artisan item, im best of making a content patcher mod, right?

hard fern
#

Ye

gritty hazel
#

also, is there something like a generic starting point for the content.json and manifest.json?

uncut viper
#

wdym generic starting point

lucid iron
#

that would be the content patcher docs i suppose

gritty hazel
#

fair enough

lucid iron
#

and the github docs linked on this page

shadow pagoda
#

Can someone explain this code in TryOpenShopMenu (the overload with less parameters). I'm familiar with sql databases, so I understand some of the things going on. I'm mainly confused on the use of orderby and descending. Is this saying the sort shopOwnersData by having all the types with NamedNpc first, and have None be last? If that's the case, why not just filter out the types that are not NamedNpc if looking at the first element of the collection? I assume it's a failsafe, but this is under the case where the ownerType is NamedNpc. I just trying to make sure I'm understanding this correctly

(from p in shopOwnersData
                                 orderby p.Type == ShopOwnerType.NamedNpc descending, p.Type != ShopOwnerType.None descending
                                 select p).FirstOrDefault((ShopOwnerData p) => p.IsValid(ownerName)
lucid iron
#

this stuff is LINQ

#

forget all about SQL tbh its not really that, more like functional programming with enumerators

ivory plume
#

(LINQ is based on SQL, so it's very similar.)

#

It's a priority order in this case rather than a filter; the game will choose the owner matching a named NPC if found, else any value except None, and then None if no other entry was matched.

lucid iron
#

hm i wonder if you can just directly use TryOpenShopMenu to figure it out Bolb

#

the main trouble is the Game1.activeClickableMenu = at the end

brittle pasture
#

instantly unassigning it is probably fine, the draw code wouldnt even get to it right

lucid iron
#

yea but close menu things will fire right

#

perhaps if you can ensure this only ever gets called with no menu

uncut viper
#

MenuChanged?

#

in addition

#

(she says, not confidently)

brittle pasture
#

ah yeah forgot that the user may already have a menu

lucid iron
#

a use case for reverse patc- * yoinked *

brittle pasture
#

hmm how about storing Game1.activeClickableMenu somewhere if assigned and restoring it

gritty hazel
#

also, i assume here's the right place to ask balance questions?

lucid iron
#

sure but no one plays game here

uncut viper
#

not really actually

#

like you can

#

but as chu says we dont play

lucid iron
#

i think we tend to be focused more on "is ur mod working"

#

"ok cool parsnips now worth 999999 sounds good"

brittle ledge
#

FWIW, Agentbla, I would take a look at similar mods and see how they price things (or even vanilla items, but I think modded items tend to have a bit of inflation to incentivize people).

fossil spear
#

Sorry to bother you guys. What is GreenRainFinished for? Is it for the day after the green rain event? If you don't have a greenrainfinished line, will the character just resort to their other dialogue for that day, or will it cause an issue?

brittle pasture
#

yes and yes it's fine

fossil spear
#

cool, thank you

gritty hazel
#

so uh
how do items with coloration/name based on ingredients work?

#

i.e. roe/pickles/etc

lucid iron
#

Take a look at pickled egg in cornucopia

brittle pasture
#

those need to be machine output

lucid iron
#

The vanilla ones r bit hardcoded hence why mod example better

gritty hazel
lucid iron
#

im not sure, ctrl+f it from vscode/notepad++/etc

gritty hazel
#

yep, that found nothing

#

oh i downloaded the wrong cornucopia module

brittle pasture
#

that's Crops
pickled eggs is in Artisan Machines

#

yep

brave fable
#

oh i wish people would make smaller mods so the usual answer to "how do I make a parsnip orange?" isn't "download stardew valley expanded and these 12 small dependencies, it's in one of these 21,000 lines of json i'm sure"

brave fable
#

surely there's an orange parsnips mod out there somewhere

brittle pasture
#

I mean Artisan Machines have like 1 dep outside of CP

#

and not a lot of mods out there add custom flavored items in the first place

#

(mainly because it wasn't possible before 1.6.9 without said dependency) ignore me, it's multilevel flavored items that isnt possible

uncut viper
#

well a small enough mod is just Content Patcher docs and/or a tutorial

#

theres not much difference between tiny tiny mods

brave fable
#

multilevel flavoured items?

#

like, cucumber staircase or

brittle pasture
#

think flavored honey into flavored mead

uncut viper
#

Smoked Blueberry Snail Jam?

drowsy pewter
gritty hazel
#

ok so
pickled eggs are suposed to have a sell price of:
3 x Base Ingredient Price + 50
but their actual sell price in the json is
"Price": 300,

#

which
confuses me

brittle pasture
#

the price is set dynamically in machine rules

#

based on the input item

gritty hazel
#

oh, i see
so just put whatever there

brittle pasture
#

the object price is for unflavored variants that you can spawn in CJB cheats, or rarely some other mod's RANDOM_ITEMS query

drowsy pewter
#

i have my own mod with a single crop, but the only time it gets recommended as an example is if i'm actually in chat. Other people know the big name mods--VMV, cornucopia crops, etc

tawny ore
#

Flavors

brittle pasture
#

a balanced breakfast, lunch and dinner

brave fable
#

i could really go for one of those right about now. i just don't think i know how to order it

lucid iron
#

i like how squished they are

reef kiln
gritty hazel
lucid iron
#

cornucopia has em

gritty hazel
brittle pasture
#

it's easy, you go into the local subway, and then you get beat up by the restaurant workers

reef kiln
gritty hazel
#

so how do people determine edibility?
trying to make fish sauce so it's not something you should chug normally
but then
you can chug mayonnaise and it gives positive energy/health soo

brave fable
#

the thing is mayonnaise edibility is balanced out by the dramatic damage to your social life

lucid iron
#

you should be able to chug fish sauce

brittle pasture
#

sodium poisoning

tawny ore
#

Someone should make a database of every item in the game modded+vanilla

drowsy pewter
#

:puffermayo:

#

Hm, someone needs to make this

reef kiln
gritty hazel
brittle pasture
#

NPCs already have unique dialogue reaction to drinking mayo, it would be simple to slap on a reduce friendship trigger

brave fable
#

i was under the impression that's already ingame SDVdemetriums

tawny ore
#

My test Custom Bush mod produces Mayo

#

And if you leave the mayo alone for a couple days, it matures into Duck Mayo

gritty hazel
uncut viper
#

theres no social negative to drinking it

#

just weird looks

lucid iron
#

is :puffermayo: SMCPufferCheeto but with mayo or like, a white and blue puffer

reef kiln
brave fable
#

also makes for a viable pufferpepsi

drowsy pewter
#

I imagine it to be like SDVpufferchickegg

lucid iron
#

ah reasonable

#

the pufferchick put her egg into the mayo machine

gritty hazel
#

so what's up with this?

tawny ore
#

That's actually not the recommended way to do that anymore

gritty hazel
#

ah, localisation

tawny ore
#

Localized name/description goes into Strings now

brittle pasture
#

yes, tokenized strings right

#

but consider: I'm Lazy

drowsy pewter
#

Huh?

#

Since when was this

tawny ore
#

Otherwise when you change the language, the non-localized name/description persist

drowsy pewter
#

This is the object data not the machine output

tawny ore
#

Tokens let objects get new translated text after they have been crafted

#

Otherwise whatever name they are assigned is permanently attached to them without deleting and crafting again

drowsy pewter
#

I'm pretty sure these swap too. I'd have noticed while testing translations

tawny ore
#

That's why Strings/Objects and Strings/BigCraftables exists

brittle pasture
#

that's only if you explicitly set DisplayName in the item query

#

otherwise it just fetchs the name from the object data

tawny ore
#

Ah, well I just started copying the conventions from vanilla objects

brittle pasture
#

(yeah I thought bla's screenshot was from machine rules. it's totally fine to use raw i18n in object data)

versed wyvern
#

So, is there a proper way to make sound effects loop during events? I ended up just making my sound into a music track but doing it that way means it can't play at the same time as actual music rosedopSip

rough lintel
#

as far as i know? no

#

you just have to play them repeatedly

versed wyvern
uncut viper
#

can you just make the sfx like a minute long

#

but still keep it as sfx

#

and just hope the player doesnt take longer than a minute SDVpufferthumbsup

gritty hazel
#

how do multi-category items such as smoked fish work?

#

context tags?

brittle pasture
#

if you're talking about the fact that it also benefits from the profession that increases fish sell price
that's hardcoded

versed wyvern
#

It would probably keep playing the sound even after the action it was needed for is over if I did that woopsThink

uncut viper
#

all items will always only ever be one Category. everything that doesnt act like it is exception based

gritty hazel
crude plank
brittle pasture
#

different reason, that's a manual exception I specified in the competition rules

#

the artisan goods category count every artisan goods except for smoked fish and honey

#

and aged roe

crude plank
#

Interesting, i thought i was going insane selling smoked fish and my artisan count wasn't going up lol

hot gale
reef kiln
#

I need to get serious with FFP. I currently just take whatever rank I get. I need to aim for first place at least once.

uncut viper
#

!json

ocean sailBOT
#

JSON is a standard format for machine-readable text files that's used by Stardew Valley mods.

If you need help with a JSON file, you can upload it to smapi.io/json to see automatic validation and share the link here.

When making mods, it's recommended to edit your files in a text editor with JSON support, such as VS Code, Notepad++, or Sublime Text. These programs will check for syntax errors.

uncut viper
#

please use the json uploader

uncut viper
#

but you can add a second sprite to your same png and just change the SpriteIndex

#

or you can load a separate png to a separate Target

hot gale
#

Would I need to pack the sheet with texturepacker to get the index? Not sure how that works

brittle pasture
#

SpriteIndex: 0 means use the first 16x16 square in your PNG, 1 is the second

uncut viper
#

you can use whatever image editing software you want to put them in one png

brittle pasture
#

just extend it in your image editing program

hot gale
#

Oh cool so it's automatic like that

#

Thanks

gritty hazel
#

huh, cornucopia tags allergens and vegan-ness

#

is that just a thing mods do or is that cornucopia specific

hot gale
#

I would add the "SpriteIndex": xxx inside the item entry right?

brittle pasture
#

yes

#

xxx being a number

hot gale
#

Sweet, thanks!

drowsy pewter
uncut viper
#

other mods can look for those context tags on items too, so if another mod wanted to look for all items with the gluten_allergy tag or w/e, having it on cornucopia items will make it compatible

brittle pasture
#

automatic asynchronous compatibility as ichor put it

hot gale
#

I have another question about the commas in the JSON files, I have some experience with C++ and I know a random comma can break everything. VSCode is throwing errors at me for some erroneous commas, and I know the mod works with them there, question is; is there any specific reason there are commas on the end of lists from a function standpoint, or can I cull them for my OCD

lucid iron
#

!vscodejsonc

uncut viper
#

SMAPI uses a different json parser that is less strict

#

trailing commas are NOT standard json, but they work fine for stardew content packs

lucid iron
#

!vscjsonc

ocean sailBOT
#
How to make VSCode not scream at json comments

In Visual Studio Code, go to File -> Preferences -> Settings, then search for "associations", and in the "Associations" setting, click the Add Item button to add an item with key *.json and value jsonc (see image).
If you are making a content pack for Content Patcher, you should consider using its json schema so that VSCode can tell you if your patches are valid, you simply have to add

"$schema": "https://smapi.io/schemas/content-patcher.json"

at the start of your content.json file.

hot gale
#

Answers for everything haha thanks!

lucid iron
#

hm i dont think this one covers trailing comma unfortunately

#

still useful tho

uncut viper
#

but from a function standpoint they are irrelevant

#

i dont believe jsonc does trailing commas

#

i might be wrong. but i assumed it was just for. the c.

#

comments

#

json5 will do both though

brittle pasture
#

JSONC does cover it apparently

tawny ore
#

If json5 is so great, what about json6?

shadow pagoda
#

Is there a reason why breakpoints won't hit for decompiled code?

brittle pasture
#

yaml

uncut viper
#

please do not make me write yaml

tawny ore
#

Yeah, not as long as toml is an option

hot gale
#

So I can easily cull these commas and not worry?

drowsy pewter
#

if someone ever makes a second smapi, they should call it Yet Another Mod Loader

uncut viper
#

please do not make me write toml

brittle pasture
#

you can, but personally I recommend keeping them

reef kiln
#

Is there a way to find out why the sprite for my dwarvish mattock is using the sprite for combine fertilizer in my game? Or do I just have to live with it because they are both .dll mods.

brittle pasture
#

they're there to cover your ass in case you add a new entry to the list

hot gale
#

Proper formatting does that really well as well :D

reef kiln
uncut viper
# hot gale Proper formatting does that really well as well :D

this is true, if you remember to follow it. by default you can take every "its recommended you do this" message in here as "we have seen other new modders fall victim to things a thousand times before and this will avoid that"
if you can handle not having the commas then its completely fine

gritty hazel
#

is doing multiple actions like this in just the content.json allowed?

uncut viper
#

you need to separate your patches

#

also those patches arent in their own objects anyway

#

so it wouldnt work even if there was only one

gritty hazel
tawny ore
#

You can if you do it right

drowsy pewter
#

Look at someone elses mod and keep track of the brackets

uncut viper
#

you have to read CP's documentation to follow its syntax

#

and then beyond that you have to follow json syntax

reef kiln
gritty hazel
uncut viper
#

generally mods arent made for users to find stuff in the internal files so if you prefer one big file then dont worry about it

brittle pasture
drowsy pewter
tawny ore
#

"Changes" is an array [ ... , ... , ...] of JSON Objects { ... }, { ... }, { ... }

brittle pasture
#

if yes you can enable data mining fields and see what their Texture/SpriteIndex fields are

reef kiln
# brittle pasture are those in game items?

Yes, the dwarven mattock is an artifact for the museum. The combined fertilizer is well... fertilizer. It is just weird that the mattock is for some reason using the sprite for the fertilizer. The fertilizer I using the correct sprite.

brave fable
rough lintel
#

to add a custom field to the crop i'm postfixing, i need to do an injection into ___CustomFields...? or, wrong track

uncut viper
#

you cannot add CustomFields to something that doesnt have it

rough lintel
#

oh

tawny ore
#

CustomFields are just an edit using AssetRequested or ContentPatcher

uncut viper
#

a Crop has modData which you can access from getting the crop instance

gritty hazel
#

what are these used for? i assume an item produced by a jar doesnt actually need any of those tags?

rough lintel
#

ok so Crop __instance, ref Crop.....?

tawny ore
#

CustomFields aren't part of an instance though, they're shared by all crops of the same id

drowsy pewter
# gritty hazel soo like this?

Syntax looks good now, but i'd recommend that your item ID start with your entire mod ID, which is typically your username + mod name, such as Agentbla.GarumMod_Garum

gritty hazel
#

oh is it for like
a "give me 12 wines" quest?

brittle pasture
rough lintel
#

oh

drowsy pewter
#

so useless in your case

rough lintel
#

but button said the crop instance

tawny ore
#

CustomFields is what you find in Data/Crops, which is different from modData

brave fable
# gritty hazel soo like this?

notice how your second Target key is highlighted? that's because your json syntax is inconsistent and won't work.
re-read the key name carefully, and check your , commas: there should be a , comma between each entry in both a [] list and each key-value pair in an {} object.

rough lintel
#

oh. i see.

uncut viper
#

modData is very very different

#

they are both dictionaries

#

but used differently

rough lintel
#

ah i scrolled down and found it 💀

hot gale
#

I recommend VSCode to help with syntax and formatting

tawny ore
#

AFAIK CustomFields and modData are both for the purpose of mods sharing data with each other though. I don't think there is any vanilla use of CustomFields.

shadow pagoda
reef kiln
rough lintel
#

so in said moddata, i need to set the quality or i need to get the quality?

rough lintel
#

i'm assuming set, but after ... getting

uncut viper
#

the process of how you use them is very different, though

drowsy pewter
brave fable
uncut viper
#

once you have access to the modData you can set or get whatever you want whenever you want as needed

brave fable
#

instead, you're better off telling us what you're trying to find by breakpointing the game code, and what your goal is here @shadow pagoda

rough lintel
#

wait matt, is that what the hellif (!__instance.modData.TryGetValue("HMMSCropQualityOverhaul_Quality", out var quality)) { return; } is?

gritty hazel
#

i see the issue now

rough lintel
#

is that the modData bit

brave fable
tawny ore
#

Yes, in that patch __instance refers to the crop, and modData is that crops mod data

gritty hazel
rough lintel
#

oh my god so i just grab and set it in there

#

why was i reinventing the wheel

#

my bad bro

iron ridge
tawny ore
#

You can grab it in there, but you need to set it somewhere else around plant

#

In Object.placementAction when it calls HoeDirt.plant is when you'll have the seed and Crop

rough lintel
#

so that is when i do.... an injeeeection? [looks at harmony docs]

tawny ore
#

You can, you may not even have to do that

#

A postfix would probably work as well

uncut viper
#

(well you need a harmony injection to get the crop)

tawny ore
#

You don't since you can just get the placement target again

#

Expanded Storage is able to postfix placementAction to make placed big craftables into Chests

uncut viper
#

how would you get the placement target from HoeDirt.plant

gritty hazel
brittle pasture
#

it could be

uncut viper
#

injections are also not mutually exclusive with postfixes, are we referring to different things here

hot gale
#

I have a mod that turns the SVE Bear Honey into Honey Mead, since the pig truffles can artisan I figured why not the bear "truffles" too. Reason I bring this up is I'm not sure how 'long' it should take to convert the jar of honey into mead. Right now its 8 hours and the mead hsa a base price of 1950. What would be a reasonable time/price for the mead? Additionally, I am working on the ability to age the mead in a cask, which will take 40 days with a base price of 4215. Does that feel balanced? Both artisan goods are configured to retain their input quality as well

uncut viper
#

well.... im not a junimo but i would kinda say they were wrong to direct you here if you just wanna know what people think good balance is lol

brittle pasture
#

retaining quality means at max friendship a bear is digging up 3900 gold per bottle

uncut viper
#

i think it fits in both

drowsy pewter
#

I ask modded farmers balance questions all the time

hot gale
uncut viper
#

but again, im not a junimo

drowsy pewter
#

You just have to do it in a way thats interesting

brittle pasture
#

that's nearly four times as strong as pig

brittle pasture
#

do you want bears to be four times as good as pigs

lucid iron
#

arent bears already really strong

shadow pagoda
# brave fable instead, you're better off telling us what you're trying to find by breakpointin...

I'm pretty much just trying to understand how the TryOpenShopMenu method (the one with more parameters works (as suggested here #making-mods-general message) in order to dynamically know when a shop is open, and the player can buy something from that shop. Since this is a mod related to perfectionist, I would need to do this will all shops in the game.

Right now, I think I need to "hard code" the location, ownerArea, and maxOwnerY given the seedId. I know this is very vague, and I'm honestly not sure for what I'm looking for exactly as I'm still wrapping my head around the code. I think right now I need to know what the values are for the 3 vairables I said earlier given the seedId. But I think this is the method I need to dissect in order to make the method I want. I hope that makes sense.

If I can't get what I'm looking for through someone else recompiling the code, my next plan was to make a prefix of the method, but just copy/paste the original code so I can put breakpoints.

drowsy pewter
#

"How do you guys feel about a late game machine that does this at X amount of profit?"

vs "I'm making a machine can someone look at all of these formulas and my spreadsheet and stuff and tell me what to do"

rough lintel
#

if i were to.. reference this

tawny ore
#

No, SObject is your seed

rough lintel
#

oh ok

hot gale
#

I didn't have that perspective thats why I asked, good points Selph. Four times? I would say that is a bit much

tawny ore
#

It's the action that happens when the player places a seed

#

You'd need to look at the hoedirt at tile to get the crop

hot gale
#

It did take me personally a long ass time to get bears fwiw

rough lintel
#

ahhhh ok

crude plank
drowsy pewter
#

exactly

calm nebula
#

People who have the game open right now, how many fingers do you have

uncut viper
#

(though keep in mind Lani SObject isnt a thing, its StardewValley.Object and people just usually alias that to SObject. i dont know where Matt's doing that in his code)

drowsy pewter
rough lintel
tawny ore
# rough lintel ahhhh ok

So something like:

if (!location.terrainFeatures.TryGetValue(tile, out var terrainFeature) || terrainFeature is not HoeDirt hoeDirt || hoeDirt.crop.Value is not { } crop)
{
  return;
}

switch (__instance.quality.Value)
{
  case 4:
    crop.modData["YourMod.Id_Quality"] = "Iridium";
  break;
  ...
}

Note all untested since I'm not on my computer. so you may need to fix a few things.

rough lintel
#

does this go in the object placement postfix or the crop getdata postfix

tawny ore
#

Object placement

#

This is where you set the mod data so that the Crop can remember what quality the seed was

rough lintel
#

i see now

shadow pagoda
uncut viper
#

it will use the right one

#

if it cant figure it out it will tell you

hot gale
#

Okay, new question lol. I made a map mod that swaps a single tile at the bus stop, and I placed the grass it sits on 'behind' the art on the tile so it matched and lined up, but now fall hit and its still green grass because I added the grass tile from spring_outdoorTileSheet. How do I make my mod swap with the seasons? Is that something I can do in the tmx through Tiled? Did I use the wrong tilesheet for the grass?

uncut viper
#

(usually that just means you used var instead of the specific type)

#

if you're using a tile from a seasonal tilesheet it should swap automatically

hot gale
#

Okay sweet I just need to use a seasonal sheet, thanks!

rough lintel
#

spring_outdoorTileSheet is a seasonal tilesheet

uncut viper
#

as in, if you use a tile from a tilesheet that starts with "spring_" it will work

#

do you still have the tilesheet in your mod folder next to your tmx?

hot gale
#

Yeah

uncut viper
#

remove the tilesheets from your mod folder

hot gale
#

This is my git folder

#

The mod folder itself doesnt need the sheet alongside it?

uncut viper
#

when you put your mod in your Mods/ folder and launch the game, there needs to be no tilesheets next to your .tmx

hot gale
#

I see

uncut viper
#

if they are already present in the games Maps/ folder or the image is loaded into a target that starts with Maps/, it will work fine

#

they do need to be there when editing the tmx ofc, but you remove them after

#

if you keep the png in your folder with the tmx, SMAPI will always use that specific png

hot gale
#

Gotcha!!

#

Thank you!

uncut viper
#

also, just to be clear, i should say there needs to be no tilesheets if you WANT to use the ones present in the Maps/ folder or ones loaded into there

#

if you do want to specifically use the pngs in your mod folder for some reason, you can leave them

#

same with custom tilesheets

#

but ideally for custom tilesheets you Load them so that they can be removed from the .tmx folder

hot gale
#

My first mod was a custom item so I just rolled with what I knew haha

shadow pagoda
#

I'm reading this to learn more about prefixes https://harmony.pardeike.net/articles/patching-prefix.html . It says that the return value says if you should run the original method or not, since I'm basically rewriting the method, I shouldn't run the code again. However, TryOpenShopMenu return type is also a bool. How do I return if the shop should open or not without telling the end early and either run the original code accidently?

ocean sailBOT
#

@shadow pagoda You leveled up to Cowpoke. You can now speak in our voice channels and share images in all channels!

uncut viper
#

wait, why are you prefixing it (i was not following earlier)

tender bloom
uncut viper
#

you can access the return result

tender bloom
#

But from a postfix you can separately get the method’s return with a ref and change it

uncut viper
#

it's still just __result

tender bloom
#

But prefixes run first

#

Shouldn’t the __result be undetermined at that point?

uncut viper
#

yes and other prefixes may run after you

#

you can still assign it anyway

tender bloom
#

Ah fair, but the method itself should be the main thing that changes __result

#

(Assuming the method runs)

shadow pagoda
uncut viper
#

you can let the original run, and then another prefix after you can check if you set it to something and THEN skip

tender bloom
#

I am confused about what “breakpoints” is in this context

#

If you just want to know what the method returns, do a postfix

#

And grab it with __result

uncut viper
#

You should never need a breakpoint because you don't have a breakpoint when you release the mod

lucid iron
#

isnt the actual issue like

#

you can't easily probe TryOpenShopMenu bc it changes your menu

rough lintel
#

why it no like 🤔

lucid iron
#

i dont think harmony helps with this except maybe reverse patch

ivory plume
#

Are you just trying to detect when a shop is opened? If so, you can just hook SMAPI's MenuChanged event and check if e.NewMenu is ShopMenu.

uncut viper
#

they want to get every shop that is currently open

lucid iron
#

to build a informational ui mod of some sort

shadow pagoda
uncut viper
#

the idea was to probe tryopenshopmenu and if it worked you'd know the shop was open

ivory plume
#

That won't be very reliable; e.g. Pierre's shop is always accessible via TryOpenShopMenu because it's restricted in the location code (which is fairly common for vanilla shops).

rough lintel
lucid iron
#

yea i think for some vanilla shops you will just have to hardcode it bc its not going through TryOpenShopMenu directly

shadow pagoda
lucid iron
#

this is mostly for modded OpenShop things

uncut viper
rough lintel
#

will do

#

oh prrbt __instance.Quality

shadow pagoda
uncut viper
#

your "I think I need it to know" made me think you were expecting to use it in production code which is why I said that

#

it was clearer after that it was just for debugging though

reef kiln
#

So question! The dwarvish mattock mod I not able to break the nodes that mistyspings item extension nodes. Who do I report that too? Item extension or the mattock mod?

uncut viper
#

assuming there's no error in the log when you try, probably dwarvish mattock who would then determine if it's bc of them or because of IE

lucid iron
#

i think IE does some strange thing there bc tool code strange right

uncut viper
#

(or a third party)

lucid iron
#

hence why mistyspring had to patch cjb cheats

uncut viper
#

ive no idea what IE does personally

lucid iron
#

but i would say if dwarvish mattock has C# component report to them first

#

see if theres api integration

reef kiln
#

Ok will do. Mattock it is.

rotund elm
#

Heyo quick question.... I set the days tell ready to 1 and this is happening and when I set it to 3 it triples

#

dont understand whats going on and I am looking at the wiki and the machines.json

brittle pasture
#

I know UI Info Suite 2 special cases the time display for casks which is known to cause strange behvior with modded rules

#

Does the minutesUntilReady field on the machine look right

#

you can check with LA + data mining fields

reef kiln
#

Yup, UI info suite is wrong sometimes. It does not do tea bushes in a green house correctly either. Not sure where it pulls it's info from.

rotund elm
#

Sorry had to step away for a sec Ill give that a shot

#

says 790 for minutes until ready if that is correct

#

So I guess it is working after doing the math in my head slowsly XD

#

Is there any fields I could add from the machine.json into my json to make the time show properly? Or is it just a lost cause for that

gritty hazel
brittle pasture
#

you need C# sadly

uncut viper
brittle pasture
#

now there's a workaround where you increase the machine/object price if the player has the profession

#

that wouldn't change any existing unsold items

#

maybe that's good enough for you, maybe

gritty hazel
#

or wait right you couldnt do the "wait around until fishing 10 and bulk sell"

reef kiln
lucid iron
#

well once u got the profession

#

you have become good

#

and therefore make higher priced things

reef kiln