-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#612 added support for local Trading
fixed issue with exposing ThingOwner
- Loading branch information
1 parent
a3c4090
commit 2e0e230
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...jectRimFactory/Common/HarmonyPatches/Patch_Pawn_TraderTracker_ColonyThingsWillingToBuy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Thing> __result) | ||
{ | ||
var map = playerNegotiator.Map; | ||
if (map is null) return; | ||
|
||
HashSet<Thing> yieldedThings = new HashSet<Thing>(); | ||
yieldedThings.AddRange<Thing>(__result); | ||
foreach (ILinkableStorageParent dsu in TradePatchHelper.AllPowered(map)) | ||
{ | ||
//Only for Cold Storage | ||
if (dsu.AdvancedIOAllowed) continue; | ||
|
||
yieldedThings.AddRange<Thing>(dsu.StoredItems); | ||
} | ||
__result = yieldedThings; | ||
|
||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters