Exemplo n.º 1
0
 public UnloadCargo(Actor self, bool unloadAll)
 {
     this.self = self;
     cargo = self.Trait<Cargo>();
     cloak = self.TraitOrDefault<Cloak>();
     this.unloadAll = unloadAll;
 }
Exemplo n.º 2
0
 public EnterTransport(Actor self, Actor transport, int maxTries = 0, bool targetCenter = false)
     : base(self, transport, EnterBehaviour.Exit, maxTries, targetCenter)
 {
     this.transport = transport;
     this.maxTries = maxTries;
     cargo = transport.Trait<Cargo>();
     passenger = self.Trait<Passenger>();
 }
Exemplo n.º 3
0
 protected override bool TryGetAlternateTarget(Actor self, int tries, ref Target target)
 {
     if (tries > maxTries)
         return false;
     var type = target.Actor.Info.Name;
     return TryGetAlternateTargetInCircle(
         self, passenger.Info.AlternateTransportScanRange,
         t => { transport = t.Actor; cargo = t.Actor.Trait<Cargo>(); }, // update transport and cargo
         a => { var c = a.TraitOrDefault<Cargo>(); return c != null && c.Info.Types.Contains(passenger.Info.CargoType) && (c.Unloading || c.CanLoad(a, self)); },
         new Func<Actor, bool>[] { a => a.Info.Name == type }); // Prefer transports of the same type
 }
Exemplo n.º 4
0
 public EnterTransport(Actor self, Actor transport)
 {
     this.transport = transport;
     cargo = transport.Trait<Cargo>();
 }
Exemplo n.º 5
0
 public bool Reserve(Actor self, Cargo cargo)
 {
     Unreserve(self);
     if (!cargo.ReserveSpace(self))
         return false;
     ReservedCargo = cargo;
     return true;
 }
Exemplo n.º 6
0
 bool CanEnter(Cargo cargo)
 {
     return cargo != null && cargo.HasSpace(Info.Weight);
 }
Exemplo n.º 7
0
 public void Unreserve(Actor self)
 {
     if (ReservedCargo == null)
         return;
     ReservedCargo.UnreserveSpace(self);
     ReservedCargo = null;
 }
		void INotifyCreated.Created(Actor self)
		{
			gainsExp = self.TraitOrDefault<GainsExperience>();
			cargo = self.TraitOrDefault<Cargo>();
		}