Level Editor/Scripting/Reference/GamemodeClientApi

Revision as of 04:46, 20 October 2026 by TeamSpecBot (talk | contribs) (American spelling)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

get_player(entity_id: int, name: StringName) -> int
Method · Available to client.gd

A player counter's value for one player. 0 for a counter the server never declared.

Parameters
  • entity_id: int
  • name: StringName
    Returns: int

get_team

get_team(team: int, name: StringName) -> int
Method · Available to client.gd

A team counter's value for one team. 0 for a counter the server never declared.

Parameters
  • team: int
  • name: StringName
    Returns: int

get_global

get_global(name: StringName) -> int
Method · Available to client.gd

A global counter's value. 0 for a counter the server never declared.

Parameters
  • name: StringName
    Returns: int

local_player

local_player() -> int
Method · Available to client.gd

The 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.

Returns: int

team_of

team_of(entity_id: int) -> int
Method · Available to client.gd

The team a player is on, or 0 for none (not placed yet, or spectating).

Parameters
  • entity_id: int
    Returns: int

players

players() -> Array
Method · Available to client.gd

The entity ids of every player in the match, sorted.

Returns: Array

counter_maximum

counter_maximum(scope: int, name: StringName) -> int
Method · Available to client.gd

A 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.

Parameters
  • scope: int
  • name: StringName
    Returns: int

teams

teams() -> PackedInt32Array
Method · Available to client.gd

Every playing team's id, in order. Never includes 0, which means "on no team" and covers both an unplaced player and a spectator.

Returns: PackedInt32Array

team_name

team_name(team: int) -> String
Method · Available to client.gd

The name the server gave a team, or "" for a team that does not exist.

Parameters
  • team: int
    Returns: String

team_maximum

team_maximum(team: int) -> int
Method · Available to client.gd

How many players a team may hold, or 0 when there is no limit.

Parameters
  • team: int
    Returns: int

match_state

match_state() -> int
Method · Available to client.gd

Which 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.

Returns: int

tracks

tracks() -> PackedStringArray
Method · Available to client.gd

Every payload track's name, in map order. Where a cart is comes from the server, as a counter the server script keeps.

Returns: PackedStringArray

track_length

track_length(track: StringName) -> float
Method · Available to client.gd

A track's length in meters, or 0 for a track that does not exist.

Parameters
  • track: StringName
    Returns: float

track_checkpoints

track_checkpoints(track: StringName) -> PackedFloat32Array
Method · Available to client.gd

Each 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.

Parameters
  • track: StringName
    Returns: PackedFloat32Array

show_widget

show_widget(kind: StringName, config: Dictionary) -> int
Method · Available to client.gd

Put 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.

Parameters
  • kind: StringName
  • config: Dictionary
    Returns: int

remove_widget

remove_widget(handle: int) -> bool
Method · Available to client.gd

Take a widget off the screen. False when the handle names no widget.

Parameters
  • handle: int
    Returns: bool

log

log(message: String) -> void
Method · Available to client.gd

Print a line tagged with the map's name and client, for testing.

Parameters
  • message: String
    Returns: void

Constants

SCOPE_PLAYER

SCOPE_PLAYER
Constant · Available to client.gd

The player counters, for counter_maximum and _counter_changed.

SCOPE_TEAM

SCOPE_TEAM
Constant · Available to client.gd

The team counters, for counter_maximum and _counter_changed.

SCOPE_GLOBAL

SCOPE_GLOBAL
Constant · Available to client.gd

The global counters, for counter_maximum and _counter_changed.

MATCH_LIVE

MATCH_LIVE
Constant · Available to client.gd

match_state(): the round is being played.

MATCH_DECIDED

MATCH_DECIDED
Constant · Available to client.gd

match_state(): a winner has been declared; the world plays on for a moment.

MATCH_RESULT

MATCH_RESULT
Constant · Available to client.gd

match_state(): the world is paused and the result is showing.

MATCH_VOTING

MATCH_VOTING
Constant · Available to client.gd

match_state(): players are voting for the next map.

MATCH_LOADING

MATCH_LOADING
Constant · Available to client.gd

match_state(): the next map is loading.

TeamSpec Level Editor
Basics Getting started · Interface · Viewport and camera · Selecting and hiding · Keyboard shortcuts · Settings · Map Config · Troubleshooting
Menus File · Edit · View · Tools · Functional
Panels Scene tree · Inspector · Materials · Props · Snapping · UV editor · Displacement · Terrain
Tools Move, Rotate and Scale · Box · Sphere · Cylinder · Prism · Stairs · Spiral Stairs · Spiral Tower · Arch · Path Brush · Plane · Terrain · Clip · Duplicate · Ruler and Cordon · Edit Vertex and Edge · Edit Face · Loop Cut · Material Brush · Vertex Color Brush · Displacement · Prop Path
Entities Brush · Zone · Group · Mirror Node · Prop · Spawn Point · Supply Pickup · World Boundary · Lights · Water · Sounds · Anchor Platform · Payload Track · Boss Spawn · Map Marker · World Text · Decal · Door · Button · Logic entities · 3D Skybox · Nav Region
Workflows Your first map · Brushes and CSG · Materials and UVs · Lighting and lightmaps · Bots and navigation · Mirrored maps · Outputs and logic · Custom assets · Playtesting · Exporting and publishing · Importing Source maps
Scripting Overview · Server rules · Client HUD · Bots · Teams and spawning · Zones · Pickups · Payload tracks · Map entities · Sandbox limits · Testing · King of the Hill · Team Deathmatch · API reference · What a script may use