Skip to content

Commit

Permalink
Add indicators for unusable vents in hide and seek mode
Browse files Browse the repository at this point in the history
Related to SubmergedAmongUs#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.
  • Loading branch information
AmongUsafk committed May 18, 2024
1 parent 9741a92 commit 9f72758
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Submerged/Map/Patches/HideAndSeekPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vent>() 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<SpriteRenderer>();
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;
}
}
}

0 comments on commit 9f72758

Please sign in to comment.