mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-22 03:41:15 +00:00
SERVER: Enable Soft_Restart for FTE, add command for it, clean Power-Ups
Use qc_soft_restart in FTE to see it.
This commit is contained in:
parent
1498f61986
commit
f69ab208f7
6 changed files with 225 additions and 154 deletions
|
@ -10,6 +10,7 @@
|
|||
../source/server/rounds.qc
|
||||
../source/server/nzdparser.qc
|
||||
../source/server/main.qc
|
||||
../source/server/utilities/game_restart.qc
|
||||
../source/server/utilities/command_parser.qc
|
||||
../source/server/utilities/math.qc
|
||||
../source/server/player.qc
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
../source/server/dummies.qc
|
||||
../source/server/rounds.qc
|
||||
../source/server/nzdparser.qc
|
||||
../source/server/main.qc
|
||||
../source/server/main.qc
|
||||
../source/server/utilities/game_restart.qc
|
||||
../source/server/utilities/command_parser.qc
|
||||
../source/server/utilities/math.qc
|
||||
../source/server/player.qc
|
||||
|
|
|
@ -365,14 +365,6 @@ void() item_barricade =
|
|||
setsize(self, '-20 -20 -64', '20 20 16');
|
||||
setorigin(self, self.origin);
|
||||
spawn_boxes();
|
||||
|
||||
#ifndef FTE
|
||||
|
||||
windows[wincnt] = self;
|
||||
wincnt++;
|
||||
|
||||
#endif // FTE
|
||||
|
||||
};
|
||||
|
||||
void() item_cover = {item_barricade();};
|
||||
|
|
|
@ -26,12 +26,8 @@
|
|||
*/
|
||||
|
||||
void() Do_Zombie_A = {};
|
||||
void() func_door_nzp;
|
||||
void() mystery_box;
|
||||
|
||||
entity windows[32];
|
||||
float wincnt;
|
||||
|
||||
void () CL_SendWeaponFire =
|
||||
{
|
||||
float return_time;
|
||||
|
@ -50,138 +46,4 @@ void () CL_SendWeaponFire =
|
|||
self.recoil_delay = 60/return_time + time;
|
||||
}
|
||||
|
||||
void() ParseClientCommand = {SV_ParseClientCommand(CMD_STRING);}
|
||||
void() PutClientInServer;
|
||||
void() InitRounds;
|
||||
|
||||
//moto -- put this here because it keeps soft_restart somewhat clean..
|
||||
void(entity door) reclose_door = {
|
||||
entity oldself;
|
||||
oldself = self;
|
||||
|
||||
self = door;
|
||||
setmodel(self, self.oldmodel);
|
||||
self.solid = SOLID_BSP;
|
||||
setorigin(self, self.oldorigin);
|
||||
self.isopen = 0;
|
||||
func_door_nzp();
|
||||
|
||||
//Close_Waypoint(self.wayTarget);
|
||||
|
||||
self = oldself;
|
||||
}
|
||||
|
||||
void() Soft_Restart = {
|
||||
entity who, oldself, doors, box, revive, endgame;
|
||||
self = find(world,classname,"player");
|
||||
oldself = self;
|
||||
|
||||
//remove all zombies
|
||||
who = find(world,classname,"ai_zombie");
|
||||
while(who != world)
|
||||
{
|
||||
if(who.health)
|
||||
{
|
||||
self = who;
|
||||
self.th_die();
|
||||
|
||||
// hide bodies
|
||||
setmodel(self, "");
|
||||
if (self.head)
|
||||
setmodel(self.head, "");
|
||||
if (self.larm)
|
||||
setmodel(self.larm, "");
|
||||
if (self.rarm)
|
||||
setmodel(self.rarm, "");
|
||||
|
||||
self = oldself;
|
||||
}
|
||||
|
||||
who = find(who,classname,"ai_zombie");
|
||||
}
|
||||
|
||||
//repair all windows
|
||||
for(float i = 0; i < wincnt; i++) {
|
||||
if (windows[i].health != -10) {
|
||||
windows[i].health = 6;
|
||||
windows[i].frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//close doors
|
||||
doors = findfloat(world, isopen, 1);
|
||||
while (doors) {
|
||||
if (doors.isopen)
|
||||
reclose_door(doors);
|
||||
doors = findfloat(world, isopen, 1);
|
||||
}
|
||||
|
||||
//revert mystery box
|
||||
box = find(world, classname, "mystery");
|
||||
if (box) {
|
||||
box.boxstatus = 0;
|
||||
box.frame = 0;
|
||||
box.goaldummy.frame = 0;
|
||||
boxCount = 0;
|
||||
box.origin = boxOrigin;
|
||||
//self = box;
|
||||
|
||||
if (box.boxweapon)
|
||||
remove(box.boxweapon);
|
||||
|
||||
//mystery_box();
|
||||
//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) {
|
||||
endgame.activated = false;
|
||||
}
|
||||
|
||||
//reset teleporters
|
||||
local entity tp;
|
||||
tp = find(world, classname, "func_teleporter_entrance");
|
||||
|
||||
if (tp) {
|
||||
tp.activated = false;
|
||||
tp.isLinked = false;
|
||||
tp.cooldown = false;
|
||||
tp.waitLink = false;
|
||||
tp.think = SUB_Null;
|
||||
}
|
||||
|
||||
local entity power;
|
||||
power = find(world, classname, "power_switch");
|
||||
if(power) {
|
||||
isPowerOn = false;
|
||||
power.frame = 0;
|
||||
}
|
||||
|
||||
self = oldself;
|
||||
self.downed = 0;
|
||||
self.progress_bar = 0;
|
||||
self.progress_bar_time = 0;
|
||||
self.progress_bar_percent = 0;
|
||||
game_over = false;
|
||||
rounds = 0;
|
||||
self.score = 0;
|
||||
self.points = 0;
|
||||
self.secondaryweapon = 0;
|
||||
|
||||
// naievil -- clear betty
|
||||
self.secondary_grenades = 0;
|
||||
self.grenades = 1;
|
||||
self.pri_grenade_state = 0;
|
||||
|
||||
InitRounds();
|
||||
self.isspec = false;
|
||||
PutClientInServer();
|
||||
}
|
||||
void() ParseClientCommand = {SV_ParseClientCommand(CMD_STRING);}
|
|
@ -5,7 +5,7 @@
|
|||
commands, and a table storing command information. Modeled after
|
||||
pr_cmds.
|
||||
|
||||
Copyright (C) 2021-2022 NZ:P Team
|
||||
Copyright (C) 2021-2023 NZ:P Team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
|
@ -27,9 +27,6 @@
|
|||
|
||||
*/
|
||||
|
||||
// Needed to iterate through all of the command table.
|
||||
#define NUMBER_OF_COMMANDS 2
|
||||
|
||||
// Success/Failure return codes
|
||||
#define COMMAND_SUCCESS 0
|
||||
#define COMMAND_FAILURE 1
|
||||
|
@ -105,6 +102,18 @@ float(string params) Command_addmoney =
|
|||
return COMMAND_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Command_softrestart()
|
||||
// Executes the Soft_Restart QuakeC function.
|
||||
// Useful for debugging its functionality.
|
||||
//
|
||||
float(string params) Command_softrestart =
|
||||
{
|
||||
Soft_Restart();
|
||||
|
||||
return COMMAND_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Server command table
|
||||
// command_name : Command string entered into developer console.
|
||||
|
@ -121,7 +130,8 @@ var struct {
|
|||
string command_description;
|
||||
} server_commands[] = {
|
||||
{"addmoney", Command_addmoney, true, "Usage: addmoney <point_value>\n Gives `point_value` amount of points to the client who requested it.\n"},
|
||||
{"give", Command_give, true, "Usage: give <weapon number>\n Gives `weapon` of index.\n"}
|
||||
{"give", Command_give, true, "Usage: give <weapon number>\n Gives `weapon` of index.\n"},
|
||||
{"qc_soft_restart", Command_softrestart, false, "Executes the Soft_Restart QuakeC function. Useful for debugging its functionality.\n"}
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -151,7 +161,7 @@ void(string command_string) SV_ParseClientCommand =
|
|||
}
|
||||
|
||||
// Now iterate over our commands
|
||||
for (float i = 0; i < NUMBER_OF_COMMANDS; i++) {
|
||||
for (float i = 0; i < server_commands.length; i++) {
|
||||
// Command names match
|
||||
if (command == server_commands[i].command_name) {
|
||||
// Override Client Commands
|
||||
|
|
205
source/server/utilities/game_restart.qc
Normal file
205
source/server/utilities/game_restart.qc
Normal file
|
@ -0,0 +1,205 @@
|
|||
/*
|
||||
server/utilities/game_restart.qc
|
||||
|
||||
A utility for re-starting the game without going through the
|
||||
server unload procedure.
|
||||
|
||||
Copyright (C) 2021-2023 NZ:P Team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
|
||||
void() PutClientInServer;
|
||||
void() InitRounds;
|
||||
void() func_door_nzp;
|
||||
|
||||
//
|
||||
// GameRestart_CleanPowerUps()
|
||||
// Cleans Power-Ups thrown about on the map,
|
||||
// as well as a sanity check for their state.
|
||||
//
|
||||
void() GameRestart_CleanPowerUps =
|
||||
{
|
||||
entity tempe;
|
||||
|
||||
// Delete lingering PU entities
|
||||
tempe = find(world, classname, "item_powerup");
|
||||
while(tempe != world) {
|
||||
// Kill their sounds
|
||||
sound(tempe.owner, CHAN_VOICE, "sounds/null.wav", 1, ATTN_NORM);
|
||||
sound(tempe, CHAN_AUTO, "sounds/null.wav", 1, ATTN_NONE);
|
||||
|
||||
// Delete em
|
||||
remove(tempe.owner); // Sparkle
|
||||
remove(tempe);
|
||||
|
||||
// Iterate to the next
|
||||
tempe = find(tempe, classname, "item_powerup");
|
||||
}
|
||||
|
||||
// Turn off HUD icons
|
||||
tempe = find(world, classname, "player");
|
||||
while (tempe != world) {
|
||||
tempe.insta_icon = false;
|
||||
tempe.x2_icon = false;
|
||||
tempe = find(tempe, classname, "player");
|
||||
}
|
||||
|
||||
// They're finished, stop doing the effects.
|
||||
instakill_finished = time;
|
||||
x2_finished = time;
|
||||
}
|
||||
|
||||
//moto -- put this here because it keeps soft_restart somewhat clean..
|
||||
void(entity door) reclose_door = {
|
||||
entity oldself;
|
||||
oldself = self;
|
||||
|
||||
self = door;
|
||||
setmodel(self, self.oldmodel);
|
||||
self.solid = SOLID_BSP;
|
||||
setorigin(self, self.oldorigin);
|
||||
self.isopen = 0;
|
||||
func_door_nzp();
|
||||
|
||||
//Close_Waypoint(self.wayTarget);
|
||||
|
||||
self = oldself;
|
||||
}
|
||||
|
||||
void() Soft_Restart = {
|
||||
entity who, oldself, doors, box, revive, endgame, barricades;
|
||||
self = find(world,classname,"player");
|
||||
oldself = self;
|
||||
|
||||
//remove all zombies
|
||||
who = find(world,classname,"ai_zombie");
|
||||
while(who != world)
|
||||
{
|
||||
if(who.health)
|
||||
{
|
||||
self = who;
|
||||
self.th_die();
|
||||
|
||||
// hide bodies
|
||||
setmodel(self, "");
|
||||
if (self.head)
|
||||
setmodel(self.head, "");
|
||||
if (self.larm)
|
||||
setmodel(self.larm, "");
|
||||
if (self.rarm)
|
||||
setmodel(self.rarm, "");
|
||||
|
||||
self = oldself;
|
||||
}
|
||||
|
||||
who = find(who,classname,"ai_zombie");
|
||||
}
|
||||
|
||||
GameRestart_CleanPowerUps();
|
||||
|
||||
//repair all windows
|
||||
barricades = find(world, classname, "item_barricade");
|
||||
while(barricades != world) {
|
||||
if (barricades.health != -10) {
|
||||
barricades.health = 6;
|
||||
barricades.frame = 0;
|
||||
}
|
||||
|
||||
barricades = find(barricades, classname, "item_barricade");
|
||||
}
|
||||
|
||||
//close doors
|
||||
doors = findfloat(world, isopen, 1);
|
||||
while (doors) {
|
||||
if (doors.isopen)
|
||||
reclose_door(doors);
|
||||
doors = findfloat(world, isopen, 1);
|
||||
}
|
||||
|
||||
//revert mystery box
|
||||
box = find(world, classname, "mystery");
|
||||
if (box) {
|
||||
box.boxstatus = 0;
|
||||
box.frame = 0;
|
||||
box.goaldummy.frame = 0;
|
||||
boxCount = 0;
|
||||
box.origin = boxOrigin;
|
||||
//self = box;
|
||||
|
||||
if (box.boxweapon)
|
||||
remove(box.boxweapon);
|
||||
|
||||
//mystery_box();
|
||||
//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) {
|
||||
endgame.activated = false;
|
||||
}
|
||||
|
||||
//reset teleporters
|
||||
local entity tp;
|
||||
tp = find(world, classname, "func_teleporter_entrance");
|
||||
|
||||
if (tp) {
|
||||
tp.activated = false;
|
||||
tp.isLinked = false;
|
||||
tp.cooldown = false;
|
||||
tp.waitLink = false;
|
||||
tp.think = SUB_Null;
|
||||
}
|
||||
|
||||
local entity power;
|
||||
power = find(world, classname, "power_switch");
|
||||
if(power) {
|
||||
isPowerOn = false;
|
||||
power.frame = 0;
|
||||
}
|
||||
|
||||
self = oldself;
|
||||
self.downed = 0;
|
||||
self.progress_bar = 0;
|
||||
self.progress_bar_time = 0;
|
||||
self.progress_bar_percent = 0;
|
||||
game_over = false;
|
||||
rounds = 0;
|
||||
self.score = 0;
|
||||
self.points = 0;
|
||||
self.secondaryweapon = 0;
|
||||
|
||||
// naievil -- clear betty
|
||||
self.secondary_grenades = 0;
|
||||
self.grenades = 1;
|
||||
self.pri_grenade_state = 0;
|
||||
|
||||
InitRounds();
|
||||
self.isspec = false;
|
||||
PutClientInServer();
|
||||
}
|
Loading…
Reference in a new issue