From bccfedad57d7c5fe1bbd0603ef3185ec80b94e0f Mon Sep 17 00:00:00 2001 From: Alexey Date: Tue, 9 May 2023 21:42:29 +0300 Subject: [PATCH] Add docs for faults and fault fixes --- doc/JSON_INFO.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/doc/JSON_INFO.md b/doc/JSON_INFO.md index ec6e0167021ac..f6505411f68fd 100644 --- a/doc/JSON_INFO.md +++ b/doc/JSON_INFO.md @@ -1344,6 +1344,46 @@ the item is spawned the variables set on the prototype no longer affect the item a migration can clear out the item's variables and reassign the prototype ones if reset_item_vars flag is set. +### Item faults + +Faults can be defined for more specialized damage of an item. + +```C++ +{ + "type": "fault", + "id": "fault_gun_chamber_spent", // unique id for the fault + "name": { "str": "Spent casing in chamber" }, // fault name for display + "description": "This gun currently...", // fault description + "item_prefix": "jammed", // optional string, items with this fault will be prefixed with this + "flags": [ "JAMMED_GUN" ] // optional flags, used by C++ parts +} +``` + +### Item fault fixes + +Fault fixes are methods to fix faults, the fixes can optionally add other faults, modify damage, degradation and item variables. + +```C++ +{ + "type": "fault_fix", + "id": "mend_gun_fouling_clean", // unique id for the fix + "name": "Clean fouling", // name for display + "success_msg": "You clean your %s.", // message printed when fix is applied + "time": "50 m", // time to apply fix + "faults_removed": [ "fault_gun_dirt", "fault_gun_blackpowder" ], // faults removed when fix is applied + "faults_added": [ "fault_gun_unlubricated" ], // faults added when fix is applied + "skills": { "mechanics": 1 }, // skills required to apply fix + "set_variables": { "dirt": "0" }, // sets the variables on the item when fix is applied + "requirements": [ [ "gun_cleaning", 1 ] ], // requirements array, see below + "mod_damage": 1000, // damage to modify on item when fix is applied, can be negative to repair + "mod_degradation": 50 // degradation to modify on item when fix is applied, can be negative to reduce degradation +} +``` + +`requirements` is an array of requirements, they can be specified in 2 ways: +* An array specifying an already defined requirement by it's id and a multiplier, `[ "gun_lubrication", 2 ]` will add `gun_lubrication` requirement and multiply the components and tools ammo required by 2. +* Inline object specifying the requirement in the same way [recipes define it](#recipe-requirements) + ### Materials | Identifier | Description