示例#1
0
 public UnloadSharedCargo(Actor self, bool unloadAll)
 {
     this.self      = self;
     cargo          = self.Trait <SharedCargo>();
     notifiers      = self.TraitsImplementing <INotifyUnload>().ToArray();
     this.unloadAll = unloadAll;
 }
 public WithSharedCargoPipsDecoration(Actor self, WithSharedCargoPipsDecorationInfo info)
     : base(self, info)
 {
     cargo    = self.Trait <SharedCargo>();
     pipCount = info.PipCount > 0 ? info.PipCount : cargo.Manager.Info.MaxWeight;
     pips     = new Animation(self.World, info.Image);
 }
示例#3
0
 public EnterSharedTransport(Actor self, Actor transport, int maxTries = 0, bool repathWhileMoving = true)
     : base(self, transport, EnterBehaviour.Exit, maxTries, repathWhileMoving)
 {
     this.transport = transport;
     cargo          = transport.Trait <SharedCargo>();
     passenger      = self.Trait <SharedPassenger>();
 }
 public UnloadSharedCargo(Actor self, Target destination, WDist unloadRange, bool unloadAll = true)
 {
     this.self        = self;
     cargo            = self.Trait <SharedCargo>();
     notifiers        = self.TraitsImplementing <INotifyUnload>().ToArray();
     this.unloadAll   = unloadAll;
     aircraft         = self.TraitOrDefault <Aircraft>();
     mobile           = self.TraitOrDefault <Mobile>();
     this.destination = destination;
     this.unloadRange = unloadRange;
 }
示例#5
0
        protected override bool TryStartEnter(Actor self, Actor targetActor)
        {
            enterActor = targetActor;
            enterCargo = targetActor.TraitOrDefault <SharedCargo>();

            // Make sure we can still enter the transport
            // (but not before, because this may stop the actor in the middle of nowhere)
            if (enterCargo == null || !passenger.Reserve(self, enterCargo))
            {
                Cancel(self, true);
                return(false);
            }

            return(true);
        }