Pass initial race to husks and transformed actors.
This commit is contained in:
@@ -22,6 +22,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
public string[] Sounds = { };
|
public string[] Sounds = { };
|
||||||
public int ForceHealthPercentage = 0;
|
public int ForceHealthPercentage = 0;
|
||||||
public bool SkipMakeAnims = false;
|
public bool SkipMakeAnims = false;
|
||||||
|
public string Race = null;
|
||||||
|
|
||||||
public Transform(Actor self, string toActor)
|
public Transform(Actor self, string toActor)
|
||||||
{
|
{
|
||||||
@@ -57,6 +58,9 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
if (SkipMakeAnims)
|
if (SkipMakeAnims)
|
||||||
init.Add(new SkipMakeAnimsInit());
|
init.Add(new SkipMakeAnimsInit());
|
||||||
|
|
||||||
|
if (Race != null)
|
||||||
|
init.Add(new RaceInit(Race));
|
||||||
|
|
||||||
var health = self.TraitOrDefault<Health>();
|
var health = self.TraitOrDefault<Health>();
|
||||||
if (health != null)
|
if (health != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,14 +20,20 @@ namespace OpenRA.Mods.RA
|
|||||||
[ActorReference]
|
[ActorReference]
|
||||||
public readonly string HuskActor = null;
|
public readonly string HuskActor = null;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new LeavesHusk(this); }
|
public object Create(ActorInitializer init) { return new LeavesHusk(init, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LeavesHusk : INotifyKilled
|
public class LeavesHusk : INotifyKilled
|
||||||
{
|
{
|
||||||
LeavesHuskInfo info;
|
readonly LeavesHuskInfo info;
|
||||||
|
readonly string race;
|
||||||
|
|
||||||
public LeavesHusk(LeavesHuskInfo info) { this.info = info; }
|
public LeavesHusk(ActorInitializer init, LeavesHuskInfo info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
|
||||||
|
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.self.Owner.Country.Race;
|
||||||
|
}
|
||||||
|
|
||||||
public void Killed(Actor self, AttackInfo e)
|
public void Killed(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
@@ -42,6 +48,7 @@ namespace OpenRA.Mods.RA
|
|||||||
new LocationInit(self.Location),
|
new LocationInit(self.Location),
|
||||||
new CenterPositionInit(self.CenterPosition),
|
new CenterPositionInit(self.CenterPosition),
|
||||||
new OwnerInit(self.Owner),
|
new OwnerInit(self.Owner),
|
||||||
|
new RaceInit(race),
|
||||||
new SkipMakeAnimsInit()
|
new SkipMakeAnimsInit()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly string[] TransformSounds = { };
|
public readonly string[] TransformSounds = { };
|
||||||
public readonly string[] NoTransformSounds = { };
|
public readonly string[] NoTransformSounds = { };
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new Transforms(init.self, this); }
|
public virtual object Create(ActorInitializer init) { return new Transforms(init, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Transforms : IIssueOrder, IResolveOrder, IOrderVoice
|
class Transforms : IIssueOrder, IResolveOrder, IOrderVoice
|
||||||
@@ -33,12 +33,14 @@ namespace OpenRA.Mods.RA
|
|||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
readonly TransformsInfo info;
|
readonly TransformsInfo info;
|
||||||
readonly BuildingInfo bi;
|
readonly BuildingInfo bi;
|
||||||
|
readonly string race;
|
||||||
|
|
||||||
public Transforms(Actor self, TransformsInfo info)
|
public Transforms(ActorInitializer init, TransformsInfo info)
|
||||||
{
|
{
|
||||||
this.self = self;
|
self = init.self;
|
||||||
this.info = info;
|
this.info = info;
|
||||||
bi = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>();
|
bi = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>();
|
||||||
|
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.Race;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string VoicePhraseForOrder(Actor self, Order order)
|
public string VoicePhraseForOrder(Actor self, Order order)
|
||||||
@@ -90,7 +92,7 @@ namespace OpenRA.Mods.RA
|
|||||||
if (rb != null && self.Info.Traits.Get<RenderBuildingInfo>().HasMakeAnimation)
|
if (rb != null && self.Info.Traits.Get<RenderBuildingInfo>().HasMakeAnimation)
|
||||||
self.QueueActivity(new MakeAnimation(self, true, () => rb.PlayCustomAnim(self, "make")));
|
self.QueueActivity(new MakeAnimation(self, true, () => rb.PlayCustomAnim(self, "make")));
|
||||||
|
|
||||||
self.QueueActivity(new Transform(self, info.IntoActor) { Offset = (CVec)info.Offset, Facing = info.Facing, Sounds = info.TransformSounds });
|
self.QueueActivity(new Transform(self, info.IntoActor) { Offset = (CVec)info.Offset, Facing = info.Facing, Sounds = info.TransformSounds, Race = race });
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
|
|||||||
Reference in New Issue
Block a user