opx_lib
Lib.Zone
Last updated on
Test whether a point or the player is inside a zone, and watch entries and exits.
No permission. A zone definition is what Open77.zones.contains takes, e.g. { position = { x, y, z }, radius = 8.0 }. A client zone is a display cue, never proof: re-check on the server.
Lib.Zone.Contains
Whether a point is inside a zone. ok = true, value = false means outside.
Lib.Zone.Contains(definition, point, options)Parameters
- definition:
table - point:
{ x, y, z } - options?:
table—grace,origin,rotation
Returns
Result—boolean
Lib.Zone.Here
Whether the local player is inside a zone now.
Lib.Zone.Here(definition, options)Parameters
- definition:
table - options?:
table
Returns
Result—boolean
Lib.Zone.Watch
Calls onEnter / onExit as the local player crosses the boundary. One shared thread polls every 250 ms (Zone.INTERVAL). A player already inside gets onEnter.
Lib.Zone.Watch(definition, handlers)Parameters
- definition:
table - handlers:
table- onEnter?:
function - onExit?:
function - grace?:
number
- onEnter?:
Returns
Result— a watch handle; errorsinvalid_definition,invalid_handlers,no_handlers
local watch = Lib.Zone.Watch({ position = { x = 10.0, y = 20.0, z = 5.0 }, radius = 8.0 }, {
onEnter = function() Lib.Notify.Show('Welcome to the market') end,
})Lib.Zone.Unwatch
Stops a watch. The shared thread stops with the last one.
Lib.Zone.Unwatch(handle)Parameters
- handle:
any
Returns
Result— errorno_such_watch
Lib.Zone.Count
Running watches.
Lib.Zone.Count()Returns
integer