Skip to content

Commit

Permalink
Add docs for faults and fault fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
irwiss committed May 11, 2023
1 parent da1e054 commit 3259cd3
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions doc/JSON_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3259cd3

Please sign in to comment.