if(self.vehicle)
vehicles_exit(VHEF_RELEASE);
- WaypointSprite_PlayerDead();
+ WaypointSprite_PlayerDead(self);
if(!mutator_returnvalue) // mutator prevents resetting teams
self.team = -1; // move this as it is needed to log the player spectating in eventlog
*/
.float clientkill_nexttime;
-void ClientKill_Now_TeamChange()
-{SELFPARAM();
- if(self.killindicator_teamchange == -1)
+void ClientKill_Now_TeamChange(entity this)
+{
+ if(this.killindicator_teamchange == -1)
{
- JoinBestTeam( self, false, true );
+ JoinBestTeam( this, false, true );
}
- else if(self.killindicator_teamchange == -2)
+ else if(this.killindicator_teamchange == -2)
{
if(blockSpectators)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
- PutObserverInServer();
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
+ WITH(entity, self, this, PutObserverInServer());
}
else
- SV_ChangeTeam(self.killindicator_teamchange - 1);
- self.killindicator_teamchange = 0;
+ WITH(entity, self, this, SV_ChangeTeam(this.killindicator_teamchange - 1));
+ this.killindicator_teamchange = 0;
}
void ClientKill_Now()
self.killindicator = world;
if(self.killindicator_teamchange)
- ClientKill_Now_TeamChange();
+ ClientKill_Now_TeamChange(self);
if(IS_PLAYER(self))
Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0');
if(!self.killindicator)
{
- if(self.deadflag == DEAD_NO)
+ if(!IS_DEAD(self))
{
killtime = max(killtime, self.clientkill_nexttime - time);
self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
}
- if(killtime <= 0 || !IS_PLAYER(self) || self.deadflag != DEAD_NO)
+ if(killtime <= 0 || !IS_PLAYER(self) || IS_DEAD(self))
{
ClientKill_Now();
}
self.killindicator.colormod = Team_ColorRGB(targetteam);
if(IS_REAL_CLIENT(self))
if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, APP_TEAM_NUM_4(targetteam, CENTER_TEAMCHANGE_), self.killindicator.cnt);
+ Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, APP_TEAM_NUM(targetteam, CENTER_TEAMCHANGE), self.killindicator.cnt);
}
}
{SELFPARAM();
if(gameover) return;
if(self.player_blocked) return;
- if(self.frozen) return;
+ if(STAT(FROZEN, self)) return;
ClientKill_TeamChange(0);
}
this.netname_previous = strzone(this.netname);
- Send_Notification(NOTIF_ALL, NULL, MSG_INFO, (teamplay ? APP_TEAM_ENT_4(this, INFO_JOIN_CONNECT_TEAM_) : INFO_JOIN_CONNECT), this.netname);
+ Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && IS_PLAYER(this)) ? APP_TEAM_ENT(this, INFO_JOIN_CONNECT_TEAM) : INFO_JOIN_CONNECT), this.netname);
stuffcmd(this, clientstuff, "\n");
stuffcmd(this, "cl_particles_reloadeffects\n"); // TODO do we still need this?
self.playerid = 0;
ReadyCount();
+ VoteCount(false);
// free cvars
GetCvars(-1);
self.mdl = "";
- if ( !self.owner.deadflag && IS_PLAYER(self.owner) )
+ if ( !IS_DEAD(self.owner) && IS_PLAYER(self.owner) )
{
if ( self.owner.active_minigame )
self.mdl = "models/sprites/minigame_busy.iqm";
SUB_SetFade (self, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
}
- CopyBody(1);
+ CopyBody(self, 1);
self.effects |= EF_NODRAW; // prevent another CopyBody
PutClientInServer();
// add a way to see what the items were BEFORE all of these checks for the mutator hook
int items_prev = self.items;
- if((self.items & IT_USING_JETPACK) && !self.deadflag && !gameover)
+ if((self.items & IT_USING_JETPACK) && !IS_DEAD(self) && !gameover)
self.modelflags |= MF_ROCKET;
else
self.modelflags &= ~MF_ROCKET;
self.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
- if((self.alpha < 0 || self.deadflag) && !self.vehicle) // don't apply the flags if the player is gibbed
+ if((self.alpha < 0 || IS_DEAD(self)) && !self.vehicle) // don't apply the flags if the player is gibbed
return;
Fire_ApplyDamage(self);
regen_health_stable = autocvar_g_balance_health_regenstable;
regen_health_rotstable = autocvar_g_balance_health_rotstable;
if(!MUTATOR_CALLHOOK(PlayerRegen))
- if(!self.frozen)
+ if(!STAT(FROZEN, self))
{
float mina, maxa, limith, limita;
maxa = autocvar_g_balance_armor_rotstable;
if(self.vehicle)
vehicles_exit(VHEF_RELEASE);
if(self.event_damage)
- self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
+ self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
}
if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
self.dmg_inflictor = spectatee.dmg_inflictor;
self.v_angle = spectatee.v_angle;
self.angles = spectatee.v_angle;
- self.frozen = spectatee.frozen;
+ STAT(FROZEN, self) = STAT(FROZEN, spectatee);
self.revive_progress = spectatee.revive_progress;
if(!self.BUTTON_USE)
self.fixangle = true;
bool SpectateNext()
{SELFPARAM();
- other = find(self.enemy, classname, "player");
+ other = find(self.enemy, classname, STR_PLAYER);
if (MUTATOR_CALLHOOK(SpectateNext, self, other))
other = spec_player;
else if (!other)
- other = find(other, classname, "player");
+ other = find(other, classname, STR_PLAYER);
if(other) { SetSpectatee(self, other); }
bool SpectatePrev()
{SELFPARAM();
// NOTE: chain order is from the highest to the lower entnum (unlike find)
- other = findchain(classname, "player");
+ other = findchain(classname, STR_PLAYER);
if (!other) // no player
return false;
void ShowRespawnCountdown()
{SELFPARAM();
float number;
- if(self.deadflag == DEAD_NO) // just respawned?
+ if(!IS_DEAD(self)) // just respawned?
return;
else
{
if(autocvar_g_campaign)
{ campaign_bots_may_start = 1; }
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_PREVENT_JOIN);
+ Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_PREVENT_JOIN);
PutClientInServer();
- if(IS_PLAYER(self)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_JOIN_PLAY, self.netname); }
+ if(IS_PLAYER(self)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname); }
}
else
stuffcmd(self, "menu_showteamselect\n");
self.motd_actived_time = time;
else if ((time - self.motd_actived_time > 2) && IS_PLAYER(self)) { // hide it some seconds after BUTTON_INFO has been released
self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD);
+ Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
}
} else {
if (self.BUTTON_INFO)
self.motd_actived_time = time;
else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD);
+ Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
}
}
}
{
// instanctly hide MOTD
self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD);
+ Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
}
}
}
}
else if(autocvar_g_vehicles_enter)
{
- if(!self.frozen)
- if(self.deadflag == DEAD_NO)
+ if(!STAT(FROZEN, self))
+ if(!IS_DEAD(self))
if(!gameover)
{
entity head, closest_target = world;
while(head) // find the closest acceptable target to enter
{
if(head.vehicle_flags & VHF_ISVEHICLE)
- if(head.deadflag == DEAD_NO)
+ if(!IS_DEAD(head))
if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, self)))
if(head.takedamage != DAMAGE_NO)
{
self.max_armorvalue = 0;
}
- if(self.frozen == 2)
+ if(STAT(FROZEN, self) == 2)
{
self.revive_progress = bound(0, self.revive_progress + frametime * self.revive_speed, 1);
self.health = max(1, self.revive_progress * start_health);
if(self.revive_progress >= 1)
Unfreeze(self);
}
- else if(self.frozen == 3)
+ else if(STAT(FROZEN, self) == 3)
{
self.revive_progress = bound(0, self.revive_progress - frametime * self.revive_speed, 1);
self.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * self.revive_progress );
{
if(self.vehicle)
vehicles_exit(VHEF_RELEASE);
- self.event_damage(self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0');
+ self.event_damage(self, self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0');
}
else if ( self.revive_progress <= 0 )
Unfreeze(self);
if(time > self.last_vehiclecheck)
if(IS_PLAYER(self))
if(!gameover)
- if(!self.frozen)
+ if(!STAT(FROZEN, self))
if(!self.vehicle)
- if(self.deadflag == DEAD_NO)
+ if(!IS_DEAD(self))
{
entity veh;
for(veh = world; (veh = findflags(veh, vehicle_flags, VHF_ISVEHICLE)); )
if(vlen(veh.origin - self.origin) < autocvar_g_vehicles_enter_radius)
- if(veh.deadflag == DEAD_NO)
+ if(!IS_DEAD(veh))
if(veh.takedamage != DAMAGE_NO)
if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, self))
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER);
player_powerups();
}
- if (self.deadflag != DEAD_NO)
+ if (IS_DEAD(self))
{
if(self.personal && g_race_qualifying)
{
do_crouch = 0;
if(self.vehicle)
do_crouch = 0;
- if(self.frozen)
+ if(STAT(FROZEN, self))
do_crouch = 0;
// WEAPONTODO: THIS SHIT NEEDS TO GO EVENTUALLY
secrets_setstatus();
// monsters status
- monsters_setstatus();
+ monsters_setstatus(self);
self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
void DrownPlayer(entity this)
{
- if(this.deadflag != DEAD_NO)
+ if(IS_DEAD(this))
return;
if (this.waterlevel != WATERLEVEL_SUBMERGED)
if(self.idlekick_lasttimeleft)
{
self.idlekick_lasttimeleft = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_IDLING);
+ Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_IDLING);
}
}
else