diff --git a/OpenRA.Mods.Cnc/Activities/LayMines.cs b/OpenRA.Mods.Cnc/Activities/LayMines.cs index 60c7462f4d..713c6a6598 100644 --- a/OpenRA.Mods.Cnc/Activities/LayMines.cs +++ b/OpenRA.Mods.Cnc/Activities/LayMines.cs @@ -147,7 +147,7 @@ namespace OpenRA.Mods.Cnc.Activities if (pool == null) return; - pool.TakeAmmo(self, 1); + pool.TakeAmmo(self, minelayer.Info.AmmoUsage); } self.World.AddFrameEndTask(w => w.CreateActor(minelayer.Info.Mine, new TypeDictionary diff --git a/OpenRA.Mods.Cnc/Traits/Minelayer.cs b/OpenRA.Mods.Cnc/Traits/Minelayer.cs index b48758c66a..acd00e3a99 100644 --- a/OpenRA.Mods.Cnc/Traits/Minelayer.cs +++ b/OpenRA.Mods.Cnc/Traits/Minelayer.cs @@ -62,6 +62,9 @@ namespace OpenRA.Mods.Cnc.Traits [Desc("Cursor to display when able to lay a mine.")] public readonly string AbilityCursor = "ability"; + [Desc("Ammo the minelayer consumes per mine.")] + public readonly int AmmoUsage = 1; + public override object Create(ActorInitializer init) { return new Minelayer(init.Self, this); } } diff --git a/OpenRA.Mods.Common/Traits/AmmoPool.cs b/OpenRA.Mods.Common/Traits/AmmoPool.cs index a1a3a92016..04f63abe22 100644 --- a/OpenRA.Mods.Common/Traits/AmmoPool.cs +++ b/OpenRA.Mods.Common/Traits/AmmoPool.cs @@ -99,7 +99,7 @@ namespace OpenRA.Mods.Common.Traits void INotifyAttack.Attacking(Actor self, in Target target, Armament a, Barrel barrel) { if (a != null && Info.Armaments.Contains(a.Info.Name)) - TakeAmmo(self, 1); + TakeAmmo(self, a.Info.AmmoUsage); } void INotifyAttack.PreparingAttack(Actor self, in Target target, Armament a, Barrel barrel) { } diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index e5016572ec..fc3ebf833a 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -83,6 +83,9 @@ namespace OpenRA.Mods.Common.Traits [Desc("Cursor to display when hovering over a valid target that is outside of range.")] public readonly string OutsideRangeCursor = "attackoutsiderange"; + [Desc("Ammo the weapon consumes per shot.")] + public readonly int AmmoUsage = 1; + public override object Create(ActorInitializer init) { return new Armament(init.Self, this); } public override void RulesetLoaded(Ruleset rules, ActorInfo ai)