SERVER: Fix Revive sequence continuing when in Last Stand

This commit is contained in:
cypress 2023-11-08 09:13:24 -05:00
parent a19658ec9e
commit 88c08e24b4
2 changed files with 50 additions and 57 deletions

View file

@ -117,24 +117,16 @@ void() startspectate =
// Returns 1 if there IS someone in the world that's not downed // Returns 1 if there IS someone in the world that's not downed
float() PollPlayersAlive = float() PollPlayersAlive =
{ {
float i, gotalive; entity players = find(world, classname, "player");
entity playerent;
gotalive = 0; while(players != world) {
if (!players.downed)
return 1;
for (i = 1; i <= 4; i++) players = find(players, classname, "player");
{
playerent = findfloat(world, playernum, i);
if (playerent) {
if (!playerent.downed && !playerent.isspec) {
gotalive = 1;
break;
}
}
} }
return gotalive; return 0;
} }
// Endgamesetup -- think function for setting up the death of everyone // Endgamesetup -- think function for setting up the death of everyone

View file

@ -1797,7 +1797,43 @@ void() CheckPlayer =
self.changestance = false; self.changestance = false;
} }
/* Check player push start */ if (!self.button2 && self.flags & FL_ONGROUND) {
if (self.dive) {
if (self.perks & P_FLOP && fabs(self.oldz - self.origin_z) >= 64) {
sound (self, CHAN_WEAPON, "sounds/weapons/grenade/explode.wav", 1, ATTN_NORM);
DamgageExplode (self, self, 5000, 1000, 300);
#ifdef FTE
te_customflash(self.origin, 300, 300, '1 0.6 0.1');
#endif // FTE
CallExplosion(self.origin);
CallExplosion(self.origin);
CallExplosion(self.origin);
}
self.dive = 0;
}
if (fabs(self.oldz - self.origin_z) + 64 > 176 && !(self.perks & P_FLOP)) {
float height = fabs(self.oldz - self.origin_z) + 64;
float damage = height*(0.68);
if (damage > 98) damage = 98;
DamageHandler (self, other, damage, S_ZOMBIE);
if (self.health <= 5)
GiveAchievement(7, self);
}
self.oldz = self.origin_z;
}
//
// Revive Sequence
//
#ifdef FTE #ifdef FTE
entity ent; entity ent;
@ -1805,7 +1841,7 @@ void() CheckPlayer =
while(ent) while(ent)
{ {
if(ent.classname == "player" && ent != self && ent.downed && !self.downed) if(ent.classname == "player" && ent != self && ent.downed)
{ {
// perform a trace to make sure they're always facing the revivee // perform a trace to make sure they're always facing the revivee
@ -1815,10 +1851,10 @@ void() CheckPlayer =
traceline(source, source + v_forward*50, 0, self); traceline(source, source + v_forward*50, 0, self);
self.active_door = trace_ent; self.active_door = trace_ent;
if (ent.beingrevived == false && self.active_door == ent) if (ent.beingrevived == false && self.active_door == ent && !self.downed)
useprint (self, 13, 0, 0); useprint (self, 13, 0, 0);
if (self.button7 && !ent.invoke_revive && self.active_door == ent) { if (self.button7 && !ent.invoke_revive && self.active_door == ent && !self.downed) {
if (ent.beingrevived == true && ent.firer != self) if (ent.beingrevived == true && ent.firer != self)
return; return;
@ -1856,7 +1892,7 @@ void() CheckPlayer =
addmoney(self, ent.requirespower, false); addmoney(self, ent.requirespower, false);
} }
} }
else if ((!self.button7 && self.reviving) || (self.reviving && self.active_door != ent) || ent.classname == "disconnected") { else if (self.downed || (!self.button7 && self.reviving) || (self.reviving && self.active_door != ent) || ent.classname == "disconnected") {
if (ent.classname != "disconnected") if (ent.classname != "disconnected")
ChangeReviveIconState(ent.electro_targeted, 1); ChangeReviveIconState(ent.electro_targeted, 1);
else else
@ -1886,41 +1922,6 @@ void() CheckPlayer =
#endif // FTE #endif // FTE
/* Check for player push end */
if (!self.button2 && self.flags & FL_ONGROUND) {
if (self.dive) {
if (self.perks & P_FLOP && fabs(self.oldz - self.origin_z) >= 64) {
sound (self, CHAN_WEAPON, "sounds/weapons/grenade/explode.wav", 1, ATTN_NORM);
DamgageExplode (self, self, 5000, 1000, 300);
#ifdef FTE
te_customflash(self.origin, 300, 300, '1 0.6 0.1');
#endif // FTE
CallExplosion(self.origin);
CallExplosion(self.origin);
CallExplosion(self.origin);
}
self.dive = 0;
}
if (fabs(self.oldz - self.origin_z) + 64 > 176 && !(self.perks & P_FLOP)) {
float height = fabs(self.oldz - self.origin_z) + 64;
float damage = height*(0.68);
if (damage > 98) damage = 98;
DamageHandler (self, other, damage, S_ZOMBIE);
if (self.health <= 5)
GiveAchievement(7, self);
}
self.oldz = self.origin_z;
}
} }
void () Weapon_Logic = void () Weapon_Logic =