zones.compound
zones.compound(def: table): Zone
Creates a zone made of several shapes.
A single entry and a single exit for the whole: going from one shape to another calls nothing.
| Field | Type | Role |
|---|---|---|
shapes |
{ table } |
each shape: center + size (box), center + radius (sphere) or points + zmin + zmax (polygon) |
name |
string |
name, shown in the console |
onEnter |
(zone, player, reason) -> () |
someone enters |
onExit |
(zone, player, reason) -> () |
someone leaves |
inside |
(zone, player) -> () |
called regularly for each member |
insideEvery |
number |
seconds between two calls to inside (0.25 by default) |
exitMargin |
number |
metres to go past in order to leave, from 0 to 5 (0.25 by default) |
priority |
number |
overlapping zones: the highest wins |
who |
string |
"players" (default), "entities" or "all" |
bucket |
number |
bucket set on entry and given back on exit, without any other code |
holes |
{ table } |
shapes removed from the zone |
data |
table |
free fields, read through zone.data |
debug |
boolean |
thick outline, for debugging |
Parameters#
- def (
table): fields below
Example#
zones.compound({
name = "Lecture hall and its mezzanine",
shapes = {
{ center = { 0, 0, 2 }, size = { 20, 12, 4 } },
{ center = { 0, 4, 5.5 }, size = { 20, 4, 3 } },
},
holes = { { center = { 0, 0, 1 }, radius = 1 } },
bucket = 150,
})