Add damagetypes to repairing.

This commit is contained in:
Zimmermann Gyula
2020-02-23 17:23:20 +01:00
committed by atlimit8
parent ca3cfc0184
commit 9e534f3804
3 changed files with 10 additions and 2 deletions

View File

@@ -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

View File

@@ -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<DamageType> RepairDamageTypes = default(BitSet<DamageType>);
[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)
{

View File

@@ -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<DamageType> RepairDamageTypes = default(BitSet<DamageType>);
[NotificationReference("Speech")]
[Desc("The sound played when starting to repair a unit.")]
public readonly string StartRepairingNotification = null;