add mp_randomresfromkill

This commit is contained in:
pierow 2023-08-20 17:35:45 -04:00
parent c270808c43
commit ff051cab8e
3 changed files with 14 additions and 0 deletions

View file

@ -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);

View file

@ -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)
{

View file

@ -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