Gamemodes:
- Madness now fully reimplemented - Standard and Stealth hunting now finished - New gamemode Invasion, where scientists work together to kill off all players (WIP) Major thanks to @eukara for his help, time, and patienece
This commit is contained in:
parent
9c5339e262
commit
4aca5e6540
3 changed files with 76 additions and 44 deletions
|
@ -63,6 +63,7 @@ class SHTeamRules:HLGameRules
|
|||
|
||||
class SHRules:HLGameRules
|
||||
{
|
||||
void(void) SHRules;
|
||||
virtual void(void) RegisterSciDeath;
|
||||
};
|
||||
|
||||
|
@ -124,5 +125,17 @@ typedef enum
|
|||
SHMODE_INVASION
|
||||
} shmode_e;
|
||||
|
||||
/* give our gamemode cvar a default */
|
||||
var shmode_e autocvar_sh_realistic = SHMODE_SLAUGHTER;
|
||||
var shmode_e g_chosen_mode;
|
||||
|
||||
/* limit the amount of scientists that can spawn by default */
|
||||
var int autocvar_sh_scimax = 5;
|
||||
|
||||
var int autocvar_sh_scialert = FALSE;
|
||||
|
||||
/* default speed for scientists */
|
||||
var int autocvar_sh_scispeed = 40;
|
||||
|
||||
/* an override for sh_scimax */
|
||||
var int autocvarsh_scimax_override = 0;
|
|
@ -81,6 +81,7 @@ HLGameRules::PlayerDeath(NSClientPlayer pl)
|
|||
pl.gflags &= ~GF_FLASHLIGHT;
|
||||
pl.gflags &= ~GF_EGONBEAM;
|
||||
pl.gflags &= ~GF_MADNESS;
|
||||
pl.poisonTimer.StopTimer();
|
||||
|
||||
sh_pl.sh_insaneactive = 0.0f;
|
||||
|
||||
|
@ -372,6 +373,24 @@ HLGameRules::InitPostEnts(void)
|
|||
void
|
||||
HLGameRules::HLGameRules(void)
|
||||
{
|
||||
/* HACK we'll set this here for now to ensure we don't
|
||||
* have a race condition */
|
||||
forceinfokey(world, "sci_count", "0");
|
||||
|
||||
/* if the previous map set this value but the current doesn't
|
||||
* then set the default */
|
||||
cvar_set("sh_scispeed","40");
|
||||
|
||||
/* just re-read this to prevent funny beahviour */
|
||||
readcmd(sprintf("exec maps/%s.cfg\n", mapname));
|
||||
|
||||
/* always broadcast how many max scientists the server has set
|
||||
* but allow an override for server admins */
|
||||
if (cvar("sh_scimax_override") > 0) {
|
||||
forceinfokey(world, "sv_scimax", cvar_string("sh_scimax_override"));
|
||||
} else {
|
||||
forceinfokey(world, "sv_scimax", cvar_string("sh_scimax"));
|
||||
}
|
||||
}
|
||||
|
||||
/* TEAMPLAY ONLY LOGIC */
|
||||
|
@ -393,6 +412,8 @@ SHTeamRules::PlayerSpawn(NSClientPlayer cl)
|
|||
if (cl.team != 0)
|
||||
return;
|
||||
|
||||
/* auto-balance
|
||||
* TODO make this a command instead */
|
||||
for (entity e = world; (e = find( e, ::classname, "player"));) {
|
||||
if (e == cl)
|
||||
continue;
|
||||
|
@ -422,18 +443,6 @@ SHTeamRules::ScientistKill(NSClientPlayer cl, entity sci)
|
|||
AddTeam1Kill();
|
||||
}
|
||||
|
||||
void
|
||||
SHTeamRules::ScientistKillFear(NSClientPlayer cl, entity sci)
|
||||
{
|
||||
super::ScientistKill(cl, sci);
|
||||
|
||||
if (cl.team == 2)
|
||||
RemoveTeam2Kill();
|
||||
else if (cl.team == 1)
|
||||
AddTeam1Kill();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SHTeamRules::AddTeam1Kill(void)
|
||||
{
|
||||
|
@ -448,30 +457,17 @@ SHTeamRules::AddTeam2Kill(void)
|
|||
forceinfokey(world, "teamkills_2", sprintf("%i", m_iKillsTeam2));
|
||||
}
|
||||
|
||||
/* teamplay scientist death tracking */
|
||||
void
|
||||
SHTeamRules::RemoveTeam1Kill(void)
|
||||
{
|
||||
m_iKillsTeam1--;
|
||||
forceinfokey(world, "teamkills_1", sprintf("%i", m_iKillsTeam1));
|
||||
}
|
||||
|
||||
void
|
||||
SHTeamRules::RemoveTeam2Kill(void)
|
||||
{
|
||||
m_iKillsTeam2--;
|
||||
forceinfokey(world, "teamkills_2", sprintf("%i", m_iKillsTeam2));
|
||||
}
|
||||
|
||||
void
|
||||
SHTeamRules::RegisterSciDeathHuntTeam(void)
|
||||
SHTeamRules::RegisterSciDeath(void)
|
||||
{
|
||||
super::RegisterSciDeath();
|
||||
|
||||
/* if no scientists are left then stop */
|
||||
if (m_iScientistsAlive > 0)
|
||||
return;
|
||||
|
||||
switch (g_chosen_mode) {
|
||||
case SHMODE_STANDARD:
|
||||
/* award the kill to the appropiate team */
|
||||
if (m_iKillsTeam1 > m_iKillsTeam2) {
|
||||
m_iScoreTeam1++;
|
||||
env_message_broadcast("Red team has won!");
|
||||
|
@ -486,8 +482,6 @@ SHTeamRules::RegisterSciDeathHuntTeam(void)
|
|||
forceinfokey(world, "teamscore_2", sprintf("%i", m_iScoreTeam2));
|
||||
think = RestartRound;
|
||||
nextthink = time + 5.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -519,3 +513,25 @@ SHTeamRules::SHTeamRules(void)
|
|||
m_iKillsTeam1 = 0;
|
||||
m_iKillsTeam2 = 0;
|
||||
}
|
||||
|
||||
/* invasion scientist death tracking */
|
||||
void
|
||||
SHRules::RegisterSciDeath(void)
|
||||
{
|
||||
super::RegisterSciDeath();
|
||||
|
||||
/* if no scientists are left then we win */
|
||||
if (m_iScientistsAlive > 0)
|
||||
return;
|
||||
|
||||
env_message_broadcast("You have survived!\nCan you do it again?");
|
||||
|
||||
think = RestartRound;
|
||||
nextthink = time + 5.0f;
|
||||
}
|
||||
|
||||
void
|
||||
SHRules::SHRules(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -35,6 +35,9 @@ Game_InitRules(void)
|
|||
case SHMODE_MADNESS:
|
||||
g_grMode = spawn(SHGameMadness);
|
||||
break;
|
||||
case SHMODE_INVASION:
|
||||
g_grMode = spawn(SHGameInvasion);
|
||||
break;
|
||||
default:
|
||||
g_grMode = spawn(HLGameRules);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue