public WithGarrisonPipsDecoration(Actor self, WithGarrisonPipsDecorationInfo info) : base(self, info) { garrisonable = self.Trait <Garrisonable>(); pipCount = info.PipCount > 0 ? info.PipCount : garrisonable.Info.MaxWeight; pips = new Animation(self.World, info.Image); }
public UnloadGarrison(Actor self, Target destination, WDist unloadRange, bool unloadAll = true) { this.self = self; garrison = self.Trait <Garrisonable>(); notifiers = self.TraitsImplementing <INotifyUnload>().ToArray(); this.unloadAll = unloadAll; aircraft = self.TraitOrDefault <Aircraft>(); mobile = self.TraitOrDefault <Mobile>(); this.destination = destination; this.unloadRange = unloadRange; }
protected bool TryStartEnter(Actor self, Actor targetActor) { enterActor = targetActor; enterGarrison = targetActor.TraitOrDefault <Garrisonable>(); enterAircraft = targetActor.TraitOrDefault <Aircraft>(); // Make sure we can still enter the transport // (but not before, because this may stop the actor in the middle of nowhere) if (enterGarrison == null || enterGarrison.IsTraitDisabled || enterGarrison.IsTraitPaused || !garrisoner.Reserve(self, enterGarrison)) { Cancel(self, true); return(false); } if (enterAircraft != null && !enterAircraft.AtLandAltitude) { return(false); } return(true); }