SERVER: Fix Soft_Restart not reverting Perk-a-Cola state

This commit is contained in:
Steam Deck User 2023-03-18 15:46:52 -04:00
parent d98cdbdc51
commit 7b1df5578b
2 changed files with 75 additions and 8 deletions

View file

@ -479,6 +479,9 @@ void() perk_revive =
precache_sound("sounds/weapons/papfire.wav");
precache_extra(W_BIATCH);
setorigin(self, self.origin);
self.oldorigin = self.origin;
self.finalangle = self.angles;
self.door_model_name = self.model;
setmodel(self, self.model);
setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.classname = "perk_revive";
@ -541,6 +544,9 @@ void() perk_flopper =
if (self.aistatus) { precache_sound(self.aistatus); }
if (self.powerup_vo) { precache_sound(self.powerup_vo); }
setorigin(self, self.origin);
self.oldorigin = self.origin;
self.finalangle = self.angles;
self.door_model_name = self.model;
setmodel(self, self.model);
setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.classname = "perk_flopper";
@ -603,6 +609,9 @@ void() perk_juggernog =
if (self.aistatus) { precache_sound(self.aistatus); }
if (self.powerup_vo) { precache_sound(self.powerup_vo); }
setorigin(self, self.origin);
self.oldorigin = self.origin;
self.finalangle = self.angles;
self.door_model_name = self.model;
setmodel(self, self.model);
setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.classname = "perk_juggernog";
@ -665,6 +674,9 @@ void() perk_staminup =
if (self.aistatus) { precache_sound(self.aistatus); }
if (self.powerup_vo) { precache_sound(self.powerup_vo); }
setorigin(self, self.origin);
self.oldorigin = self.origin;
self.finalangle = self.angles;
self.door_model_name = self.model;
setmodel(self, self.model);
setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.classname = "perk_staminup";
@ -727,6 +739,9 @@ void() perk_speed =
if (self.aistatus) { precache_sound(self.aistatus); }
if (self.powerup_vo) { precache_sound(self.powerup_vo); }
setorigin(self, self.origin);
self.oldorigin = self.origin;
self.finalangle = self.angles;
self.door_model_name = self.model;
setmodel(self, self.model);
setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.classname = "perk_speed";
@ -789,6 +804,9 @@ void() perk_double =
if (self.aistatus) { precache_sound(self.aistatus); }
if (self.powerup_vo) { precache_sound(self.powerup_vo); }
setorigin(self, self.origin);
self.oldorigin = self.origin;
self.finalangle = self.angles;
self.door_model_name = self.model;
setmodel(self, self.model);
setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.classname = "perk_double";
@ -850,6 +868,9 @@ void() perk_deadshot =
precache_model(self.weapon2model);
precache_sound(self.oldmodel);
setorigin(self, self.origin);
self.oldorigin = self.origin;
self.finalangle = self.angles;
self.door_model_name = self.model;
if (self.aistatus) { precache_sound(self.aistatus); }
if (self.powerup_vo) { precache_sound(self.powerup_vo); }
setmodel(self, self.model);
@ -916,6 +937,9 @@ void() perk_mule =
if (self.aistatus) { precache_sound(self.aistatus); }
if (self.powerup_vo) { precache_sound(self.powerup_vo); }
setorigin(self, self.origin);
self.oldorigin = self.origin;
self.finalangle = self.angles;
self.door_model_name = self.model;
setmodel(self, self.model);
setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX);
self.classname = "perk_mule";

View file

@ -29,6 +29,9 @@
void() PutClientInServer;
void() InitRounds;
void() func_door_nzp;
void(entity e) Light_None;
void() setup_perk;
void() touch_perk;
//
// GameRestart_CleanPowerUps()
@ -109,6 +112,52 @@ void() GameRestart_RepairBarricades =
}
}
//
// GameRestart_TurnPerkOff()
// Wrapper for turning off Perk lights.
//
void(string perk_classname) GameRestart_TurnPerkOff =
{
entity tempe;
tempe = find(world, classname, perk_classname);
while(tempe != world) {
setmodel(tempe, tempe.door_model_name);
setorigin(tempe, tempe.oldorigin);
Light_None(tempe);
tempe.velocity = '0 0 0';
tempe.angles = tempe.finalangle;
tempe.touch = touch_perk;
tempe.revivesoda = 0;
// Run our initial setup function
tempe.think = setup_perk;
tempe.nextthink = time + 0.1;
tempe = find(tempe, classname, perk_classname);
}
}
//
// GameRestart_ResetPerkaColas()
// Make sure Perk-a-Colas are in their
// right states.
//
void() GameRestart_ResetPerkaColas =
{
// Go on a reset spree!
GameRestart_TurnPerkOff("perk_revive"); // Quick Revive
GameRestart_TurnPerkOff("perk_juggernog"); // Jugger-Nog
GameRestart_TurnPerkOff("perk_speed"); // Speed Cola
GameRestart_TurnPerkOff("perk_double"); // Double Tap Root Beer
GameRestart_TurnPerkOff("perk_flopper"); // PhD Flopper
GameRestart_TurnPerkOff("perk_staminup"); // Stamin-Up
GameRestart_TurnPerkOff("perk_deadshot"); // Deadshot Daiquiri
GameRestart_TurnPerkOff("perk_mule"); // Mule Kick
}
//moto -- put this here because it keeps soft_restart somewhat clean..
void(entity door) reclose_door = {
entity oldself;
@ -127,7 +176,7 @@ void(entity door) reclose_door = {
}
void() Soft_Restart = {
entity who, oldself, doors, box, revive, endgame;
entity who, oldself, doors, box, endgame;
self = find(world,classname,"player");
oldself = self;
@ -158,6 +207,7 @@ void() Soft_Restart = {
GameRestart_CleanPowerUps(); // Get rid of any Power-Ups that were spawned and left.
GameRestart_CleanWallSummons(); // Delete residual wall weapon spawns from our last game.
GameRestart_RepairBarricades(); // Make sure all barricades are fully repaired.
GameRestart_ResetPerkaColas(); // Turn all of the Perk-a-Cola lights off, reset states.
//close doors
doors = findfloat(world, isopen, 1);
@ -184,13 +234,6 @@ void() Soft_Restart = {
//self = oldself;
}
//reset quick revive
revive = find(world, classname, "perk_revive");
if (revive) {
setmodel(revive, revive.model);
oldself.revivesoda = 0;
}
//reset buyable ending
endgame = find(world, classname, "func_ending");
if (endgame) {