mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 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
|
# 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
|
```lua
|
||||||
-- data: table
|
-- data: table
|
||||||
-- points: table of vector3s, all z values must match
|
-- points: vector3[] all z values must match
|
||||||
-- thickness: number (optional), default 2
|
-- thickness: number (optional), default 2
|
||||||
-- debug: bool (optional)
|
-- debug: bool (optional)
|
||||||
lib.zones.poly(data)
|
lib.zones.poly(data)
|
||||||
@@ -21,21 +21,59 @@ lib.zones.box(data)
|
|||||||
-- radius: number (optional), default is 2
|
-- radius: number (optional), default is 2
|
||||||
-- debug: bool (optional)
|
-- debug: bool (optional)
|
||||||
lib.zones.sphere(data)
|
lib.zones.sphere(data)
|
||||||
|
```
|
||||||
|
|
||||||
local zone = lib.points.box({
|
```lua
|
||||||
coords = playerCoords,
|
function onEnter(self)
|
||||||
dunak = 'nerd',
|
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()
|
local sphere = lib.zones.sphere({
|
||||||
print('entered box', self.id)
|
coords = vec3(442.5363, -1017.666, 28.65637),
|
||||||
end
|
radius = 1,
|
||||||
|
debug = true,
|
||||||
|
inside = inside,
|
||||||
|
onEnter = onEnter,
|
||||||
|
onExit = onExit
|
||||||
|
})
|
||||||
|
|
||||||
function zone:onExit()
|
local box = lib.zones.box({
|
||||||
print('exited box', self.id)
|
coords = vec3(442.5363, -1017.666, 28.65637),
|
||||||
end
|
size = vec3(1, 1, 1),
|
||||||
|
rotation = 45,
|
||||||
function zone:inside()
|
debug = true,
|
||||||
print('you are inside the box ' .. self.id)
|
inside = insideZone,
|
||||||
end
|
onEnter = onEnter,
|
||||||
|
onExit = onExit
|
||||||
|
})
|
||||||
```
|
```
|
||||||
@@ -3,9 +3,9 @@
|
|||||||
### lib.checkDependency
|
### lib.checkDependency
|
||||||
Check if a resource is using a specified version or higher, allowing for compatibility checks or throwing errors.
|
Check if a resource is using a specified version or higher, allowing for compatibility checks or throwing errors.
|
||||||
```lua
|
```lua
|
||||||
-- repository: string
|
-- resource: string
|
||||||
-- version: string
|
-- version: string
|
||||||
lib.checkDependency(repository, version)
|
lib.checkDependency(resource, version)
|
||||||
|
|
||||||
if not lib.checkDependency('ox_lib', '1.5.0') then error() end
|
if not lib.checkDependency('ox_lib', '1.5.0') then error() end
|
||||||
```
|
```
|
||||||
Reference in new issue
Block a user