stalker
A module script.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2mistwood.stalker — a patient woodland stalker AI. A reusable predator brain: it patrols a ring of waypoints, investigates disturbances, chases what it sees, searches where it last saw you, and — when it has lost the trail for too long — quietly drifts its patrol toward your quarter of the woods so it never wanders harmlessly to the far side. The host owns the stalker's root entity and drives the brain each frame: it computes the *senses* (are you hidden? exposed? in the open? in a grace period?) and reacts to the *events* the brain returns (it caught you, a chase just began, it lost your trail). The brain owns the state machine and the movement; it knows nothing about flashlights, fog, or fear, so it drops into any stalk-and-hide game. Usage: local Stalker = require("mistwood.stalker") local wt = Stalker.newState({ x = -40, z = -40 }) -- spawn corner -- each frame, with the stalker's root entity id: local ev = Stalker.tick(wt, rootId, dt, { px = px, pz = pz, flashOn = lit, hidden = h, exposure = e, visible = v, grace = g, outOfBounds = oob }, { speed = 2.5, sight = 22, catch = 1.9, waypoints = wps }) if ev.caught then ... end -- it reached you if ev.chaseOnset then ... end -- a chase just started (sting!) States: patrol · investigate · chase · search
dist2(ax: ?, az: ?, bx: ?, bz: ?) → void
| arg | type | description |
|---|---|---|
| ax | ? | |
| az | ? | |
| bx | ? | |
| bz | ? |
yawQuat(yaw: ?) → void
Yaw-only quaternion (the stalker stands upright and turns to face travel).
| arg | type | description |
|---|---|---|
| yaw | ? |
newState(spawn: ?) → void
Fresh per-run state. `spawn` is the far corner the stalker starts in.
| arg | type | description |
|---|---|---|
| spawn | ? |
nearestWaypoint(wps: ?, px: ?, pz: ?) → void
The waypoint nearest the player — patrol drifts toward it once the trail has gone cold, so the hunt slowly closes back in.
| arg | type | description |
|---|---|---|
| wps | ? | |
| px | ? | |
| pz | ? |
tick(wt: ?, rootId: ?, dt: ?, sense: ?, cfg: ?) → void
Advance one frame. Returns { dist, state, caught, chaseOnset, lostTrail }.
| arg | type | description |
|---|---|---|
| wt | ? | |
| rootId | ? | |
| dt | ? | |
| sense | ? | |
| cfg | ? |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.