-
-
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.
Added compat for Vanilla Temperature Expanded (#436)
The compat required a new sync worker for Vanilla Expanded Framework (for `PipeNet`) - specifically, the link/unlink interaction. It could technically be achieved differently (don't sync the pipe net but get it from the `Thing`), but this was the simplest solution and could come in handy if we ever need to sync `PipeNet` again in the future. Likely the last, or one of the last 1.4 PRs from me.
- Loading branch information
1 parent
8f8aa1a
commit dd62f75
Showing
2 changed files
with
133 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
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 Multiplayer.API; | ||
using Verse; | ||
|
||
namespace Multiplayer.Compat; | ||
|
||
/// <summary>Vanilla Temperature Expanded by Oskar Potocki, xrushha, Arquebus, Taranchuk</summary> | ||
/// <see href="https://github.com/Vanilla-Expanded/VanillaTemperatureExpanded"/> | ||
/// <see href="https://steamcommunity.com/sharedfiles/filedetails/?id=3202046258"/> | ||
[MpCompatFor("VanillaExpanded.Temperature")] | ||
public class VanillaTemperatureExpanded | ||
{ | ||
public VanillaTemperatureExpanded(ModContentPack mod) | ||
{ | ||
LongEventHandler.ExecuteWhenFinished(LatePatch); | ||
|
||
// Unlink/relink | ||
MpCompat.RegisterLambdaDelegate("VanillaTemperatureExpanded.Comps.CompAcTempControl", nameof(ThingComp.CompGetGizmosExtra), 0); | ||
} | ||
|
||
private static void LatePatch() | ||
{ | ||
var type = AccessTools.TypeByName("VanillaTemperatureExpanded.Buildings.Building_AcControlUnit"); | ||
// Change temperature by +/- 1/10 | ||
MP.RegisterSyncMethod(type, "InterfaceChangeTargetNetworkTemperature"); | ||
// Reset temperature | ||
MP.RegisterSyncMethodLambda(type, nameof(Thing.GetGizmos), 2); | ||
} | ||
} |