Replace magic numbers, Put changes under cvar

This commit is contained in:
tyabus 2019-05-29 16:31:16 +03:00 committed by Alibek Omarov
parent 1f2f268173
commit 873baccceb
4 changed files with 8 additions and 2 deletions

View File

@ -31,6 +31,7 @@ cvar_t friendlyfire = { "mp_friendlyfire","0", FCVAR_SERVER };
cvar_t falldamage = { "mp_falldamage","0", FCVAR_SERVER };
cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER };
cvar_t selfgauss = { "mp_selfgauss", "1", FCVAR_SERVER };
cvar_t chargerfix = { "mp_chargerfix", "0", FCVAR_SERVER };
cvar_t satchelfix = { "mp_satchelfix", "0", FCVAR_SERVER };
cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER };
cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER };
@ -471,6 +472,7 @@ void GameDLLInit( void )
CVAR_REGISTER( &falldamage );
CVAR_REGISTER( &weaponstay );
CVAR_REGISTER( &selfgauss );
CVAR_REGISTER( &chargerfix );
CVAR_REGISTER( &satchelfix );
CVAR_REGISTER( &forcerespawn );
CVAR_REGISTER( &flashlight );

View File

@ -28,6 +28,7 @@ extern cvar_t friendlyfire;
extern cvar_t falldamage;
extern cvar_t weaponstay;
extern cvar_t selfgauss;
extern cvar_t chargerfix;
extern cvar_t satchelfix;
extern cvar_t forcerespawn;
extern cvar_t flashlight;

View File

@ -26,6 +26,8 @@
#include "saverestore.h"
#include "skill.h"
#include "gamerules.h"
#include "weapons.h"
#include "game.h"
class CRecharge : public CBaseToggle
{
@ -116,7 +118,7 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
}
// if the player doesn't have the suit, or there is no juice left, make the deny noise
if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) || ( pActivator->pev->armorvalue == 100 ) )
if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) || ( chargerfix.value ) && ( pActivator->pev->armorvalue == MAX_NORMAL_BATTERY ) )
{
if( m_flSoundTime <= gpGlobals->time )
{

View File

@ -22,6 +22,7 @@
#include "player.h"
#include "items.h"
#include "gamerules.h"
#include "game.h"
extern int gmsgItemPickup;
@ -187,7 +188,7 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
}
// if the player doesn't have the suit, or there is no juice left, make the deny noise
if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) || ( pActivator->pev->health == 100 ) )
if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) || ( chargerfix.value ) && ( pActivator->pev->health >= pActivator->pev->max_health ) )
{
if( m_flSoundTime <= gpGlobals->time )
{