Skip to content

Commit

Permalink
Add 'Armor Damage' parameter and 'Do Armor Damage' spawnflag for trig…
Browse files Browse the repository at this point in the history
…ger_hurt_remote
  • Loading branch information
FreeSlave committed Jun 11, 2024
1 parent 3c5fb47 commit 913850c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dlls/triggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5163,6 +5163,7 @@ void CTriggerChangeClass::Affect(CBaseEntity *pEntity, USE_TYPE useType)
#define SF_TRIGGER_HURT_REMOTE_INSTANT_KILL 1
#define SF_TRIGGER_HURT_REMOTE_CONSTANT 2
#define SF_TRIGGER_HURT_REMOTE_STARTON 4
#define SF_TRIGGER_HURT_REMOTE_DO_ARMOR_DAMAGE 8

#define SF_TRIGGER_HURT_REMOTE_IGNORE_ARMOR 256
#define SF_TRIGGER_HURT_REMOTE_NO_PUNCH 512
Expand Down Expand Up @@ -5244,6 +5245,11 @@ void CTriggerHurtRemote::KeyValue(KeyValueData *pkvd)
pev->dmg_save = atof( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "armordmg"))
{
pev->armorvalue = atof( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else
CPointEntity::KeyValue( pkvd );
}
Expand Down Expand Up @@ -5322,6 +5328,13 @@ void CTriggerHurtRemote::DoDamage(CBaseEntity* pTarget)
return;

CBaseEntity* pActivator = m_hActivator;

if (pev->armorvalue != 0 && FBitSet(pev->spawnflags, SF_TRIGGER_HURT_REMOTE_DO_ARMOR_DAMAGE))
{
CBaseEntity* charger = pActivator != 0 ? pActivator : this;
pTarget->TakeArmor(charger, -pev->armorvalue);
}

if (pev->dmg >= 0)
{
float fldmg = pev->dmg;
Expand Down
2 changes: 2 additions & 0 deletions fgd/halflife.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -8008,6 +8008,7 @@
1 : "Instant Kill" : 0
2 : "Constant" : 0
4 : "Start On" : 0
8 : "Do Armor Damage" : 0
256:"Ignore Armor" : 0
512:"No Camera Punch" : 0
]
Expand All @@ -8016,6 +8017,7 @@
dmg(integer) : "Damage" : 10 : "Damage to deal. If 'Constant' flag is selected, this is a damage to deal every 'Delay' seconds. Can be negative to provide healing instead of dealing damage."
delay(string) : "Delay (Only when Constant)" : "1"
min_health(string) : "Minimum health threshold" : : "Don't decrease the toucher health beyond this value"
armordmg(string) : "Armor damage" : : "Deal damage to armor. Works only if 'Do Armor' flag is selected. When target is out of armor, the damage is not dealt. Can be negative to give an armor instead of draining it."
]

@PointClass base(Targetname) = trigger_killmonster : "Trigger Kill Monster"
Expand Down

0 comments on commit 913850c

Please sign in to comment.