Disable items with the mod manager #5993
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because some items are referenced in the code directly, removing them from the json data is problematic. Similar, but much more serious for other things like skills, terrain, furniture ...
This PR add a new json type: ITEM_BLACKLIST (not the best name for it, any suggestions?)
It will remove the items from all item_groups and all recipes that have this item as result.
If the item appears as component/tool of a recipes it is removed there, too. If this leaves an empty component/tool list (which means item was required and there were no alternatives for it), the recipe is removed, too.
The item definition is not changed, the item will still spawn when the C++ code contains the item id directly (or the mapgen spawns it directly and not as part of an item group). Everything (including saves) will still have the item and the item will work like before (with the exception that it can not be used in crafting directly, but its item quality can still be used in crafting).
Same with construction.
For testing, put this in a json file that is loaded by the game (either something in data/json, or something in save/my-world/mods).
The rock item is in the normal field spawn list and wandering around gives fields that contain strawberries but no rocks. All the stone based tools have no recipe anymore. Recipes that allow a rock as alternatives for a hammer are still there, but with the rock as tool. Burning down a house will still give you rocks as this is coed in C++ and does not refer to a spawn list. The results of deconstruction of furniture/terrain is fixed in the code and not influenced hereby.
The blacklist is applied after loading all mods, so it applies to item groups/recipes from other mods, too. No to prevent that one can make a ITEM_WHITELIST which removes the item from the blacklist. Is this feasible?
Shall I add a similar thing for monsters?