Contract.Interaction.adjacent?/2 reads as a verdict but is only a gate #21
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Contract.Interaction.adjacent?/2is public, named as a verdict, and documentedas "stands on or beside
action's footprint... Chebyshev distance, so adiagonal counts as adjacent."
It is not a verdict. Reach is cardinal: a target is usable from a tile beside it
with the shared edge open, which is what
World.Collision.Flags.interactable_from?/3tests and what
World.Movement.approach/3routes to.adjacent?/2is thecheap filter that decides whether that stricter check is worth running.
Every caller that reads the name and uses it as the answer reintroduces the same
bug, which has now happened twice —
World.reachable?/1for NPCs, andfollow/2when deciding a walk had finished. Both were live. The symptom is aninteraction firing one tile early, which is invisible in isolation because the
player usually keeps walking afterwards and ends up somewhere plausible.
Shape of a fix
Rename so the name cannot be mistaken for the answer —
maybe_in_range?/2,worth_checking?/2— or make it private to the contract and expose only thecombined verdict. The doc should say outright that a true answer means "run the
real check", not "you can use this".