}
void Announce(string snd) {
- WriteByte(MSG_ALL, SVC_TEMPENTITY);
- WriteByte(MSG_ALL, TE_CSQC_ANNOUNCE);
- WriteString(MSG_ALL, snd);
+ WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte(MSG_BROADCAST, TE_CSQC_ANNOUNCE);
+ WriteString(MSG_BROADCAST, snd);
}
void AnnounceTo(entity e, string snd) {
else
{
float mindist;
- if (arena_roundbased && !g_ca)
+ if (g_arena && arena_roundbased)
mindist = 800;
else
mindist = 100;
WriteEntity(MSG_ONE, self);
}
+ if(g_lms)
+ {
+ // Only if the player cannot play at all
+ if(PlayerScore_Add(self, SP_LMS_RANK, 0) == 666)
+ self.frags = FRAGS_SPECTATOR;
+ else
+ self.frags = FRAGS_LMS_LOSER;
+ }
+ else if((g_race && g_race_qualifying) || g_cts)
+ {
+ if(PlayerScore_Add(self, SP_RACE_FASTEST, 0))
+ self.frags = FRAGS_LMS_LOSER;
+ else
+ self.frags = FRAGS_SPECTATOR;
+ }
+ else
+ self.frags = FRAGS_SPECTATOR;
+
DropAllRunes(self);
MUTATOR_CALLHOOK(MakePlayerObserver);
minstagib_stop_countdown(self);
Portal_ClearAll(self);
-
+
if(self.alivetime)
{
- PlayerStats_Event(self, PLAYERSTATS_ALIVETIME, time - self.alivetime);
+ if(!inWarmupStage)
+ PlayerStats_Event(self, PLAYERSTATS_ALIVETIME, time - self.alivetime);
self.alivetime = 0;
}
if(self.vehicle)
vehicles_exit(VHEF_RELESE);
- if(self.flagcarried)
- DropFlag(self.flagcarried, world, world);
-
WaypointSprite_PlayerDead();
if not(g_ca) // don't reset teams when moving a ca player to the spectators
self.classname = "observer";
self.iscreature = FALSE;
+ self.teleportable = TELEPORT_SIMPLE;
self.damagedbycontents = FALSE;
self.health = -666;
self.takedamage = DAMAGE_NO;
self.superweapons_finished = 0;
self.pushltime = 0;
self.istypefrag = 0;
- self.think = SUB_Null;
+ self.think = func_null;
self.nextthink = 0;
self.hook_time = 0;
self.runes = 0;
self.punchvector = '0 0 0';
self.oldvelocity = self.velocity;
self.fire_endtime = -1;
-
- if(g_arena)
- {
- if(self.version_mismatch)
- {
- Spawnqueue_Unmark(self);
- Spawnqueue_Remove(self);
- }
- else
- {
- Spawnqueue_Insert(self);
- }
- }
- else if(g_lms)
- {
- // Only if the player cannot play at all
- if(PlayerScore_Add(self, SP_LMS_RANK, 0) == 666)
- self.frags = FRAGS_SPECTATOR;
- else
- self.frags = FRAGS_LMS_LOSER;
- }
- else if(g_ca)
- {
- if(self.caplayer)
- self.frags = FRAGS_LMS_LOSER;
- else
- self.frags = FRAGS_SPECTATOR;
- }
- else
- self.frags = FRAGS_SPECTATOR;
}
.float model_randomizer;
Called when a client spawns in the server
=============
*/
-//void() ctf_playerchanged;
void PutClientInServer (void)
{
if(clienttype(self) == CLIENTTYPE_BOT)
- {
self.classname = "player";
- if(g_ca)
- self.caplayer = 1;
- }
else if(clienttype(self) == CLIENTTYPE_REAL)
{
msg_entity = self;
self.classname = "observer";
}
- if((g_arena && !self.spawned) || (g_ca && !allowed_to_spawn))
- self.classname = "observer";
+ MUTATOR_CALLHOOK(PutClientInServer);
if(gameover)
self.classname = "observer";
- if(self.classname == "player" && (!g_ca || (g_ca && allowed_to_spawn))) {
+ if(self.classname == "player") {
entity spot, oldself;
float j;
self.classname = "player";
self.wasplayer = TRUE;
self.iscreature = TRUE;
+ self.teleportable = TELEPORT_NORMAL;
self.damagedbycontents = TRUE;
self.movetype = MOVETYPE_WALK;
self.solid = SOLID_SLIDEBOX;
self.invincible_finished = 0;
self.pushltime = 0;
// players have no think function
- self.think = SUB_Null;
+ self.think = func_null;
self.nextthink = 0;
self.hook_time = 0;
self.dmg_team = 0;
self.lastteleporttime = time; // prevent insane speeds due to changing origin
self.hud = HUD_NORMAL;
- if(g_arena)
- {
- Spawnqueue_Remove(self);
- Spawnqueue_Mark(self);
- }
- else if(g_ca)
- self.caplayer = 1;
-
self.event_damage = PlayerDamage;
self.bot_attack = TRUE;
self.weaponname = "";
self.switchingweapon = 0;
- if(!self.alivetime)
- self.alivetime = time;
+ if(!inWarmupStage)
+ if(!self.alivetime)
+ self.alivetime = time;
antilag_clear(self);
} else if(self.classname == "observer") {
PutObserverInServer ();
}
-
- //if(g_ctf)
- // ctf_playerchanged();
}
.float ebouncefactor, ebouncestop; // electro's values
void ClientKill (void)
{
- if (gameover)
- return;
+ if(gameover) return;
+ if(g_ca && player_count == 1) return;
+ if(self.player_blocked) return;
+ if(self.freezetag_frozen) return;
- if((g_arena || g_ca) && ((champion && champion.classname == "player" && player_count > 1) || player_count == 1)) // don't allow a kill in this case either
- {
- // do nothing
- }
- else if(self.freezetag_frozen)
- {
- // do nothing
- }
- else
- ClientKill_TeamChange(0);
+ ClientKill_TeamChange(0);
}
void CTS_ClientKill (entity e) // silent version of ClientKill, used when player finishes a CTS run. Useful to prevent cheating by running back to the start line and starting out with more speed
Called when a client connects to the server
=============
*/
-//void ctf_clientconnect();
string ColoredTeamName(float t);
void DecodeLevelParms (void);
//void dom_player_join_team(entity pl);
DecodeLevelParms();
#ifdef WATERMARK
- sprint(self, strcat("^4SVQC Build information: ^1", WATERMARK(), "\n"));
+ sprint(self, strcat("^4SVQC Build information: ^1", WATERMARK, "\n"));
#endif
self.classname = "player_joining";
race_PreSpawnObserver();
- //if(g_domination)
- // dom_player_join_team(self);
-
// identify the right forced team
if(autocvar_g_campaign)
{
else
stuffcmd(self, "set _teams_available 0\n");
- if(g_arena || g_ca)
- {
- self.classname = "observer";
- if(g_arena)
- Spawnqueue_Insert(self);
- }
- /*else if(g_ctf)
- {
- ctf_clientconnect();
- }*/
-
attach_entcs();
bot_relinkplayerlist();
if(!sv_foginterval && world.fog != "")
stuffcmd(self, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
- SoundEntity_Attach(self);
-
if(autocvar_g_hitplots || strstrofs(strcat(" ", autocvar_g_hitplots_individuals, " "), strcat(" ", self.netaddress, " "), 0) >= 0)
{
self.hitplotfh = fopen(strcat("hits-", matchid, "-", self.netaddress, "-", ftos(self.playerid), ".plot"), FILE_WRITE);
else if(autocvar_sv_teamnagger && !(autocvar_bot_vs_human && (c3==-1 && c4==-1)) && !g_ca) // teamnagger is currently bad for ca
send_CSQC_teamnagger();
- if (g_domination)
- set_dom_state(self);
-
CheatInitClient();
if(!autocvar_g_campaign)
CSQCMODEL_AUTOINIT();
self.model_randomizer = random();
-
- if(clienttype(self) != CLIENTTYPE_REAL)
- return;
-
- sv_notice_join();
+
+ if(clienttype(self) == CLIENTTYPE_REAL)
+ sv_notice_join();
+
+ MUTATOR_CALLHOOK(ClientConnect);
}
/*
=============
bprint ("^4",self.netname);
bprint ("^4 disconnected\n");
- SoundEntity_Detach(self);
-
DropAllRunes(self);
MUTATOR_CALLHOOK(ClientDisconnect);
Portal_ClearAll(self);
RemoveGrapplingHook(self);
- if(self.flagcarried)
- DropFlag(self.flagcarried, world, world);
// Here, everything has been done that requires this player to be a client.
bot_relinkplayerlist();
- if(g_arena)
- {
- Spawnqueue_Unmark(self);
- Spawnqueue_Remove(self);
- }
-
accuracy_free(self);
ClientData_Detach();
PlayerScore_Detach(self);
olditems = self.items;
if((self.items & IT_USING_JETPACK) && !self.deadflag)
- {
- SoundEntity_StartSound(self, CH_TRIGGER_SINGLE, "misc/jetpack_fly.wav", VOL_BASE, autocvar_g_jetpack_attenuation);
self.modelflags |= MF_ROCKET;
- }
else
- {
- SoundEntity_StopSound(self, CH_TRIGGER_SINGLE);
self.modelflags &~= MF_ROCKET;
- }
self.effects &~= (EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
limita = limita * limit_mod;
//limitf = limitf * limit_mod;
- if(g_lms && g_ca)
+ if(g_ca)
rot_mod = 0;
if (!g_minstagib && !g_ca && (!g_lms || autocvar_g_lms_regenerate))
self.dmg_inflictor = spectatee.dmg_inflictor;
self.v_angle = spectatee.v_angle;
self.angles = spectatee.v_angle;
+ self.stat_respawn_time = spectatee.stat_respawn_time;
if(!self.BUTTON_USE)
self.fixangle = TRUE;
setorigin(self, spectatee.origin);
self.flags |= FL_CLIENT | FL_NOTARGET;
}
-float ctf_usekey();
void PlayerUseKey()
{
if(self.classname != "player")
}
// a use key was pressed; call handlers
- if(ctf_usekey())
- return;
-
MUTATOR_CALLHOOK(PlayerUseKey);
}
=============
*/
.float usekeypressed;
-void() ctf_setstatus;
void() nexball_setstatus;
.float items_added;
void PlayerPreThink (void)
WarpZone_PlayerPhysics_FixVAngle();
self.stat_game_starttime = game_starttime;
+ self.stat_round_starttime = round_starttime;
self.stat_allow_oldnexbeam = autocvar_g_allow_oldnexbeam;
self.stat_leadlimit = autocvar_leadlimit;
+ self.stat_respawn_time = self.respawn_time;
+
if(frametime)
{
// physics frames: update anticheat stuff
if(frametime)
{
-#ifndef NO_LEGACY_NETWORKING
- self.glowmod = colormapPaletteColor(self.clientcolors & 0x0F, TRUE) * 2;
-#endif
-
if(self.weapon == WEP_NEX && autocvar_g_balance_nex_charge)
{
self.weaponentity_glowmod_x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_animlimit);
}
ShowRespawnCountdown();
}
+
+ // if respawning, invert stat_respawn_time to indicate this, the client translates it
+ if(self.deadflag == DEAD_RESPAWNING && self.stat_respawn_time > 0)
+ self.stat_respawn_time *= -1;
+
return;
}
// FIXME from now on self.deadflag is always 0 (and self.health is never < 1)
self.prevorigin = self.origin;
- if (!self.vehicle)
- if (((self.BUTTON_CROUCH && !self.hook.state) || self.health <= g_bloodloss) && self.animstate_startframe != self.anim_melee_x && !self.freezetag_frozen) // prevent crouching if using melee attack
+ float do_crouch = self.BUTTON_CROUCH;
+ if(self.hook.state)
+ do_crouch = 0;
+ if(self.health <= g_bloodloss)
+ do_crouch = 1;
+ if(self.vehicle)
+ do_crouch = 0;
+ if(self.freezetag_frozen)
+ do_crouch = 0;
+ if(self.weapon == WEP_SHOTGUN && self.weaponentity.wframe == WFRAME_FIRE2 && time < self.weapon_nextthink)
+ do_crouch = 0;
+
+ if (do_crouch)
{
if (!self.crouch)
{
if(frametime)
player_anim();
- if(g_ctf)
- ctf_setstatus();
-
if(g_nexball)
nexball_setstatus();
=============
*/
.float idlekick_lasttimeleft;
-.entity showheadshotbbox;
-void showheadshotbbox_think()
-{
- if(self.owner.showheadshotbbox != self)
- {
- remove(self);
- return;
- }
- self.nextthink = time;
- setorigin(self, self.owner.origin);
- setsize(self, GetHeadshotMins(self.owner), GetHeadshotMaxs(self.owner));
-}
void PlayerPostThink (void)
{
// Savage: Check for nameless players
if (intermission_running)
return; // intermission or finale
GetPressedKeys();
- } else if (self.classname == "observer") {
- //do nothing
- } else if (self.classname == "spectator") {
- //do nothing
}
#ifdef TETRIS
if(self.waypointsprite_attachedforcarrier)
WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent));
- if(self.classname == "player" && self.deadflag == DEAD_NO && autocvar_r_showbboxes)
- {
- if(!self.showheadshotbbox)
- {
- self.showheadshotbbox = spawn();
- self.showheadshotbbox.classname = "headshotbbox";
- self.showheadshotbbox.owner = self;
- self.showheadshotbbox.think = showheadshotbbox_think;
- self.showheadshotbbox.nextthink = time;
- self = self.showheadshotbbox;
- self.think();
- self = self.owner;
- }
- }
- else
- {
- if(self.showheadshotbbox)
- if(self.showheadshotbbox && !wasfreed(self.showheadshotbbox))
- remove(self.showheadshotbbox);
- }
-
playerdemo_write();
if((g_cts || g_race) && self.cvar_cl_allow_uidtracking == 1 && self.cvar_cl_allow_uid2name == 1)
{
- if(!self.stored_netname)
+ if not(self.stored_netname)
self.stored_netname = strzone(uid2name(self.crypto_idfp));
if(self.stored_netname != self.netname)
{