Set actor race (and icons) based on active producer.
This commit is contained in:
@@ -24,18 +24,21 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("e.g. Infantry, Vehicles, Aircraft, Buildings")]
|
||||
public readonly string[] Produces = { };
|
||||
|
||||
public virtual object Create(ActorInitializer init) { return new Production(this, init.Self); }
|
||||
public virtual object Create(ActorInitializer init) { return new Production(init, this); }
|
||||
}
|
||||
|
||||
public class Production
|
||||
{
|
||||
Lazy<RallyPoint> rp;
|
||||
readonly Lazy<RallyPoint> rp;
|
||||
|
||||
public ProductionInfo Info;
|
||||
public Production(ProductionInfo info, Actor self)
|
||||
public string Race { get; private set; }
|
||||
|
||||
public Production(ActorInitializer init, ProductionInfo info)
|
||||
{
|
||||
Info = info;
|
||||
rp = Exts.Lazy(() => self.IsDead ? null : self.TraitOrDefault<RallyPoint>());
|
||||
rp = Exts.Lazy(() => init.Self.IsDead ? null : init.Self.TraitOrDefault<RallyPoint>());
|
||||
Race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race;
|
||||
}
|
||||
|
||||
public void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo, string raceVariant)
|
||||
|
||||
Reference in New Issue
Block a user