Fix for Same Room Lovin' compatibility
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -14,15 +14,15 @@ public static class PrepatcherFields
|
||||
[PrepatcherField]
|
||||
[ValueInitializer(nameof(CreateGeneList))]
|
||||
public static extern List<Gene> GenesToTick(this Pawn_GeneTracker geneTracker);
|
||||
|
||||
// [PrepatcherField]
|
||||
// [ValueInitializer(nameof(CreateGeneList))]
|
||||
// public static extern List<Gene> EndogenesToTick(this Pawn_GeneTracker geneTracker);
|
||||
|
||||
[PrepatcherField]
|
||||
[ValueInitializer(nameof(CreateWorldPawnsCache))]
|
||||
public static extern ref WorldPawnsOptimization.Cache Cache(this WorldPawns worldPawns);
|
||||
|
||||
[PrepatcherField]
|
||||
[ValueInitializer(nameof(CreateBedHashSet))]
|
||||
public static extern HashSet<Building_Bed> UniqueContainedBeds(this Room room);
|
||||
|
||||
#if false
|
||||
[PrepatcherField]
|
||||
[ValueInitializer(nameof(CreateHediffList))]
|
||||
@@ -33,4 +33,5 @@ public static class PrepatcherFields
|
||||
|
||||
public static List<Gene> CreateGeneList() => new();
|
||||
public static WorldPawnsOptimization.Cache CreateWorldPawnsCache() => new();
|
||||
public static HashSet<Building_Bed> CreateBedHashSet() => new();
|
||||
}
|
||||
@@ -207,16 +207,21 @@ public class RoomOptimizations : ClassWithFishPatches, IHasDescription
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static IEnumerable<Building_Bed> ContainedBeds_Replacement(Room instance)
|
||||
{
|
||||
var uniqueContainedBeds = instance.UniqueContainedBeds();
|
||||
uniqueContainedBeds.Clear();
|
||||
|
||||
var regions = instance.Regions;
|
||||
for (var i = 0; i < regions.Count; i++)
|
||||
for (var i = regions.Count; i-- > 0;)
|
||||
{
|
||||
var beds = regions[i].ListerThings.listsByGroup[(int)ThingRequestGroup.Bed];
|
||||
if (beds is null)
|
||||
continue;
|
||||
|
||||
for (var j = 0; j < beds.Count; j++)
|
||||
yield return (Building_Bed)beds[j];
|
||||
for (var j = beds.Count; j-- > 0;)
|
||||
uniqueContainedBeds.Add((Building_Bed)beds[j]);
|
||||
}
|
||||
|
||||
return uniqueContainedBeds;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user