▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage pursuitKit.package·originates fromworld 0a0b119f-a…
awareness
One meter per observer, 0 (unaware) to 1 (certain), with two thresholds.
by·posted 11d ago
What it does
awareness
One meter per observer, 0 (unaware) to 1 (certain), with two thresholds.
Each tick the host says how fast each observer that can currently see the suspect is filling (from
perception.fillRate); everyone else drains. Crossing a threshold is a moment, returned as an event:
local Awareness = require("~.modules.awareness")
local aw = Awareness.new(cfg) -- the kit config (reads cfg.observers[kind])
local events = aw:tick(dt, { { id = "w1", kind = "guard", rate = 0.6 }, ... })
-- events: { type = "suspicious" | "alert" | "calm", id, kind, onAlert? }
aw:value("w1") aw:stage("w1") -- 0..1 and "unaware" | "suspicious" | "alert"
aw:max() -- highest value, and whose (the HUD's meter)
aw:forget("w1") -- the observer left the world
aw:set("w1", "guard", 1) -- a host-forced value (a radio call that tells a guard for certain)
aw:snapshot() -- { { id, kind, value, stage } } sorted by value, for UI
An observer stays "alert" until it has drained below its suspicious threshold again ("calm"), so a pursuer that
loses sight for a moment does not forget whom it was chasing.
The interface is documented in the header of init.luau; this file repeats it for the asset browser.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.