MUTATOR_CALLHOOK(MakePlayerObserver);
Portal_ClearAll(self);
-
+
if(self.alivetime)
{
if(!warmup_stage)
}
if(self.vehicle)
- vehicles_exit(VHEF_RELESE);
+ vehicles_exit(VHEF_RELESE);
WaypointSprite_PlayerDead();
- if not(g_ca) // don't reset teams when moving a ca player to the spectators
+ if (!g_ca) // don't reset teams when moving a ca player to the spectators
self.team = -1; // move this as it is needed to log the player spectating in eventlog
if(self.killcount != -666)
accuracy_resend(self);
self.spectatortime = time;
-
+
self.classname = "observer";
self.iscreature = FALSE;
self.teleportable = TELEPORT_SIMPLE;
n = tokenize_console(defaultmodel);
if(n > 0)
+ {
defaultmodel = argv(floor(n * self.model_randomizer));
+ // However, do NOT randomize if the player-selected model is in the list.
+ for (i = 0; i < n; ++i)
+ if ((argv(i) == self.playermodel && defaultskin == stof(self.playerskin)) || argv(i) == strcat(self.playermodel, ":", self.playerskin))
+ defaultmodel = argv(i);
+ }
i = strstrofs(defaultmodel, ":", 0);
if(i >= 0)
RemoveGrapplingHook(self); // Wazat's Grappling Hook
+ if(self.vehicle)
+ vehicles_exit(VHEF_RELESE);
+
self.classname = "player";
self.wasplayer = TRUE;
self.iscreature = TRUE;
self.ammo_fuel = warmup_start_ammo_fuel;
self.health = warmup_start_health;
self.armorvalue = warmup_start_armorvalue;
- self.weapons = warmup_start_weapons;
+ self.weapons = WARMUP_START_WEAPONS;
}
else
{
self.event_damage = PlayerDamage;
self.bot_attack = TRUE;
+ self.monster_attack = TRUE;
+
+ self.spider_slowness = 0;
self.statdraintime = time + 5;
self.BUTTON_ATCK = self.BUTTON_JUMP = self.BUTTON_ATCK2 = 0;
//stuffcmd(self, "chase_active 0");
//stuffcmd(self, "set viewsize $tmpviewsize \n");
-
+
target_voicescript_clear(self);
// reset fields the weapons may use
if(!self.killindicator_teamchange)
{
self.vehicle_health = -1;
- Damage(self, self, self, 1 , DEATH_KILL, self.origin, '0 0 0');
+ Damage(self, self, self, 1 , DEATH_KILL, self.origin, '0 0 0');
}
}
if(gameover) return;
if(self.player_blocked) return;
if(self.freezetag_frozen) return;
-
+
ClientKill_TeamChange(0);
}
string s;
// NOTE: we do NOT check crypto_keyfp here, an unsigned ID is fine too for this
- if not(p.crypto_idfp)
+ if (!p.crypto_idfp)
return 0;
// this function allows abbreviated player IDs too!
{
Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
}
+
+ if(IS_SPEC(self) || IS_OBSERVER(self))
+ if(autocvar_g_chat_nospectators == 1 || (!(warmup_stage || gameover) && autocvar_g_chat_nospectators == 2))
+ Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_CHAT_NOSPECTATORS);
self.jointime = time;
self.allowed_timeouts = autocvar_sv_timeout_number;
if(self.vehicle)
vehicles_exit(VHEF_RELESE);
- if not(IS_CLIENT(self))
+ if (!IS_CLIENT(self))
{
print("Warning: ClientDisconnect without ClientConnect\n");
return;
if(autocvar_sv_eventlog)
GameLogEcho(strcat(":part:", ftos(self.playerid)));
-
+
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_DISCONNECT, self.netname);
MUTATOR_CALLHOOK(ClientDisconnect);
Fire_ApplyDamage(self);
Fire_ApplyEffect(self);
- if not(g_minstagib)
+ if (!g_minstagib)
{
if (self.items & IT_STRENGTH)
{
self.superweapons_finished = 0;
}
}
-
+
if(autocvar_g_nodepthtestplayers)
self.effects = self.effects | EF_NODEPTHTEST;
void player_regen (void)
{
- float minh, mina, minf, maxh, maxa, maxf, limith, limita, limitf, max_mod, regen_mod, rot_mod, limit_mod;
- maxh = autocvar_g_balance_health_rotstable;
- maxa = autocvar_g_balance_armor_rotstable;
- maxf = autocvar_g_balance_fuel_rotstable;
- minh = autocvar_g_balance_health_regenstable;
- mina = autocvar_g_balance_armor_regenstable;
- minf = autocvar_g_balance_fuel_regenstable;
- limith = autocvar_g_balance_health_limit;
- limita = autocvar_g_balance_armor_limit;
- limitf = autocvar_g_balance_fuel_limit;
-
- max_mod = regen_mod = rot_mod = limit_mod = 1;
-
- maxh = maxh * max_mod;
- //maxa = maxa * max_mod;
- //maxf = maxf * max_mod;
- minh = minh * max_mod;
- //mina = mina * max_mod;
- //minf = minf * max_mod;
- limith = limith * limit_mod;
- limita = limita * limit_mod;
- //limitf = limitf * limit_mod;
-
- if(g_ca)
- rot_mod = 0;
-
- if (!g_minstagib && !g_ca && (!g_lms || autocvar_g_lms_regenerate))
+ if(!MUTATOR_CALLHOOK(PlayerRegen))
{
+ float minh, mina, maxh, maxa, limith, limita, max_mod, regen_mod, rot_mod, limit_mod;
+ maxh = autocvar_g_balance_health_rotstable;
+ maxa = autocvar_g_balance_armor_rotstable;
+ minh = autocvar_g_balance_health_regenstable;
+ mina = autocvar_g_balance_armor_regenstable;
+ limith = autocvar_g_balance_health_limit;
+ limita = autocvar_g_balance_armor_limit;
+
+ max_mod = regen_mod = rot_mod = limit_mod = 1;
+
+ maxh = maxh * max_mod;
+ minh = minh * max_mod;
+ limith = limith * limit_mod;
+ limita = limita * limit_mod;
+
self.armorvalue = CalcRotRegen(self.armorvalue, mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, regen_mod * frametime * (time > self.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear, rot_mod * frametime * (time > self.pauserotarmor_finished), limita);
self.health = CalcRotRegen(self.health, minh, autocvar_g_balance_health_regen, autocvar_g_balance_health_regenlinear, regen_mod * frametime * (time > self.pauseregen_finished), maxh, autocvar_g_balance_health_rot, autocvar_g_balance_health_rotlinear, rot_mod * frametime * (time > self.pauserothealth_finished), limith);
-
- // if player rotted to death... die!
- if(self.health < 1)
- self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0');
}
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
- self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, regen_mod * frametime * (time > self.pauseregen_finished) * ((self.items & IT_FUEL_REGEN) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, rot_mod * frametime * (time > self.pauserotfuel_finished), limitf);
+ // if player rotted to death... die!
+ // check this outside above checks, as player may still be able to rot to death
+ if(self.health < 1)
+ self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0');
+
+ if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ {
+ float minf, maxf, limitf;
+
+ maxf = autocvar_g_balance_fuel_rotstable;
+ minf = autocvar_g_balance_fuel_regenstable;
+ limitf = autocvar_g_balance_fuel_limit;
+
+ self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & IT_FUEL_REGEN) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf);
+ }
}
float zoomstate_set;
setorigin(self, spectatee.origin);
setsize(self, spectatee.mins, spectatee.maxs);
SetZoomState(spectatee.zoomstate);
-
+
anticheat_spectatecopy(spectatee);
self.hud = spectatee.hud;
if(spectatee.vehicle)
self.vehicle_reload2 = spectatee.vehicle_reload2;
msg_entity = self;
-
+
WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
WriteAngle(MSG_ONE, spectatee.v_angle_x);
WriteAngle(MSG_ONE, spectatee.v_angle_y);
WriteAngle(MSG_ONE, spectatee.v_angle_z);
//WriteByte (MSG_ONE, SVC_SETVIEW);
- // WriteEntity(MSG_ONE, self);
+ // WriteEntity(MSG_ONE, self);
//makevectors(spectatee.v_angle);
- //setorigin(self, spectatee.origin - v_forward * 400 + v_up * 300);*/
+ //setorigin(self, spectatee.origin - v_forward * 400 + v_up * 300);*/
}
}
float SpectateUpdate() {
if(!self.enemy)
- return 0;
+ return 0;
if (self == self.enemy)
return 0;
- if not(IS_PLAYER(self.enemy))
+ if (!IS_PLAYER(self.enemy))
return 0;
SpectateCopy(self.enemy);
if (start.team == self.team) {
return start;
}
-
+
other = start;
// continue from current player
while(other && other.team != self.team) {
other = find(other, classname, "player");
}
-
+
if (!other) {
// restart from begining
other = find(other, classname, "player");
other = find(other, classname, "player");
}
}
-
+
return other;
}
{
// NOTE: chain order is from the highest to the lower entnum (unlike find)
other = findchain(classname, "player");
- if not(other) // no player
+ if (!other) // no player
return FALSE;
entity first = other;
do { other = other.chain; }
while(other && other.team != self.team);
- if not(other)
+ if (!other)
{
other = first;
while(other.team != self.team)
{
if(self.BUTTON_INFO) // BUTTON_INFO hides initial MOTD
self.motd_actived_time = -2; // wait until BUTTON_INFO gets released
- else if(self.motd_actived_time == -2 || IS_PLAYER(self) || time - self.jointime > autocvar_welcome_message_time)
+ else if(self.motd_actived_time == -2 || IS_PLAYER(self))
{
// instanctly hide MOTD
self.motd_actived_time = 0;
void PlayerUseKey()
{
- if not(IS_PLAYER(self))
+ if (!IS_PLAYER(self))
return;
if(self.vehicle)
vehicles_exit(VHEF_NORMAL);
return;
}
-
+
// a use key was pressed; call handlers
MUTATOR_CALLHOOK(PlayerUseKey);
}
if(frametime)
player_anim();
button_pressed = (self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE);
-
+
if (self.deadflag == DEAD_DYING)
{
- if(self.respawn_flags & RESPAWN_FORCE)
+ if((self.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max)
self.deadflag = DEAD_RESPAWNING;
else if(!button_pressed)
self.deadflag = DEAD_DEAD;
{
if(button_pressed)
self.deadflag = DEAD_RESPAWNABLE;
+ else if(time >= self.respawn_time_max && (self.respawn_flags & RESPAWN_FORCE))
+ self.deadflag = DEAD_RESPAWNING;
}
else if (self.deadflag == DEAD_RESPAWNABLE)
{
if(time > self.respawn_time)
{
self.respawn_time = time + 1; // only retry once a second
+ self.respawn_time_max = self.respawn_time;
respawn();
}
}
if(self.respawn_flags & RESPAWN_SILENT)
self.stat_respawn_time = 0;
+ else if((self.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
+ self.stat_respawn_time = self.respawn_time_max;
else
self.stat_respawn_time = self.respawn_time;
}
if(frametime)
player_anim();
-
+
// secret status
secrets_setstatus();
-
+
+ // monsters status
+ monsters_setstatus();
+
self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
//self.angles_y=self.v_angle_y + 90; // temp
return; // intermission or finale
GetPressedKeys();
}
-
+
#ifdef TETRIS
}
#endif
if((g_cts || g_race) && self.cvar_cl_allow_uidtracking == 1 && self.cvar_cl_allow_uid2name == 1)
{
- if not(self.stored_netname)
+ if (!self.stored_netname)
self.stored_netname = strzone(uid2name(self.crypto_idfp));
if(self.stored_netname != self.netname)
{
/*
if(g_race)
- dprint(sprintf("%f %.6f\n", time, race_GetFractionalLapCount(self)));
+ dprintf("%f %.6f\n", time, race_GetFractionalLapCount(self));
*/
CSQCMODEL_AUTOUPDATE();