#Moddable and Unlockable Recipe

64 messages · Page 1 of 1 (latest)

potent thunder
#

Make adding and removing recipes easy for modders. Also add Locking & Unlocking recipes feature.

If you need any help with this mod, please feel free to post here 🙂

Steam Link: https://steamcommunity.com/sharedfiles/filedetails/?id=3446669921
Mod.io Link: https://mod.io/g/timberborn/m/moddable-and-unlockable-recipe

mod.io

Make adding and removing recipes easy for modders. Add Inferior Treating recipe in the Lumber Mill.

prime quarry
#

ahh, so this doesn't enabled a codeless way to add recipes, it still needs some code?

potent thunder
#

good idea actually

#

thanks for the suggestion, v7.0.1 incoming

potent thunder
#

v7.1.0: Added a code-less way to add and remove recipes.

you can now add or remove recipes like this:

{
    "RecipeModderSpec": {
        "PrefabNames": [ "LumberMill.Folktails", "IndustrialLumberMill.IronTeeth" ],
        "RecipeIds": [ "InferiorTreatedPlank" ],
        "Remove": false // optional for adding, you don't actually need this line
    }
}

Or an example RemovePlank.json file (just a demo, not actually in the release of the mod):

{
    "RecipeModderSpec": {
        "PrefabNames": [ "LumberMill.Folktails", "IndustrialLumberMill.IronTeeth" ],
        "RecipeIds": [ "Plank" ],
        "Remove": true
    }
}
tender python
#

Yay! I now have my bento recipes in the bakery and factory again :D Now to check they're still working... when I actually have the ingredients for all of them XD

potent thunder
#

too long since I use Japanese, I don't even want to bother to install the Japanese keyboard now 😂

muted flax
#

Oh this is AMAZING, I'll be trying to use this for my berry pies

potent thunder
#

which recipe are you using btw? gluten-free would be nice since my wife can't eat wheat HappyFT /s

muted flax
#

🙂 I've been using wheat for most factions, but IronTeeth have a berry meal bar instead of pie, and that's corn based.

potent thunder
#

you should also check to see if #1351976116713291948 is more suitable for you

#

this one is more powerful but needs some code, the other is codeless.

muted flax
#

I only need to add recipes, so the Moddable Prefab is probably more straight forward for me. Thank you!

potent thunder
#

wonderful. feel free to ask if you need to add something to that mod so your JSON can be cleaner.

prime quarry
#

So what's the difference between PrefabModderSpec and RecipeModderSpec? Can't PrefabModderSpec also add/remove/change recipes?

potent thunder
#

two different mods I believe

#

RecipeModderSpec is from this mod #1351275770483310772 (written before), while PrefabModderSpec is from #1351976116713291948 .

prime quarry
#

yea, I'm trying to figure out what the feature difference is,

potent thunder
#

the latter is not exactly "recipe-specific" 😛

#

the former is focused on the unlockable aspect and so adds a simple way to add recipe

prime quarry
#

Can PrefabModderSpec be used to change the ManufactorySpec?

potent thunder
#

definitely, but that one belongs to #1351976116713291948 😛

potent thunder
prime quarry
#

I see

#

So you could use either mod to add a recipe to a building?

potent thunder
#

yep, either but if you don't want to code you should use the other one

#

I mean, you can also use this one code-less if you only need to add recipes I guess HappyFT

prime quarry
#

I guess RecipeModderSpec is the only way to remove a recipe

potent thunder
#

you can use the other one too but you have to replace the whole array.

prime quarry
#

yea

potent thunder
#

so you potentially will remove other mods' recipes, unlike this one.

#

because this one is more specific to recipes, it can "compare"

#

the other one does not have any reference/property to compare for removal

prime quarry
#

yea, it would need a RemoveArray option

potent thunder
prime quarry
#

yea, if it's array of string, then much easier,

potent thunder
prime quarry
#

oh, like "only add, if it's not already present?"

potent thunder
#

most likely I will just add them all and perform a distict once 😛

#

or no, I think you are right

prime quarry
#

oh, just always? yea, that might be fine too

#

I can't think of a reason why a string would need to be present twice,

#

and hopefully 🤞 soon the devs will make both mods obsolete and allow regular blueprint specs to override these things

prime quarry
#

so update 9 maybe? 😛

muted flax
#

Do either of these mods support the "optional" blueprint/spec keyword, so that for example, it will ignore a spec for emberpelts if the emberpelts mod is not loaded? WIth Timberborn blueprints/specs I'm able to name them, for example, for modifying the faction "Faction.FolkTails.json" and "Faction.Emberpelts.optional.json" and it's then only loaded if the Emberpelts faction is loaded. So, since Emberpelts has their own bakery, I'd want to make the spec/blueprint for adding berry pie to the emberpelts bakery optional, only used if the Emberpelts faction mod is loaded?

#

Or maybe the way you coded this, it's not important?

potent thunder
#

oh is the .optional thing handled by Timberborn spec system?

#

I wasn't aware of that

muted flax
#

It was in 6.0 anyway

prime quarry
#

yea, it's handled by Timberborn.BlueprintSystem.SpecService

potent thunder
#
    private IEnumerable<IGrouping<string, TextAsset>> GetBlueprints()
    {
        return from loadedAsset in _assetLoader.LoadAll<TextAsset>(BlueprintsPath)
            select loadedAsset.Asset into asset
            group asset by asset.name.Replace(OptionalBlueprintSuffix, string.Empty) into assetGroup
            where assetGroup.Any((TextAsset asset) => !asset.name.EndsWith(OptionalBlueprintSuffix))
            select assetGroup;
    }

so my code wouldn't be able to aware of any Optional stuff

prime quarry
#

basically once the blueprint are groupd by basename, there needs to be at least 1 non-optional one, otherwise the rest are ignored

#

so what happens if a PrefabName can't be found? error, or just skipped?

muted flax
#

I'm going to test first for just Folktails and IronTeeth, but then will want to add for Emberpelts if possible.

potent thunder
#

I don't bother scanning for unused ones 😛

potent thunder
muted flax
#

I'll let you know if it "just works" or not.

potent thunder
#

v7.1.3: Updated the fix for recipe removal. Added railguard against recipes with both Ingredients and Products of the same Good. Moved Inferior Treating to the Gear Workshop instead.

A new note was added:

  1. Note that you CANNOT have a whole building (like Lumbermill) to have recipes where the same Good may appear in both Ingredients and Products even across recipes. For example, Inferior Treating cannot be in the Lumbermill because it uses Planks, which is the output of the default Plank recipe.