Level Editor/Scripting/Reference/GamemodeServerApi: Difference between revisions
TeamSpecBot (talk | contribs) Scripting reference: GamemodeServerApi |
TeamSpecBot (talk | contribs) American spelling |
||
| Line 399: | Line 399: | ||
}} | }} | ||
=== | === zones_labeled === | ||
{{API member | {{API member | ||
|name= | |name=zones_labeled | ||
|kind=Method | |kind=Method | ||
|signature= | |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 | |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's name, in map order: the name the track has in the level editor. Every distance the track calls take or give is | |description=Every payload track'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's length in | |description=A track'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's distance from the track's start in | |description=Each checkpoint's distance from the track'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's distance from the track's start in | |description=A marker's distance from the track'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 | |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 | |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 | |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, | |signature=bot_dodge(entity_id: int, center: Vector3, radius: float = 4.0) -> 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's screen, under the gamemode'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 | |description=Flash a message across the top of one player's screen, under the gamemode'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. | ||
}} | }} | ||