Skip to content

Commit 2109bd1

Browse files
committed
Colshape functions
1 parent bcd11e9 commit 2109bd1

52 files changed

Lines changed: 609 additions & 366 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
1.58 MB
Loading
1.53 MB
Loading
723 KB
Loading
1.18 MB
Loading
949 KB
Loading
908 KB
Loading
Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# Scraped from: https://wiki.multitheftauto.com/wiki/AddColPolygonPoint
2-
shared:
1+
shared: &shared
32
name: addColPolygonPoint
4-
description: This function is used to add a new point to an existing [colshape polygon](/wiki/CreateColPolygon
5-
"CreateColPolygon").
3+
description: This function is used to add a new point to an existing [colshape polygon](/reference/createColPolygon).
64
parameters:
75
- name: shape
86
type: colshape
@@ -15,21 +13,21 @@ shared:
1513
description: The Y position of the new bound point.
1614
- name: index
1715
type: int
18-
description: MISSING_PARAM_DESC
16+
description: The index where the new point will be inserted in the polygon. The points are indexed in order, with 1 being the first bound point. Passing 0 will insert the point as the last one in the polygon.
1917
default: '0'
20-
examples:
21-
- path: examples/addColPolygonPoint-1.lua
22-
description: This examples adds a point to an existing polygon shape by a command.
23-
side: server
2418
returns:
2519
values:
2620
- type: bool
27-
name: value
28-
description: Returns true if the polygon was changed, false if invalid arguments
21+
name: result
22+
description: Returns **true** if the polygon was changed, **false** if invalid arguments
2923
were passed.
3024
oop:
3125
element: colshape
3226
method: addPoint
33-
static: false
3427
pair: removeColPolygonPoint
35-
requires_review: true
28+
29+
server:
30+
<<: *shared
31+
examples:
32+
- path: examples/addColPolygonPoint-1.lua
33+
description: This examples adds a point to an existing polygon shape by a command.
Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
# Scraped from: https://wiki.multitheftauto.com/wiki/CreateColCircle
2-
shared:
1+
shared: &shared
32
name: createColCircle
4-
description: This function creates a collision circle. This is a shape that has
5-
a position and a radius and infinite height that you can use to detect a player's
6-
presence. Events will be triggered when a player enters or leaves it.
3+
description: This function creates a collision circle. This is a shape that has a position and a radius and infinite height. Events will be triggered when a [[element]] enters or leaves it.
74
parameters:
85
- name: fX
96
type: float
@@ -14,23 +11,29 @@ shared:
1411
- name: radius
1512
type: float
1613
description: The radius of the collision circle. Can not be smaller than 0.1.
17-
examples:
18-
- path: examples/createColCircle-1.lua
19-
description: This example displays a chat message when a player enters the colshape
20-
and allows the colshape to be created using a console functionset_zone.
21-
side: server
2214
returns:
2315
values:
24-
- type: colshape
25-
name: value
26-
description: Returns a colshape element if successful, false if invalid arguments
16+
- type: colshape|false
17+
name: col-circle
18+
description: Returns a [[colshape]] element if successful, **false** if invalid arguments
2719
were passed to the function.
2820
oop:
29-
element: ColShape
21+
element: colshape
3022
method: Circle
3123
static: true
3224
notes:
3325
- type: tip
34-
content: To visualize a colshape when writing scripts, use the client console
35-
command showcol
36-
requires_review: true
26+
content: To visualize a colshape when writing scripts, use the client console command [showcol](/articles/Client_commands#showcol).
27+
preview_images:
28+
- path: 'Colshapes/shape_circle.png'
29+
30+
server:
31+
<<: *shared
32+
examples:
33+
- path: examples/createColCircle-1.lua
34+
description: This example displays a chat message when a player enters the colshape
35+
and allows the colshape to be created using a console command <code>set_zone</code>.
36+
- path: examples/createColCircle_OOP-1.lua
37+
description: This example displays a chat message when a player enters the colshape
38+
and allows the colshape to be created using a console command <code>set_zone</code>.
39+
oop: true
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Scraped from: https://wiki.multitheftauto.com/wiki/CreateColCuboid
2-
shared:
1+
shared: &shared
32
name: createColCuboid
43
description: This function creates a collision cuboid. This is a shape that has
54
a position, width, depth and height. See [Wikipedia](http://en.wikipedia.org/wiki/Cuboid)
@@ -24,19 +23,11 @@ shared:
2423
- name: fHeight
2524
type: float
2625
description: The collision cuboid's height.
27-
examples:
28-
- path: examples/createColCuboid-1.lua
29-
description: This example displays a chat message when a player enters the colshape
30-
and allows the colshape to be created using a console functionset_zone.
31-
side: server
32-
- path: examples/createColCuboid-2.lua
33-
description: This function creates a cuboid and centers it to given coordinates
34-
side: server
3526
returns:
3627
values:
37-
- type: colshape
38-
name: value
39-
description: Returns a colshape element if successful, false if invalid arguments
28+
- type: colshape|false
29+
name: col-cuboid
30+
description: Returns a [[colshape]] element if successful, **false** if invalid arguments
4031
were passed to the function.
4132
oop:
4233
element: ColShape
@@ -45,9 +36,21 @@ shared:
4536
notes:
4637
- type: info
4738
content: Attaching a cuboid colshape to another element may give unexpected results
48-
as the origin is not at the cuboid centre. Try using a collision sphere for
49-
attaching instead
39+
as the origin is not at the cuboid centre. Try using a [collision sphere](/reference/createColSphere) for
40+
attaching instead.
5041
- type: tip
51-
content: To visualize a colshape when writing scripts, use the client console
52-
command showcol
53-
requires_review: true
42+
content: To visualize a colshape when writing scripts, use the client console command [showcol](/articles/Client_commands#showcol).
43+
preview_images:
44+
- path: 'Colshapes/shape_cuboid.png'
45+
46+
server:
47+
<<: *shared
48+
examples:
49+
- path: examples/createColCuboid-1.lua
50+
description: This example displays a chat message when a player enters the colshape
51+
and allows the colshape to be created using a console command <code>set_zone</code>.
52+
- path: examples/createColCuboid-2.lua
53+
description: This function creates a cuboid and centers it to given coordinates.
54+
- path: examples/createColCuboid_OOP-1.lua
55+
description: This function creates a cuboid and centers it to given coordinates.
56+
oop: true
Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Scraped from: https://wiki.multitheftauto.com/wiki/CreateColPolygon
2-
shared:
1+
shared: &shared
32
name: createColPolygon
43
description: This function creates a collision polygon. See [Wikipedia](http://en.wikipedia.org/wiki/Polygon)
54
for a definition of a polygon. The first set of X Y of this shape is not part
@@ -10,11 +9,11 @@ shared:
109
- name: fCenterX
1110
type: float
1211
description: The X position of the collision polygon's position - the position
13-
that will be returned from getElementPosition .
12+
that will be returned from [[getElementPosition]].
1413
- name: fCenterY
1514
type: float
1615
description: The Y position of the collision polygon's position - the position
17-
that will be returned from getElementPosition .
16+
that will be returned from [[getElementPosition]].
1817
- name: fX1
1918
type: float
2019
description: The 1st X position of the collision polygon's bound point
@@ -34,35 +33,39 @@ shared:
3433
type: float
3534
description: The 3rd Y position of the collision polygon's bound point
3635
- name: '...'
37-
type: unknown
38-
description: MISSING_PARAM_DESC
39-
examples:
40-
- path: examples/createColPolygon-1.lua
41-
description: This example displays a chat message when any element hits the colshape
42-
and allows the colshape to be created using a console functionset_zone.
43-
side: server
44-
- path: examples/createColPolygon-2.lua
45-
description: This example displays a chat message when any element hits the colshape
46-
and allows the colshape to be created using a console functionset_wall.
47-
side: server
36+
type: ''
37+
description: From the 3rd position you can have as many points as you require to create the colshape.
4838
returns:
4939
values:
50-
- type: colshape
51-
name: value
52-
description: Returns a colshape element if successful, false if invalid arguments
40+
- type: colshape|false
41+
name: col-polygon
42+
description: Returns a [[colshape]] element if successful, **false** if invalid arguments
5343
were passed to the function.
5444
oop:
55-
element: ColShape
45+
element: colshape
5646
method: Polygon
5747
static: true
48+
preview_images:
49+
- path: 'Colshapes/shape_polygon.png'
5850
notes:
5951
- type: info
60-
content: For this function to work correctly, get/set your bound points in an
52+
content: |
53+
- For this function to work correctly, get/set your bound points in an
6154
anti-clockwise fashion.
62-
- type: info
63-
content: Even though this is a 2D colshape, isElementWithinColShape returns false
55+
- Even though this is a 2D colshape, [[isElementWithinColShape]] returns **false**
6456
if an element is in the area but below 0 Z height.
6557
- type: tip
66-
content: To visualize a colshape when writing scripts, use the client console
67-
command showcol
68-
requires_review: true
58+
content: To visualize a colshape when writing scripts, use the client console command [showcol](/articles/Client_commands#showcol).
59+
60+
server:
61+
<<: *shared
62+
examples:
63+
- path: examples/createColPolygon-1.lua
64+
description: This example displays a chat message when any element hits the colshape
65+
and allows the colshape to be created using a console command <code>set_zone</code>.
66+
- path: examples/createColPolygon-2.lua
67+
description: This example displays a chat message when any element hits the colshape
68+
and allows the colshape to be created using a console command <code>set_wall</code>.
69+
- path: examples/createColPolygon_OOP-1.lua
70+
description: This example displays a chat message when any element hits the colshape
71+
and allows the colshape to be created using a console command <code>set_wall</code>.

0 commit comments

Comments
 (0)