diff --git a/Source/ProjectRimFactory/Common/HarmonyPatches/Patch_Pawn_TraderTracker_ColonyThingsWillingToBuy.cs b/Source/ProjectRimFactory/Common/HarmonyPatches/Patch_Pawn_TraderTracker_ColonyThingsWillingToBuy.cs new file mode 100644 index 00000000..77e42d08 --- /dev/null +++ b/Source/ProjectRimFactory/Common/HarmonyPatches/Patch_Pawn_TraderTracker_ColonyThingsWillingToBuy.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using HarmonyLib; +using ProjectRimFactory.Storage; +using RimWorld; +using Verse; + +namespace ProjectRimFactory.Common.HarmonyPatches +{ + [HarmonyPatch(typeof(Pawn_TraderTracker), "ColonyThingsWillingToBuy")] + class Patch_Pawn_TraderTracker_ColonyThingsWillingToBuy + { + static void Postfix(Pawn playerNegotiator, ref IEnumerable __result) + { + var map = playerNegotiator.Map; + if (map is null) return; + + HashSet yieldedThings = new HashSet(); + yieldedThings.AddRange(__result); + foreach (ILinkableStorageParent dsu in TradePatchHelper.AllPowered(map)) + { + //Only for Cold Storage + if (dsu.AdvancedIOAllowed) continue; + + yieldedThings.AddRange(dsu.StoredItems); + } + __result = yieldedThings; + + } + + } +} diff --git a/Source/ProjectRimFactory/Storage/Building_ColdStorage.cs b/Source/ProjectRimFactory/Storage/Building_ColdStorage.cs index ff7d540c..94283647 100644 --- a/Source/ProjectRimFactory/Storage/Building_ColdStorage.cs +++ b/Source/ProjectRimFactory/Storage/Building_ColdStorage.cs @@ -141,7 +141,7 @@ public override void ExposeData() { base.ExposeData(); Scribe_Collections.Look(ref ports, "ports", LookMode.Reference); - Scribe_Deep.Look(ref this.thingOwner, "thingowner"); + Scribe_Deep.Look(ref this.thingOwner, "thingowner",this); Scribe_Values.Look(ref uniqueName, "uniqueName"); Scribe_Deep.Look(ref settings, "settings", this); ModExtension_Crate ??= def.GetModExtension();