QuakeServer.Builtins (quake_server v0.1.0)

Copy Markdown View Source

The engine functions a QuakeC program calls by number, as FTE runs them for a server program: vectors and angles, entities and models, traces, sounds, monster movement, searches, console variables, messages and level changes. Where FTE's rule depends on the kind of program, a QuakeWorld program is one whose crc is 54730.

call/3 takes the server (the QuakeC host), the builtin number and the argument count; arguments are read from the program's parameter slots and the result written to its return slot.

error (10) prints its arguments joined, as a line. With the console variable developer set it then prints break statement and the program goes on; otherwise it raises QuakeC.Exec.Error with the message Program error: and the text, which ends the call into the program. objerror (11) prints Program error: and its arguments joined, removes self and stops every running function (QuakeC.Exec.abort/1). breakpoint (6) prints break statement; dprint (25) prints its arguments joined while developer is set.

random (7) is FTE's: a step of 1/32768 from 0 up to 1, offset by half a step so it is never 0 or 1; with one argument it is scaled by it, with two it runs from the first toward the second. ftos (26) and vtos (27) write numbers as QuakeServer.Builtins.Text does, ftos as %5.1f while pr_brokenfloatconvert is set.

findradius (22) chains, through the field its third argument names (chain without one), every entity whose centre (with sv_gameplayfix_findradiusdistancetobox set, nearest point of its box) lies within the radius, the last found first; an entity with solid 0 is left out unless its flags hold 16384 (FL_FINDABLE_NONSOLID) or sv_gameplayfix_blowupfallenzombies is set.

setmodel (3) sets model and modelindex and then sizes the entity by the model's box: always for a world submodel (*n); for any model when the program is not a QuakeWorld one or sv_gameplayfix_setmodelsize_qw is set; otherwise only for a model that was found and is not a Quake alias model; any other keeps its size. The entity is linked either way.

Summary

Functions

Run builtin number, or the game's own function for a program function its source replaces (QuakeServer.Source.replacements/0), called by that function's name.

Set the program's trace_ globals from trace (set_trace_globals): with sv_gameplayfix_honest_tracelines at 0 a trace that started inside something reports a fraction of 1.

Trace a box from from to to for entity and set the program's trace_ globals from what it hit, as traceline and tracebox do: flags is the program's MOVE_ bits (QuakeServer.World.trace/7), the mover's hull field left out.

Functions

call(server, name, argc)

Run builtin number, or the game's own function for a program function its source replaces (QuakeServer.Source.replacements/0), called by that function's name.

put_trace(s, trace)

Set the program's trace_ globals from trace (set_trace_globals): with sv_gameplayfix_honest_tracelines at 0 a trace that started inside something reports a fraction of 1.

trace(s, from, mins, maxs, to, flags, entity)

Trace a box from from to to for entity and set the program's trace_ globals from what it hit, as traceline and tracebox do: flags is the program's MOVE_ bits (QuakeServer.World.trace/7), the mover's hull field left out.