← Ülevaadedocs\ai_context\MOB_KEEP_ATTACKING_20261127.md

Mobs keep attacking until the player dies (2026-11-27, Claude)

Owner report (Janari): when standing next to mobs for a long time, they eventually stop attacking. They must keep attacking until the player is dead.

Cause (reproduced, not the aggro timer)

Aggro/leash were fine: aggro stayed refreshed (3 s while in sight), no leash, no return home. Two stalls in Scripts/Enemies/OverworldSkeleton.gd:

  1. Attack-line ray hit the wall at the player's feet. _clear_attack_line_from casts a ray from the mob to the target's feet (+5 px). When the player stands against a fence, wall, rock or tree, the last pixels of the ray touch that collider, the line counts as blocked, so the mob stays in CHASE right next to the player (~48 px), pushing into the player forever, never swinging. Sparring moves the mob around, so sooner or later it lands on such an angle. Archers had the same freeze (their ray ends at the player's centre).
  2. Pressed just outside attack_range. In ATTACK state (allowed up to attack_range + 14) a melee mob pinned against a wall/body at e.g. 88.5 px with range 88 never started a swing (start needed <= attack_range) and could not get closer.

Fix (OverworldSkeleton.gd only; online server mobs are separate, untouched)

Pure local AI decisions, no new synced state: multiplayer-compatible.

Test

Scripts/Build/GameChecks/game_check_mob_persist.gd (run with run_one_game_check.ps1 -Script game_check_mob_persist.gd, ~3 min). Player stands still (godmode) next to goblin, skeleton, and with feet on GraveFenceWest_middle_07 vs goblin, skeleton, archer. PASS = swings keep coming, no gap > 8 s.

Archive / rollback: D:/WieldHavenBackups/archive/mob_keep_attacking_20261127/ (OverworldSkeleton.gd.before, .after). Nothing deleted.