Interaction reach rules live in World rather than a pure contract #20
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?
World.reachable?/1is three clauses of interaction policy — what "close enoughto use this" means for an NPC, for a loc footprint, and for a wall — living
inside the module that owns the tick. It is reachable only through
resolve_action/4, which means the only way to test any of it is to stand aplayer up in a running world and drive it through
World.request/2.This is the case the contracts standard exists for: a rule set buried inside
something expensive to run gets extracted into a pure contract, and the burden
is on not doing it.
It is also not academic. The cheap distance gate lives in
Contract.Interactionand the real answer lives inWorld, and the two driftedapart in exactly the way that split invites — the gate was used as the verdict
in two separate places, both of which shipped:
reachable?/1answeredtrueunconditionally for:npcand for walls, sothe gate was the answer,
follow/2decided a walk to a moving target was finished using the gate whilearrival used the strict test, which strands the player when the target stops
on a diagonal tile.
Shape of a fix
A
Contract.Reachtaking the collision snapshot and a target, with one clauseper target kind and one test per clause.
Worldkeeps the thunk that fetchesthe snapshot; the rules stop being something only the tick can answer.