Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions Source/ProjectRimFactory/Common/GatherThingsUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static IEnumerable<IntVec3> InputCells(this Building building)
/// <summary>
/// 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.
/// </summary>
/// <returns>The items in cell <paramref name="c"/> for use.</returns>
/// <param name="c">Cell</param>
Expand All @@ -36,24 +36,20 @@ public static IEnumerable<Thing> 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<Thing> owner)
{
if (holder.GetDirectlyHeldThings() is not ThingOwner<Thing> 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
Expand Down