From 9e534f3804e8807e017985533f12ce6d655bc70b Mon Sep 17 00:00:00 2001 From: Zimmermann Gyula Date: Sun, 23 Feb 2020 17:23:20 +0100 Subject: [PATCH] Add damagetypes to repairing. --- OpenRA.Mods.Common/Activities/Resupply.cs | 2 +- OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs | 6 +++++- OpenRA.Mods.Common/Traits/RepairsUnits.cs | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Activities/Resupply.cs b/OpenRA.Mods.Common/Activities/Resupply.cs index 919c736bda..bdcc05ed64 100644 --- a/OpenRA.Mods.Common/Activities/Resupply.cs +++ b/OpenRA.Mods.Common/Activities/Resupply.cs @@ -267,7 +267,7 @@ namespace OpenRA.Mods.Common.Activities return; } - self.InflictDamage(host.Actor, new Damage(-hpToRepair)); + self.InflictDamage(host.Actor, new Damage(-hpToRepair, repairsUnits.Info.RepairDamageTypes)); remainingTicks = repairsUnits.Info.Interval; } else diff --git a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs index 6beb78133f..fdfabc7b4f 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/RepairableBuilding.cs @@ -12,6 +12,7 @@ using System; using System.Collections.Generic; using System.Linq; +using OpenRA.Primitives; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits @@ -28,6 +29,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("The maximum amount of HP to repair each step.")] public readonly int RepairStep = 7; + [Desc("Damage types used for the repair.")] + public readonly BitSet RepairDamageTypes = default(BitSet); + [Desc("The percentage repair bonus applied with increasing numbers of repairers.")] public readonly int[] RepairBonuses = { 100, 150, 175, 200, 220, 240, 260, 280, 300 }; @@ -166,7 +170,7 @@ namespace OpenRA.Mods.Common.Traits // activePlayers won't cause IndexOutOfRange because we capped the max amount of players // to the length of the array - self.InflictDamage(self, new Damage(-(hpToRepair * Info.RepairBonuses[activePlayers - 1] / 100))); + self.InflictDamage(self, new Damage(-(hpToRepair * Info.RepairBonuses[activePlayers - 1] / 100), Info.RepairDamageTypes)); if (health.DamageState == DamageState.Undamaged) { diff --git a/OpenRA.Mods.Common/Traits/RepairsUnits.cs b/OpenRA.Mods.Common/Traits/RepairsUnits.cs index c4a2bf0577..39586af03c 100644 --- a/OpenRA.Mods.Common/Traits/RepairsUnits.cs +++ b/OpenRA.Mods.Common/Traits/RepairsUnits.cs @@ -9,6 +9,7 @@ */ #endregion +using OpenRA.Primitives; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits @@ -23,6 +24,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Time (in ticks) between two repair steps.")] public readonly int Interval = 24; + [Desc("Damage types used for the repair.")] + public readonly BitSet RepairDamageTypes = default(BitSet); + [NotificationReference("Speech")] [Desc("The sound played when starting to repair a unit.")] public readonly string StartRepairingNotification = null;