Skip to content

Commit 53a13d8

Browse files
committed
Optional side property for examples
Added an optional side property, which allows specifying the type of the example on pages other than function definitions, where the type is determined automatically. An example would be element pages like Vector2, where the type can't be detected automatically and manual specification is useful.
1 parent 7b2249d commit 53a13d8

File tree

5 files changed

+17
-3
lines changed

5 files changed

+17
-3
lines changed

elements/Matrix/Matrix.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,12 @@ examples:
106106
- path: examples/matrix-1.lua
107107
description: >
108108
Say you wanted to create a bin - object 1337 - two units in front of a player. You don't want to manually do trigonometry and you don't want to play with the complicated tables. You just want to get the position two units in front of the player whilst taking into account the rotation of the player. You only need to use Matrix.getForward, Matrix.getPosition and getElementMatrix. It's just:
109+
side: 'shared'
109110
- path: examples/matrix-2.lua
110111
description: >
111112
If you wanted the opposite of matrix.forward you'll still use matrix.forward but you minus it instead of matrix.backward which doesn't exist. Same applies with matrix.right and matrix.up. To make the bin object appear behind a player:
113+
side: 'shared'
112114
- path: examples/matrix-3.lua
113115
description: >
114-
Say you'd like to get find the position underneath a vehicle. This is the position at any rotation. So if it was upside down, the Z value would be higher than the vehicle Z value. If the vehicle was the right way round, the Z value for underneath car would be less than the Z value for the car.
116+
Say you'd like to get find the position underneath a vehicle. This is the position at any rotation. So if it was upside down, the Z value would be higher than the vehicle Z value. If the vehicle was the right way round, the Z value for underneath car would be less than the Z value for the car.
117+
side: 'shared'

elements/Vector/Vector2.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,7 @@ oop_only_methods:
9999
examples:
100100
- path: examples/vector2-1.lua
101101
description: Checks if the player is using a low resolution
102+
side: 'client'
102103
- path: examples/vector2-2.lua
103-
description: Draws a red line from center to cursor, 200px long
104+
description: Draws a red line from center to cursor, 200px long
105+
side: 'client'

elements/Vector/Vector3.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,18 @@ oop_only_methods:
183183
examples:
184184
- path: examples/vector3-1.lua
185185
description: This example sorts all players in a nice line on the center of the map.
186+
side: 'shared'
186187
- path: examples/vector3-2.lua
187188
description: >
188189
This example creates a tiny sun which is always at the right of the vehicle the local player drives. By default it will draw the vectors used to compute the position where it should be, so you can understand what does this function do. Note that the code could be made simpler by simply getting the right component of the vehicle matrix. Make sure that you put this code in a resource which has OOP enabled, or it won't work.
190+
side: 'client'
189191
- path: examples/vector3-3.lua
190192
description: >
191193
This examples illustrates the concept of dot/scalar product and implements a useful function which can be used to get the angle between two vectors.
194+
side: 'shared'
192195
- path: examples/vector3-4.lua
193196
description: This example slowly moves all the players' camera to look at the Mount Chilliad.
197+
side: 'client'
194198
- path: examples/vector3-5.lua
195199
description: This example slowly moves all the players' camera to look at the Mount Chilliad with a shorter code than the previous example.
200+
side: 'client'

elements/Vector/Vector4.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ oop_only_methods:
2626

2727
examples:
2828
- path: examples/vector4-1.lua
29-
description: This example adds a command called "/garage", allowing you to get any garage bounding box.
29+
description: This example adds a command called "/garage", allowing you to get any garage bounding box.
30+
side: 'client'

schemas/common-defs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ $defs:
120120
exampleTitle:
121121
type: string
122122
description: Optional title displayed in the frame around the example.
123+
side:
124+
type: string
125+
description: Optionally, you can specify the type of the example. In the case of function definitions, the type is automatically determined based on the client, server, or shared section.
123126

124127
see_also:
125128
type: array

0 commit comments

Comments
 (0)