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]
|
[PrepatcherField]
|
||||||
[ValueInitializer(nameof(CreateGeneList))]
|
[ValueInitializer(nameof(CreateGeneList))]
|
||||||
public static extern List<Gene> GenesToTick(this Pawn_GeneTracker geneTracker);
|
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]
|
[PrepatcherField]
|
||||||
[ValueInitializer(nameof(CreateWorldPawnsCache))]
|
[ValueInitializer(nameof(CreateWorldPawnsCache))]
|
||||||
public static extern ref WorldPawnsOptimization.Cache Cache(this WorldPawns worldPawns);
|
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
|
#if false
|
||||||
[PrepatcherField]
|
[PrepatcherField]
|
||||||
[ValueInitializer(nameof(CreateHediffList))]
|
[ValueInitializer(nameof(CreateHediffList))]
|
||||||
@@ -33,4 +33,5 @@ public static class PrepatcherFields
|
|||||||
|
|
||||||
public static List<Gene> CreateGeneList() => new();
|
public static List<Gene> CreateGeneList() => new();
|
||||||
public static WorldPawnsOptimization.Cache CreateWorldPawnsCache() => 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)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static IEnumerable<Building_Bed> ContainedBeds_Replacement(Room instance)
|
public static IEnumerable<Building_Bed> ContainedBeds_Replacement(Room instance)
|
||||||
{
|
{
|
||||||
|
var uniqueContainedBeds = instance.UniqueContainedBeds();
|
||||||
|
uniqueContainedBeds.Clear();
|
||||||
|
|
||||||
var regions = instance.Regions;
|
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];
|
var beds = regions[i].ListerThings.listsByGroup[(int)ThingRequestGroup.Bed];
|
||||||
if (beds is null)
|
if (beds is null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (var j = 0; j < beds.Count; j++)
|
for (var j = beds.Count; j-- > 0;)
|
||||||
yield return (Building_Bed)beds[j];
|
uniqueContainedBeds.Add((Building_Bed)beds[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return uniqueContainedBeds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user