Exemple #1
0
        public static int TotalHeldItemsStack(this SlotGroup slotGroup)
        {
            if (slotGroup == null)
            {
                return(0);
            }

            return(slotGroup.HeldThings.Where(x => StoreUtility.IsInValidStorage(x)).Sum(y => y.stackCount));
        }
Exemple #2
0
        // Token: 0x06000009 RID: 9 RVA: 0x0000211C File Offset: 0x0000031C
        public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (pawn.Map.designationManager.DesignationOn(t, TrapsDefOf.TR_RearmTrap) == null)
            {
                return(false);
            }
            LocalTargetInfo localTargetInfo = t;

            if (!ReservationUtility.CanReserve(pawn, localTargetInfo, 1, -1, null, forced))
            {
                return(false);
            }
            List <Thing> thingList = GridsUtility.GetThingList(t.Position, t.Map);

            for (int i = 0; i < thingList.Count; i++)
            {
                if (thingList[i] != t && thingList[i].def.category == ThingCategory.Item && (ForbidUtility.IsForbidden(thingList[i], pawn) || StoreUtility.IsInValidStorage(thingList[i]) || !HaulAIUtility.CanHaulAside(pawn, thingList[i], out IntVec3 intVec)))
                {
                    return(false);
                }
            }
            return(true);
        }