Exlude DamageTypes from HarvesterNotifier

This commit is contained in:
N.N
2023-12-08 19:11:47 +01:00
committed by Gustas
parent adf515d50b
commit aa5b193746
3 changed files with 9 additions and 2 deletions

View File

@@ -27,6 +27,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Length of time (in ticks) to display a location ping in the minimap.")] [Desc("Length of time (in ticks) to display a location ping in the minimap.")]
public readonly int RadarPingDuration = 250; public readonly int RadarPingDuration = 250;
[Desc("Exclude damage types (defined on the warheads) that trigger Notification.")]
public readonly BitSet<DamageType> ExludeDamageTypes = default;
[NotificationReference("Speech")] [NotificationReference("Speech")]
[Desc("Speech notification type to play.")] [Desc("Speech notification type to play.")]
public readonly string Notification = "HarvesterAttack"; public readonly string Notification = "HarvesterAttack";
@@ -54,6 +57,9 @@ namespace OpenRA.Mods.Common.Traits
void INotifyDamage.Damaged(Actor self, AttackInfo e) void INotifyDamage.Damaged(Actor self, AttackInfo e)
{ {
if (!info.ExludeDamageTypes.IsEmpty && e.Damage.DamageTypes.Overlaps(info.ExludeDamageTypes))
return;
// Don't track self-damage // Don't track self-damage
if (e.Attacker != null && e.Attacker.Owner == self.Owner) if (e.Attacker != null && e.Attacker.Owner == self.Owner)
return; return;

View File

@@ -133,6 +133,7 @@ Player:
Prerequisites: global-auto-concrete Prerequisites: global-auto-concrete
FrozenActorLayer: FrozenActorLayer:
HarvesterAttackNotifier: HarvesterAttackNotifier:
ExludeDamageTypes: SpiceExplosion
TextNotification: notification-harvester-under-attack TextNotification: notification-harvester-under-attack
PlayerStatistics: PlayerStatistics:
PlaceBeacon: PlaceBeacon:

View File

@@ -305,7 +305,7 @@ SpiceExplosion:
invulnerable: 0 invulnerable: 0
cy: 20 cy: 20
harvester: 25 harvester: 25
DamageTypes: Prone50Percent, TriggerProne, ExplosionDeath DamageTypes: Prone50Percent, TriggerProne, SpiceExplosion
DamageCalculationType: ClosestTargetablePosition DamageCalculationType: ClosestTargetablePosition
AffectsParent: true AffectsParent: true
Warhead@2Res: CreateResource Warhead@2Res: CreateResource
@@ -333,7 +333,7 @@ BloomExplosion:
invulnerable: 0 invulnerable: 0
cy: 20 cy: 20
harvester: 25 harvester: 25
DamageTypes: Prone50Percent, TriggerProne, ExplosionDeath DamageTypes: Prone50Percent, TriggerProne, ExplosionDeath, SpiceExplosion
DamageCalculationType: ClosestTargetablePosition DamageCalculationType: ClosestTargetablePosition
AffectsParent: true AffectsParent: true