Read emojunky player/cursor/debug surfaces
Transcript
Thinking21:03:33
I'll start by exploring the emojunky project's directory structure.
Glob**/*.lua21:03:33Output not recorded
**/*.luaBashcd "C:/Users/a327e/Desktop/a327ex/emojunky" && ls -la && echo "---emoji---" && l...21:03:33Output not recorded
cd "C:/Users/a327e/Desktop/a327ex/emojunky" && ls -la && echo "---emoji---" && l...Thinking21:03:38
I'm going to look into view.lua next, checking the drawing functions for the player, robot, debug info, HUD, and labels.
Grep^local function draw_|^function draw_|^local function M\.|draw_player|draw_dig_human|draw_robot|draw_debug|draw_dig_debug|draw_hud|draw_dig_hud|draw_labels21:03:38Output not recorded
^local function draw_|^function draw_|^local function M\.|draw_player|draw_dig_human|draw_robot|draw_debug|draw_dig_debug|draw_hud|draw_dig_hud|draw_labelsGrepstate ==|set_state|self\.state =|\.facing|hurt_t|last_dmg|\.dmg\b|body_w|body_h|airborne|grounded|fall_t|hp\b|HP\b21:03:38Output not recorded
state ==|set_state|self\.state =|\.facing|hurt_t|last_dmg|\.dmg\b|body_w|body_h|airborne|grounded|fall_t|hp\b|HP\bThinking21:03:44
I should dig deeper into view.lua, checking the various drawing functions—player rendering, dig-mode rendering, robot rendering, debug overlays, HUD elements, labels, markers, popups, and effects—to understand how each piece fits together.
ReadC:/Users/a327e/Desktop/a327ex/emojunky/view.lua21:03:44Output not recorded
C:/Users/a327e/Desktop/a327ex/emojunky/view.luaThinking21:03:49
This CLAUDE.md file gives useful context. I want to keep reading view.lua, looking at the drawing functions for the robot, dig human, dig debug overlay, dig HUD, robot marker, dig popups, and dig effects.
ReadC:/Users/a327e/Desktop/a327ex/emojunky/view.lua21:03:49Output not recorded
C:/Users/a327e/Desktop/a327ex/emojunky/view.luaThinking21:03:56
I've got most of view.lua covered now, but I still need to check tuning.lua and controller.lua for player_hh, hitbox dimensions, HP fields, state lists, debug flags, and boot.lua details—plus grep controller.lua for the crouch/hang/climb/rope/dead/hurt state handling.
I want to see how set_state assignments work and whether p.crouched changes player_hh or the draw logic, so I'll search controller.lua for the player_hh function signature and any state-setting code.
Grepfunction player_hh|p\.state = |p\.state='|T\.hitbox_w|T\.hitbox_h|T\.body_w|T\.body_h|D\.hw|D\.hh\b|T\.hp\b|p\.hp\b|hurt_flash|notice_t|notice_text|last_land_t|last_land_dmg|last_land_h|do_land|player_hurt|fall_time = 021:03:57Output not recorded
function player_hh|p\.state = |p\.state='|T\.hitbox_w|T\.hitbox_h|T\.body_w|T\.body_h|D\.hw|D\.hh\b|T\.hp\b|p\.hp\b|hurt_flash|notice_t|notice_text|last_land_t|last_land_dmg|last_land_h|do_land|player_hurt|fall_time = 0Grephitbox_w|hitbox_h|body_w|body_h|D\.hw|D\.hh\b|\bhp = |hp\s*=21:03:57Output not recorded
hitbox_w|hitbox_h|body_w|body_h|D\.hw|D\.hh\b|\bhp = |hp\s*=Thinking21:04:09
I'm compiling the full list of player state names like hang, climb_up, lower_off, rope, jump, fall, slide, stand, walk, run, crouch, and dead, checking whether 'peek' also appears as a distinct state. Then I want to trace where the hp field and any hurt timestamp field originate for the player.
I noticed the global hurt_flash for screen effects and per-landing fields like last_land_t/last_land_dmg/last_land_h that decrement over time, so I want to check if room 4's human has an equivalent reset in the spawn_player function around line 528, and confirm whether that controller table is shared for room4. I also want to check game.lua and robot.lua for how the player table is used, particularly around fall damage function naming for hooking dizzy states after damage, and read controller.lua's land/hurt logic and spawn/reset sections plus the purpose of notice_text/notice_t globals.
ReadC:/Users/a327e/Desktop/a327ex/emojunky/controller.lua21:04:09Output not recorded
C:/Users/a327e/Desktop/a327ex/emojunky/controller.luaReadC:/Users/a327e/Desktop/a327ex/emojunky/controller.lua21:04:09Output not recorded
C:/Users/a327e/Desktop/a327ex/emojunky/controller.luaThinking21:04:16
I've confirmed the `player` global is the single controller table shared across rooms 1-4, so room 4's draw_dig_human isn't using a separate "human" variable. Now I want to check game.lua for any standalone "human" identifier to be sure there's no distinct global I'm missing.
I'm also enumerating the movement states — hang, climb_up, lower_off, rope, crouch, stand, walk, run, jump, fall, slide, dead — and checking whether "peek" is its own state or just a flag on the player table used while crouched or hanging. Let me grep for all unique `p.state ==` comparisons to get the complete list.
Grep'human'|human\.|local human|human =21:04:16Output not recorded
'human'|human\.|local human|human =Bashcd "C:/Users/a327e/Desktop/a327ex/emojunky" && grep -oE "p\.state == '[a-z_]+'" ...21:04:16Output not recorded
cd "C:/Users/a327e/Desktop/a327ex/emojunky" && grep -oE "p\.state == '[a-z_]+'" ...Grepdebug_on|F1|bind\('f1|key ==|player_reset\(|spawn_player21:04:16Output not recorded
debug_on|F1|bind\('f1|key ==|player_reset\(|spawn_playerThinking21:04:26
"human" turns out to just be the run.state value for when the player controller drives the human character, not a separate table—confirmed no distinct "human = player" entity exists elsewhere. Now I'm compiling the full list of player states like crouch, stand, walk, run, etc.
Going through the assignments, I count twelve total states: stand, walk, run, crouch, jump, fall, slide, hang, climb_up, lower_off, rope, and dead. Next I want to check boot.lua for the debug toggle key, F1 binding, layer definitions, and cursor spawn logic, so I'll read through that file completely.
ReadC:/Users/a327e/Desktop/a327ex/emojunky/boot.lua21:04:26Output not recorded
C:/Users/a327e/Desktop/a327ex/emojunky/boot.luaThinking21:04:31
No emoji cursor spawning here, confirming this instance doesn't use it. I want to check main.lua next for how the debug toggle works with F1, how the layer globals are set up, and the order of draw calls including emoji rendering.
ReadC:/Users/a327e/Desktop/a327ex/emojunky/main.lua21:04:31Output not recorded
C:/Users/a327e/Desktop/a327ex/emojunky/main.luaThinking21:04:37
I confirm F1 toggles debug_on directly, and draw_hud always runs regardless of debug_on while draw_debug is gated by it—now checking whether room4's game.lua follows the same pattern with draw_dig_hud versus draw_dig_debug gating.
ReadC:/Users/a327e/Desktop/a327ex/emojunky/game.lua21:04:37Output not recorded
C:/Users/a327e/Desktop/a327ex/emojunky/game.luaThinking21:04:53
This answers Q6 well: fall damage runs through controller.lua's landing handler which decrements HP, and it sets a timestamp flag that game.lua checks against the previous tick to detect when a landing has just resolved.
I could hook a dizzy timer right there—checking if the landing timestamp advanced and damage was nonzero—without touching the core landing or damage mechanics. Now I want to check view.lua's draw function to understand room4's layer order and drawing sequence.
ReadC:/Users/a327e/Desktop/a327ex/emojunky/view.lua21:04:53Output not recorded
C:/Users/a327e/Desktop/a327ex/emojunky/view.luaNow let's look at the cursor.lua, juice.lua, windrang's draw pattern, and knightvspawns' boot/main for the cursor host contract, plus emoji/init.lua for asset loading.
ReadC:/Users/a327e/Desktop/a327ex/emojunky/emoji/cursor.lua21:04:56Output not recorded
C:/Users/a327e/Desktop/a327ex/emojunky/emoji/cursor.luaReadC:/Users/a327e/Desktop/a327ex/emojunky/emoji/juice.lua21:04:56Output not recorded
C:/Users/a327e/Desktop/a327ex/emojunky/emoji/juice.luaThinking21:05:03
I should check anchor/spring.lua to confirm the exact signature for spring_add and spring_pull, then look at windrang's player draw code, hitfx_init call, dizzy_img load, and knightvspawns boot/main files for reference.
Bashcd "C:/Users/a327e/Desktop/a327ex/ABAgames" && sed -n '85,100p' windrang/main.lu...21:05:04Output not recorded
cd "C:/Users/a327e/Desktop/a327ex/ABAgames" && sed -n '85,100p' windrang/main.lu...Grepcursor_layer|spawn_cursor|the_cursor|bind\('click'21:05:04Output not recorded
cursor_layer|spawn_cursor|the_cursor|bind\('click'Grepcursor_layer|spawn_cursor|the_cursor|bind\('click'21:05:04Output not recorded
cursor_layer|spawn_cursor|the_cursor|bind\('click'Thinking21:05:17
I found the dizzy_until pattern in windrang, which tracks a timed state by comparing current time against a stored expiry timestamp - exactly the approach needed for the Q6 hook of being dizzy for N seconds. Now I'm checking knightvspawns boot.lua for the cursor_layer declaration, main.lua's draw order for cursor update/draw placement, and related references.
Bashcd "C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns" && grep -n "emoji_laye...21:05:17Output not recorded
cd "C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns" && grep -n "emoji_laye...Bashcd "C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns" && sed -n '860,875p' b...21:05:17Output not recorded
cd "C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns" && sed -n '860,875p' b...Thinking21:05:23
I've confirmed cursor_layer sits outside WORLD_LAYERS in screen space, placed last in the LAYERS list so it draws on top, with the_cursor:draw() called right at the end of draw() after emoji_render, and the_cursor:update(dt) called near the end of update().
Now let me check emoji/init.lua for how slight_smile and dizzy are loaded, and verify slight_smile.png and dizzy.png exist in the emojunky assets folder.
Bashcd "C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns" && sed -n '10770,10780...21:05:23Output not recorded
cd "C:/Users/a327e/Desktop/a327ex/ABAgames/knightvspawns" && sed -n '10770,10780...Bashcd "C:/Users/a327e/Desktop/a327ex/emojunky" && grep -n "slight_smile\|dizzy\|ima...21:05:23Output not recorded
cd "C:/Users/a327e/Desktop/a327ex/emojunky" && grep -n "slight_smile\|dizzy\|ima...Thinking21:05:29
I confirmed that emojunky's emoji/init.lua loads slight_smile globally but never loads dizzy, even though the dizzy.png asset exists in the assets folder — it would need an explicit image_load call added, similar to how windrang handles it in boot.lua.
Now I need to check anchor/spring.lua for the spring_add and spring_pull signatures to answer Q5 accurately.
Grepfunction spring_add|function spring_pull|function spring_new|function spring_update|function spring_get21:05:29Output not recorded
function spring_add|function spring_pull|function spring_new|function spring_update|function spring_getNow I have everything needed. Let me do a final check on a couple of small things: p.hurt flag existence, and the exact image_draw/layer_image argument order confirmation (already have it), plus confirm spring_add(s, name, x, frequency, bounce) base value is x (the third positional arg, the spring's initial/rest value), which matches hitfx_init's calls spring_add(e.spring, 'hit', 1, 3, 0.7) etc.
Grepimage_load\(|assets/dizzy|assets/slight_smile21:05:34Output not recorded
image_load\(|assets/dizzy|assets/slight_smileNo image_load calls exist anywhere in emojunky's boot.lua — confirmed dizzy would need one added there. I now have everything needed to answer all six questions.
1. The human's draw
draw_player (view.lua:207-252, rooms 1-3) draws two rectangles for the body, both keyed off p.x, p.y where p.x, p.y is the horizontal-center / vertical-center point, at the FEET-relative half-height — i.e. p.y is the center of the hitbox, not the feet or top-left (feet = p.y + hh, top-left = p.x - D.hw, p.y - hh).
- Hitbox (outline only):
bx,by = (p.x - D.hw)*TILE_PX, (p.y - hh)*TILE_PX, sizeT.hitbox_w*TILE_PX × hh*2*TILE_PX(view.lua:210-211,223), wherehh = player_hh(p)(controller.lua:33-34) isD.hh_crouchwhen crouched, elseD.hh. - Sprite (filled body, the one that gets the fall-tell color): 1.15x the hitbox, feet-aligned:
sw = T.hitbox_w*1.15*TILE_PX,sh = hh*2*1.15*TILE_PX,sx = p.x*TILE_PX - sw/2,sy = (p.y+hh)*TILE_PX - sh(view.lua:214-218). - Facing: a 3x3 "facing pip" square offset by
p.facing*(sw*0.22)from center (view.lua:220-221); no mirroring of a sprite (it's flat rects). - Per-state changes: crouch shrinks
hh(drawn shorter, same code path, no separate branch). Airborne states (jump,fall,slide) draw a two-tick "hand window" on the facing side (view.lua:226-230).slideadditionally draws a wall-side budget bar (view.lua:235-240).dead/hurt have no distinct draw branch — color is the only "hurt" tell, viafall_color(p)(view.lua:157-164), which returnsFALL_COLORS[4](red) whenp.state == 'dead', otherwise a tier color read fromp.fall_time. There is no separate white-flash/blink for a hit. - HP/hearts:
draw_hud(view.lua:267-298) drawsT.hp9x9 squares onui_content_layer(litCOL_HEARTvsCOL_HEART_OFF), rope pips below them, and a full-screen red border flash driven by globalhurt_flash(decaysdt*3, set to1indo_land,controller.lua:353). - Fall-damage floating text: drawn in
draw_playeritself but queued ontoeffects_layer(notgame_layer) —'-%s %.1f tiles'usingp.last_land_dmg/p.last_land_h, gated onp.last_land_t > 0(view.lua:244-248);p.last_land_tis stamped to1.2indo_land(controller.lua:350) and ticks down inplayer_update(controller.lua:636).
controller.lua state exposed:
- State names (12 total, all via
p.state ==/direct assignment, noset_statehelper for the player — onlygame_set_statefor the room-4 run FSM):stand,walk,run,crouch(controller.lua:737-740),jump(587),fall(721, 896, 909, 915, 918, 1012, 1038),slide(886),hang(292),climb_up(941),lower_off(981),rope(506),dead(362). - Facing:
p.facing, ±1 (controller.lua:185etc; set at 245, 293, 526, 699, 830, 840, 920, 986, 1018). - Body size:
tuning.lua:49-51—T.hitbox_w = 0.6,T.hitbox_h = 0.8,T.hitbox_h_crouch = 0.45(tiles); derived half-sizesD.hw = T.hitbox_w/2,D.hh = T.hitbox_h/2,D.hh_crouch = T.hitbox_h_crouch/2(tuning.lua:296-298). - Airborne/grounded: no boolean field stored on
p; grounded is computed on demand viaon_ground(p)(called atcontroller.lua:657,667); airborne is implied by state (jump/fall/slide). - Fall time:
p.fall_time,p.fall_tiles,p.fall_from_y(reset together infall_reset,controller.lua:312-315; advanced at 866-870). - HP / last damage:
p.hp(int, set fromT.hp = 4,tuning.lua:108), decremented inplayer_hurt(p, n)(controller.lua:358-365, no stun applied). Last-damage record:p.last_land_h,p.last_land_dmg,p.last_land_t(set together indo_land,controller.lua:350) —p.last_land_tis the closest thing to a "hurt timestamp": it's a countdown (1.2s) rather than an absolute time, but the tick it goes from 0→1.2 is exactly "a landing just resolved" (this is the patterngame.lua:189-194already uses:was_land_t = player.last_land_tbeforeplayer_update, then compare after). There is nop.hurt_t/p.dmgfield and no i-frames/stun of any kind —do_land's comment says "HP only in this batch; no stun." - Global (not per-player) hurt state:
hurt_flash(screen-flash decay,boot.lua:88),notice_text/notice_t(a short floating message like "NO ROPES", unrelated to damage —controller.lua:386-388).
Robot-stage human: draw_dig_human (view.lua:564-586, room 4) reads the exact same global player table — not a separate human variable. (The only thing named human anywhere is run.state == 'human', the room-4 loop state that means "the human is currently being driven," in game.lua; the player controller itself is always player/p.) game_spawn_human() (game.lua:55-66) just calls player_reset(x, y). draw_dig_human shares player_hh(p), D.hw, T.hitbox_w for the box, adds the sketch's skin/shirt/eye rectangles as fractional insets of that same box, and draws the identical hitbox outline + fall-damage text + notice text as draw_player — it is functionally draw_player with cosmetic overlays, on game_layer.
2. The robot's draw
draw_robot (view.lua:526-539) is a plain rectangle sized T.hitbox_w*TILE_PX × T.hitbox_h*TILE_PX — the same tuning constants as the human's hitbox — with origin bx,by = (robot.x - D.hw)*TILE_PX, (robot.y - D.hh)*TILE_PX, i.e. robot.x, robot.y is the center, same convention as the player. Two small eye squares sit on the facing side; color/eye-color swap between "on" (yellow, run.state=='play') and "off" (grey, plus a small red "dead" chip above it). So yes — human and robot draw the same way this pass: centered origin, hh/hw half-extents from tuning, filled rect + accent details, no sprite/rotation.
3. The debug text
| Text | Function | Layer | Font | Gated by debug_on? |
|---|---|---|---|---|
| F1 readout, rooms 1-3 | draw_debug (view.lua:301-332) | ui_content_layer | fonts.debug | yes (main.lua:153) |
| F1 readout, room 4 | draw_dig_debug (view.lua:773-809) | ui_content_layer | fonts.debug | yes (view.lua:861) |
| Help strip, rooms 1-3 | last line inside draw_debug itself (view.lua:330-331) | ui_content_layer | fonts.debug | yes (part of draw_debug) |
| Help strip, room 4 | draw_dig_hud calling dig_help_lines() (view.lua:689-698,726-733) | ui_content_layer | fonts.debug | no — always on while run.total_t/run.t are inside help_time/human_help_time |
| Top HUD, rooms 1-3 (hearts/ropes/DEPTH/BEST/SEED) | draw_hud (view.lua:267-298) | ui_content_layer | fonts.debug | no, always drawn |
| Top HUD, room 4 (DEPTH, stats line, seed, clock, bar, hearts/ropes) | draw_dig_hud (view.lua:653-717) | ui_content_layer | fonts.hud (DEPTH/clock) + fonts.debug (stats/seed/ropes) | no, always drawn |
| Room labels / calibration pit depths | draw_labels (view.lua:255-265) | bg_layer | fonts.debug | no |
| Robot off-screen marker | draw_robot_marker (view.lua:595-608) | ui_content_layer | fonts.debug | no (gated by run.marker_on, not debug_on) |
| Floating fall-damage / notice text | inside draw_player/draw_dig_human (view.lua:244-251, 578-585) | effects_layer | fonts.debug | no |
Dig popups (+5s LINE 1, CHAIN x3) | draw_dig_popups (view.lua:635-644) | effects_layer | fonts.hud | no |
| Loop banners (powerdown/camp/dead) | draw_dig_hud → dig_banner_text (view.lua:700-716,749-765) | ui_content_layer | fonts.hud/fonts.debug | no |
debug_on is initialized true in boot.lua:83; the F1 bind (bind('debug', 'key:f1'), boot.lua:74) is toggled directly in main.lua:101: if input_pressed('debug') then debug_on = not debug_on end.
4. The cursor host contract
emoji/cursor.lua's own header (cursor.lua:17-26) states the requirements: bind('click', 'mouse:1'); a 'cursor'-named entry in emoji_layers (draws to the auto-created cursor_layer global); spawn_cursor() called after emoji_layers; then the_cursor:update(dt) at the end of update() and the_cursor:draw() in draw(). Mouse position comes from mouse_position()/mouse_delta() (cursor.lua:89-90), not a bind. cursor:new calls mouse_set_visible(false) (cursor.lua:57) to hide the OS cursor. cursor:draw() (cursor.lua:138-160) applies click-squash + movement-squash as an outer transform and rotation + main-spring scale as an inner one, offset (+7,+9) to land the sprite's fingertip on the mouse. cursor:error(duration) (cursor.lua:78-83) is the red-X "error persona," styled flat with no spring; cursor:flash/cursor:pulse (62-73) are the pop/press-adjacent acknowledgements (a click press/release also pulls the main spring directly in update, cursor.lua:124-135).
Host wiring, quoted from ABAgames/knightvspawns:
boot.lua:76:LAYERS[#LAYERS + 1] = { 'cursor', outline = true }— appended after everything else including per-player UI panel/content layers andstorm/wave.boot.lua:77:emoji_layers(LAYERS)boot.lua:871:spawn_cursor()(called afterreset(...), near the end of boot).main.lua:93:bind('click', 'mouse:1') -- cursor + move commit read 'click'main.lua:10776:the_cursor:update(dt)— near the end ofupdate().main.lua:12217:the_cursor:draw(), immediately followed bymain.lua:12228:emoji_render()— i.e. the cursor draws last, right before the composite, on top of everything.- The
cursorlayer is not in that game'sWORLD_LAYERS/camera-attach list — it stays screen space, same as emojunky'sui_contentetc.
emojunky's own boot.lua currently has none of this: no 'cursor' entry in emoji_layers({...}) (boot.lua:36-47), no spawn_cursor() call, and no bind('click', ...) — only bind('dig','mouse:1') and bind('flag','mouse:2') (boot.lua:79-80). All of it would need to be added to wire the cursor in.
5. The springs
hitfx_init(e)(juice.lua:53-59) — signaturehitfx_init(e), requirese.timeralready set (timer_new()), createse.spring = e.spring or spring_new()then adds three named springs viaspring_add(s, name, x, frequency, bounce):spring_add(e.spring, 'hit', 1, 3, 0.7),spring_add(e.spring, 'squash_x', 1, 3, 0.5),spring_add(e.spring, 'squash_y', 1, 3, 0.5)— base value1for all three (they multiply into scale), freq3, bounce0.7(hit)/0.5(squash). Also setse.flashing = false.spring_pull(s, name, force, frequency, bounce)(anchor/spring.lua:102-...) — addsforcetos[name].x;frequency/bounceare optional overrides of the spring's stiffness/damping for that pull only.hitfx_hit(e, pull, flash_duration)(juice.lua:63-71) pulls thehitspring (spring_pull(e.spring,'hit', pull or 0.3, 3, 0.5)) and, unlessflash_duration == false, setse.flashing = trueforflash_duration or 0.1s via a named timer tag'hitfx_flash'.- A draw reads springs as
self.spring.<name>.x(a plain field on the spring's sub-table), e.g. windrang's player draw (ABAgames/windrang/main.lua:536-545):
local img = time < self.dizzy_until and dizzy_img or slight_smile
local s = (22/img.width)*self.spring.hit.x
local sx = s*self.spring.squash_x.x
local sy = s*self.spring.squash_y.x
...
layer_push(game_layer, self.x, self.y, r, sx, sy)
layer_image(game_layer, img, 0, 0, nil, self.flashing and white())
layer_pop(game_layer)hitfx_init(self) is called once in player:new at ABAgames/windrang/main.lua:280. layer_image(layer, image, x, y, flip?, flash_color?)'s draw-position args are 0,0 because the preceding layer_push already translated/scaled/rotated to the entity's transform. dizzy_img is loaded once at boot: ABAgames/windrang/main.lua:93: dizzy_img = image_load('dizzy', 'assets/dizzy.png').
- In emojunky,
emoji/init.lua:49loadsslight_smile = image_load('slight_smile', 'assets/slight_smile.png')as a global already — soslight_smileis ready to use.dizzyis not loaded anywhere in emojunky'semoji/init.lua(grepped, no match) despiteassets/dizzy.pngexisting on disk; it would need its ownimage_load('dizzy', 'assets/dizzy.png')call, most naturally inboot.lua(which has noimage_loadcalls of its own yet either), mirroring windrang's pattern.
6. Room 4's human and the fall
Fall damage is applied in do_land(p) (controller.lua:347-356), which computes dmg = fall_damage_for(fall_height_for_time(p.fall_time)) and, if dmg > 0, calls player_hurt(p, dmg == 99 and p.hp or dmg) (controller.lua:352) — player_hurt (controller.lua:358-365) is the function that actually decrements the field: p.hp = math.max(0, p.hp - n), setting p.state = 'dead' if it reaches 0. do_land also stamps p.last_land_h, p.last_land_dmg, p.last_land_t = h, dmg, 1.2 and sets the global hurt_flash = 1 at the moment of damage (controller.lua:350,353).
Game.lua already has the exact non-mutating hook point documented in its own comment (game.lua:179-182,189-194): game_human(dt) snapshots was_land_t = player.last_land_t before player_update, then after it, if player.last_land_t > was_land_t and player.last_land_dmg > 0 then ... end is true on precisely the tick a damaging landing resolved. A "dizzy for N seconds" feature can add e.g. player.dizzy_until = time + N inside that same if block in game_human (or inside do_land's if dmg > 0 then branch in controller.lua:351-354) without touching player_hurt/do_land's HP math, then have draw_dig_human/draw_player read time < player.dizzy_until the way windrang's player draw reads time < self.dizzy_until for its dizzy_img swap.