Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: document trap data in json_info.md #3971

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions doc/src/content/docs/en/mod/json/reference/json_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -3268,6 +3268,102 @@ longer to grow, and for numbers less than one it will take less time to grow.
A flat multiplier on the harvest count of the plant. For numbers greater than one, the plant will
give more produce from harvest, for numbers less than one it will give less produce from harvest.

### trap

```json
{
"type": "trap", // Defines this as a trap
"id": "tr_caltrops_glass", // Unique identifier
"name": "glass caltrops", // Displayed name
"color": "dark_gray", // Color of symbol displayed if tiles are disabled or if no sprite is defined for it
"symbol": "_", // Symbol display if tiles are disabled or if no sprite is defined
"looks_like": "tr_caltrops", // hint to tilesets if this part has no tile, use the looks_like tile
"visibility": 6, // Difficulty of spotting this trap if not placed by the player, checked against perception. 0 means the trap is never concealed from the player
"avoidance": 6, // How likely the trap is to be set off when stepped into. 0 means the trap will never be set off if stepped onto
"difficulty": 0, // How hard the trap is to disarm, higher is harder.
"action": "caltrops_glass", // What the trap does when triggered, see trapfunc.cpp or below for more info
"spell_data": { "id": "spell_trap_can_alarm_trigger" }, // `id` of spell cast by a trap with the `spell` trap action
"map_regen": "microlab_shifting_hall", // Used by traps with the `map_regen` action, defines what `mapgen_update` entry is used for the area it's applied to.
"remove_on_trigger": true, // Does the trap remove itself after being set off? Omit if the trap is intended to stick around and trigger repeatedly, not recommended for traps generated by terrain
"trigger_items": [ "tripwire", "shotgun_d", { "item": "shot_hull", "quantity": 2, "charges": 1 } ], // What items spawn when the trap is triggered, times `quantity` and of `charges` amount (used if item has a default stack size like ammo). Note that the `beartrap`, `snare_light`, `snare_heavy`, `pit_spikes`, `pit_glass`, and `crossbow` still have some items that are spawned by hardcoded behavior for various reasons.
"drops": [ "tripwire", "shotgun_d", { "item": "shot_00", "quantity": 2, "charges": 1 } ], // That items drop when the trap is succesfully disarmed. Optional use of `quantity` or `charges` follows same conventions as with `trigger_items`
"vehicle_data": { // Block of behaviors that occur when a vehicle's wheel rolls over this trap, separate from normal behaviors of traps being set off by players or monsters
"do_explosion": true, // If true, create an explosion instead of simply applying damage value to the exact vehicle tile that triggered the trap
"damage": 1000, // Direct damage applied to the vehicle tile that triggered it, or base damage at epicenter, depending on if `do_explosion` is true
"shrapnel": 8, // Fragmentation damage if set to explode
"sound_volume": 10, // Volume of sound, if specified, that plays when triggering
"sound": "Boom!", // Sound description as posted in message log, in the form of "You hear %s"
"sound_type": "explosion", // Possible types are: background, weather, music, movement, speech, activity, destructive_activity, alarm, combat, alert, order
"sound_variant": "default" // Sound variant used
},
"benign": true, // This means it's not a trap meant to be set off but something harmless like a rollmat or funnel, so won't ask the player if they're really sure about stepping into it, and monsters with the `PATH_AVOID_DANGER_2` monflag won't care about avoiding these. Using this with an `action` that can actually cause harm is a Bad Idea
"funnel_radius": 200 // Used for funnels, when it's raining this trap will collect water at a rate based on this value, automatically filling empty container items placed on the same tile as it
"floor_bedding_warmth": -1000, // Used for rollmats and the like, bonus warmth offered by this terrain/furniture when used to sleep.
},
```

#### action

The following actions are available as defined in trapfunc.cpp:

