Level Editor/Scripting/Reference/GamemodeServerApi: Difference between revisions

Scripting reference: GamemodeServerApi
 
American spelling
 
Line 399: Line 399:
}}
}}


=== zones_labelled ===
=== zones_labeled ===
{{API member
{{API member
|name=zones_labelled
|name=zones_labeled
|kind=Method
|kind=Method
|signature=zones_labelled(label: StringName) -> Array
|signature=zones_labeled(label: StringName) -> Array
|scripts=<code>server.gd</code>, <code>bot.gd</code>
|scripts=<code>server.gd</code>, <code>bot.gd</code>
|params=* <code>label</code>: <code>StringName</code>
|params=* <code>label</code>: <code>StringName</code>
Line 451: Line 451:
|params=* <code>zone</code>: <code>StringName</code>
|params=* <code>zone</code>: <code>StringName</code>
|returns=<code>void</code>
|returns=<code>void</code>
|description=Nobody may build inside a zone from now until the map ends: a building whose centre would stand in it is refused. For your spawn rooms, from <code>_start</code>. A zone on a moving platform cannot be forbidden, and says so in the log.
|description=Nobody may build inside a zone from now until the map ends: a building whose center would stand in it is refused. For your spawn rooms, from <code>_start</code>. A zone on a moving platform cannot be forbidden, and says so in the log.
}}
}}


Line 461: Line 461:
|scripts=<code>server.gd</code>, <code>bot.gd</code>
|scripts=<code>server.gd</code>, <code>bot.gd</code>
|returns=<code>PackedStringArray</code>
|returns=<code>PackedStringArray</code>
|description=Every payload track&#39;s name, in map order: the name the track has in the level editor. Every distance the track calls take or give is metres along the track, 0 at its start. An unknown track reads as 0 or empty, and commands to it are ignored.
|description=Every payload track&#39;s name, in map order: the name the track has in the level editor. Every distance the track calls take or give is meters along the track, 0 at its start. An unknown track reads as 0 or empty, and commands to it are ignored.
}}
}}


Line 472: Line 472:
|params=* <code>track</code>: <code>StringName</code>
|params=* <code>track</code>: <code>StringName</code>
|returns=<code>float</code>
|returns=<code>float</code>
|description=A track&#39;s length in metres.
|description=A track&#39;s length in meters.
}}
}}


Line 483: Line 483:
|params=* <code>track</code>: <code>StringName</code>
|params=* <code>track</code>: <code>StringName</code>
|returns=<code>PackedFloat32Array</code>
|returns=<code>PackedFloat32Array</code>
|description=Each checkpoint&#39;s distance from the track&#39;s start in metres, in order. What reaching one means is up to the mode; usually <code>set_track_floor</code> to it.
|description=Each checkpoint&#39;s distance from the track&#39;s start in meters, in order. What reaching one means is up to the mode; usually <code>set_track_floor</code> to it.
}}
}}


Line 506: Line 506:
* <code>marker</code>: <code>StringName</code>
* <code>marker</code>: <code>StringName</code>
|returns=<code>float</code>
|returns=<code>float</code>
|description=A marker&#39;s distance from the track&#39;s start in metres, or -1.0 when the track has no marker by that name. For planning ahead of the cart, such as slowing it down before it reaches the marker.
|description=A marker&#39;s distance from the track&#39;s start in meters, or -1.0 when the track has no marker by that name. For planning ahead of the cart, such as slowing it down before it reaches the marker.
}}
}}


Line 517: Line 517:
|params=* <code>track</code>: <code>StringName</code>
|params=* <code>track</code>: <code>StringName</code>
|returns=<code>float</code>
|returns=<code>float</code>
|description=How far the cart has come, in metres, as of this server tick.
|description=How far the cart has come, in meters, as of this server tick.
}}
}}


Line 552: Line 552:
* <code>speed</code>: <code>float</code>
* <code>speed</code>: <code>float</code>
|returns=<code>void</code>
|returns=<code>void</code>
|description=Set the speed the cart heads for, in metres per second: negative rolls it back, 0 stops it. The cart speeds up and slows down smoothly, never past its top speed, and stops at either end and at its floor (<code>set_track_floor</code>). Setting the same speed again costs nothing, so set it every tick.
|description=Set the speed the cart heads for, in meters per second: negative rolls it back, 0 stops it. The cart speeds up and slows down smoothly, never past its top speed, and stops at either end and at its floor (<code>set_track_floor</code>). Setting the same speed again costs nothing, so set it every tick.
}}
}}


Line 619: Line 619:
|params=* <code>marker_name</code>: <code>String</code>
|params=* <code>marker_name</code>: <code>String</code>
|returns=<code>Vector3</code>
|returns=<code>Vector3</code>
|description=The way the marker named <code>marker_name</code> faces, level and one metre long: the arrow at its feet in the editor. A point it looks at is <code>api.marker(n) + api.marker_facing(n) * distance</code>.
|description=The way the marker named <code>marker_name</code> faces, level and one meter long: the arrow at its feet in the editor. A point it looks at is <code>api.marker(n) + api.marker_facing(n) * distance</code>.
}}
}}


Line 1,193: Line 1,193:
|name=bot_dodge
|name=bot_dodge
|kind=Method
|kind=Method
|signature=bot_dodge(entity_id: int, centre: Vector3, radius: float &#61; 4.0) -&gt; bool
|signature=bot_dodge(entity_id: int, center: Vector3, radius: float &#61; 4.0) -&gt; bool
|scripts=<code>server.gd</code>, <code>bot.gd</code>
|scripts=<code>server.gd</code>, <code>bot.gd</code>
|params=* <code>entity_id</code>: <code>int</code>
|params=* <code>entity_id</code>: <code>int</code>
Line 1,417: Line 1,417:
* <code>warn</code>: <code>bool</code>, default <code>false</code>
* <code>warn</code>: <code>bool</code>, default <code>false</code>
|returns=<code>void</code>
|returns=<code>void</code>
|description=Flash a message across the top of one player&#39;s screen, under the gamemode&#39;s widgets, for a few seconds. <code>title</code> is the line; <code>body</code> is a shorter line under it; <code>warn</code> marks something they lose by ignoring, drawn in the warning colour and held longer. A new message replaces the one on screen, so send what matters now (a checkpoint reached, your boss under attack), not every hit. Bots are skipped, so looping over <code>players()</code> is fine.
|description=Flash a message across the top of one player&#39;s screen, under the gamemode&#39;s widgets, for a few seconds. <code>title</code> is the line; <code>body</code> is a shorter line under it; <code>warn</code> marks something they lose by ignoring, drawn in the warning color and held longer. A new message replaces the one on screen, so send what matters now (a checkpoint reached, your boss under attack), not every hit. Bots are skipped, so looping over <code>players()</code> is fine.
}}
}}