Exemplo n.º 1
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Job  result = null;
            Pawn mech   = t as Pawn;

            if (mech != null && HaulAIUtility.PawnCanAutomaticallyHaulFast(pawn, t, forced))
            {
                Building_HackingTable closestAvailableTable = Utilities.GetAvailableHackingTable(pawn, mech);

                if (closestAvailableTable != null && !mech.OnHackingTable())
                {
                    result = new Job(WTH_DefOf.WTH_CarryToHackingTable, t, closestAvailableTable)
                    {
                        count = 1
                    };
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        static bool Prefix(Pawn p, ref Building_Bed __result)
        {
            if (!p.RaceProps.IsMechanoid || p.Map == null)
            {
                return(true);
            }
            if (p.jobs.curDriver == null || ((p.CurJob.def != WTH_DefOf.WTH_Mechanoid_Rest) && p.jobs.posture != PawnPosture.LayingInBed))
            {
                return(true);
            }
            List <Thing> thingList = p.Position.GetThingList(p.Map);



            if (!p.IsHacked())
            {
                Building_HackingTable hackingTable = null;
                for (int i = 0; i < thingList.Count; i++)
                {
                    hackingTable = (thingList[i] as Building_HackingTable);
                    if (hackingTable != null)
                    {
                        break;
                    }
                }
                if (hackingTable == null)
                {
                    return(true);
                }

                if (hackingTable.GetCurOccupant(Building_HackingTable.SLOTINDEX) == p)
                {
                    __result = hackingTable;
                    return(false);
                }
            }
            else
            {
                Building_BaseMechanoidPlatform mechanoidPlatform = null;
                for (int i = 0; i < thingList.Count; i++)
                {
                    mechanoidPlatform = (thingList[i] as Building_BaseMechanoidPlatform);
                    if (mechanoidPlatform != null)
                    {
                        break;
                    }
                }
                if (mechanoidPlatform == null)
                {
                    return(true);
                }

                if (mechanoidPlatform.GetCurOccupant(Building_BaseMechanoidPlatform.SLOTINDEX) == p)
                {
                    __result = mechanoidPlatform;
                    return(false);
                }
            }

            return(true);
        }