Level Editor/Scripting/Reference/GamemodeClientApi
Reached as api from client.gd.
What a client script can do: read the match and draw the HUD.
Reached as api in client.gd. Every call here only reads, or shows something on this player's screen; nothing here can change the match.
See Level Editor/Scripting/Reference for every class, and Level Editor/Scripting/Reference/Sandbox for the rest of GDScript a script may use.
Methods
get_player
client.gdA player counter's value for one player. 0 for a counter the server never declared.
entity_id:intname:StringNameReturns:int
get_team
client.gdA team counter's value for one team. 0 for a counter the server never declared.
team:intname:StringNameReturns:int
get_global
client.gdA global counter's value. 0 for a counter the server never declared.
name:StringNameReturns:int
local_player
client.gdThe entity id of the player at this keyboard, or -1 before there is one. What a client script shows is usually relative to this player.
intteam_of
client.gdThe team a player is on, or 0 for none (not placed yet, or spectating).
entity_id:intReturns:int
players
client.gdThe entity ids of every player in the match, sorted.
Arraycounter_maximum
client.gdA counter's declared maximum, from the server. Read limits from here instead of copying the server script's numbers, so the two cannot disagree. scope is SCOPE_PLAYER, SCOPE_TEAM or SCOPE_GLOBAL. 0 for a counter that was never declared.
scope:intname:StringNameReturns:int
teams
client.gdEvery playing team's id, in order. Never includes 0, which means "on no team" and covers both an unplaced player and a spectator.
PackedInt32Arrayteam_name
client.gdThe name the server gave a team, or "" for a team that does not exist.
team:intReturns:String
team_maximum
client.gdHow many players a team may hold, or 0 when there is no limit.
team:intReturns:int
match_state
client.gdWhich phase the match is in: MATCH_LIVE, MATCH_DECIDED, MATCH_RESULT, MATCH_VOTING or MATCH_LOADING. The game already shows the result screen and the map vote; this is for HUD of your own that should change once the round is decided.
inttracks
client.gdEvery payload track's name, in map order. Where a cart is comes from the server, as a counter the server script keeps.
PackedStringArraytrack_length
client.gdA track's length in meters, or 0 for a track that does not exist.
track:StringNameReturns:float
track_checkpoints
client.gdEach checkpoint's distance from the track's start in meters, in order. Divide each by track_length for the checkpoints a payload_progress widget takes.
track:StringNameReturns:PackedFloat32Array
show_widget
client.gdPut one of TeamSpec's HUD widgets on screen and return a handle for remove_widget. kind is team_score, carry_pips, round_timer, payload_progress or boss_health; config is a Dictionary of that widget's settings, with counter names as strings. The widget shows the current values straight away and keeps itself up to date. An unknown kind shows nothing and returns 0.
kind:StringNameconfig:DictionaryReturns:int
remove_widget
client.gdTake a widget off the screen. False when the handle names no widget.
handle:intReturns:bool
log
client.gdPrint a line tagged with the map's name and client, for testing.
message:StringReturns:void
Constants
SCOPE_PLAYER
client.gdThe player counters, for counter_maximum and _counter_changed.
SCOPE_TEAM
client.gdThe team counters, for counter_maximum and _counter_changed.
SCOPE_GLOBAL
client.gdThe global counters, for counter_maximum and _counter_changed.
MATCH_LIVE
client.gdmatch_state(): the round is being played.
MATCH_DECIDED
client.gdmatch_state(): a winner has been declared; the world plays on for a moment.
MATCH_RESULT
client.gdmatch_state(): the world is paused and the result is showing.
MATCH_VOTING
client.gdmatch_state(): players are voting for the next map.
MATCH_LOADING
client.gdmatch_state(): the next map is loading.