Skip to content

Commit 4f72c67

Browse files
committed
Missing OOP example for addColPolygonPoint
1 parent 436f010 commit 4f72c67

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

functions/Colshape/addColPolygonPoint.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,7 @@ server:
3030
<<: *shared
3131
examples:
3232
- path: examples/addColPolygonPoint-1.lua
33-
description: This examples adds a point to an existing polygon shape by a command.
33+
description: This examples adds a point to an existing polygon shape by a command.
34+
- path: examples/addColPolygonPoint_OOP-1.lua
35+
description: This examples adds a point to an existing polygon shape by a command.
36+
oop: true
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
local shape = ColShape.Polygon(2, 2, 5, 5, 6, 6, 8, 8) -- Somewhere in the map
2+
function addPointToPolygon(plr, cmd, fX, fY, index)
3+
if (not fX or not fY) then
4+
plr:outputChat("Correct syntax: /addpoint <fX fY>", 255, 25, 25)
5+
return false
6+
end
7+
if (not index or index == 0) then
8+
shape:addPoint(fX, fY)
9+
else
10+
shape:addPoint(fX, fY, index)
11+
end
12+
plr:outputChat("Point added", 0, 255, 0)
13+
end
14+
addCommandHandler("addpoint", addPointToPolygon)

0 commit comments

Comments
 (0)