diff --git a/Source/ProjectRimFactory/Storage/Building_ColdStorage.cs b/Source/ProjectRimFactory/Storage/Building_ColdStorage.cs index 8e286352..14cd44cf 100644 --- a/Source/ProjectRimFactory/Storage/Building_ColdStorage.cs +++ b/Source/ProjectRimFactory/Storage/Building_ColdStorage.cs @@ -57,7 +57,7 @@ public abstract class Building_ColdStorage : Building, IRenameBuilding, IHaulDes { private static readonly Texture2D RenameTex = ContentFinder.Get("UI/Buttons/Rename"); - private ThingOwner thingOwner = new ThingOwner(); + protected ThingOwner thingOwner = new ThingOwner(); private List items => thingOwner.InnerListForReading; @@ -147,17 +147,19 @@ public virtual string GetITabString(int itemsSelected) public virtual void RegisterNewItem(Thing newItem) { - - Log.Message($"RegisterNewItem: {newItem}"); if (items.Contains(newItem)) { Log.Message($"dup: {newItem}"); return; } - for (var i = 0; i < items.Count; i++) + + var items_arr = items.ToArray(); + for (var i = 0; i < items_arr.Length; i++) { - var item = items[i]; - if (item.def.category == ThingCategory.Item && item.CanStackWith(newItem)) + var item = items_arr[i]; + //CanStackWith is already called by TryAbsorbStack... + //Is the Item Check really needed? + if (item.def.category == ThingCategory.Item) item.TryAbsorbStack(newItem, true); if (newItem.Destroyed) break; } diff --git a/Source/ProjectRimFactory/Storage/Building_ColdStoragePowerd.cs b/Source/ProjectRimFactory/Storage/Building_ColdStoragePowerd.cs index 814476b5..73478702 100644 --- a/Source/ProjectRimFactory/Storage/Building_ColdStoragePowerd.cs +++ b/Source/ProjectRimFactory/Storage/Building_ColdStoragePowerd.cs @@ -54,6 +54,7 @@ public override void Tick() { UpdatePowerConsumption(); } + thingOwner.ThingOwnerTick(); } public override void PostMapInit() diff --git a/Source/ProjectRimFactory/Storage/Building_StorageUnitIOPort.cs b/Source/ProjectRimFactory/Storage/Building_StorageUnitIOPort.cs index f9a23cd0..60126729 100644 --- a/Source/ProjectRimFactory/Storage/Building_StorageUnitIOPort.cs +++ b/Source/ProjectRimFactory/Storage/Building_StorageUnitIOPort.cs @@ -460,19 +460,11 @@ public override StorageIOMode IOMode public override void Notify_ReceivedThing(Thing newItem) { base.Notify_ReceivedThing(newItem); - if (mode == StorageIOMode.Input) - { - RefreshInput(); - } } public override void Notify_LostThing(Thing newItem) { base.Notify_LostThing(newItem); - if (mode == StorageIOMode.Output) - { - RefreshOutput(); - } } public override void RefreshInput()