From ff051cab8ec3d8bbf032d481de23de794f3d0fcc Mon Sep 17 00:00:00 2001 From: pierow Date: Sun, 20 Aug 2023 17:35:45 -0400 Subject: [PATCH] add mp_randomresfromkill --- main/source/dlls/game.cpp | 3 +++ main/source/mod/AvHGamerules.cpp | 9 +++++++++ main/source/mod/AvHServerVariables.h | 2 ++ 3 files changed, 14 insertions(+) diff --git a/main/source/dlls/game.cpp b/main/source/dlls/game.cpp index 9e45fa25..c1871548 100644 --- a/main/source/dlls/game.cpp +++ b/main/source/dlls/game.cpp @@ -125,6 +125,8 @@ cvar_t avh_jumpmode = {kvJumpMode, "1", FCVAR_SERVER}; cvar_t avh_version = {kvVersion, "330", FCVAR_SERVER}; //playtest cvars cvar_t avh_fastjp = {kvfastjp, "0", FCVAR_SERVER}; +cvar_t avh_randomrfk = {kvRandomRfk, "1", FCVAR_SERVER}; + #ifdef DEBUG cvar_t avh_testing = {kvTesting, "0", FCVAR_SERVER}; #endif @@ -238,6 +240,7 @@ void GameDLLInit( void ) CVAR_REGISTER (&avh_version); //playtest cvars CVAR_REGISTER (&avh_fastjp); + CVAR_REGISTER (&avh_randomrfk); // TODO: Remove CVAR_REGISTER (&avh_ironman); diff --git a/main/source/mod/AvHGamerules.cpp b/main/source/mod/AvHGamerules.cpp index 7762d1dd..0b05c287 100644 --- a/main/source/mod/AvHGamerules.cpp +++ b/main/source/mod/AvHGamerules.cpp @@ -340,6 +340,7 @@ AvHGamerules::AvHGamerules() : mTeamA(TEAM_ONE), mTeamB(TEAM_TWO) RegisterServerVariable(&avh_version); //playtest cvars RegisterServerVariable(&avh_fastjp); + RegisterServerVariable(&avh_randomrfk); g_VoiceGameMgr.Init(&gVoiceHelper, gpGlobals->maxClients); @@ -509,9 +510,17 @@ void AvHGamerules::RewardPlayerForKill(AvHPlayer* inPlayer, CBaseEntity* inTarge if(!this->GetIsCombatMode()) { int theResourceValue = 0; + + if (avh_randomrfk.value == 0) + { + theResourceValue = 2; + } + else + { int theMin = BALANCE_VAR(kKillRewardMin); int theMax = BALANCE_VAR(kKillRewardMax); theResourceValue = RANDOM_LONG(theMin, theMax); + } if(theResourceValue > 0) { diff --git a/main/source/mod/AvHServerVariables.h b/main/source/mod/AvHServerVariables.h index 795d8980..c8dd035e 100644 --- a/main/source/mod/AvHServerVariables.h +++ b/main/source/mod/AvHServerVariables.h @@ -98,6 +98,7 @@ extern cvar_t *showtriggers; extern cvar_t avh_version; //playtest cvars extern cvar_t avh_fastjp; +extern cvar_t avh_randomrfk; char *ns_cvar_string(const cvar_t *cvar); int ns_cvar_int(const cvar_t *cvar); @@ -149,4 +150,5 @@ float ns_cvar_float(const cvar_t *cvar); #define kvVersion "sv_nsversion" //playtest cvars #define kvfastjp "sv_fastjp" +#define kvRandomRfk "mp_randomresfromkill" #endif