From eda8140127e7cc54e13e0250b8eabac66db1d3c9 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Wed, 13 Jul 2022 22:58:58 -0700 Subject: [PATCH] Server: Add stubs for game-mode seperation --- src/server/gamerules.h | 65 +++++++++++++++++++++++++++++++ src/server/gamerules.qc | 13 +++++++ src/server/gamerules_fear.qc | 5 +++ src/server/gamerules_hunt.qc | 5 +++ src/server/gamerules_madness.qc | 5 +++ src/server/gamerules_slaughter.qc | 5 +++ src/server/gamerules_stealth.qc | 5 +++ src/server/progs.src | 6 +++ src/server/server.qc | 20 +++++++++- 9 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 src/server/gamerules_fear.qc create mode 100644 src/server/gamerules_hunt.qc create mode 100644 src/server/gamerules_madness.qc create mode 100644 src/server/gamerules_slaughter.qc create mode 100644 src/server/gamerules_stealth.qc diff --git a/src/server/gamerules.h b/src/server/gamerules.h index 11f3400..a3eda69 100644 --- a/src/server/gamerules.h +++ b/src/server/gamerules.h @@ -38,3 +38,68 @@ class HLGameRules:CGameRules void(void) HLGameRules; }; + +class SHTeamRules:HLGameRules +{ + void(void) SHTeamRules; + + virtual bool(void) IsTeamPlay; +}; + +/* Standard Hunting (0): + Round-based competitive killing where scientists are always running around. Scientists don't respawn. +*/ +class SHGameHunt:SHTeamRules +{ + + void(void) SHGameHunt; +}; + +/* Stealth Hunting (1): + Round-based competitive killing where scientists stand or walk around, but will run in fear if they see the player. Scientists don't respawn. Similar to deer hunting. +*/ +class SHGameStealth:SHTeamRules +{ + + void(void) SHGameStealth; +}; + +/* Traditional Slaughter (2): + Casual killing where scientists treat the player same as in Single Player. Scientists respawn. I suggest we just leave teams out on this one? +*/ +class SHGameSlaughter:HLGameRules +{ + + void(void) SHGameSlaughter; +}; + +/* Live in Fear (3): + Unique round-based gamemode where players have to only kill an evil randomly selected player controlled scientist causing chaos. Those who kill good scientists are punished with lost points. The evil scientist gains one point from every kill (NPC or Players). Scientists respawn. This is the only gamemode where there are no teams. +*/ +class SHGameFear:HLGameRules +{ + + void(void) SHGameFear; +}; + +/* Madness (4): + Unique gamemode where scientists attack themselves and the players. Scientists inject players and NPCs only once with a poison that slowly drains their health to 0. The scientists also play a sound (sh/hide_laugh.wav) when they get a sucessful kill and are still alive. Scientists respawn. We use to have something similar, still in the logic? +*/ +class SHGameMadness:HLGameRules +{ + + void(void) SHGameMadness; +}; + + +typedef enum +{ + SHMODE_STANDARD = 0, + SHMODE_STEALTH, + SHMODE_SLAUGHTER, + SHMODE_LIVEINFEAR, + SHMODE_MADNESS +} shmode_e; + + +var shmode_e autocvar_sv_realistic = SHMODE_SLAUGHTER; diff --git a/src/server/gamerules.qc b/src/server/gamerules.qc index 541aaeb..656bc14 100644 --- a/src/server/gamerules.qc +++ b/src/server/gamerules.qc @@ -336,3 +336,16 @@ HLGameRules::HLGameRules(void) { CGameRules::CGameRules(); } + +/* TEAMPLAY ONLY LOGIC */ +bool +SHTeamRules::IsTeamPlay(void) +{ + return true; +} + +void +SHTeamRules::SHTeamRules(void) +{ + +} diff --git a/src/server/gamerules_fear.qc b/src/server/gamerules_fear.qc new file mode 100644 index 0000000..dcfc442 --- /dev/null +++ b/src/server/gamerules_fear.qc @@ -0,0 +1,5 @@ +void +SHGameFear::SHGameFear(void) +{ + +} \ No newline at end of file diff --git a/src/server/gamerules_hunt.qc b/src/server/gamerules_hunt.qc new file mode 100644 index 0000000..0a8c3f7 --- /dev/null +++ b/src/server/gamerules_hunt.qc @@ -0,0 +1,5 @@ +void +SHGameHunt::SHGameHunt(void) +{ + +} \ No newline at end of file diff --git a/src/server/gamerules_madness.qc b/src/server/gamerules_madness.qc new file mode 100644 index 0000000..38db85c --- /dev/null +++ b/src/server/gamerules_madness.qc @@ -0,0 +1,5 @@ +void +SHGameMadness::SHGameMadness(void) +{ + +} \ No newline at end of file diff --git a/src/server/gamerules_slaughter.qc b/src/server/gamerules_slaughter.qc new file mode 100644 index 0000000..dd82133 --- /dev/null +++ b/src/server/gamerules_slaughter.qc @@ -0,0 +1,5 @@ +void +SHGameSlaughter::SHGameSlaughter(void) +{ + +} \ No newline at end of file diff --git a/src/server/gamerules_stealth.qc b/src/server/gamerules_stealth.qc new file mode 100644 index 0000000..2d383e3 --- /dev/null +++ b/src/server/gamerules_stealth.qc @@ -0,0 +1,5 @@ +void +SHGameStealth::SHGameStealth(void) +{ + +} \ No newline at end of file diff --git a/src/server/progs.src b/src/server/progs.src index 9ee9b67..aa85290 100644 --- a/src/server/progs.src +++ b/src/server/progs.src @@ -72,6 +72,12 @@ monster_scientist.qc shdata_parse.qc gamerules.qc +gamerules_fear.qc +gamerules_hunt.qc +gamerules_madness.qc +gamerules_slaughter.qc +gamerules_stealth.qc + ../../../valve/src/server/client.qc server.qc ../../../base/src/server/damage.qc diff --git a/src/server/server.qc b/src/server/server.qc index 92d32aa..a4bd606 100644 --- a/src/server/server.qc +++ b/src/server/server.qc @@ -17,7 +17,25 @@ void Game_InitRules(void) { - g_grMode = spawn(HLGameRules); + switch (autocvar_sv_realistic) { + case SHMODE_STANDARD: + g_grMode = spawn(SHGameHunt); + break; + case SHMODE_STEALTH: + g_grMode = spawn(SHGameStealth); + break; + case SHMODE_SLAUGHTER: + g_grMode = spawn(SHGameSlaughter); + break; + case SHMODE_LIVEINFEAR: + g_grMode = spawn(SHGameFear); + break; + case SHMODE_MADNESS: + g_grMode = spawn(SHGameMadness); + break; + default: + g_grMode = spawn(HLGameRules); + } } void