From e60c055c4294b4aed9d4f1ae2340c1b150a086ed Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sat, 19 Jun 2021 12:14:45 +0100 Subject: [PATCH] added test patches --- QSB/ShipSync/Patches/ShipPatches.cs | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/QSB/ShipSync/Patches/ShipPatches.cs b/QSB/ShipSync/Patches/ShipPatches.cs index 19aa3253..8bc031f8 100644 --- a/QSB/ShipSync/Patches/ShipPatches.cs +++ b/QSB/ShipSync/Patches/ShipPatches.cs @@ -16,6 +16,10 @@ namespace QSB.ShipSync.Patches Prefix(nameof(HatchController_OnEntry)); Prefix(nameof(ShipTractorBeamSwitch_OnTriggerExit)); Prefix(nameof(InteractZone_UpdateInteractVolume)); + Prefix(nameof(ShipElectricalComponent_OnEnterShip)); + Prefix(nameof(ShipElectricalComponent_OnExitShip)); + Prefix(nameof(ElectricalSystem_SetPowered)); + Prefix(nameof(ElectricalComponent_SetPowered)); } public static bool HatchController_OnPressInteract() @@ -81,5 +85,41 @@ namespace QSB.ShipSync.Patches return false; } + + public static bool ShipElectricalComponent_OnEnterShip(ShipElectricalComponent __instance, bool ____damaged, ElectricalSystem ____electricalSystem) + { + __instance.CallBase("OnEnterShip"); + if (!____damaged) + { + DebugLog.DebugWrite($"ShipElectricalComponent - OnEnterShip"); + ____electricalSystem.SetPowered(true); + } + + return false; + } + + public static bool ShipElectricalComponent_OnExitShip(ShipElectricalComponent __instance, bool ____damaged, ElectricalSystem ____electricalSystem) + { + __instance.CallBase("OnExitShip"); + if (!____damaged) + { + DebugLog.DebugWrite($"ShipElectricalComponent - OnExitShip"); + ____electricalSystem.SetPowered(false); + } + + return false; + } + + public static bool ElectricalSystem_SetPowered(ElectricalSystem __instance, bool powered) + { + DebugLog.DebugWrite($"[SYSTEM] {__instance.name} set powered {powered}"); + return true; + } + + public static bool ElectricalComponent_SetPowered(ElectricalComponent __instance, bool powered) + { + DebugLog.DebugWrite($"[COMPONENT] {__instance.name} set powered {powered}"); + return true; + } } }