From 9f727583923375f160fa3918843177bb8bf7439c Mon Sep 17 00:00:00 2001 From: GameTechGuides <161961980+GameTechGuides@users.noreply.github.com> Date: Sat, 18 May 2024 10:16:14 +0100 Subject: [PATCH] Add indicators for unusable vents in hide and seek mode Related to #134 Implements visual indicators for unusable vents in hide and seek mode. - Adds logic to display a wet floor sign at the admin vent and caution tape at central vents during hide and seek mode. - Ensures these indicators are only visible in hide and seek mode to maintain gameplay clarity without affecting other modes. - Utilizes the `LogicUsablesHnS` class to check if a vent is usable by a player, and if not, changes the sprite to the appropriate indicator based on the vent's ID. --- Submerged/Map/Patches/HideAndSeekPatches.cs | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Submerged/Map/Patches/HideAndSeekPatches.cs b/Submerged/Map/Patches/HideAndSeekPatches.cs index 7432040..6f30ca1 100644 --- a/Submerged/Map/Patches/HideAndSeekPatches.cs +++ b/Submerged/Map/Patches/HideAndSeekPatches.cs @@ -66,4 +66,31 @@ public static bool DisplaySpawnInBeforeGameStartsPatch(IntroCutscene_CoBegin __i return true; } } + + // Add logic to display indicators for unusable vents during hide and seek mode + [HarmonyPatch(typeof(LogicUsablesHnS), nameof(LogicUsablesHnS.CanUse))] + [HarmonyPostfix] + public static void MarkUnusableVentsPatch(ref bool __result, [HarmonyArgument(0)] IUsable usable, [HarmonyArgument(1)] PlayerControl player) + { + if (!ShipStatus.Instance.IsSubmerged()) return; + if (!GameManager.Instance.IsHideAndSeek()) return; + + // Check if the usable is a vent and if it's one of the vents that should be marked as unusable + if (usable.TryCast() is { } vent && (vent.Id == UPPER_CENTRAL_VENT_ID || vent.Id == LOWER_CENTRAL_VENT_ID || vent.Id == ADMIN_VENT_ID)) + { + // Display the wet floor sign for the admin vent and caution tape for central vents + SpriteRenderer ventRenderer = vent.GetComponent(); + if (vent.Id == ADMIN_VENT_ID) + { + ventRenderer.sprite = AssetLoader.GetSprite("WetFloorSign"); + } + else + { + ventRenderer.sprite = AssetLoader.GetSprite("CautionTape"); + } + + // Ensure the indicators are only visible in hide and seek mode + __result = false; + } + } }