Survivalist: Invisible Strain

Survivalist: Invisible Strain

Not enough ratings
SIS Extended: Crafting Framework
   
Award
Favorite
Favorited
Unfavorite
Tags: IsMod
File Size
Posted
Updated
336.749 KB
9 Apr, 2022 @ 4:33pm
30 May, 2022 @ 11:56am
10 Change Notes ( view )

Subscribe to download
SIS Extended: Crafting Framework

Description
Versatile framework that gives modders an ability to extend recipes with extra products providing many extra options that don't exist in original game

This mod is a plugin to be used by modders and does not add anything to the game on it's own.

As a player you will need this mod (and Harmony) in case some of the mods you have installed are using this plugin
As a modder you can add this mod as a dependency to your new mods or add .dll from this mod to your existing mods (potentially with Harmony .dll) and it will enable you to add extra outputs to your recipes. The reason why I suggest adding .dll if you change existing mod is because right now game does not automatically fetch and enable new dependencies of existing mods

Features
  • Add any number of additional outputs to any recipe
  • Use min/max to define an output amount range for each addition
  • Use probabilities to add some RNG to your crafting
  • Advanced: use conditions to check if certain exact item was used during crafting and produce extra output if it was (e.g. ripping combat boots will give strings while buckled boots - won't)
  • Advanced: use suffixes and/or prefixes together with conditions to dynamically define the name of the output item

Extra facts
  • In order to add extra outputs to your recipes you will need to create extra file recipes_extended.xml next to your recipes.xml and add all extensions there. Separate file ensures that your additions are not lost when using in-game recipes editor
  • You can add as many extra outputs as you want but only of Equipment type meaning you can only add items but not liquids and/or props
  • I have tested mod with hand and workbench crafting - works well
  • I am pretty sure AI won't be considering those extra outputs when considering actions
  • There is also no weight check for handcrafting and you can easily get encumbered if you do some crazy recipes
  • If one way or another you will remove this mod or it's .dll your save will not be affected. It will simply stop extended outputs from being produced
  • Game UI will not be showing extra outputs in any way so you will have to let players know about these extra items in some other way (name of recipe or in mod page)
  • Plugin is nit fully fool-proof and if you do weird stuff (like adding invalid values to ProductPrototypeName it may misbehave. Or maybe it won't)
  • I have no idea what happens if you overload recipes that already have extra outputs. Would be easier to deal with if we could control mod loading order

Typical use-cases
  • Creating weapon attachments and allowing player to detach them
  • Creating clothing mods and allowing player to detach them
  • Creating recipes that require several tools to complete but you don't want some tools to be consumed. For example you add a recipe to chop wood into firewood at workbench but you want player to have axe in his inventory. You can add axe as an ingredient (will be consumed at the start of the crafting) and as an extra output meaning it will be re-added once crafting is complete
  • Salvaging recipes that may produce several outputs e.g. ripping clothes may be given a small chance to produce string on top of rags
  • More advanced recipes e.g. skinning rabbit giving meat and fur; crushing stone into stone dust and rock salt, etc.
  • Compressing complex recipes into simple and elegant ones (I was able to compress ~150 recipes into 3)
  • Etc.

How to use
Create recipes_extended.xml next to your recipes.xml in mod folder (mod folder has extension_samples folder with some samples):
<?xml version="1.0" encoding="utf-8"?> <Recipes> <Recipe> <UniqueID>SIS Extended Crafting Framework TETS RECIPE</UniqueID> <ExtraOutputs> <ExtraOutput> <ProductPrototypeName>Leather</ProductPrototypeName> <ProductAmountMin>1</ProductAmountMin> <ProductAmountMax>1</ProductAmountMax> <ProductProbability>100</ProductProbability> </ExtraOutput> </ExtraOutputs> </Recipe> </Recipes>

Advanced usage and info
  • Probability accepts values from 1 to 100 (chance of this extra output being produced) and is defaulted to 100 if you skip it in XML. If you set probability to less than 1 this output will be skipped
  • If probability check is passed then random amount between ProductAmountMin and ProductAmountMax will be chosen. If ProductAmountMax is lower than ProductAmountMin or if chosen amount is 0 or less then this output will be skipped
  • ProductAmountMin and ProductAmountMax are defaulted to 1 if you skip both of them in XML. If you skip just one then the other will use the same value. Example 1: if you have neither ProductAmountMin nor ProductAmountMax then plugin will treat both as "1" and this will be the amount produced. Example 2: if you have ProductAmountMax defined as 4 and ProductAmountMin not defined then ProductAmountMin will be set to 4 and recipe will produce exactly 4 units of this output
  • If you use invalid ProductPrototypeName then I think it will just skip this item with not major crashes but one can never be sure
  • You can same resource multiple times as an extra output. This can be done to ensure the guaranteed minimum gain and optional extra. For example you add 1 string with 100 probability to ripping cloth and you add 1 more string with 25% probability. This way you will get at least 1 in all cases but in 25% cases you will get 2
  • You can define <condition> that will check for the actual items used during recipe creation. This is useful in certain cases when your recipe can accept multiple interchangeable items and you want to make some outputs to be dependent on some of them. For example you want to Tear Beanie and Jacket to pieces and you want Beanie to return 1 rag and Jacket - 3. You can, of course, implement it via 2 recipes or you can create single recipe with 1 Rag as output and then use <condition>Jacket</condition> and 2 more rags if that condition is fulfilled.
  • Suffixes and prefixes can be used for advanced crafting using conditions that in my opinion would be done around attachments to weapons/items. For example you want all of your weapons to have scope version (with scope attachment). If you create all "scoped" items with suffix added to original name (rifle -> rifle_scoped) then you can use an extension recipe with condition (<condition>rifle</condition>) and suffix (<suffix>_scope</suffix>) and it will tell the game to create an item named rifle_scoped. Similarly with prefixes

Compatibility: actually should be compatible with pretty much anything. At least I think so
7 Comments
sf 5 Nov, 2024 @ 12:44am 
I think it's broken. Throws exception when added to game.
sf 28 Oct, 2024 @ 1:03am 
any recent users to confirm if this mod is still working with latest game version?
erikem  [author] 25 Jul, 2022 @ 11:00am 
@luo2430 yeah, it's kinda tricky to start using it but it's actually more of an "instrument" for modders rather than standalone mod so yeah, kinda cumbersome to set and get it running =)
luo2430 25 Jul, 2022 @ 9:52am 
@erikem
This mod may seem cumbersome to set, but it does not prevent it from being a good mod.
erikem  [author] 27 Apr, 2022 @ 2:07am 
v7
- entire refactoring of the most of the mod code
- now mod saves important state values into the save game folder and reads form there. This means that you will no longer lose condition-based outputs if you save/load during crafting
- huge refactoring of injection code and setting reader. Now settings are properly laoded during game load and not on the first usage of mod
- improved compatibility in case .dll or settings file of this mod is available in several mod folders
- introduced priority to settings so that you can control which of the configs if you have many is the one that has to be used
erikem  [author] 19 Apr, 2022 @ 10:20am 
v5
- renamed dll file to match mod name
- added setting file (SIS_Extended_Crafting_Framework.xml) that allow you to disable all effects of this framework in this mod. If framework has been added to multiple mods - it has to be disabled in each of them individually
- refactored mod loader to make sure that it loads correctly every time, does not conflict in case this DLL appears in severald mods and reloads data correctly when loading saved game
erikem  [author] 17 Apr, 2022 @ 12:46pm 
Feel free to ask me questions here or on discord regarding the framework. If you have any requests - you can also let me know and I'll see if it's somethign I can do