Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
main.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define autocvar_slowmo   cvar("slowmo")

Functions

void dedicated_print (string input)
 print(), but only print if the server is not local
bool dropclient_schedule (entity this)
 Schedules dropclient for a player and returns true; if dropclient is already scheduled (for that player) it does nothing and returns false.
string GetField_fullspawndata (entity e, string fieldname, bool vfspath)
 Retrieves the value of a map entity field from fullspawndata.
void main ()
void Pause_TryPause_Dedicated (entity this)
void remove_except_protected (entity e)
void remove_safely (entity e)
void remove_unsafely (entity e)

Variables

float autocvar_g_balance_contents_damagerate
float autocvar_g_balance_contents_drowndelay
int autocvar_g_balance_contents_playerdamage_drowning
int autocvar_g_balance_contents_playerdamage_lava
int autocvar_g_balance_contents_playerdamage_lava_burn
float autocvar_g_balance_contents_playerdamage_lava_burn_time = 2.5
int autocvar_g_balance_contents_playerdamage_slime
int autocvar_g_balance_contents_projectiledamage
float autocvar_g_balance_falldamage_deadminspeed
float autocvar_g_balance_falldamage_factor
int autocvar_g_balance_falldamage_maxdamage
float autocvar_g_balance_falldamage_minspeed
bool autocvar_g_balance_falldamage_onlyvertical
bool autocvar_sv_autopause
float autocvar_sys_ticrate
float contents_damagetime
bool iscreature
vector oldvelocity
float remove_except_protected_forbidden
float serverframetime
float serverprevtime
float servertime
float species
float watersound_finished

Macro Definition Documentation

◆ autocvar_slowmo

#define autocvar_slowmo   cvar("slowmo")

Definition at line 16 of file main.qh.

Referenced by anticheat_physics(), and StartFrame().

Function Documentation

◆ dedicated_print()

void dedicated_print ( string input)

print(), but only print if the server is not local

Definition at line 233 of file main.qc.

234{
235 if (autocvar_sv_dedicated) print(input);
236}
void print(string text,...)
bool autocvar_sv_dedicated
Definition world.qh:41

References autocvar_sv_dedicated, and print().

Referenced by GameLogEcho(), and Say().

◆ dropclient_schedule()

bool dropclient_schedule ( entity this)

Schedules dropclient for a player and returns true; if dropclient is already scheduled (for that player) it does nothing and returns false.

NOTE: this function exists only to allow sending a message to the kicked player with Send_Notification, which doesn't work if called together with dropclient

Definition at line 44 of file main.qc.

45{
46 bool scheduled = false;
47 FOREACH_ENTITY_CLASS("dropclient_handler", true,
48 {
49 if(it.owner == this)
50 {
51 scheduled = true;
52 break; // can't use return here, compiler shows a warning
53 }
54 });
55 if (scheduled)
56 return false;
57
58 entity e = new_pure(dropclient_handler);
60 e.owner = this;
61 e.nextthink = time + 0.1;
62
63 // ignore this player for team balancing and queuing
64 this.team = -1;
65 this.wants_join = 0;
67 return true;
68}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
int team
Definition main.qh:188
string classname
float time
int wants_join
Definition ent_cs.qh:73
#define FOREACH_ENTITY_CLASS(class, cond, body)
Definition iter.qh:189
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:67
#define setthink(e, f)
void dropclient_do(entity this)
Definition main.qc:30
const string STR_OBSERVER
Definition utils.qh:7

References classname, dropclient_do(), entity(), FOREACH_ENTITY_CLASS, new_pure, setthink, STR_OBSERVER, team, time, and wants_join.

Referenced by MUTATOR_HOOKFUNCTION(), and PlayerFrame().

◆ GetField_fullspawndata()

string GetField_fullspawndata ( entity e,
string fieldname,
bool vfspath )

Retrieves the value of a map entity field from fullspawndata.

This bypasses field value changes made by the engine, eg string-to-float and escape sequence substitution.

