fix: NPC strand recovery, nav reroute storm, and the Al Kharid toll gate #184
No reviewers
Labels
No labels
bug
ci-cd
client
epic:security-hardening
feature
optimization
priority:high
priority:low
priority:medium
server
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
BlackLobster/Server!184
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/nav-storm-npc-strand-tollgate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #174, #175.
NPC return-home (#175)
An NPC lured off its spawn and abandoned could sit as furniture forever.
maybe_return_home/1 is a greedy line-step: a wall leaves it standing with
no waypoints, so active_tick?/1 is false and the NPC sleeps after five idle
ticks. Sleep then starves the only recovery there is, since a sleeping NPC
gets no :pulse_tick_movement and never advances wander_counter toward the
snap-home. Its wake poll only fires for a real player in range and grants
five ticks a visit, so the 500-tick timeout needed ~100 separate visits.
Both idle polls now wake a displaced NPC, and a displaced one uses a much
shorter snap-home limit (50 ticks) than the wandering drift timeout. The
wake deliberately lives in the polls rather than in active_tick?/1:
walk_range defaults to 0, so every stationary NPC off its spawn tile reads
as displaced and gating sleep on that would hold much of the NPC population
awake. Relocating NPCs are exempt from both return-home paths — maybe_relocate/1
moves tile without moving spawn_tile, so a hopped fishing spot would
otherwise be dragged back to the slot it just left.
Bot navigation (#174)
The reroute tier rebuilt its waypoints with the collision-blind
generate_waypoints/2. A bot only reaches that tier because something blocked
it, so the straight line aimed the replacement waypoints back through the
very obstacle that caused the stuck; every reroute reproduced the block and
the budget drained into recover_to_hub, which teleported the bot onto the
identical route. Now routes through build_route/2, and the per-reroute log
drops to debug.
Al Kharid toll gate
Both halves of the crossing were stubs returning false, so the gate charged
nothing and was an unbroken wall to every router — the wall the fleets were
grinding against. TollGate is now real, from the 468 landscape: leaves 2882
@{3268,3227,0} and 2883 @{3268,3228,0}, solid, on the west edge of x=3268.
Collision is deliberately untouched. Clearing the wall would open the border
for everyone, bots included, and let A* route through a gate the walker
cannot open; a payer instead crosses under a short noclip window. "Open"
now reaches the Border Guard (925), who asks for the toll in dialogue, and
both routes share TollGate.pay_and_cross/2.
GatePassage drives the same sequence for bots through its three phases,
paying via the human click path so bots get no discount. A bot that cannot
pay fails out to the runner's backoff instead of retrying the border.
066c3ff7cdc931f6eb5c