initial plugin before git init

This commit is contained in:
Valentijn
2026-05-30 14:24:45 +02:00
commit d589d77934
21 changed files with 4114 additions and 0 deletions

56
Patches/LeverPatch.cs Normal file
View File

@@ -0,0 +1,56 @@
using HarmonyLib;
using UnityEngine;
using UnityEngine.InputSystem;
namespace LaunchConfirm;
[HarmonyPatch(typeof(StartMatchLever))]
public class LeverPatch
{
private static LungProp? _cachedApparatus;
[HarmonyPostfix]
[HarmonyPatch("Update")]
private static void UpdatePostfix(StartMatchLever __instance)
{
// prevent weird null references
if (__instance == null || __instance.triggerScript == null) return;
if (StartOfRound.Instance == null || RoundManager.Instance == null) return;
if (StartOfRound.Instance.inShipPhase)
{
__instance.triggerScript.hoverTip = "Pull lever : [Land Ship]";
_cachedApparatus = null; // clear api for next round
return;
}
// caching the apparatus to prevent polling it EVERY FUCKING FRAME
if (_cachedApparatus == null)
{
_cachedApparatus = Object.FindObjectOfType<LungProp>();
}
// Checking if its actually been pulled.
bool isApparatusPulled;
if (_cachedApparatus != null)
{
isApparatusPulled = _cachedApparatus.isInShipRoom;
} else {
isApparatusPulled = true; // cant find the apparatus
}
if (!isApparatusPulled)
{
__instance.triggerScript.hoverTip = "Pull lever : [Start Ship]\n<color=#FF0000>WARNING: Launching without Apparatus in the Ship!</color>";
}
else
{
__instance.triggerScript.hoverTip = "Pull lever : [Start Ship]";
}
}
}