Avoids the need to declare fields just to read them once :)

Returns the last instance of the field to match DarkPlaces behaviour.

Path support: converts \ to / and checks the file exists, if vfspath is true. Returns string_null if the entity does not have the field, or the file is not in the VFS.

FIXME: entities with //comments are not supported.

Definition at line 451 of file main.qc.

452{
453 string v = string_null;
454
455 if (!e.fullspawndata) // Engine lacks support, warning spam in CheckEngineExtensions()
456 return v;
457
458 if (strstrofs(e.fullspawndata, "//", 0) >= 0)
459 {
460 // tokenize and tokenize_console return early if "//" is reached,
461 // which can leave an odd number of tokens and break key:value pairing.
462 LOG_WARNF("^1EDICT %s fullspawndata contains unsupported //comment^7%s", ftos(num_for_edict(e)), e.fullspawndata);
463 return v;
464 }
465
466 //print(sprintf("%s(EDICT %s, FIELD %s)\n", __FUNC__, ftos(num_for_edict(e)), fieldname));
467 //print(strcat("FULLSPAWNDATA:", e.fullspawndata, "\n"));
468
469 // tokenize treats \ as an escape, but tokenize_console returns the required literal
470 for (int t = tokenize_console(e.fullspawndata) - 3; t > 0; t -= 2)
471 {
472 //print(sprintf("\tTOKEN %s:%s\t%s:%s\n", ftos(t), ftos(t + 1), argv(t), argv(t + 1)));
473 if (argv(t) == fieldname)
474 {
475 v = argv(t + 1);
476 break;
477 }
478 }
479
480 //print(strcat("RESULT: ", v, "\n\n"));
481
482 if (v && vfspath)
483 {
484 v = strreplace("\\", "/", v);
485 if (whichpack(v) == "")
486 return string_null;
487 }
488
489 return v;
490}
#define strstrofs
#define tokenize_console
#define LOG_WARNF(...)
Definition log.qh:62
string ftos(float f)
string argv(float n)
string string_null
Definition nil.qh:9

References argv(), entity(), ftos(), LOG_WARNF, string_null, strstrofs, and tokenize_console.

Referenced by DoesQ3ARemoveThisEntity(), door_init_shared(), MapInfo_Get_ByName_NoFallbacks(), spawnfunc(), spawnfunc(), spawnfunc(), spawnfunc(), and StartItem().

◆ main()

void main ( )

Definition at line 26 of file menu.qh.

◆ Pause_TryPause_Dedicated()

void Pause_TryPause_Dedicated ( entity this)

Definition at line 198 of file main.qc.

199{
201 setpause(1);
202}
int player_count
Definition api.qh:103
bool intermission_running
bool autocvar__endmatch
Definition world.qh:6

References autocvar__endmatch, entity(), intermission_running, and player_count.

Referenced by spawnfunc().

◆ remove_except_protected()

void remove_except_protected ( entity e)

Definition at line 269 of file main.qc.

270{
271 if(e.remove_except_protected_forbidden)
272 error("not allowed to remove this at this point");
273 builtin_remove(e);
274}
#define error
Definition pre.qh:6

References entity(), and error.

Referenced by InitializeEntitiesRun().

◆ remove_safely()

void remove_safely ( entity e)

Definition at line 283 of file main.qc.

284{
286 builtin_remove(e);
287}
void make_safe_for_remove(entity e)
Definition main.qc:238

References entity(), and make_safe_for_remove().

Referenced by spawnfunc().

◆ remove_unsafely()

void remove_unsafely ( entity e)

Definition at line 276 of file main.qc.

277{
278 if(e.classname == "spike")
279 error("Removing spikes is forbidden (crylink bug), please report");
280 builtin_remove(e);
281}

References entity(), and error.

Referenced by InitializeEntitiesRun(), spawnfunc(), and StartFrame().

Variable Documentation

◆ autocvar_g_balance_contents_damagerate

float autocvar_g_balance_contents_damagerate

