diff --git a/Source/ProjectRimFactory/Common/GatherThingsUtility.cs b/Source/ProjectRimFactory/Common/GatherThingsUtility.cs index 98e5d986..08a5e566 100644 --- a/Source/ProjectRimFactory/Common/GatherThingsUtility.cs +++ b/Source/ProjectRimFactory/Common/GatherThingsUtility.cs @@ -22,7 +22,7 @@ public static IEnumerable InputCells(this Building building) /// /// WARNING MAY CONTAIN DUPLICATES /// A list of items a PRF building might want to use as input resources, either on the ground, - /// in storage, or on coveyor belts. + /// in storage, or on conveyor belts. /// /// The items in cell for use. /// Cell @@ -36,24 +36,20 @@ public static IEnumerable AllThingsInCellForUse(this IntVec3 c, Map map, if (!c.InBounds(map)) yield break; var thingList = map.thingGrid.ThingsListAt(c); - //Risk for duplicate entrys if a cell contins both a Item & a IThingHolder that holds said item + //Risk for duplicate entry's if a cell contains both an Item & a IThingHolder that holds said item for (int i = thingList.Count - 1; i >= 0; i--) { - Thing t = thingList[i]; - if (t is Building && t is IThingHolder holder && !(t is Frame)) + var t = thingList[i]; + if (t is Building and IThingHolder holder and not Frame + && holder.GetDirectlyHeldThings() is ThingOwner owner) { - if (holder.GetDirectlyHeldThings() is not ThingOwner owner) continue; - if (t is Building_BeltConveyor belt && belt.IsUnderground && !allowUGBelts) + switch (t) { - // It the target is an Underground Belt & wen don't Explicitly allow that then don't place anything - continue; - } - - if (t is Building_BeltConveyorUGConnector { ToUnderground: true }) - { - if (!allowUGEntranceConnector) { - continue; // Don't allow Entrance unless specifically allowed - } + // If the target is an Underground Belt & when don't Explicitly allow that then don't place anything + case Building_BeltConveyor { IsUnderground: true } when !allowUGBelts: + // Don't allow Entrance unless specifically allowed + case Building_BeltConveyorUGConnector { ToUnderground: true } when !allowUGEntranceConnector: + continue; } // Exits should always be allowed