This commit is contained in:
@@ -36,7 +36,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public class Helicopter : Aircraft, ITick, IResolveOrder, IMove
|
public class Helicopter : Aircraft, ITick, IResolveOrder, IMove
|
||||||
{
|
{
|
||||||
public readonly HelicopterInfo Info;
|
public readonly HelicopterInfo Info;
|
||||||
readonly bool fallsToEarth;
|
|
||||||
Actor self;
|
Actor self;
|
||||||
bool firstTick = true;
|
bool firstTick = true;
|
||||||
public bool IsMoving { get { return self.CenterPosition.Z > 0; } set { } }
|
public bool IsMoving { get { return self.CenterPosition.Z > 0; } set { } }
|
||||||
@@ -46,7 +45,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
self = init.Self;
|
self = init.Self;
|
||||||
Info = info;
|
Info = info;
|
||||||
fallsToEarth = self.HasTrait<FallsToEarth>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
@@ -132,7 +130,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (firstTick)
|
if (firstTick)
|
||||||
{
|
{
|
||||||
firstTick = false;
|
firstTick = false;
|
||||||
if (!fallsToEarth) // TODO: Aircraft husks don't properly unreserve.
|
if (!self.HasTrait<FallsToEarth>()) // TODO: Aircraft husks don't properly unreserve.
|
||||||
ReserveSpawnBuilding();
|
ReserveSpawnBuilding();
|
||||||
|
|
||||||
var host = GetActorBelow();
|
var host = GetActorBelow();
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public class Plane : Aircraft, IResolveOrder, IMove, ITick, ISync
|
public class Plane : Aircraft, IResolveOrder, IMove, ITick, ISync
|
||||||
{
|
{
|
||||||
public readonly PlaneInfo Info;
|
public readonly PlaneInfo Info;
|
||||||
readonly bool fallsToEarth;
|
|
||||||
[Sync] public WPos RTBPathHash;
|
[Sync] public WPos RTBPathHash;
|
||||||
Actor self;
|
Actor self;
|
||||||
public bool IsMoving { get { return self.CenterPosition.Z > 0; } set { } }
|
public bool IsMoving { get { return self.CenterPosition.Z > 0; } set { } }
|
||||||
@@ -36,7 +35,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
self = init.Self;
|
self = init.Self;
|
||||||
Info = info;
|
Info = info;
|
||||||
fallsToEarth = self.HasTrait<FallsToEarth>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool firstTick = true;
|
bool firstTick = true;
|
||||||
@@ -45,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (firstTick)
|
if (firstTick)
|
||||||
{
|
{
|
||||||
firstTick = false;
|
firstTick = false;
|
||||||
if (!fallsToEarth) // TODO: Aircraft husks don't properly unreserve.
|
if (!self.HasTrait<FallsToEarth>()) // TODO: Aircraft husks don't properly unreserve.
|
||||||
ReserveSpawnBuilding();
|
ReserveSpawnBuilding();
|
||||||
|
|
||||||
var host = GetActorBelow();
|
var host = GetActorBelow();
|
||||||
|
|||||||
@@ -51,20 +51,21 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public class ExternalCapturable : ITick
|
public class ExternalCapturable : ITick
|
||||||
{
|
{
|
||||||
readonly Building building;
|
|
||||||
[Sync] public int CaptureProgressTime = 0;
|
[Sync] public int CaptureProgressTime = 0;
|
||||||
[Sync] public Actor Captor;
|
[Sync] public Actor Captor;
|
||||||
|
private Actor self;
|
||||||
public ExternalCapturableInfo Info;
|
public ExternalCapturableInfo Info;
|
||||||
public bool CaptureInProgress { get { return Captor != null; } }
|
public bool CaptureInProgress { get { return Captor != null; } }
|
||||||
|
|
||||||
public ExternalCapturable(Actor self, ExternalCapturableInfo info)
|
public ExternalCapturable(Actor self, ExternalCapturableInfo info)
|
||||||
{
|
{
|
||||||
|
this.self = self;
|
||||||
Info = info;
|
Info = info;
|
||||||
building = self.TraitOrDefault<Building>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BeginCapture(Actor captor)
|
public void BeginCapture(Actor captor)
|
||||||
{
|
{
|
||||||
|
var building = self.TraitOrDefault<Building>();
|
||||||
if (building != null)
|
if (building != null)
|
||||||
building.Lock();
|
building.Lock();
|
||||||
|
|
||||||
@@ -73,6 +74,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public void EndCapture()
|
public void EndCapture()
|
||||||
{
|
{
|
||||||
|
var building = self.TraitOrDefault<Building>();
|
||||||
if (building != null)
|
if (building != null)
|
||||||
building.Unlock();
|
building.Unlock();
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Makes the unit automatically run around when taking damage.")]
|
[Desc("Makes the unit automatically run around when taking damage.")]
|
||||||
class ScaredyCatInfo : ITraitInfo
|
class ScaredyCatInfo : ITraitInfo, Requires<MobileInfo>
|
||||||
{
|
{
|
||||||
[Desc("How long (in ticks) the actor should panic for.")]
|
[Desc("How long (in ticks) the actor should panic for.")]
|
||||||
public readonly int PanicLength = 25 * 10;
|
public readonly int PanicLength = 25 * 10;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
class RepairableNearInfo : ITraitInfo, Requires<HealthInfo>
|
class RepairableNearInfo : ITraitInfo, Requires<HealthInfo>, Requires<IMoveInfo>
|
||||||
{
|
{
|
||||||
[ActorReference] public readonly string[] Buildings = { "spen", "syrd" };
|
[ActorReference] public readonly string[] Buildings = { "spen", "syrd" };
|
||||||
public readonly int CloseEnough = 4; /* cells */
|
public readonly int CloseEnough = 4; /* cells */
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
readonly Lazy<Health> health;
|
readonly Lazy<Health> health;
|
||||||
readonly SellableInfo info;
|
readonly SellableInfo info;
|
||||||
readonly Building building;
|
|
||||||
readonly WithMakeAnimation makeAnimation;
|
|
||||||
|
|
||||||
public Sellable(Actor self, SellableInfo info)
|
public Sellable(Actor self, SellableInfo info)
|
||||||
: base(info)
|
: base(info)
|
||||||
@@ -39,8 +37,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
this.self = self;
|
this.self = self;
|
||||||
this.info = info;
|
this.info = info;
|
||||||
health = Exts.Lazy(() => self.TraitOrDefault<Health>());
|
health = Exts.Lazy(() => self.TraitOrDefault<Health>());
|
||||||
building = self.TraitOrDefault<Building>();
|
|
||||||
makeAnimation = self.TraitOrDefault<WithMakeAnimation>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
@@ -54,6 +50,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (IsTraitDisabled)
|
if (IsTraitDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var building = self.TraitOrDefault<Building>();
|
||||||
if (building != null && !building.Lock())
|
if (building != null && !building.Lock())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -65,6 +62,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
foreach (var ns in self.TraitsImplementing<INotifySold>())
|
foreach (var ns in self.TraitsImplementing<INotifySold>())
|
||||||
ns.Selling(self);
|
ns.Selling(self);
|
||||||
|
|
||||||
|
var makeAnimation = self.TraitOrDefault<WithMakeAnimation>();
|
||||||
if (makeAnimation != null)
|
if (makeAnimation != null)
|
||||||
makeAnimation.Reverse(self, new Sell(self), false);
|
makeAnimation.Reverse(self, new Sell(self), false);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -46,18 +46,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
readonly TransformsInfo info;
|
readonly TransformsInfo info;
|
||||||
readonly Building building;
|
|
||||||
readonly BuildingInfo buildingInfo;
|
readonly BuildingInfo buildingInfo;
|
||||||
readonly string race;
|
readonly string race;
|
||||||
readonly WithMakeAnimation makeAnimation;
|
|
||||||
|
|
||||||
public Transforms(ActorInitializer init, TransformsInfo info)
|
public Transforms(ActorInitializer init, TransformsInfo info)
|
||||||
{
|
{
|
||||||
self = init.Self;
|
self = init.Self;
|
||||||
this.info = info;
|
this.info = info;
|
||||||
buildingInfo = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>();
|
buildingInfo = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>();
|
||||||
building = self.TraitOrDefault<Building>();
|
|
||||||
makeAnimation = self.TraitOrDefault<WithMakeAnimation>();
|
|
||||||
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.Race;
|
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.Race;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +64,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
bool CanDeploy()
|
bool CanDeploy()
|
||||||
{
|
{
|
||||||
|
var building = self.TraitOrDefault<Building>();
|
||||||
if (building != null && building.Locked)
|
if (building != null && building.Locked)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -89,6 +86,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public void DeployTransform(bool queued)
|
public void DeployTransform(bool queued)
|
||||||
{
|
{
|
||||||
|
var building = self.TraitOrDefault<Building>();
|
||||||
if (!CanDeploy() || (building != null && !building.Lock()))
|
if (!CanDeploy() || (building != null && !building.Lock()))
|
||||||
{
|
{
|
||||||
foreach (var s in info.NoTransformSounds)
|
foreach (var s in info.NoTransformSounds)
|
||||||
@@ -117,6 +115,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Race = race
|
Race = race
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var makeAnimation = self.TraitOrDefault<WithMakeAnimation>();
|
||||||
if (makeAnimation != null)
|
if (makeAnimation != null)
|
||||||
makeAnimation.Reverse(self, transform);
|
makeAnimation.Reverse(self, transform);
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user