mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
13e184be32
1 file changed
-76
@@ -76,82 +76,6 @@ public static class DleksPatch
|
||||
}
|
||||
#endif
|
||||
|
||||
[HarmonyPatch(typeof(Vent), nameof(Vent.SetButtons))]
|
||||
public static class VentSetButtonsPatch
|
||||
{
|
||||
public static bool ShowButtons;
|
||||
|
||||
// Fix arrows buttons in vent on Dleks map and "Index was outside the bounds of the array" errors
|
||||
private static bool Prefix( /*Vent __instance,*/ [HarmonyArgument(0)] ref bool enabled)
|
||||
{
|
||||
if (Main.CurrentMap == MapNames.Dleks && Main.IntroDestroyed)
|
||||
{
|
||||
enabled = false;
|
||||
if (GameStates.IsMeeting) ShowButtons = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void Postfix(Vent __instance, [HarmonyArgument(0)] bool enabled)
|
||||
{
|
||||
if (Main.CurrentMap != MapNames.Dleks) return;
|
||||
|
||||
if (enabled || !Main.IntroDestroyed) return;
|
||||
|
||||
bool setActive = ShowButtons || (!PlayerControl.LocalPlayer.inVent && !GameStates.IsMeeting);
|
||||
|
||||
switch (__instance.Id)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
__instance.Buttons[0].gameObject.SetActive(setActive);
|
||||
__instance.Buttons[1].gameObject.SetActive(setActive);
|
||||
break;
|
||||
case 7:
|
||||
case 12:
|
||||
case 13:
|
||||
__instance.Buttons[0].gameObject.SetActive(setActive);
|
||||
break;
|
||||
case 4:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
__instance.Buttons[1].gameObject.SetActive(setActive);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Vent), nameof(Vent.TryMoveToVent))]
|
||||
internal static class VentTryMoveToVentPatch
|
||||
{
|
||||
// Update arrows buttons when player move to vents
|
||||
private static void Postfix(Vent __instance, [HarmonyArgument(0)] Vent otherVent)
|
||||
{
|
||||
if (__instance == null || otherVent == null || Main.CurrentMap != MapNames.Dleks) return;
|
||||
|
||||
VentSetButtonsPatch.ShowButtons = true;
|
||||
VentSetButtonsPatch.Postfix(otherVent, false);
|
||||
VentSetButtonsPatch.ShowButtons = false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Vent), nameof(Vent.UpdateArrows))]
|
||||
internal static class VentUpdateArrowsPatch
|
||||
{
|
||||
// Fixes "Index was outside the bounds of the array" errors when arrows updates in vent on Dleks map
|
||||
private static bool Prefix()
|
||||
{
|
||||
return Main.CurrentMap != MapNames.Dleks;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(StringOption), nameof(StringOption.Start))]
|
||||
public static class AutoselectDleksPatch
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user