From 618cda4e04db07178bcf1838d08c9bd5c1350477 Mon Sep 17 00:00:00 2001 From: Steam Deck User Date: Fri, 17 Mar 2023 15:01:32 -0400 Subject: [PATCH] SERVER: Add sv_tracedmgmultiplier --- source/server/defs/custom.qc | 2 ++ source/server/main.qc | 1 + source/server/utilities/command_parser.qc | 29 +++++++++++++++++++++-- source/server/weapons/weapon_core.qc | 6 ++++- 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/source/server/defs/custom.qc b/source/server/defs/custom.qc index 321ad8a..144a38c 100644 --- a/source/server/defs/custom.qc +++ b/source/server/defs/custom.qc @@ -65,6 +65,8 @@ float ach_tracker_barr; float ach_tracker_spin; float ach_tracker_luck; +float global_trace_damage_multiplier; + .float ads_release; .vector oldvelocity; diff --git a/source/server/main.qc b/source/server/main.qc index d9f0060..99e6769 100644 --- a/source/server/main.qc +++ b/source/server/main.qc @@ -34,6 +34,7 @@ void() SUB_Remove = {remove(self);} void() main = { cheats_have_been_activated = false; + global_trace_damage_multiplier = 1; } float ai_delay_time; diff --git a/source/server/utilities/command_parser.qc b/source/server/utilities/command_parser.qc index 890a0bd..9788bc1 100644 --- a/source/server/utilities/command_parser.qc +++ b/source/server/utilities/command_parser.qc @@ -161,6 +161,30 @@ float(string params) Command_noclip = return COMMAND_SUCCESS; } +// +// Command_tracedmgmultiplier() +// Multiplies damage output with weapons that fire Traces. +// +float(string params) Command_tracedmgmultiplier = +{ + // Anti-Cheat in Co-Op. + if (coop && cheats_have_been_activated == false) { + bprint(PRINT_HIGH, "Someone tried to issue sv_tracedmgmultiplier in a Co-Op match. Nice try!\n"); + return COMMAND_FAILURE; + } + + // Grab parameters. + tokenize(params); + float value = stof(argv(0)); + + if (value <= 0) { + bprint(PRINT_HIGH, "Command_tracedmgmultiplier: 0 or less than 0 multiplier not allowed. Failing.\n"); + return COMMAND_FAILURE; + } + + global_trace_damage_multiplier = value; + return COMMAND_SUCCESS; +} // // Server command table @@ -181,7 +205,8 @@ var struct { {"give", Command_give, true, "Usage: give \n Gives `weapon` of index.\n"}, {"qc_soft_restart", Command_softrestart, false, "Executes the Soft_Restart QuakeC function. Useful for debugging its functionality.\n"}, {"god", Command_godmode, false, "Toggles God Mode.\n"}, - {"noclip", Command_noclip, false, "Toggles No Clip.\n"} + {"noclip", Command_noclip, false, "Toggles No Clip.\n"}, + {"sv_tracedmgmultiplier", Command_tracedmgmultiplier, true, "Multiplies damage output with weapons that fire Traces.\n"} }; // @@ -237,4 +262,4 @@ void(string command_string) SV_ParseClientCommand = clientcommand(self, command_string); #endif // FTE -}; \ No newline at end of file +}; diff --git a/source/server/weapons/weapon_core.qc b/source/server/weapons/weapon_core.qc index ab8b259..7f94b2b 100644 --- a/source/server/weapons/weapon_core.qc +++ b/source/server/weapons/weapon_core.qc @@ -1426,7 +1426,11 @@ void(float side) W_Fire = } //get some basic info - damage = getWeaponDamage(self.weapon); + damage = getWeaponDamage(self.weapon); + + if (global_trace_damage_multiplier != 0) + damage *= global_trace_damage_multiplier; + firetype = GetFiretype (self.weapon); if (side == S_RIGHT) { modelname = GetWeaponModel(self.weapon, 0);