From 63ee6ffc0aba5f6dd7300fa5c542141d1a7440ab Mon Sep 17 00:00:00 2001 From: drjaska Date: Sun, 7 Nov 2021 04:14:28 +0200 Subject: [PATCH] update cvar to autocvar in SetStartItems hookfunction --- .../gamemodes/gamemode/mayhem/sv_mayhem.qc | 25 +++++++++++++------ .../gamemodes/gamemode/tmayhem/sv_tmayhem.qc | 25 ++++++++++++------- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc b/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc index 36f1159fd..2f8f33716 100644 --- a/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc +++ b/qcsrc/common/gamemodes/gamemode/mayhem/sv_mayhem.qc @@ -6,6 +6,15 @@ bool autocvar_g_mayhem_powerups; bool autocvar_g_mayhem_selfdamage; int autocvar_g_mayhem_scoringmethod; +float autocvar_g_mayhem_start_health = 200; +float autocvar_g_mayhem_start_armor = 200; +float autocvar_g_mayhem_start_ammo_shells = 60; +float autocvar_g_mayhem_start_ammo_nails = 320; +float autocvar_g_mayhem_start_ammo_rockets = 180; +float autocvar_g_mayhem_start_ammo_cells = 180; +float autocvar_g_mayhem_start_ammo_plasma = 180; +float autocvar_g_mayhem_start_ammo_fuel = 0; + void mayhem_DelayedInit(entity this) { return; @@ -30,14 +39,14 @@ MUTATOR_HOOKFUNCTION(mayhem, Scores_CountFragsRemaining) MUTATOR_HOOKFUNCTION(mayhem, SetStartItems) { start_items &= ~(IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS); - start_health = warmup_start_health = cvar("g_mayhem_start_health"); - start_armorvalue = warmup_start_armorvalue = cvar("g_mayhem_start_armor"); - start_ammo_shells = warmup_start_ammo_shells = cvar("g_mayhem_start_ammo_shells"); - start_ammo_nails = warmup_start_ammo_nails = cvar("g_mayhem_start_ammo_nails"); - start_ammo_rockets = warmup_start_ammo_rockets = cvar("g_mayhem_start_ammo_rockets"); - start_ammo_cells = warmup_start_ammo_cells = cvar("g_mayhem_start_ammo_cells"); - start_ammo_plasma = warmup_start_ammo_plasma = cvar("g_mayhem_start_ammo_plasma"); - start_ammo_fuel = warmup_start_ammo_fuel = cvar("g_mayhem_start_ammo_fuel"); + start_health = warmup_start_health = autocvar_g_mayhem_start_health; + start_armorvalue = warmup_start_armorvalue = autocvar_g_mayhem_start_armor; + start_ammo_shells = warmup_start_ammo_shells = autocvar_g_mayhem_start_ammo_shells; + start_ammo_nails = warmup_start_ammo_nails = autocvar_g_mayhem_start_ammo_nails; + start_ammo_rockets = warmup_start_ammo_rockets = autocvar_g_mayhem_start_ammo_rockets; + start_ammo_cells = warmup_start_ammo_cells = autocvar_g_mayhem_start_ammo_cells; + start_ammo_plasma = warmup_start_ammo_plasma = autocvar_g_mayhem_start_ammo_plasma; + start_ammo_fuel = warmup_start_ammo_fuel = autocvar_g_mayhem_start_ammo_fuel; } //this hook also enables rotting, as players spawn with more hp and armor than what default rot limits are set to this is a bad idea as of now diff --git a/qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc b/qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc index 805199d27..69f2b0b55 100644 --- a/qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc +++ b/qcsrc/common/gamemodes/gamemode/tmayhem/sv_tmayhem.qc @@ -10,7 +10,14 @@ bool autocvar_g_tmayhem_powerups; bool autocvar_g_tmayhem_selfdamage; int autocvar_g_tmayhem_scoringmethod; - +float autocvar_g_tmayhem_start_health = 200; +float autocvar_g_tmayhem_start_armor = 200; +float autocvar_g_tmayhem_start_ammo_shells = 60; +float autocvar_g_tmayhem_start_ammo_nails = 320; +float autocvar_g_tmayhem_start_ammo_rockets = 180; +float autocvar_g_tmayhem_start_ammo_cells = 180; +float autocvar_g_tmayhem_start_ammo_plasma = 180; +float autocvar_g_tmayhem_start_ammo_fuel = 0; // code from here on is just to support maps that don't have team entities void tmayhem_SpawnTeam (string teamname, int teamcolor) @@ -72,14 +79,14 @@ MUTATOR_HOOKFUNCTION(tmayhem, Scores_CountFragsRemaining) MUTATOR_HOOKFUNCTION(tmayhem, SetStartItems) { start_items &= ~(IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS); - start_health = warmup_start_health = cvar("g_tmayhem_start_health"); - start_armorvalue = warmup_start_armorvalue = cvar("g_tmayhem_start_armor"); - start_ammo_shells = warmup_start_ammo_shells = cvar("g_tmayhem_start_ammo_shells"); - start_ammo_nails = warmup_start_ammo_nails = cvar("g_tmayhem_start_ammo_nails"); - start_ammo_rockets = warmup_start_ammo_rockets = cvar("g_tmayhem_start_ammo_rockets"); - start_ammo_cells = warmup_start_ammo_cells = cvar("g_tmayhem_start_ammo_cells"); - start_ammo_plasma = warmup_start_ammo_plasma = cvar("g_tmayhem_start_ammo_plasma"); - start_ammo_fuel = warmup_start_ammo_fuel = cvar("g_tmayhem_start_ammo_fuel"); + start_health = warmup_start_health = autocvar_g_tmayhem_start_health; + start_armorvalue = warmup_start_armorvalue = autocvar_g_tmayhem_start_armor; + start_ammo_shells = warmup_start_ammo_shells = autocvar_g_tmayhem_start_ammo_shells; + start_ammo_nails = warmup_start_ammo_nails = autocvar_g_tmayhem_start_ammo_nails; + start_ammo_rockets = warmup_start_ammo_rockets = autocvar_g_tmayhem_start_ammo_rockets; + start_ammo_cells = warmup_start_ammo_cells = autocvar_g_tmayhem_start_ammo_cells; + start_ammo_plasma = warmup_start_ammo_plasma = autocvar_g_tmayhem_start_ammo_plasma; + start_ammo_fuel = warmup_start_ammo_fuel = autocvar_g_tmayhem_start_ammo_fuel; } //this hook also enables rotting, as players spawn with more hp and armor than what default rot limits are set to this is a bad idea as of now -- 2.39.2