From 1b857498e7161c37460027237c1f90be890c9abc Mon Sep 17 00:00:00 2001 From: terencehill Date: Thu, 27 May 2021 18:15:29 +0200 Subject: [PATCH] Prevent negative damage by correctly bounding g_spawnshield_blockdamage. Also whitelist g_spawnshield_blockdamage as an allowed server setting --- qcsrc/server/player.qc | 2 +- qcsrc/server/world.qc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 4ad0d7936..0a7dd86cb 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -249,7 +249,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, damage = 0; } else if (time < this.spawnshieldtime && autocvar_g_spawnshield_blockdamage < 1) - damage *= 1 - max(0, autocvar_g_spawnshield_blockdamage); + damage *= 1 - bound(0, autocvar_g_spawnshield_blockdamage, 1); if(deathtype & HITTYPE_SOUND) // sound based attacks cause bleeding from the ears { diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index 1165bd303..cfbc0caf7 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -462,7 +462,7 @@ void cvar_changes_init() BADCVAR("g_player_brightness"); BADCVAR("g_rocket_flying"); BADCVAR("g_rocket_flying_disabledelays"); - BADCVAR("g_spawnshieldtime"); + BADPREFIX("g_spawnshield"); BADCVAR("g_start_delay"); BADCVAR("g_superspectate"); BADCVAR("g_tdm_teams_override"); -- 2.39.2