コード例 #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);
        }
コード例 #2
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            ShipBase ship = (ShipBase)pawn.mindState.duty.focus;

            if (LoadShipCargoUtility.HasJobOnShip(pawn, ship))
            {
                return(LoadShipCargoUtility.JobLoadShipCargo(pawn, ship));
            }

            return(null);
        }
コード例 #3
0
 private void InterfaceDrop(Thing thing, ShipBase ship)
 {
     ship.GetDirectlyHeldThings().TryDrop(thing, ThingPlaceMode.Near, out thing);
     if (thing is Pawn)
     {
         Pawn pawn     = (Pawn)thing;
         Lord LoadLord = LoadShipCargoUtility.FindLoadLord(ship, ship.Map);
         if (LoadLord != null)
         {
             LoadLord.ownedPawns.Remove(pawn);
         }
     }
 }
コード例 #4
0
        public void TryRemoveLord(Map map)
        {
            Lord lord = LoadShipCargoUtility.FindLoadLord(ship, map);

            if (lord != null)
            {
                for (int i = 0; i < lord.ownedPawns.Count; i++)
                {
                    lord.ownedPawns[i].jobs.EndCurrentJob(Verse.AI.JobCondition.InterruptForced);
                    //     lord.ownedPawns[i].ClearMind();
                }
                map.lordManager.RemoveLord(lord);
            }
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            ShipBase ship = (ShipBase)pawn.mindState.duty.focus;

            if (LoadShipCargoUtility.HasJobOnShip(pawn, ship))
            {
                Job job = LoadShipCargoUtility.JobLoadShipCargo(pawn, ship);
                if (job != null)
                {
                    //Log.Message("Giving job to " + pawn.Name);
                    return(job);
                }
            }
            return(null);
        }
コード例 #7
0
        public void TryRemoveLord(Map map)
        {
            List <Pawn> pawns = new List <Pawn>();
            Lord        lord  = LoadShipCargoUtility.FindLoadLord(ship, map);

            if (lord != null)
            {
                pawns.AddRange(lord.ownedPawns);
                map.lordManager.RemoveLord(lord);
            }

            foreach (Pawn p in pawns)
            {
                Lord lord1 = p.GetLord();
            }
        }
コード例 #8
0
ファイル: CompShip.cs プロジェクト: madmax3004/OHU-Dropships
 public void TryRemoveLord(Map map)
 {
     if (map != null)
     {
         List <Pawn> pawns = new List <Pawn>();
         Lord        lord  = LoadShipCargoUtility.FindLoadLord(ship, map);
         if (lord != null)
         {
             foreach (Pawn p in pawns)
             {
                 lord.Notify_PawnLost(p, PawnLostCondition.LeftVoluntarily);
             }
             map.lordManager.RemoveLord(lord);
         }
     }
 }
コード例 #9
0
 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);
 }