Rename SelfReloads to AutoReloads
This commit is contained in:
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.AI
|
|||||||
protected static bool ReloadsAutomatically(Actor a)
|
protected static bool ReloadsAutomatically(Actor a)
|
||||||
{
|
{
|
||||||
var ammoPools = a.TraitsImplementing<AmmoPool>();
|
var ammoPools = a.TraitsImplementing<AmmoPool>();
|
||||||
return ammoPools.All(x => x.SelfReloads);
|
return ammoPools.All(x => x.AutoReloads);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static bool IsRearm(Actor a)
|
protected static bool IsRearm(Actor a)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
readonly Aircraft aircraft;
|
readonly Aircraft aircraft;
|
||||||
readonly AttackPlane attackPlane;
|
readonly AttackPlane attackPlane;
|
||||||
|
|
||||||
readonly bool selfReloads;
|
readonly bool autoReloads;
|
||||||
int ticksUntilTurn;
|
int ticksUntilTurn;
|
||||||
|
|
||||||
public FlyAttack(Actor self, Target target)
|
public FlyAttack(Actor self, Target target)
|
||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
aircraft = self.Trait<Aircraft>();
|
aircraft = self.Trait<Aircraft>();
|
||||||
attackPlane = self.TraitOrDefault<AttackPlane>();
|
attackPlane = self.TraitOrDefault<AttackPlane>();
|
||||||
ticksUntilTurn = attackPlane.AttackPlaneInfo.AttackTurnDelay;
|
ticksUntilTurn = attackPlane.AttackPlaneInfo.AttackTurnDelay;
|
||||||
selfReloads = self.TraitsImplementing<AmmoPool>().All(p => p.SelfReloads);
|
autoReloads = self.TraitsImplementing<AmmoPool>().All(p => p.AutoReloads);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
// If all valid weapons have depleted their ammo and RearmBuilding is defined, return to RearmBuilding to reload and then resume the activity
|
// If all valid weapons have depleted their ammo and RearmBuilding is defined, return to RearmBuilding to reload and then resume the activity
|
||||||
if (!selfReloads && aircraft.Info.RearmBuildings.Any() && attackPlane.Armaments.All(x => x.IsTraitPaused || !x.Weapon.IsValidAgainst(target, self.World, self)))
|
if (!autoReloads && aircraft.Info.RearmBuildings.Any() && attackPlane.Armaments.All(x => x.IsTraitPaused || !x.Weapon.IsValidAgainst(target, self.World, self)))
|
||||||
return ActivityUtils.SequenceActivities(new ReturnToBase(self, aircraft.Info.AbortOnResupply), this);
|
return ActivityUtils.SequenceActivities(new ReturnToBase(self, aircraft.Info.AbortOnResupply), this);
|
||||||
|
|
||||||
if (attackPlane != null)
|
if (attackPlane != null)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
readonly Aircraft helicopter;
|
readonly Aircraft helicopter;
|
||||||
readonly AttackHeli attackHeli;
|
readonly AttackHeli attackHeli;
|
||||||
readonly bool attackOnlyVisibleTargets;
|
readonly bool attackOnlyVisibleTargets;
|
||||||
readonly bool selfReloads;
|
readonly bool autoReloads;
|
||||||
|
|
||||||
Target target;
|
Target target;
|
||||||
bool canHideUnderFog;
|
bool canHideUnderFog;
|
||||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
helicopter = self.Trait<Aircraft>();
|
helicopter = self.Trait<Aircraft>();
|
||||||
attackHeli = self.Trait<AttackHeli>();
|
attackHeli = self.Trait<AttackHeli>();
|
||||||
this.attackOnlyVisibleTargets = attackOnlyVisibleTargets;
|
this.attackOnlyVisibleTargets = attackOnlyVisibleTargets;
|
||||||
selfReloads = self.TraitsImplementing<AmmoPool>().All(p => p.SelfReloads);
|
autoReloads = self.TraitsImplementing<AmmoPool>().All(p => p.AutoReloads);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If all valid weapons have depleted their ammo and RearmBuilding is defined, return to RearmBuilding to reload and then resume the activity
|
// If all valid weapons have depleted their ammo and RearmBuilding is defined, return to RearmBuilding to reload and then resume the activity
|
||||||
if (!selfReloads && helicopter.Info.RearmBuildings.Any() && attackHeli.Armaments.All(x => x.IsTraitPaused || !x.Weapon.IsValidAgainst(target, self.World, self)))
|
if (!autoReloads && helicopter.Info.RearmBuildings.Any() && attackHeli.Armaments.All(x => x.IsTraitPaused || !x.Weapon.IsValidAgainst(target, self.World, self)))
|
||||||
return ActivityUtils.SequenceActivities(new HeliReturnToBase(self, helicopter.Info.AbortOnResupply), this);
|
return ActivityUtils.SequenceActivities(new HeliReturnToBase(self, helicopter.Info.AbortOnResupply), this);
|
||||||
|
|
||||||
var dist = targetPos - pos;
|
var dist = targetPos - pos;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
return heli.Info.RearmBuildings.Contains(dest.Info.Name) && self.TraitsImplementing<AmmoPool>()
|
return heli.Info.RearmBuildings.Contains(dest.Info.Name) && self.TraitsImplementing<AmmoPool>()
|
||||||
.Any(p => !p.SelfReloads && !p.FullAmmo());
|
.Any(p => !p.AutoReloads && !p.FullAmmo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
return planeInfo.RearmBuildings.Contains(dest.Info.Name) && self.TraitsImplementing<AmmoPool>()
|
return planeInfo.RearmBuildings.Contains(dest.Info.Name) && self.TraitsImplementing<AmmoPool>()
|
||||||
.Any(p => !p.SelfReloads && !p.FullAmmo());
|
.Any(p => !p.AutoReloads && !p.FullAmmo());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
public Rearm(Actor self)
|
public Rearm(Actor self)
|
||||||
{
|
{
|
||||||
ammoPools = self.TraitsImplementing<AmmoPool>().Where(p => !p.SelfReloads).ToArray();
|
ammoPools = self.TraitsImplementing<AmmoPool>().Where(p => !p.AutoReloads).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
|
|||||||
@@ -62,10 +62,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
readonly Stack<int> tokens = new Stack<int>();
|
readonly Stack<int> tokens = new Stack<int>();
|
||||||
ConditionManager conditionManager;
|
ConditionManager conditionManager;
|
||||||
|
|
||||||
bool selfReloads;
|
|
||||||
|
|
||||||
// HACK: Temporarily needed until Rearm activity is gone for good
|
// HACK: Temporarily needed until Rearm activity is gone for good
|
||||||
[Sync] public int RemainingTicks;
|
[Sync] public int RemainingTicks;
|
||||||
|
|
||||||
[Sync] int currentAmmo;
|
[Sync] int currentAmmo;
|
||||||
|
|
||||||
public AmmoPool(Actor self, AmmoPoolInfo info)
|
public AmmoPool(Actor self, AmmoPoolInfo info)
|
||||||
@@ -100,12 +99,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
// This mostly serves to avoid complicated ReloadAmmoPool look-ups in various other places.
|
// This mostly serves to avoid complicated ReloadAmmoPool look-ups in various other places.
|
||||||
// TODO: Investigate removing this when the Rearm activity is replaced with a condition-based solution.
|
// TODO: Investigate removing this when the Rearm activity is replaced with a condition-based solution.
|
||||||
public bool SelfReloads { get { return selfReloads; } }
|
public bool AutoReloads { get; private set; }
|
||||||
|
|
||||||
void INotifyCreated.Created(Actor self)
|
void INotifyCreated.Created(Actor self)
|
||||||
{
|
{
|
||||||
conditionManager = self.TraitOrDefault<ConditionManager>();
|
conditionManager = self.TraitOrDefault<ConditionManager>();
|
||||||
selfReloads = self.TraitsImplementing<ReloadAmmoPool>().Any(r => r.Info.AmmoPool == Info.Name && r.Info.RequiresCondition == null);
|
AutoReloads = self.TraitsImplementing<ReloadAmmoPool>().Any(r => r.Info.AmmoPool == Info.Name && r.Info.RequiresCondition == null);
|
||||||
|
|
||||||
UpdateCondition(self);
|
UpdateCondition(self);
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
bool CanRearm()
|
bool CanRearm()
|
||||||
{
|
{
|
||||||
return ammoPools.Any(x => !x.SelfReloads && !x.FullAmmo());
|
return ammoPools.Any(x => !x.AutoReloads && !x.FullAmmo());
|
||||||
}
|
}
|
||||||
|
|
||||||
public string VoicePhraseForOrder(Actor self, Order order)
|
public string VoicePhraseForOrder(Actor self, Order order)
|
||||||
|
|||||||
Reference in New Issue
Block a user