Example #1
0
        public static Job JobLoadShipCargo(Pawn p, ShipBase ship)
        {
            if (p.jobs.jobQueue.Any(x => x.job.def == ShipNamespaceDefOfs.LoadContainerMultiplePawns))
            {
                return(null);
            }
            Thing thing = LoadShipCargoUtility.FindThingToLoad(p, ship);
            TransferableOneWay transferable = TransferableUtility.TransferableMatchingDesperate(thing, ship.compShip.leftToLoad);

            if (thing != null && transferable != null)
            {
                int thingCount = transferable.CountToTransfer;
                if (thingCount < 0)
                {
                    thingCount = 1;
                }
                return(new Job(ShipNamespaceDefOfs.LoadContainerMultiplePawns, thing, ship)
                {
                    count = thingCount,
                    ignoreForbidden = true,
                    playerForced = true
                });
            }

            else
            {
                Log.Message("No Transferable found.");
            }
            return(null);
        }
        public static Job JobLoadShipCargo(Pawn p, ShipBase ship)
        {
            Thing thing = LoadShipCargoUtility.FindThingToLoad(p, ship);

            if (thing != null)
            {
                return(new Job(ShipNamespaceDefOfs.LoadContainerMultiplePawns, thing, ship)
                {
                    count = Mathf.Min(TransferableUtility.TransferableMatching <TransferableOneWay>(thing, ship.compShip.leftToLoad).countToTransfer, thing.stackCount),
                    ignoreForbidden = true
                });
            }
            return(null);
        }
 public static bool HasJobOnShip(Pawn pawn, ShipBase ship)
 {
     return(!ship.IsForbidden(pawn) && ship.compShip.AnythingLeftToLoad && pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation) && pawn.CanReserveAndReach(ship, PathEndMode.Touch, pawn.NormalMaxDanger(), 10) && LoadShipCargoUtility.FindThingToLoad(pawn, ship) != null);
 }