trigger_hurt: Fix the broken use once flag (e.g. crossfire bunker fix)

This commit is contained in:
Marco Cawthorne 2019-03-02 14:03:26 +01:00
parent 182e8b9e74
commit 5e660e9399

View file

@ -26,10 +26,18 @@ class trigger_hurt : CBaseTrigger
void trigger_hurt::Trigger(void)
{
if (solid != SOLID_NOT) {
#ifdef GS_DEVELOPER
print("trigger_hurt: de-activated.\n");
#endif
solid = SOLID_NOT;
touch = __NULL__;
} else {
#ifdef GS_DEVELOPER
print("trigger_hurt: activated.\n");
#endif
solid = SOLID_TRIGGER;
touch = Touch;
}
@ -64,12 +72,10 @@ void trigger_hurt :: Touch ( void )
}
Damage_Apply(other, this, m_iDamage, other.origin, FALSE);
//Damage_Apply( other, world, m_iDamage, DAMAGE_BLEED, WEAPON_NONE );
// Shut it down if used once
if (spawnflags & SF_HURT_ONCE) {
solid = SOLID_NOT;
touch = __NULL__;
Trigger();
}
m_flNextTrigger = time + 0.5;
@ -81,6 +87,8 @@ void trigger_hurt :: Respawn ( void )
alpha = 0.5f;
#endif
m_flNextTrigger = 0;
if (spawnflags & SF_HURT_OFF) {
solid = SOLID_NOT;
touch = __NULL__;
@ -106,7 +114,7 @@ void trigger_hurt :: trigger_hurt ( void )
}
}
trigger_hurt::Respawn();
CBaseEntity::CBaseEntity();
CBaseTrigger::InitBrushTrigger();
trigger_hurt::Respawn();
}