Fixed #856 - created trait for ammo reload time, set for some aircraft
This commit is contained in:
committed by
Chris Forbes
parent
6be55b61aa
commit
de5db51f25
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
return Util.SequenceActivities(
|
||||
new Enter(rearmTarget),
|
||||
//new Move(Util.CellContaining(rearmTarget.CenterLocation), rearmTarget),
|
||||
new Rearm(),
|
||||
new Rearm(self),
|
||||
new Repair(rearmTarget),
|
||||
this );
|
||||
}
|
||||
|
||||
@@ -17,9 +17,15 @@ namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
public class Rearm : Activity
|
||||
{
|
||||
int remainingTicks = ticksPerPip;
|
||||
|
||||
const int ticksPerPip = 25 * 2;
|
||||
|
||||
int ticksPerPip = 25 * 2;
|
||||
int remainingTicks = 25 * 2;
|
||||
|
||||
public Rearm(Actor actor)
|
||||
{
|
||||
ticksPerPip = actor.TraitOrDefault<LimitedAmmo>().ReloadTimePerAmmo();
|
||||
remainingTicks = ticksPerPip;
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
@@ -37,7 +43,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (hostBuilding != null)
|
||||
hostBuilding.Trait<RenderBuilding>().PlayCustomAnim(hostBuilding, "active");
|
||||
|
||||
remainingTicks = ticksPerPip;
|
||||
remainingTicks = limitedAmmo.ReloadTimePerAmmo();
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
{
|
||||
var name = a.Info.Name;
|
||||
if (Info.RearmBuildings.Contains(name))
|
||||
self.QueueActivity(new Rearm());
|
||||
self.QueueActivity(new Rearm(self));
|
||||
if (Info.RepairBuildings.Contains(name))
|
||||
self.QueueActivity(new Repair(a));
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
new HeliFly(dest.Trait<IHasLocation>().PxPosition + offset),
|
||||
new Turn(initialFacing),
|
||||
new HeliLand(false),
|
||||
new Rearm(),
|
||||
new Rearm(self),
|
||||
NextActivity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Air
|
||||
if (airfield != null)
|
||||
{
|
||||
self.QueueActivity(new ReturnToBase(self, airfield));
|
||||
self.QueueActivity(new Rearm());
|
||||
self.QueueActivity(new Rearm(self));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -16,7 +16,8 @@ namespace OpenRA.Mods.RA
|
||||
public class LimitedAmmoInfo : ITraitInfo
|
||||
{
|
||||
public readonly int Ammo = 0;
|
||||
public readonly int PipCount = 0;
|
||||
public readonly int PipCount = 0;
|
||||
public readonly int ReloadTicks = 25 * 2; // This is measured in ticks
|
||||
|
||||
public object Create(ActorInitializer init) { return new LimitedAmmo(this); }
|
||||
}
|
||||
@@ -24,12 +25,14 @@ namespace OpenRA.Mods.RA
|
||||
public class LimitedAmmo : INotifyAttack, IPips, ISync
|
||||
{
|
||||
[Sync]
|
||||
int ammo;
|
||||
int ammo;
|
||||
int ticksPerAmmo;
|
||||
LimitedAmmoInfo Info;
|
||||
|
||||
public LimitedAmmo(LimitedAmmoInfo info)
|
||||
{
|
||||
ammo = info.Ammo;
|
||||
ammo = info.Ammo;
|
||||
ticksPerAmmo = info.ReloadTicks;
|
||||
Info = info;
|
||||
}
|
||||
|
||||
@@ -40,7 +43,9 @@ namespace OpenRA.Mods.RA
|
||||
if (ammo >= Info.Ammo) return false;
|
||||
++ammo;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int ReloadTimePerAmmo() { return ticksPerAmmo; }
|
||||
|
||||
public void Attacking(Actor self, Target target) { --ammo; }
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.RA
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new MoveAdjacentTo(order.TargetActor));
|
||||
self.QueueActivity(mobile.MoveTo(Traits.Util.CellContaining(order.TargetActor.CenterLocation), order.TargetActor));
|
||||
self.QueueActivity(new Rearm());
|
||||
self.QueueActivity(new Rearm(self));
|
||||
self.QueueActivity(new Repair(order.TargetActor));
|
||||
|
||||
if (rp != null)
|
||||
|
||||
@@ -164,6 +164,7 @@ YAK:
|
||||
LimitedAmmo:
|
||||
Ammo: 18
|
||||
PipCount: 6
|
||||
ReloadTicks: 11
|
||||
IronCurtainable:
|
||||
ReturnOnIdle:
|
||||
WithMuzzleFlash:
|
||||
@@ -300,6 +301,7 @@ HIND:
|
||||
LimitedAmmo:
|
||||
Ammo: 24
|
||||
PipCount: 6
|
||||
ReloadTicks: 8
|
||||
IronCurtainable:
|
||||
Selectable:
|
||||
Bounds: 38,32,0,0
|
||||
|
||||
Reference in New Issue
Block a user