Skip to content

Commit c63aaf9

Browse files
committed
Add nemesis mode + 'convar'
1 parent 1ec0f18 commit c63aaf9

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

cfg/cs2fixes/cs2fixes.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ zr_knockback_scale 5.0 // Global knockback scale
8787
zr_ztele_max_distance 150.0 // Maximum distance players are allowed to move after starting ztele
8888
zr_ztele_allow_humans 0 // Whether to allow humans to use ztele
8989
zr_infect_spawn_type 1 // Type of Mother Zombies Spawn [0 = MZ spawn where they stand, 1 = MZ get teleported back to spawn on being picked]
90+
zr_nemesis_mode 0 // Whether to enable Nemesis mode (CTs die but do not swap teams when stabbed)
9091
zr_infect_spawn_time_min 15 // Minimum time in which Mother Zombies should be picked, after round start
9192
zr_infect_spawn_time_max 15 // Maximum time in which Mother Zombies should be picked, after round start
9293
zr_infect_spawn_mz_ratio 7 // Ratio of all Players to Mother Zombies to be spawned at round start

src/zombiereborn.cpp

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,19 @@ void ZR_RespawnAll()
879879
}
880880
}
881881

882+
static bool g_bNemesisMode = false;
883+
CON_COMMAND_F(zr_nemesis_mode, "Whether to enable Nemesis mode (CTs die but do not swap teams when stabbed)", FCVAR_LINKED_CONCOMMAND | FCVAR_SPONLY)
884+
{
885+
if (args.ArgC() < 2)
886+
{
887+
Msg("zr_nemesis_mode %b\n", g_bNemesisMode);
888+
return;
889+
}
890+
g_bNemesisMode = V_StringToBool(args[1], false);
891+
if (g_bEnableZR && !g_bNemesisMode && g_bRespawnEnabled)
892+
ZR_RespawnAll(); // Respawn all dead CTs that hadn't swapped teams
893+
}
894+
882895
void ToggleRespawn(bool force = false, bool value = false)
883896
{
884897
if ((!force && !g_bRespawnEnabled) || (force && value))
@@ -969,7 +982,7 @@ void ZR_OnRoundStart(IGameEvent* pEvent)
969982
void ZR_OnPlayerSpawn(CCSPlayerController* pController)
970983
{
971984
// delay infection a bit
972-
bool bInfect = g_ZRRoundState == EZRRoundState::POST_INFECTION;
985+
bool bInfect = g_ZRRoundState == EZRRoundState::POST_INFECTION && (!g_bNemesisMode || pController->m_iTeamNum == CS_TEAM_T);
973986

974987
// We're infecting this guy with a delay, disable all damage as they have 100 hp until then
975988
// also set team immediately in case the spawn teleport is team filtered
@@ -1369,7 +1382,10 @@ bool ZR_Hook_OnTakeDamage_Alive(CTakeDamageInfo *pInfo, CCSPlayerPawn *pVictimPa
13691382
const char *pszAbilityClass = pInfo->m_hAbility.Get() ? pInfo->m_hAbility.Get()->GetClassname() : "";
13701383
if (pAttackerPawn->m_iTeamNum() == CS_TEAM_T && pVictimPawn->m_iTeamNum() == CS_TEAM_CT && !V_strncmp(pszAbilityClass, "weapon_knife", 12))
13711384
{
1372-
ZR_Infect(pAttackerController, pVictimController, false);
1385+
if (g_bNemesisMode)
1386+
pVictimPawn->m_iHealth(0);
1387+
else
1388+
ZR_Infect(pAttackerController, pVictimController, false);
13731389
return true; // nullify the damage
13741390
}
13751391

@@ -1527,7 +1543,8 @@ void ZR_OnPlayerDeath(IGameEvent* pEvent)
15271543
new CTimer(g_flRespawnDelay < 0.0f ? 2.0f : g_flRespawnDelay, false, false, [handle]()
15281544
{
15291545
CCSPlayerController* pController = (CCSPlayerController*)handle.Get();
1530-
if (!pController || !g_bRespawnEnabled || pController->m_iTeamNum < CS_TEAM_T)
1546+
if (!pController || !g_bRespawnEnabled || pController->m_iTeamNum < CS_TEAM_T ||
1547+
(g_bNemesisMode && pController->m_iTeamNum == CS_TEAM_CT && g_ZRRoundState == EZRRoundState::POST_INFECTION))
15311548
return -1.0f;
15321549
pController->Respawn();
15331550
return -1.0f;
@@ -1572,6 +1589,10 @@ bool ZR_CheckTeamWinConditions(int iTeamNum)
15721589
if (g_ZRRoundState == EZRRoundState::ROUND_END || (iTeamNum == CS_TEAM_CT && g_bRespawnEnabled) || (iTeamNum != CS_TEAM_T && iTeamNum != CS_TEAM_CT))
15731590
return false;
15741591

1592+
ConVar* cvar = g_pCVar->GetConVar(g_pCVar->FindConVar("mp_respawn_on_death_ct"));
1593+
if (iTeamNum == CS_TEAM_T && g_bNemesisMode && *(bool*)&cvar->values)
1594+
return false;
1595+
15751596
// check the opposite team
15761597
if (ZR_IsTeamAlive(iTeamNum == CS_TEAM_CT ? CS_TEAM_T : CS_TEAM_CT))
15771598
return false;

0 commit comments

Comments
 (0)