public UnloadCargo(Actor self, bool unloadAll) { this.self = self; cargo = self.Trait<Cargo>(); cloak = self.TraitOrDefault<Cloak>(); this.unloadAll = unloadAll; }
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>(); }
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 }
public EnterTransport(Actor self, Actor transport) { this.transport = transport; cargo = transport.Trait<Cargo>(); }
public bool Reserve(Actor self, Cargo cargo) { Unreserve(self); if (!cargo.ReserveSpace(self)) return false; ReservedCargo = cargo; return true; }
bool CanEnter(Cargo cargo) { return cargo != null && cargo.HasSpace(Info.Weight); }
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>(); }