mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-26 05:41:20 +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"))
|
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
|
//remove (self.owner.trigger_field); //moto - what does this do lol
|
||||||
if (!(self.spawnflags & 128))
|
if (!(self.spawnflags & 128)) {
|
||||||
setmodel(self, "");
|
setmodel(self, "");
|
||||||
|
self.solid = SOLID_NOT;
|
||||||
|
}
|
||||||
|
|
||||||
self.isopen = 1;
|
self.isopen = 1;
|
||||||
return;//so we dont have to reopen doors
|
return;//so we dont have to reopen doors
|
||||||
|
@ -497,6 +499,10 @@ void() LinkDoors =
|
||||||
|
|
||||||
self = self.owner;
|
self = self.owner;
|
||||||
|
|
||||||
|
// This guards against spawning more than one
|
||||||
|
// trigger field upon restart.
|
||||||
|
if (self.owner.trigger_field)
|
||||||
|
return;
|
||||||
if (self.health)
|
if (self.health)
|
||||||
return;
|
return;
|
||||||
if (self.targetname && self.classname != "door_nzp_cost")
|
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 =
|
void() GameRestart_RestoreFakeRemovals =
|
||||||
{
|
{
|
||||||
entity ent = findfloat(world, entity_removed, true);
|
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 = {
|
// GameRestart_OpenClosedDoors()
|
||||||
entity oldself;
|
// Restores doors that were previously opened in last session.
|
||||||
oldself = self;
|
//
|
||||||
|
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;
|
self = door;
|
||||||
setmodel(self, self.oldmodel);
|
|
||||||
self.solid = SOLID_BSP;
|
|
||||||
setorigin(self, self.oldorigin);
|
|
||||||
self.isopen = 0;
|
|
||||||
func_door_nzp();
|
func_door_nzp();
|
||||||
|
self = temp_ent;
|
||||||
|
|
||||||
//Close_Waypoint(self.wayTarget);
|
door = door.chain;
|
||||||
|
}
|
||||||
self = oldself;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void() Soft_Restart = {
|
void() Soft_Restart = {
|
||||||
entity who, oldself, doors, endgame;
|
entity who, oldself, endgame;
|
||||||
self = find(world,classname,"player");
|
self = find(world,classname,"player");
|
||||||
oldself = self;
|
oldself = self;
|
||||||
|
|
||||||
|
@ -307,14 +320,7 @@ void() Soft_Restart = {
|
||||||
GameRestart_ResetPerkaColas(); // Turn all of the Perk-a-Cola lights off, reset states.
|
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_ResetMysteryBox(); // Clean up the Mystery Box, delete floating weapon, etc.
|
||||||
GameRestart_RestoreFakeRemovals(); // Puts back everything "removed" using Ent_FakeRemove().
|
GameRestart_RestoreFakeRemovals(); // Puts back everything "removed" using Ent_FakeRemove().
|
||||||
|
GameRestart_OpenClosedDoors(); // Restores doors that were previously opened in last session.
|
||||||
//close doors
|
|
||||||
doors = findfloat(world, isopen, 1);
|
|
||||||
while (doors) {
|
|
||||||
if (doors.isopen)
|
|
||||||
reclose_door(doors);
|
|
||||||
doors = findfloat(world, isopen, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//reset buyable ending
|
//reset buyable ending
|
||||||
endgame = find(world, classname, "func_ending");
|
endgame = find(world, classname, "func_ending");
|
||||||
|
|
Loading…
Reference in a new issue