mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-16 21:46:03 +01:00
- seperated the 2000+ lines in ReadMe.md into seperate files. - useful if things expand - better readability for users - more organised layout
1.5 KiB
1.5 KiB
polyZone.lua
This module provides helpers for creating and removing polygon or circular zones using PolyZone-compatible data structures.
-
createPoly(data)
- Creates a polygonal zone using the detected polyzone library (ox_lib or PolyZone).
- Automatically checks which polyzone script is active. When using ox_lib, it converts the provided 2D points to 3D (setting a constant z value) and sets a thickness value.
- For PolyZone, it creates the zone and attaches onEnter and onExit callbacks for ease of use.
- Example:
createPoly({ name = 'testZone', debug = true, points = { vec2(100.0, 100.0), vec2(200.0, 100.0), vec2(200.0, 200.0), vec2(100.0, 200.0) }, onEnter = function() print("Entered Test Zone") end, onExit = function() print("Exited Test Zone") end, })
-
createCirclePoly(data)
-
When using ox_lib, it creates a sphere zone. For PolyZone, it creates a CircleZone and attaches onEnter and onExit callbacks.
-
Example:
createCirclePoly({ name = 'circleZone', coords = vector3(150.0, 150.0, 20.0), radius = 50.0, onEnter = function() print("Entered Circle Zone") end, onExit = function() print("Exited Circle Zone") end, }) -
removePolyZone(Location)
- Removes a previously created polygon or circle zone by name.
- Detects the active polyzone library and calls the appropriate removal method.
- Example:
local zone = createPoly({...}) --- removePolyZone(zone)