traps firing
What each trap does when stepped on, and untrapping.
Builtneeds review5 changes builtSeen on every levelLast touched November 29, 2026: a change of its own was written or changed. Commit 2ffdd4e97.
In the terminal
When a trap goes off under the hero it is revealed: its glyph (a colored ^, " for a web, ~ for the vibrating square) appears under the hero once the hero steps off (and is remembered). Missile traps draw the missile flying from an unseen launcher; the rolling boulder rolls in along a line. Walking onto a known trap asks first: "Really step onto that <trap>?" ("into" for pits, holes, webs; paranoid_confirmation:trap, on by default; hallucinating, a random trap name). Monsters' traps are told as "<Mon> triggers a trap but nothing happens.", "A board beneath <mon> squeaks a D note loudly." etc.
"You disarm the bear trap." ("the land mine" becomes a land mine item; "You repair the squeaky board."; "You disarm the trap." for arrow and dart traps, leaving their missiles), webs: "You succeed in removing the web."; a failure may set it off ("Whoops..."). Doors: "You find a trap on the door!" "Disarm it? [ynq]" "You disarm it!" or "You set it off!" (KABOOM); "You find no traps on the door.". Boxes: "You find a trap on the large box!" ... "That large box was not trapped.". Pets in traps: "You pull <pet> out of the pit."
Quotes from NetHack
Whoops...
In Codex
Through a magic portal, rings of points in its colors open into a sphere, close on you and waver.
Builtneeds reviewReaction to an event
Details
N-741 (the director, 2026-11-28, choosing it from N-739: "let's vary the animation for each of the examples as they represent different outcomes from a pathos perspective"). The feeling is wonder and departure: an opening. The game says how the hero came through on arrival, as the stun the portal leaves (teleport.c `domagicportal`, the message `schedule_goto` prints once the new level is reached): "You feel slightly dizzy." (teleport.c:1483) or, already stunned, "You feel dizzier." (1484). Seven rings of points, from the middle out yellow, orange and red as the DevTeam's tile has its rings (other.txt, tile 69), lie as one disc at the hero's feet; over the level teleport's own 2.4 s, while the old level goes dark and the new one forms, each ring tilts apart about its own line across into a sphere of rings over the hero, rising, and goes round faster; then on the new level they close on the hero and level out, wavering as they come to rest, twice for slightly dizzy and four times and further for dizzier, go still and go out, 6.6 s in all (7.4 for dizzier). "You feel dizzy for a moment, but nothing happens..." (teleport.c:1470, the endgame without the Amulet): the sphere begins to open, rising a little, and falls slack to the floor, loosening and slowing to a stop, 3.8 s. Not the lines of a level teleporter trap ("You feel disoriented.", "You briefly feel centered." or "oriented", teleport.c:1562 and 1564), which are not a portal's; the brief named them, the source does not. "You activated a magic portal!" (teleport.c:1463), said before leaving, stays the level teleport's moment (X-307), which this plays beside. No point shows within 0.7 of a square of the hero's column; none while the hero is blind. Back to the backlog after the third look (figures-moments): the level teleport's own lights still play inside the rings (X-7404), so it ships off (animations.magic_portal_shown false); the code stays.
- Id
codex.magic_portal- Exact state
- Built, not reviewed
- Settings
animations.magic_portal_strength,animations.magic_portal_shown- Code
crates/nh-moments/src/catalog/happened/magic_portal.rs,crates/nh-plays/src/motes/figures.rs,crates/nh-plays/src/motes.rs,crates/nh-knobs/src/animations/magic_portal.rs,crates/codex-client/src/draw/motes.rs
| N-739 | Done | Other places for the points that gather into figures |
| N-741 | To do | The magic portal as points (N-739): |
| X-307 | Done | A level teleport of its own: lights circling the hero, and the camera turning or not |
In a pit the hero's letter sinks 40% into a hollow, then crawls out to its edge. The pit stays.
Builtneeds reviewReaction to an event
Details
N-91, kept (the director, 2026-10-31: "The pit should be 40% depth."; animations 7 and 27). On the game's words for going down into a pit, the hero's letter drops into the floor by pit_depth (0.4) of its height with gravity in pit_fall_seconds, sinking a little past the bottom and settling back, once its step onto the square has arrived. The square's floor opens into a soft hollow cut into the same stones (nh-scene's Form::Pit, mesh::pit: rough rim from noise fixed to the place, darker toward the bottom (how dark a value on its own material, assets/shaders/pit.wesl, so the view moving it builds no mesh again: X-116), no line around it, meeting the next squares' floors exactly); the world swaps it for the square's floor. The letter stays down while the game keeps the hero there; each "You are still in a pit." tugs it up by pit_tug of the drop and it slips back. On "You crawl to the edge of the pit." it rises over pit_climb_seconds, leaning forward (pit_climb_lean_degrees), onto the pit's edge pit_climb_to_edge squares the way the hero faces, and steps off from there. The pit stays, as it does in NetHack: the hollow remains while the map shows a trap there, and the game's own ^, drawn once the hero steps off, stands down in it; it goes when the game draws something else there (a boulder filled it). Leaving the level puts it away, and coming back shows it again (N-206): the pits the hero fell into are filed in the one memory under the level's key (nh-state's Remembered, filed by nh-moments' remember, X-64), so a level returned to shows the hollow under the game's own ^ where the hero fell, and a late watcher's catch-up files them too (N-196). A teleport, a new level or another square brings the letter up at once. The behind camera dips pit_behind_dip of the drop; the first-person eye drops pit_eye_drop of the way to the rim (the core itself limits sight to the adjacent squares from a pit). From the high views the pit is small, so its bottom is darker there (pit_hollow_darkness_from_above, D-63). Seen from there the hero's letter also leans back and grows as every standing letter does (codex.letters_from_above), in one rotation with the climb's lean and a gesture's tilt, and still drops by pit_depth of its plain height, so a grown letter sinks no deeper than the hollow; the behind camera's dip adds to its ride to one side (codex.clear_line_ahead). A spiked pit's damage still flashes and shakes, but its knock-back gives way to the fall. Force and weight, so no light. It draws only what the messages said, a pit the hero was in, never a trap the map has not shown.
- Id
codex.pit_sink- Exact state
- Built, not reviewed
- Playtests
gallery-pit- Settings
animations.pit_depth,animations.pit_fall_seconds,animations.pit_hollow_darkness,animations.pit_hollow_darkness_from_above,animations.pit_tug,animations.pit_climb_seconds,animations.pit_climb_lean_degrees,animations.pit_climb_to_edge,camera.pit_eye_drop,camera.pit_behind_dip,characters.monster_size,dungeon.floor_stones- Code
crates/nh-moments/src/catalog.rs,crates/nh-moments/src/pits.rs,crates/nh-moments/src/remember.rs,crates/nh-state/src/remembered.rs,crates/nh-scene/src/mesh/pit.rs,crates/nh-scene/src/model.rs,crates/nh-plays/src/hero/gesture.rs,crates/codex-client/src/pov.rs,crates/codex-client/src/draw/letters.rs,crates/codex-client/src/draw/pit.rs,assets/shaders/pit.wesl
| N-91 | Done | Falling into a pit, and crawling out |
| N-206 | To do | Pits, what the keep left |
| X-64 | Built, not reviewed | One memory |
Where the game showed fire on a square, the floor keeps a soot mark while the level is remembered.
Builtneeds review3D form
Based on the real thing: Soot is the floor's own stone charred where fire touched it: a warm near-black that takes about a third of the light on the stone, darkest inside the burn and patchy as smoke settles, its rim wandering and fading to clean stone at the edge of the squares the fire was on, so a fireball's nine squares read as one burn and never more.
Details
N-733's study (docs/studies/loving-additions.md, 10), answered yes by Danny on 2026-11-28 (N-5479). Only where the terminal showed or named fire, never placed by chance: a fiery explosion's glyphs, the explosion glyphs in CLR_ORANGE (include/display.h explode_color_fiery, src/display.c:2846-2848; drawn by explode with tmp_at only where the hero can see, src/explode.c:396-398), and the hero's own fire trap, "A tower of flame erupts from the floor!" (src/trap.c:4253, dofiretrap), at the hero's square. Not a box's fire trap ("bursts from the large box!"), not a monster's ("... under the jackal!", src/trap.c:1748, which does not say the square), not a fire ray's beam (a zap glyph). NetHack's own idea that fire marks a floor: engraving by "burning your message into the floor" (engrave.c). nh-state keeps the squares per level (marks.rs, GameState::soot), nh-scene lays the plain floor of those squares only as soot (marks.rs, the Sooted ground), fading to nothing at their edge toward a square the fire was not on, so the mark never spreads past where the fire was; the darkness rides in the vertex color's alpha above 1 and the stone shader takes that share of the finished light (the stone's own color alone leaves its shine and the air's glow, most of a lit floor's light); a burst on a wall square marks nothing; an engraving, a pit, a pool's bank or a named room's laid floor keep their own ground. Codex keeps nothing in the save file, so after a save and a load the floor is clean (D-127). soot_strength 0 gives the clean floor back.
- Id
codex.soot- Exact state
- Built, not reviewed
- Playtests
gallery-soot- Settings
dungeon.soot_strength- Code
crates/nh-state/src/marks.rs,crates/nh-scene/src/marks.rs,crates/nh-scene/src/model/grounds/sooted.rs,crates/nh-knobs/src/dungeon/soot.rs,assets/shaders/stone.wesl
When the Candelabrum glows with a strange light, a still, pale light rises at the hero's hands.
Builtneeds reviewReaction to an event
Details
N-672, the committee's slate (D-131, D-135). On the vibrating square, carrying the Candelabrum of Invocation with its seven candles lit, NetHack says "The Candelabrum of Invocation glows with a strange light!" (hack.c:3082; the same lighting it there, apply.c:1379; "The candelabrum" before it is known). The light at the hero's square changes from the torch's warm flicker to a still, pale light unlike any other in the dungeon: one lamp on the hero's square at hand height (half a square up), pale white leaning to blue-green, reaching two squares, steady (no beat), a little stronger from the high views where it reads as a still pale pool on the hero's square; and the torch the hero carries stops its flicker and sway, turns pale with it and gives way a quarter. It comes on in under a second, holds, and goes over its last two seconds of five: the game says nothing of its end, so it is a moment. Never gold (the game does not call it divine, D-75), never the eerie feeling's cold blue; letters keep their colors. Blind the game says "throbs palpably!" or "radiates a strange warmth!" and nothing is shown.
- Id
codex.strange_light- Exact state
- Built, not reviewed
- Settings
light.strange_light_strength- Code
crates/nh-moments/src/catalog/happened/candelabrum.rs,crates/nh-plays/src/brings/candelabrum.rs,crates/nh-plays/src/lanes/conditions/candelabrum.rs,crates/nh-plays/src/light.rs,crates/nh-plays/src/underway/eye.rs,crates/nh-knobs/src/light/strange_light.rs
| N-672 | Done | The vibrating square, the strange light |
On the strange vibration under your feet, the light on the hero's square trembles for a second.
Builtneeds reviewReaction to an event
Details
N-672, the committee's slate (D-131, D-135). NetHack says "You feel a strange vibration under your feet." (hack.c:3079; "beneath you" levitating or flying, "beneath <your steed>" riding, "You dream that you feel ..." unconscious) each time the hero comes onto the vibrating square, the level above the Sanctum. The hero's square trembles in its light, never in its stones: a fine stipple of the lantern's own warm light lies on the square's face, laid out as the DevTeam drew the vibrating square (tile 75 in win/share/other.txt, offset rows of single points in an oval: a quiet nod to it, D-70), and the two sets of offset rows trade the light five times a second under one envelope that comes on at once and is gone within a second. The floor, the hero's letter, the walls and the camera never move: a first take moved the floor piece itself and opened dark seams round the square that crawled every frame (no outline on a room, D-75; nothing that swims, D-76), so the light moves and the shape stays. No lamp: it lights no wall. It plays the same flying, riding and blind (the vibration is felt), since it is the game's own word for that floor. A monster seen on the square ("You see a strange vibration beneath <the jackal>.", trap.c:2753) is not the hero's square and plays nothing.
- Id
codex.vibrating_square- Exact state
- Built, not reviewed
- Settings
animations.vibrating_square_strength- Code
crates/nh-moments/src/catalog/happened/invocation.rs,crates/nh-plays/src/brings/invocation.rs,crates/nh-knobs/src/animations/vibrating_square.rs
| N-672 | Done | The vibrating square, the strange light |
Accepted pictures and playtests
Playtests: gallery-pit, gallery-soot
Planned and proposed
In progress A trap that fires plays out, the arrow flying, the mine bursting, the boulder rolling in.
Left to do: Arrows, darts, falling rocks, land mines, rolling boulders and the other traps still jump as on the terminal.
Details for builders
Id: trap_moments. Lexicon subjects: moment.trap, moment.untrap.
Design notes from NetHack
Each trap's message has its own verb (shoots, squeaks a note, closes, gushes, erupts, opens up, envelops, explodes with 'KAABLAMM!!!'), and its ^ appears once the hero steps off.
'An arrow shoots out at you!', then a hit or a miss and a ) on the square; 'You hear a loud click!' when the trap is spent.
'A little dart shoots out at you!', sometimes 'The dart was poisoned!'; 'You hear a soft click.' when spent.
'A trap door in the ceiling opens and a rock falls on your head!' and a gray ` lands on the square.
The squeak is a named pitch ('squeaks a C note loudly', D flat to B note), one per board on the level (3.7).
'A bear trap closes on your foot!' (HP), then 'You are caught in a bear trap.' at each attempt to move.
'A cloud of gas puts you to sleep!' and helpless turns; resistant, 'You are enveloped in a cloud of gas!'
'A gush of water hits you on the head!' (or left arm, right arm, body), then the rust message for the item there ('Your helmet rusts.').
'A tower of flame erupts from the floor!'; underwater, 'A cascade of steamy bubbles erupts'; carried items smoulder or burn.
'You fall into a pit!', a ^ under the hero, and the view limited to adjacent squares until 'You crawl to the edge of the pit.'
'You land on a set of sharp iron spikes!' (HP), sometimes 'The spikes were poisoned!'
'There's a gaping hole under you!' and the hero falls to the level below (Dlvl changes).
'A trap door opens up under you!' and a fall of one or more levels (Dlvl changes).
No message when it works; the @ is elsewhere. Resisted: 'You feel a wrenching sensation.' and the shield sparkle.
'You step onto a level teleport trap!', 'You feel disoriented.', then a new level (Dlvl changes).
'You activated a magic portal!', then on arrival 'You feel slightly dizzy.' and a brief Stun.
'You stumble into a spider web!' and some turns stuck ('You are stuck to the web.'), or 'You tear through the web!' and it is gone.
'The statue of a <monster> comes to life!' and the statue glyph becomes the monster's.
A flash of light and 'a deafening roar', with monsters around the hero; or a shiver up the spine, 'Your pack shakes violently!', a smell of charred flesh.
'You feel your magical energy drain away.' and Pw falls; magic resistant, 'You feel very lethargic.' and HP falls.
'You step onto a polymorph trap!', the hero's glyph changes to the new form and the trap glyph goes; resisted, 'You feel momentarily different.'
'KAABLAMM!!! You triggered a land mine!', nearby objects scatter, and the red ^ becomes a pit with the hero in it.
'Click! You trigger a rolling boulder trap!', then the boulder's glyph rolls in square by square along a line, hitting what is in its path.
'You feel a strange vibration under your feet.' on a magenta ~; with the lit Candelabrum, it 'glows with a strange light'.
The box 'explodes' and is gone, or gas 'billows from the chest' (noxious, or a random color), or a needle, flame, a shock or paralysis; with luck, 'a dud'.
'You disarm the bear trap.' and the trap glyph goes, sometimes leaving its object; a failure ('Whoops...') may set it off.
Backlog rows
| N-739 | Done | Other places for the points that gather into figures |
| N-741 | To do | The magic portal as points (N-739): |
| X-307 | Done | A level teleport of its own: lights circling the hero, and the camera turning or not |
| N-91 | Done | Falling into a pit, and crawling out |
| N-206 | To do | Pits, what the keep left |
| X-64 | Built, not reviewed | One memory |
| N-672 | Done | The vibrating square, the strange light |
