QuakeServer.Extensions.Settings (quake_server v0.1.0)

Copy Markdown View Source

FTE's builtins about the engine around the program: console variables (cvar, cvar_string, cvar_set, cvar_setf, registercvar, cvar_defstring, cvar_type, cvar_description, buf_cvarlist, cvars_haveunsaved, as FTE's pr_bgcmd.c runs them on the host's QuakeServer.Cvars table), server and player info keys, which extensions and functions exist, calling functions by name, the time, printing, console commands, registered stats, and the kinds of client.

registercvar(name, value, flags) takes the value only when given flags too, as FTE reads its arguments; DarkPlaces flag bits 16 (cheat), 32 (archive), 256 (server info), 512 (user info) and 2048 (private) are taken, any other is warned about. cvar_type gives FTE's bits: 1 there, 2 archived, 4 private, 8 the engine's, 16 has a description, 32 read only.

readcmd runs the console commands queued so far, then its text, and returns what they printed, kept off the console, followed by PF_readcmd: and the text, as FTE's redirected console gives it.

Info keys live in the host's ext.serverinfo and ext.userinfo (by entity), stats in ext.stats, registered commands in ext.commands.

Summary

Functions

Run settings builtin builtin (a number or a name).

Console variable name as a server program's cvar reads it: pr_checkextension is checkextension's builtin number (0 when the variable is set to 0), pr_builtin_find and pr_map_builtin 0, halflifebsp 1 on a Half-Life map; any other name its value as readable/2 finds it, 0 when there is none.

Whether name is one of the extensions checkextension (99) reports, ignoring ASCII case, as FTE's menu program checks.

Info key key of entity: the server's for the world, a player's own otherwise; "" when unset.

The server's info keys as an info string, \key\value for each.

Set info key key of entity (the world for the server's own). A change to the server's own goes to every player reliably as svc_serverinfo (52, the key and value as strings).

Console variable name as a program reads it (FTE's PF_Cvar_FindOrGet): made when there is none and pr_autocreatecvars is set (empty, or sv_maxairspeed 30 and sv_jumpvelocity 270), nil when it is not there or programs may not read it (:nounsafeexpand).

Server key key as a client program reads it (PF_cl_serverkey_internal): ip loopback, servername local, constate active, pausestate 1 or 0 by the host's ext.paused, maxplayers 1, protocol QuakeWorld FTE, transferring and dlstate empty, loadstate 0 0 0 ""; any other key from the server's info.

Set console variable name to value as a program's cvar_set does: made when there is none (readable/2), and left alone when no program may set it (:notfromserver).

Functions

call(s, builtin, argc)

@spec call(map(), integer() | String.t(), non_neg_integer()) :: map()

Run settings builtin builtin (a number or a name).

cvar_value(s, name)

@spec cvar_value(map(), String.t()) :: float()

Console variable name as a server program's cvar reads it: pr_checkextension is checkextension's builtin number (0 when the variable is set to 0), pr_builtin_find and pr_map_builtin 0, halflifebsp 1 on a Half-Life map; any other name its value as readable/2 finds it, 0 when there is none.

extension?(name)

@spec extension?(String.t()) :: boolean()

Whether name is one of the extensions checkextension (99) reports, ignoring ASCII case, as FTE's menu program checks.

info(s, entity, key)

@spec info(map(), non_neg_integer(), String.t()) :: String.t()

Info key key of entity: the server's for the world, a player's own otherwise; "" when unset.

info_string(s)

@spec info_string(map()) :: String.t()

The server's info keys as an info string, \key\value for each.

put_info(s, entity, key, value)

@spec put_info(map(), non_neg_integer(), String.t(), String.t()) :: map()

Set info key key of entity (the world for the server's own). A change to the server's own goes to every player reliably as svc_serverinfo (52, the key and value as strings).

readable(s, name)

@spec readable(map(), String.t()) :: QuakeServer.Cvars.Cvar.t() | nil

Console variable name as a program reads it (FTE's PF_Cvar_FindOrGet): made when there is none and pr_autocreatecvars is set (empty, or sv_maxairspeed 30 and sv_jumpvelocity 270), nil when it is not there or programs may not read it (:nounsafeexpand).

server_key(s, key)

@spec server_key(map(), String.t()) :: String.t()

Server key key as a client program reads it (PF_cl_serverkey_internal): ip loopback, servername local, constate active, pausestate 1 or 0 by the host's ext.paused, maxplayers 1, protocol QuakeWorld FTE, transferring and dlstate empty, loadstate 0 0 0 ""; any other key from the server's info.

set_cvar(s, name, value)

@spec set_cvar(map(), String.t(), String.t()) :: map()

Set console variable name to value as a program's cvar_set does: made when there is none (readable/2), and left alone when no program may set it (:notfromserver).