-
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.
Added WealthWatcher Patch (may be toggeld) Added support for Orbital Trading Fixed issue when creating ThingOwner Fixed Typos in Conditional Patches Fixed Null ref issue for DSU Moved code to better locations
- Loading branch information
1 parent
c859320
commit 647622e
Showing
12 changed files
with
219 additions
and
81 deletions.
There are no files selected for viewing
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
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
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
41 changes: 41 additions & 0 deletions
41
Source/ProjectRimFactory/Common/HarmonyPatches/Patch_TradeDeal_InSellablePosition.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,41 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using RimWorld; | ||
using HarmonyLib; | ||
using Verse; | ||
using ProjectRimFactory.Storage; | ||
using System.Reflection.Emit; | ||
using System.Reflection; | ||
|
||
namespace ProjectRimFactory.Common.HarmonyPatches | ||
{ | ||
|
||
[HarmonyPatch(typeof(TradeDeal), "InSellablePosition")] | ||
class Patch_TradeDeal_InSellablePosition | ||
{ | ||
public static bool Prefix(Thing t, out string reason, ref bool __result) | ||
{ | ||
if (!t.Spawned) | ||
{ | ||
var buildings = PatchStorageUtil.GetPRFMapComponent(t.MapHeld).ColdStorageBuildings; | ||
foreach(var building in buildings) | ||
{ | ||
if (building.StoredItems.Contains(t)) | ||
{ | ||
reason = null; | ||
__result = true; | ||
return false; | ||
} | ||
} | ||
} | ||
|
||
reason = null; | ||
return true; | ||
} | ||
|
||
|
||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Source/ProjectRimFactory/Common/HarmonyPatches/Patch_WealthWatcher_CalculateWealthItems.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,29 @@ | ||
using HarmonyLib; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ProjectRimFactory.Common.HarmonyPatches | ||
{ | ||
/// <summary> | ||
/// Patch to ensure Items in Cold Storage Contribute to Wealth | ||
/// 1k Items ~ 1ms (every 5k Ticks) | ||
/// </summary> | ||
class Patch_WealthWatcher_CalculateWealthItems | ||
{ | ||
|
||
public static void Postfix(Verse.Map ___map, ref float __result) | ||
{ | ||
var buildings = PatchStorageUtil.GetPRFMapComponent(___map).ColdStorageBuildings; | ||
var cnt = buildings.Count; | ||
for(int i = 0; i < cnt; i++) | ||
{ | ||
var building = buildings[i]; | ||
__result += building.GetItemWealth(); | ||
} | ||
|
||
} | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.