- `none` - Does nothing, used for funnels and other things where no trap behavior is necessary.
- `bubble` - Makes a pop sound from stepping on bubble wrap, and that's all.
- `glass` - Deals minor cutting damage to whatever steps on it, crunchy glass noises.
- `cot` - Perfectly safe and cozy if you're a player or NPC, but monsters will stumble over it and
lose a turn.
- `beartrap` - Deals damage and keeps the victim locked to that tile until they break free. If so,
the item itself is dropped later on once they free themselves.
- `board` - Deals some minor damage to whatever steps on it, and subtracts some moves from them.
- `caltrops` - Deals damage to whatever steps on it, and subtracts some moves from them.
- `caltrops_glass` - Same basic effect as `caltrops_glass` but with more glass crunching noises.
- `tripwire` - Deals minor damage if it successfully trips the victim, knocking them back and
substracting moves from them.
- `crossbow` - Deals piercing damage with a chance of missing, the ammunition being dropped
afterward is still hardcoded into this due to having a random chance to spawn.
- `shotgun` - Deals heavy ballistic damage to whoever sets it off. If the trap's ID is specifically
`tr_shotgun_2`, the victim is hit twice instead of only once.
- `blade` - Lashes out and strikes whoever sets it off with direct bashing and cutting damage.
- `snare_light` - Deals damage and keeps the victim locked to that tile until they break free,
spawning the relevant items when the effect wears off.
- `snare_heavy` - Comparable to `snare_light` but higher damage, and different item spawns when the
target frees themselves.
- `landmine` - Explosion with moderate damage and heavy fragmentation.
- `boobytrap` - Same effect as `landmine` but different message printed on trigger.
- `telepad` - Teleports the victim to a random space within 8 tiles, with risk of teleporting into a
wall, and inflicts teleglow on them.
- `goo` - Players and NPCs have a chance of taking damage and are slowed down by slime, non-slime
monsters take a speed debuff and non-robot monsters get turned into slimes.
- `dissector` - Deals cutting damage to victims, creatures of species `ROBOT` are immune.
- `pit` - Victim takes falling damage and is held in place until they climb back out.
- `pit_spikes` - As with `pit` but additional damage from spikes. Random chance of the spikes
breaking, spawning additional items and converting underlying terrain to `t_pit`.
- `pit_glass` - Similiar to `pit_spikes`, except when it decides to break it spawns glass shards
instead of wooden spears.
- `lava` - High levels of heat damage dealt to whatever sets it off.
- `portal` - Currently aliases to `telepad` and triggers the exact same effects.
- `sinkhole` - If triggered, converts the underlying terrain to `t_pit` and triggers the effect of
falling into a pit. Players can attempt to prevent this if they have a grappling hook, bullwhip,
or long rope in their inventory, or if they have the Web Diver mutation.
- `ledge` - Fall down a level to whatever is below, triggering potential falling damage.
- `temple_flood` - Used in strange temples to trigger the hardcoded event that floors that converts
floor in the area to deep water. Only the player can set this off, not NPCs or monsters.
- `temple_toggle` - Used in strange temples, toggles red/green/blue puzzle tiles between floor and
wall forms. Only the player can set this off, not NPCs or monsters.
- `glow` - Random chance of irradiating and flashbanging players and NPCs, monsters have a chance of
suffering acid damage and a speed debuff instead.
- `hum` - Makes a humming noise of a randomized volume, ranging from barely audiable to deafening.
- `shadow` - Summons shadow monsters nearby. Only the player can set this off, not NPCs or monsters.
- `map_regen` - Applies the mapgen update specified in the trap's `map_regen` to the map tile the
trap is in, for altering the map. If used, `remove_on_trigger` and `trigger_items` aren't
processed as the mapgen update could just as easily remove the trap, change it to something else,
or do any number of things that would otherwise disrupt the trap cleanup function.
- `drain` - Deals a tiny amount of damage to the target, ignores armor and immunities.
- `cast_spell` - Casts the spell specified by the trap's `spell_data`, centered on whatever set it
off. Note that the spell used generally requires a `min_aoe` defined to work successfully, and not
all spell effects can be expected to work properly with this.
- `snake` - Similar to `shadow` trap effect, summons shadow snakes nearby. Main difference is NPCs
and monsters are capable of setting it off.

### clothing_mod

```json
Expand Down