-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compat for Vanilla Recycling Expanded (#426)
- Loading branch information
1 parent
f6d2048
commit f310845
Showing
1 changed file
with
35 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using HarmonyLib; | ||
using Multiplayer.API; | ||
using RimWorld; | ||
using Verse; | ||
|
||
namespace Multiplayer.Compat; | ||
|
||
/// <summary>Vanilla Recycling Expanded by OskarPotocki, Sarg Bjornson, xrushha</summary> | ||
[MpCompatFor("VanillaExpanded.Recycling")] | ||
public class VanillaRecyclingExpanded | ||
{ | ||
public VanillaRecyclingExpanded(ModContentPack mod) | ||
{ | ||
MpCompatPatchLoader.LoadPatch(this); | ||
|
||
var type = AccessTools.TypeByName("VanillaRecyclingExpanded.CompBiopackDissolution"); | ||
// Dev: Single dissolution event (0), dissolution events until destroyed (1), +25% dissolution progress | ||
MpCompat.RegisterLambdaMethod(type, nameof(ThingComp.CompGetGizmosExtra), 0, 1, 2).SetDebugOnly(); | ||
// Dev: Set next dissolve time | ||
MP.RegisterSyncDelegateLambda(type, nameof(ThingComp.CompGetGizmosExtra), 4).SetDebugOnly(); | ||
|
||
type = AccessTools.TypeByName("VanillaRecyclingExpanded.CompSuperSimpleProcessor"); | ||
MP.RegisterSyncMethod(type, "EjectContents"); | ||
// In interface only called as dev mode command | ||
MP.RegisterSyncMethod(type, "DoAtomize").SetDebugOnly(); | ||
// Toggle auto load | ||
MP.RegisterSyncMethodLambda(type, nameof(ThingComp.CompGetGizmosExtra), 1); | ||
// Dev: Set next processing time | ||
MP.RegisterSyncDelegateLambda(type, nameof(ThingComp.CompGetGizmosExtra), 3).SetDebugOnly(); | ||
} | ||
|
||
// Stop methods from running (most likely after syncing) when it would cause errors or other issues. | ||
[MpCompatPrefix("VanillaRecyclingExpanded.CompBiopackDissolution", "TriggerDissolutionEvent")] | ||
private static bool PreDoAtomize(CompThingContainer __instance) => __instance.ContainedThing is { stackCount: > 0 }; | ||
} |