Browse Source

Add mp_instagib cvar for instagib gamemode.

dmc
Night Owl 7 years ago
parent
commit
dcb4b90785
  1. 13
      dlls/dmc/quake_player.cpp
  2. 2
      dlls/game.cpp

13
dlls/dmc/quake_player.cpp

@ -24,6 +24,7 @@
#include "util.h" #include "util.h"
#include "cbase.h" #include "cbase.h"
#include "player.h" #include "player.h"
#include "game.h"
#include "gamerules.h" #include "gamerules.h"
#include "hltv.h" #include "hltv.h"
@ -101,6 +102,8 @@ void CBasePlayer::UpdateStatusBar()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{ {
float flTake;
if ( (pev->takedamage == DAMAGE_NO) || (IsAlive() == FALSE) ) if ( (pev->takedamage == DAMAGE_NO) || (IsAlive() == FALSE) )
return 0; return 0;
@ -150,6 +153,12 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
// Teamplay 2 you can still hurt teammates // Teamplay 2 you can still hurt teammates
} }
if( instagib.value )
{
flTake = 900.0;
}
else
{
// check for quad damage powerup on the attacker // check for quad damage powerup on the attacker
if (pAttacker->IsPlayer()) if (pAttacker->IsPlayer())
{ {
@ -182,7 +191,8 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
m_iQuakeItems &= ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3); m_iQuakeItems &= ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3);
} }
pev->armorvalue -= flSave; pev->armorvalue -= flSave;
float flTake = ceil(flDamage - flSave); flTake = ceil(flDamage - flSave);
}
// add to the damage total for clients, which will be sent as a single message at the end of the frame // add to the damage total for clients, which will be sent as a single message at the end of the frame
pev->dmg_take = pev->dmg_take + flTake; pev->dmg_take = pev->dmg_take + flTake;
@ -203,7 +213,6 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
// this global is still used for glass and other non-monster killables, along with decals. // this global is still used for glass and other non-monster killables, along with decals.
g_vecAttackDir = vecTemp.Normalize(); g_vecAttackDir = vecTemp.Normalize();
// figure momentum add // figure momentum add
if ( (pevInflictor) && (pev->movetype == MOVETYPE_WALK) && !( FBitSet (bitsDamageType, DMG_BURN) ) && !( FBitSet (bitsDamageType, DMG_ACID) ) ) if ( (pevInflictor) && (pev->movetype == MOVETYPE_WALK) && !( FBitSet (bitsDamageType, DMG_BURN) ) && !( FBitSet (bitsDamageType, DMG_ACID) ) )
{ {

2
dlls/game.cpp

@ -46,6 +46,7 @@ cvar_t defaultteam = { "mp_defaultteam","0" };
cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER }; cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER };
cvar_t bhopcap = { "mp_bhopcap", "1", FCVAR_SERVER }; cvar_t bhopcap = { "mp_bhopcap", "1", FCVAR_SERVER };
cvar_t allowhook = { "mp_allow_hook", "1", FCVAR_SERVER }; cvar_t allowhook = { "mp_allow_hook", "1", FCVAR_SERVER };
cvar_t instagib = { "mp_instagib", "0", FCVAR_SERVER };
cvar_t allow_spectators = { "allow_spectators", "0", FCVAR_SERVER }; // 0 prevents players from being spectators cvar_t allow_spectators = { "allow_spectators", "0", FCVAR_SERVER }; // 0 prevents players from being spectators
@ -487,6 +488,7 @@ void GameDLLInit( void )
CVAR_REGISTER( &allowmonsters ); CVAR_REGISTER( &allowmonsters );
CVAR_REGISTER( &bhopcap ); CVAR_REGISTER( &bhopcap );
CVAR_REGISTER( &allowhook ); CVAR_REGISTER( &allowhook );
CVAR_REGISTER( &instagib );
CVAR_REGISTER( &mp_chattime ); CVAR_REGISTER( &mp_chattime );

Loading…
Cancel
Save