コード例 #1
0
ファイル: RestUtility.cs プロジェクト: sachdevs/RW-Decompile
 public static IntVec3 GetBedSleepingSlotPosFor(Pawn pawn, Building_Bed bed)
 {
     for (int i = 0; i < bed.owners.Count; i++)
     {
         if (bed.owners[i] == pawn)
         {
             return(bed.GetSleepingSlotPos(i));
         }
     }
     for (int j = 0; j < bed.SleepingSlotsCount; j++)
     {
         Pawn curOccupant = bed.GetCurOccupant(j);
         if ((j >= bed.owners.Count || bed.owners[j] == null) && curOccupant == pawn)
         {
             return(bed.GetSleepingSlotPos(j));
         }
     }
     for (int k = 0; k < bed.SleepingSlotsCount; k++)
     {
         Pawn curOccupant2 = bed.GetCurOccupant(k);
         if ((k >= bed.owners.Count || bed.owners[k] == null) && curOccupant2 == null)
         {
             return(bed.GetSleepingSlotPos(k));
         }
     }
     Log.Error("Could not find good sleeping slot position for " + pawn + ". Perhaps AnyUnoccupiedSleepingSlot check is missing somewhere.");
     return(bed.GetSleepingSlotPos(0));
 }
コード例 #2
0
ファイル: RestUtility.cs プロジェクト: sachdevs/RW-Decompile
        public static Building_Bed CurrentBed(this Pawn p)
        {
            if (!p.Spawned || p.CurJob == null || p.jobs.curDriver.layingDown != LayingDownState.LayingInBed)
            {
                return(null);
            }
            Building_Bed building_Bed = null;
            List <Thing> thingList    = p.Position.GetThingList(p.Map);

            for (int i = 0; i < thingList.Count; i++)
            {
                building_Bed = (thingList[i] as Building_Bed);
                if (building_Bed != null)
                {
                    break;
                }
            }
            if (building_Bed == null)
            {
                return(null);
            }
            for (int j = 0; j < building_Bed.SleepingSlotsCount; j++)
            {
                if (building_Bed.GetCurOccupant(j) == p)
                {
                    return(building_Bed);
                }
            }
            return(null);
        }
コード例 #3
0
 public static Building_Bed CurrentBed(this Pawn p)
 {
     if (p.Spawned && p.CurJob != null && p.jobs.curDriver.layingDown == LayingDownState.LayingInBed)
     {
         Building_Bed building_Bed = null;
         List <Thing> thingList    = p.Position.GetThingList(p.Map);
         int          num          = 0;
         while (num < thingList.Count)
         {
             building_Bed = (thingList[num] as Building_Bed);
             if (building_Bed == null)
             {
                 num++;
                 continue;
             }
             break;
         }
         if (building_Bed == null)
         {
             return(null);
         }
         for (int i = 0; i < building_Bed.SleepingSlotsCount; i++)
         {
             if (building_Bed.GetCurOccupant(i) == p)
             {
                 return(building_Bed);
             }
         }
         return(null);
     }
     return(null);
 }
コード例 #4
0
        public static Building_Bed CurrentBed(this Pawn p)
        {
            Building_Bed result;

            if (!p.Spawned || p.CurJob == null || p.GetPosture() != PawnPosture.LayingInBed)
            {
                result = null;
            }
            else
            {
                Building_Bed building_Bed = null;
                List <Thing> thingList    = p.Position.GetThingList(p.Map);
                for (int i = 0; i < thingList.Count; i++)
                {
                    building_Bed = (thingList[i] as Building_Bed);
                    if (building_Bed != null)
                    {
                        break;
                    }
                }
                if (building_Bed == null)
                {
                    result = null;
                }
                else
                {
                    for (int j = 0; j < building_Bed.SleepingSlotsCount; j++)
                    {
                        if (building_Bed.GetCurOccupant(j) == p)
                        {
                            return(building_Bed);
                        }
                    }
                    result = null;
                }
            }
            return(result);
        }