defineTargetRule
defineTargetRule(
name,test):TargetRule
Declares a target rule under name, at module scope, and returns the
handle a behaviour’s targets lists. For example, const flagHolder = defineTargetRule("flagHolder", (world, chaser, candidate) => candidate.has(FlagTrait)), then <Chase targets={[flagHolder]} />.
The rule narrows the kinds beside it, the default where there are
none, so it is asked only about candidates they let through. The room
and every page load the same module, so both ends ask the same test:
on the room for chase, pickup and loot, and on the player’s page too
for Interact’s prompt and Trigger’s callbacks, where it reads what
the page holds. A name is camel case, as an event’s is; two rules
under one name throw as the second loads.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
test |
TargetTest |