mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-01 14:38:50 +00:00
more zone examples
This commit is contained in:
1 parent
cabfbfb107
commit
8081132d6f
2 files changed
+55
-17
No files matched your search
+53
-15
@@ -1,10 +1,10 @@
|
||||
# Zones
|
||||
|
||||
More optimised version of polyzones utilising glm polygon.
|
||||
An alternative to PolyZone utilising [glm.polygon](https://github.com/gottfriedleibniz/lua/blob/luaglm/EXTENDED.md#polygon).
|
||||
|
||||
```lua
|
||||
-- data: table
|
||||
-- points: table of vector3s, all z values must match
|
||||
-- points: vector3[] all z values must match
|
||||
-- thickness: number (optional), default 2
|
||||
-- debug: bool (optional)
|
||||
lib.zones.poly(data)
|
||||
@@ -21,21 +21,59 @@ lib.zones.box(data)
|
||||
-- radius: number (optional), default is 2
|
||||
-- debug: bool (optional)
|
||||
lib.zones.sphere(data)
|
||||
```
|
||||
|
||||
local zone = lib.points.box({
|
||||
coords = playerCoords,
|
||||
dunak = 'nerd',
|
||||
```lua
|
||||
function onEnter(self)
|
||||
print('entered zone', self.id)
|
||||
end
|
||||
|
||||
function onExit(self)
|
||||
print('exited zone', self.id)
|
||||
end
|
||||
|
||||
function inside(self)
|
||||
print('you are inside zone ' .. self.id)
|
||||
end
|
||||
|
||||
local poly = lib.zones.poly({
|
||||
points = {
|
||||
vec(413.8, -1026.1, 29),
|
||||
vec(411.6, -1023.1, 29),
|
||||
vec(412.2, -1018.0, 29),
|
||||
vec(417.2, -1016.3, 29),
|
||||
vec(422.3, -1020.0, 29),
|
||||
vec(426.8, -1015.9, 29),
|
||||
vec(431.8, -1013.0, 29),
|
||||
vec(437.3, -1018.4, 29),
|
||||
vec(432.4, -1027.2, 29),
|
||||
vec(424.7, -1023.5, 29),
|
||||
vec(420.0, -1030.2, 29),
|
||||
vec(409.8, -1028.4, 29),
|
||||
},
|
||||
thickness = 2,
|
||||
debug = true,
|
||||
inside = inside,
|
||||
onEnter = onEnter,
|
||||
onExit = onExit
|
||||
})
|
||||
|
||||
function zone:onEnter()
|
||||
print('entered box', self.id)
|
||||
end
|
||||
local sphere = lib.zones.sphere({
|
||||
coords = vec3(442.5363, -1017.666, 28.65637),
|
||||
radius = 1,
|
||||
debug = true,
|
||||
inside = inside,
|
||||
onEnter = onEnter,
|
||||
onExit = onExit
|
||||
})
|
||||
|
||||
function zone:onExit()
|
||||
print('exited box', self.id)
|
||||
end
|
||||
|
||||
function zone:inside()
|
||||
print('you are inside the box ' .. self.id)
|
||||
end
|
||||
local box = lib.zones.box({
|
||||
coords = vec3(442.5363, -1017.666, 28.65637),
|
||||
size = vec3(1, 1, 1),
|
||||
rotation = 45,
|
||||
debug = true,
|
||||
inside = insideZone,
|
||||
onEnter = onEnter,
|
||||
onExit = onExit
|
||||
})
|
||||
```
|
||||
@@ -3,9 +3,9 @@
|
||||
### lib.checkDependency
|
||||
Check if a resource is using a specified version or higher, allowing for compatibility checks or throwing errors.
|
||||
```lua
|
||||
-- repository: string
|
||||
-- resource: string
|
||||
-- version: string
|
||||
lib.checkDependency(repository, version)
|
||||
lib.checkDependency(resource, version)
|
||||
|
||||
if not lib.checkDependency('ox_lib', '1.5.0') then error() end
|
||||
```
|
||||
Reference in new issue
Block a user