mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-22 11:51:11 +00:00
SERVER: Improve Door restoration via Soft_Restart
This commit is contained in:
parent
e50536924b
commit
cb72f35aa5
2 changed files with 34 additions and 22 deletions
|
@ -103,8 +103,10 @@ void() door_hit_top =
|
|||
if ((self.classname == "door_nzp_cost" || self.classname == "door_nzp" || self.classname == "door_open"))
|
||||
{
|
||||
//remove (self.owner.trigger_field); //moto - what does this do lol
|
||||
if (!(self.spawnflags & 128))
|
||||
if (!(self.spawnflags & 128)) {
|
||||
setmodel(self, "");
|
||||
self.solid = SOLID_NOT;
|
||||
}
|
||||
|
||||
self.isopen = 1;
|
||||
return;//so we dont have to reopen doors
|
||||
|
@ -497,6 +499,10 @@ void() LinkDoors =
|
|||
|
||||
self = self.owner;
|
||||
|
||||
// This guards against spawning more than one
|
||||
// trigger field upon restart.
|
||||
if (self.owner.trigger_field)
|
||||
return;
|
||||
if (self.health)
|
||||
return;
|
||||
if (self.targetname && self.classname != "door_nzp_cost")
|
||||
|
|
|
@ -238,6 +238,10 @@ void() GameRestart_ResetMysteryBox =
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// GameRestart_RestoreFakeRemovals()
|
||||
// Puts back everything "removed" using Ent_FakeRemove().
|
||||
//
|
||||
void() GameRestart_RestoreFakeRemovals =
|
||||
{
|
||||
entity ent = findfloat(world, entity_removed, true);
|
||||
|
@ -255,25 +259,34 @@ void() GameRestart_RestoreFakeRemovals =
|
|||
}
|
||||
}
|
||||
|
||||
//moto -- put this here because it keeps soft_restart somewhat clean..
|
||||
void(entity door) reclose_door = {
|
||||
entity oldself;
|
||||
oldself = self;
|
||||
//
|
||||
// GameRestart_OpenClosedDoors()
|
||||
// Restores doors that were previously opened in last session.
|
||||
//
|
||||
void() GameRestart_OpenClosedDoors =
|
||||
{
|
||||
// Grab every open door.
|
||||
entity door = findfloat(world, isopen, true);
|
||||
entity temp_ent;
|
||||
|
||||
while(door) {
|
||||
setmodel(door, door.oldmodel);
|
||||
door.solid = SOLID_BSP;
|
||||
setorigin(door, door.oldorigin);
|
||||
door.isopen = false;
|
||||
|
||||
// Run the spawn function again.
|
||||
temp_ent = self;
|
||||
self = door;
|
||||
setmodel(self, self.oldmodel);
|
||||
self.solid = SOLID_BSP;
|
||||
setorigin(self, self.oldorigin);
|
||||
self.isopen = 0;
|
||||
func_door_nzp();
|
||||
self = temp_ent;
|
||||
|
||||
//Close_Waypoint(self.wayTarget);
|
||||
|
||||
self = oldself;
|
||||
door = door.chain;
|
||||
}
|
||||
}
|
||||
|
||||
void() Soft_Restart = {
|
||||
entity who, oldself, doors, endgame;
|
||||
entity who, oldself, endgame;
|
||||
self = find(world,classname,"player");
|
||||
oldself = self;
|
||||
|
||||
|
@ -307,14 +320,7 @@ void() Soft_Restart = {
|
|||
GameRestart_ResetPerkaColas(); // Turn all of the Perk-a-Cola lights off, reset states.
|
||||
GameRestart_ResetMysteryBox(); // Clean up the Mystery Box, delete floating weapon, etc.
|
||||
GameRestart_RestoreFakeRemovals(); // Puts back everything "removed" using Ent_FakeRemove().
|
||||
|
||||
//close doors
|
||||
doors = findfloat(world, isopen, 1);
|
||||
while (doors) {
|
||||
if (doors.isopen)
|
||||
reclose_door(doors);
|
||||
doors = findfloat(world, isopen, 1);
|
||||
}
|
||||
GameRestart_OpenClosedDoors(); // Restores doors that were previously opened in last session.
|
||||
|
||||
//reset buyable ending
|
||||
endgame = find(world, classname, "func_ending");
|
||||
|
|
Loading…
Reference in a new issue