Enhanced mp_hostage_hurtable

This commit is contained in:
s1lent 2017-11-02 00:30:22 +07:00
parent a2ed63d4a3
commit 8b31478b83
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
4 changed files with 36 additions and 10 deletions

View File

@ -40,7 +40,7 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| mp_timeleft | - | - | - | Is the number of time left before the map changes, if you have set mp_timelimit. You just type mp_timeleft in server console, and it tells you the number of time left depending of mp_timelimit. |
| mp_timelimit | 0 | - | - | Period between map rotations.<br />`0` means no limit |
| mp_forcerespawn | 0 | 0 | - | Players will automatically respawn when killed.<br/>`0` disabled<br/>`>0.00001` time delay to respawn |
| mp_hostage_hurtable | 1 | 0 | 1 | The hostages can take the damage.<br/>`0` disabled<br/>`1` enabled |
| mp_hostage_hurtable | 1 | 0 | 1 | The hostages can take damage.<br/>`0` disabled<br/>`1` from any team<br/>`2` only from `CT`<br/>`3` only from `T` |
| mp_show_radioicon | 1 | 0 | 1 | Show radio icon.<br/>`0` disabled<br/>`1` enabled |
| showtriggers | 0 | 0 | 1 | Debug cvar shows triggers. |
| sv_alltalk | 0 | 0 | 3 | When teammates can hear each other.<br/>`0` dead don't hear alive<br/>`1` no restrictions<br/>`2` teammates hear each other<br/>`3` Same as 2, but spectators hear everybody

6
dist/game.cfg vendored
View File

@ -124,9 +124,11 @@ mp_timelimit 20
// Default value: "0"
mp_forcerespawn 0
// The hostages can take the damage.
// The hostages can take damage.
// 0 - disabled
// 1 - enabled (default behaviour)
// 1 - from any team (default behaviour)
// 2 - only from CT
// 3 - only from T
mp_hostage_hurtable 1
// Show radio icon.

View File

@ -575,20 +575,43 @@ void CHostage::RePosition()
m_flNextFullThink = gpGlobals->time + RANDOM_FLOAT(0.1, 0.2);
}
bool CHostage::CanTakeDamage(entvars_t *pevAttacker)
{
bool bCanTakeDmg = true; // default behaviour
#ifdef REGAMEDLL_ADD
CBasePlayer *pAttacker = CBasePlayer::Instance(pevAttacker);
switch ((int)hostagehurtable.value)
{
case 0:
bCanTakeDmg = false;
break;
case 2:
bCanTakeDmg = (pAttacker && pAttacker->IsPlayer() && pAttacker->m_iTeam == CT);
break;
case 3:
bCanTakeDmg = (pAttacker && pAttacker->IsPlayer() && pAttacker->m_iTeam == TERRORIST);
break;
default:
break;
}
#endif
return bCanTakeDmg;
}
void CHostage::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
#ifdef REGAMEDLL_ADD
if (hostagehurtable.value)
#endif
{
if (!CanTakeDamage(pevAttacker))
return;
CBaseMonster::TraceAttack(pevAttacker, flDamage, vecDir, ptr, bitsDamageType);
}
}
BOOL CHostage::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
#ifdef REGAMEDLL_ADD
if (hostagehurtable.value <= 0)
if (!CanTakeDamage(pevAttacker))
return FALSE;
#endif

View File

@ -122,6 +122,7 @@ public:
void NavReady();
void Wiggle();
void PreThink();
bool CanTakeDamage(entvars_t *pevAttacker);
// queries
bool IsFollowingSomeone() { return IsFollowing(); }