.float score_return;
.float score_team_capture; // shouldn't be too high
+// property set on objects to point to the flag they're carrying (if any)
+.entity flagcarried;
+
// effects
.string toucheffect;
.string passeffect;
#include "sv_keyhunt.qh"
#include <server/gamelog.qh>
+#include <server/g_damage.qh>
float autocvar_g_balance_keyhunt_damageforcescale;
float autocvar_g_balance_keyhunt_delay_collect;
race_ScoreRules();
if(g_race_qualifying == 2)
warmup_stage = 0;
+ radar_showennemies = true;
}
void rc_SetLimits()
#include "sv_turrets.qh"
#ifdef SVQC
#include <server/autocvars.qh>
+#include <server/weapons/weaponsystem.qh>
#include <common/mapobjects/defs.qh>
// Generic aiming
#include "racer.qh"
+#if defined(SVQC)
+ #include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
+#endif
+
#ifdef GAMEQC
#ifdef SVQC
#include "raptor.qh"
+#if defined(SVQC)
+ #include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
+#endif
+
#ifdef GAMEQC
#ifdef SVQC
#include "spiderbot.qh"
+#if defined(SVQC)
+ #include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
+#endif
+
#ifdef GAMEQC
const int SBRM_FIRST = 1;
#include <server/defs.qh>
#include <server/miscfunctions.qh>
#include <server/weapons/selection.qh>
+#include <server/weapons/weaponsystem.qh>
#include "cvars.qh"
#include <common/state.qh>
+#include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
#include <common/physics/player.qh>
#include <common/wepent.qh>
}
}
+void calculate_player_respawn_time(entity this)
+{
+ if(MUTATOR_CALLHOOK(CalculateRespawnTime, this))
+ return;
+
+ float gametype_setting_tmp;
+ float sdelay_max = GAMETYPE_DEFAULTED_SETTING(respawn_delay_max);
+ float sdelay_small = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small);
+ float sdelay_large = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large);
+ float sdelay_small_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small_count);
+ float sdelay_large_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large_count);
+ float waves = GAMETYPE_DEFAULTED_SETTING(respawn_waves);
+
+ float pcount = 1; // Include myself whether or not team is already set right and I'm a "player".
+ if (teamplay)
+ {
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
+ if(it.team == this.team)
+ ++pcount;
+ });
+ if (sdelay_small_count == 0)
+ sdelay_small_count = 1;
+ if (sdelay_large_count == 0)
+ sdelay_large_count = 1;
+ }
+ else
+ {
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
+ ++pcount;
+ });
+ if (sdelay_small_count == 0)
+ {
+ if (IS_INDEPENDENT_PLAYER(this))
+ {
+ // Players play independently. No point in requiring enemies.
+ sdelay_small_count = 1;
+ }
+ else
+ {
+ // Players play AGAINST each other. Enemies required.
+ sdelay_small_count = 2;
+ }
+ }
+ if (sdelay_large_count == 0)
+ {
+ if (IS_INDEPENDENT_PLAYER(this))
+ {
+ // Players play independently. No point in requiring enemies.
+ sdelay_large_count = 1;
+ }
+ else
+ {
+ // Players play AGAINST each other. Enemies required.
+ sdelay_large_count = 2;
+ }
+ }
+ }
+
+ float sdelay;
+
+ if (pcount <= sdelay_small_count)
+ sdelay = sdelay_small;
+ else if (pcount >= sdelay_large_count)
+ sdelay = sdelay_large;
+ else // NOTE: this case implies sdelay_large_count > sdelay_small_count.
+ sdelay = sdelay_small + (sdelay_large - sdelay_small) * (pcount - sdelay_small_count) / (sdelay_large_count - sdelay_small_count);
+
+ if(waves)
+ this.respawn_time = ceil((time + sdelay) / waves) * waves;
+ else
+ this.respawn_time = time + sdelay;
+
+ if(sdelay < sdelay_max)
+ this.respawn_time_max = time + sdelay_max;
+ else
+ this.respawn_time_max = this.respawn_time;
+
+ if((sdelay + waves >= 5.0) && (this.respawn_time - time > 1.75))
+ this.respawn_countdown = 10; // first number to count down from is 10
+ else
+ this.respawn_countdown = -1; // do not count down
+
+ if(autocvar_g_forced_respawn)
+ this.respawn_flags = this.respawn_flags | RESPAWN_FORCE;
+}
// LordHavoc: this hack will be removed when proper _pants/_shirt layers are
// added to the model skins
return false;
}
+.int respawn_flags;
+.float respawn_time;
+.float respawn_time_max;
+
+// g_<gametype>_str:
+// If 0, default is used.
+// If <0, 0 is used.
+// Otherwise, g_str (default value) is used.
+// For consistency, negative values there are mapped to zero too.
+#define GAMETYPE_DEFAULTED_SETTING(str) \
+ ((gametype_setting_tmp = cvar(strcat("g_", GetGametype(), "_" #str))), \
+ (gametype_setting_tmp < 0) ? 0 \
+ : (gametype_setting_tmp == 0 || autocvar_g_respawn_delay_forced) ? max(0, autocvar_g_##str) \
+ : gametype_setting_tmp)
+
+void calculate_player_respawn_time(entity this);
+
bool PlayerInList(entity player, string list);
+void ClientData_Touch(entity e);
+
/// \brief Print the string to the client's chat.
/// \param[in] client Client to print to.
/// \param[in] text Text to print.
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#define INDEPENDENT_ATTACK_FINISHED 1
-
// Globals
float g_footsteps, g_grappling_hook;
float currentbots;
float bots_would_leave;
-void UpdateFrags(entity player, int f);
-.int totalfrags;
+.int totalfrags; // NOTE: reused for multiple purposes
// flag set on worldspawn so that the code knows if it is dedicated or not
float server_is_dedicated;
.float count;
//.float cnt2;
-.int respawn_flags;
-.float respawn_time;
-.float respawn_time_max;
.float death_time;
.float fade_time;
.float fade_rate;
-void player_setupanimsformodel(entity this);
-
.string mdl;
.string playermodel;
.float spawnshieldtime;
.float item_spawnshieldtime;
-.entity flagcarried;
-
.int playerid;
.float noalign; // if set to 1, the item or spawnpoint won't be dropped to the floor
float bot_waypoints_for_items;
-.float attack_finished_for[REGISTRY_MAX(Weapons) * MAX_WEAPONSLOTS];
-.float attack_finished_single[MAX_WEAPONSLOTS];
-#if INDEPENDENT_ATTACK_FINISHED
-#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * MAX_WEAPONSLOTS + (slot)]))
-#else
-#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
-#endif
-#define ATTACK_FINISHED(ent, w) ATTACK_FINISHED_FOR(ent, ent.(w).m_weapon.m_id, weaponslot(w))
-
// speedrun: when 1, player auto teleports back when capture timeout happens
.float speedrunning;
float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end);
-float next_pingtime;
-
// autotaunt system
.float cvar_cl_autotaunt;
.float cvar_cl_voice_directional;
.void(entity this) reset; // if set, an entity is reset using this
.void(entity this) reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
-void ClientData_Touch(entity e);
-
//vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons
.bool wasplayer;
Nagger_Init();
- next_pingtime = time + 5;
-
// set up information replies for clients and server to use
maplist_reply = strzone(getmaplist());
lsmaps_reply = strzone(getlsmaps());
#include <common/effects/all.qh>
#include "bot/api.qh"
#include "cheats.qh"
+#include "client.qh"
#include "clientkill.qh"
#include "g_damage.qh"
#include "handicap.qh"
#include "../common/wepent.qh"
#include "weapons/weaponstats.qh"
+#include <server/weapons/weaponsystem.qh>
#include "../common/animdecide.qh"
}
}
-void calculate_player_respawn_time(entity this)
-{
- if(MUTATOR_CALLHOOK(CalculateRespawnTime, this))
- return;
-
- float gametype_setting_tmp;
- float sdelay_max = GAMETYPE_DEFAULTED_SETTING(respawn_delay_max);
- float sdelay_small = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small);
- float sdelay_large = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large);
- float sdelay_small_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small_count);
- float sdelay_large_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large_count);
- float waves = GAMETYPE_DEFAULTED_SETTING(respawn_waves);
-
- float pcount = 1; // Include myself whether or not team is already set right and I'm a "player".
- if (teamplay)
- {
- FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
- if(it.team == this.team)
- ++pcount;
- });
- if (sdelay_small_count == 0)
- sdelay_small_count = 1;
- if (sdelay_large_count == 0)
- sdelay_large_count = 1;
- }
- else
- {
- FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
- ++pcount;
- });
- if (sdelay_small_count == 0)
- {
- if (IS_INDEPENDENT_PLAYER(this))
- {
- // Players play independently. No point in requiring enemies.
- sdelay_small_count = 1;
- }
- else
- {
- // Players play AGAINST each other. Enemies required.
- sdelay_small_count = 2;
- }
- }
- if (sdelay_large_count == 0)
- {
- if (IS_INDEPENDENT_PLAYER(this))
- {
- // Players play independently. No point in requiring enemies.
- sdelay_large_count = 1;
- }
- else
- {
- // Players play AGAINST each other. Enemies required.
- sdelay_large_count = 2;
- }
- }
- }
-
- float sdelay;
-
- if (pcount <= sdelay_small_count)
- sdelay = sdelay_small;
- else if (pcount >= sdelay_large_count)
- sdelay = sdelay_large;
- else // NOTE: this case implies sdelay_large_count > sdelay_small_count.
- sdelay = sdelay_small + (sdelay_large - sdelay_small) * (pcount - sdelay_small_count) / (sdelay_large_count - sdelay_small_count);
-
- if(waves)
- this.respawn_time = ceil((time + sdelay) / waves) * waves;
- else
- this.respawn_time = time + sdelay;
-
- if(sdelay < sdelay_max)
- this.respawn_time_max = time + sdelay_max;
- else
- this.respawn_time_max = this.respawn_time;
-
- if((sdelay + waves >= 5.0) && (this.respawn_time - time > 1.75))
- this.respawn_countdown = 10; // first number to count down from is 10
- else
- this.respawn_countdown = -1; // do not count down
-
- if(autocvar_g_forced_respawn)
- this.respawn_flags = this.respawn_flags | RESPAWN_FORCE;
-}
-
void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
{
vector v;
void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force);
-// g_<gametype>_str:
-// If 0, default is used.
-// If <0, 0 is used.
-// Otherwise, g_str (default value) is used.
-// For consistency, negative values there are mapped to zero too.
-#define GAMETYPE_DEFAULTED_SETTING(str) \
- ((gametype_setting_tmp = cvar(strcat("g_", GetGametype(), "_" #str))), \
- (gametype_setting_tmp < 0) ? 0 \
- : (gametype_setting_tmp == 0 || autocvar_g_respawn_delay_forced) ? max(0, autocvar_g_##str) \
- : gametype_setting_tmp)
-
-void calculate_player_respawn_time(entity this);
-
void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force);
bool PlayerHeal(entity targ, entity inflictor, float amount, float limit);
#include <server/miscfunctions.qh>
+#define INDEPENDENT_ATTACK_FINISHED 1
+
// there is 2 weapon tics that can run in one server frame
const int W_TICSPERFRAME = 2;
.int old_clip_load;
.int clip_size;
+.float attack_finished_for[REGISTRY_MAX(Weapons) * MAX_WEAPONSLOTS];
+.float attack_finished_single[MAX_WEAPONSLOTS];
+#if INDEPENDENT_ATTACK_FINISHED
+#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * MAX_WEAPONSLOTS + (slot)]))
+#else
+#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
+#endif
+#define ATTACK_FINISHED(ent, w) ATTACK_FINISHED_FOR(ent, ent.(w).m_weapon.m_id, weaponslot(w))
+
void CL_SpawnWeaponentity(entity e, .entity weaponentity);
void w_clear(Weapon thiswep, entity actor, .entity weaponentity, int fire);