Definition at line 3 of file main.qh.

Referenced by CreatureFrame_hotliquids(), and DrownPlayer().

◆ autocvar_g_balance_contents_drowndelay

float autocvar_g_balance_contents_drowndelay

Definition at line 4 of file main.qh.

Referenced by DrownPlayer().

◆ autocvar_g_balance_contents_playerdamage_drowning

int autocvar_g_balance_contents_playerdamage_drowning

Definition at line 5 of file main.qh.

Referenced by DrownPlayer().

◆ autocvar_g_balance_contents_playerdamage_lava

int autocvar_g_balance_contents_playerdamage_lava

Definition at line 6 of file main.qh.

Referenced by CreatureFrame_hotliquids().

◆ autocvar_g_balance_contents_playerdamage_lava_burn

int autocvar_g_balance_contents_playerdamage_lava_burn

Definition at line 7 of file main.qh.

Referenced by CreatureFrame_hotliquids().

◆ autocvar_g_balance_contents_playerdamage_lava_burn_time

float autocvar_g_balance_contents_playerdamage_lava_burn_time = 2.5

Definition at line 8 of file main.qh.

Referenced by CreatureFrame_hotliquids().

◆ autocvar_g_balance_contents_playerdamage_slime

int autocvar_g_balance_contents_playerdamage_slime

Definition at line 9 of file main.qh.

Referenced by CreatureFrame_hotliquids().

◆ autocvar_g_balance_contents_projectiledamage

int autocvar_g_balance_contents_projectiledamage

Definition at line 10 of file main.qh.

Referenced by CreatureFrame_hotliquids().

◆ autocvar_g_balance_falldamage_deadminspeed

float autocvar_g_balance_falldamage_deadminspeed

Definition at line 11 of file main.qh.

Referenced by CreatureFrame_FallDamage().

◆ autocvar_g_balance_falldamage_factor

float autocvar_g_balance_falldamage_factor

Definition at line 12 of file main.qh.

Referenced by CreatureFrame_FallDamage().

◆ autocvar_g_balance_falldamage_maxdamage

int autocvar_g_balance_falldamage_maxdamage

Definition at line 13 of file main.qh.

Referenced by CreatureFrame_FallDamage().

◆ autocvar_g_balance_falldamage_minspeed

float autocvar_g_balance_falldamage_minspeed

Definition at line 14 of file main.qh.

Referenced by CreatureFrame_FallDamage().

◆ autocvar_g_balance_falldamage_onlyvertical

bool autocvar_g_balance_falldamage_onlyvertical

Definition at line 15 of file main.qh.

Referenced by CreatureFrame_FallDamage().

◆ autocvar_sv_autopause

bool autocvar_sv_autopause

Definition at line 19 of file main.qh.

Referenced by ClientConnect(), spawnfunc(), StartFrame(), and SV_PausedTic().

◆ autocvar_sys_ticrate

float autocvar_sys_ticrate

Definition at line 17 of file main.qh.

Referenced by pong_ball_think(), pong_paddle_think(), RemoveItem(), and StartFrame().

◆ contents_damagetime

float contents_damagetime

Definition at line 49 of file main.qh.

Referenced by CreatureFrame_hotliquids(), and CreatureFrame_Liquids().

◆ iscreature

◆ oldvelocity

◆ remove_except_protected_forbidden

float remove_except_protected_forbidden

Definition at line 27 of file main.qh.

◆ serverframetime

float serverframetime

Definition at line 39 of file main.qh.

Referenced by Drag_Update(), and StartFrame().

◆ serverprevtime

float serverprevtime

Definition at line 39 of file main.qh.

◆ servertime

float servertime

Definition at line 39 of file main.qh.

◆ species

float species

Definition at line 47 of file main.qh.

Referenced by CopyBody(), Damage_DamageInfo_SendEntity(), and NET_HANDLE().

◆ watersound_finished

float watersound_finished

Definition at line 44 of file main.qh.

Referenced by CreatureFrame_hotliquids().