mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
Changes for mod policies
This commit is contained in:
1 parent
3d85b70004
commit
1996110ed5
3 files changed
+5
-131
No files matched your search
@@ -1,46 +0,0 @@
|
||||
using HarmonyLib;
|
||||
|
||||
namespace BetterAmongUs.Patches;
|
||||
|
||||
internal class ButtonsPatch
|
||||
{
|
||||
// Handle EFC
|
||||
[HarmonyPatch(typeof(SabotageButton))]
|
||||
internal class SabotageButtonPatch
|
||||
{
|
||||
[HarmonyPatch(nameof(SabotageButton.DoClick))]
|
||||
[HarmonyPrefix]
|
||||
public static bool DoClick_Prefix(SabotageButton __instance)
|
||||
{
|
||||
if (PlayerControl.LocalPlayer.Data.Role.IsImpostor && GameManager.Instance.SabotagesEnabled())
|
||||
{
|
||||
DestroyableSingleton<HudManager>.Instance.ToggleMapVisible(new MapOptions
|
||||
{
|
||||
Mode = MapOptions.Modes.Sabotage
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
[HarmonyPatch(nameof(SabotageButton.Refresh))]
|
||||
[HarmonyPrefix]
|
||||
public static bool Refresh_Prefix(SabotageButton __instance)
|
||||
{
|
||||
if (GameManager.Instance == null || PlayerControl.LocalPlayer == null)
|
||||
{
|
||||
__instance.ToggleVisible(false);
|
||||
__instance.SetDisabled();
|
||||
return false;
|
||||
}
|
||||
if (!GameManager.Instance.SabotagesEnabled() || PlayerControl.LocalPlayer.petting)
|
||||
{
|
||||
__instance.ToggleVisible(PlayerControl.LocalPlayer.Data.Role.IsImpostor && GameManager.Instance.SabotagesEnabled());
|
||||
__instance.SetDisabled();
|
||||
return false;
|
||||
}
|
||||
__instance.SetEnabled();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,92 +9,12 @@ public class MiniMapBehaviourPatch
|
||||
[HarmonyPatch(typeof(MapBehaviour))]
|
||||
class MapBehaviourPatch
|
||||
{
|
||||
[HarmonyPatch(nameof(MapBehaviour.Awake))]
|
||||
[HarmonyPostfix]
|
||||
public static void Awake_Postfix(MapBehaviour __instance)
|
||||
{
|
||||
PoolablePlayer NewDisplay = __instance.HerePoint.gameObject.AddComponent<PoolablePlayer>();
|
||||
if (NewDisplay != null)
|
||||
{
|
||||
NewDisplay.SetBodyCosmeticsVisible(true);
|
||||
}
|
||||
}
|
||||
[HarmonyPatch(nameof(MapBehaviour.Show))]
|
||||
[HarmonyPrefix]
|
||||
public static bool Show_Prefix(MapBehaviour __instance, ref MapOptions opts)
|
||||
{
|
||||
if (__instance.IsOpen)
|
||||
{
|
||||
__instance.Close();
|
||||
return false;
|
||||
}
|
||||
if (!PlayerControl.LocalPlayer.CanMove && !PlayerControl.LocalPlayer.IsInVent() && !PlayerControl.LocalPlayer.onLadder && !PlayerControl.LocalPlayer.inMovingPlat && !GameStates.IsMeeting)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
switch (opts.Mode)
|
||||
{
|
||||
case MapOptions.Modes.Normal:
|
||||
__instance.ShowNormalMap();
|
||||
break;
|
||||
case MapOptions.Modes.CountOverlay:
|
||||
__instance.ShowCountOverlay(opts.AllowMovementWhileMapOpen, opts.ShowLivePlayerPosition, opts.IncludeDeadBodies);
|
||||
break;
|
||||
case MapOptions.Modes.Sabotage:
|
||||
__instance.ShowSabotageMap();
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
[HarmonyPatch(nameof(MapBehaviour.ShowNormalMap))]
|
||||
[HarmonyPrefix]
|
||||
public static bool ShowNormalMap_Prefix(MapBehaviour __instance)
|
||||
{
|
||||
if (__instance.IsOpen)
|
||||
{
|
||||
__instance.Close();
|
||||
return false;
|
||||
}
|
||||
if (!PlayerControl.LocalPlayer.CanMove && !PlayerControl.LocalPlayer.IsInVent() && !PlayerControl.LocalPlayer.onLadder && !PlayerControl.LocalPlayer.inMovingPlat && !GameStates.IsMeeting)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
PlayerControl.LocalPlayer.SetPlayerMaterialColors(__instance.HerePoint);
|
||||
if (PlayerControl.LocalPlayer.isTrackingPlayer)
|
||||
{
|
||||
if (PlayerControl.LocalPlayer.trackedPlayer.Data.Disconnected)
|
||||
{
|
||||
__instance.TrackedHerePoint.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance.SetTrackedHerePointColor(PlayerControl.LocalPlayer.trackedPlayerColorID);
|
||||
__instance.TrackedHerePoint.gameObject.SetActive(true);
|
||||
__instance.UpdateTrackedPosition();
|
||||
}
|
||||
}
|
||||
__instance.GenericShow();
|
||||
__instance.taskOverlay.Show();
|
||||
__instance.ColorControl.SetColor(new Color(0.05f, 0.6f, 1f, 1f));
|
||||
DestroyableSingleton<HudManager>.Instance.SetHudActive(false);
|
||||
return false;
|
||||
}
|
||||
[HarmonyPostfix]
|
||||
public static void ShowNormalMap_Postfix(MapBehaviour __instance) => __instance.ColorControl.SetColor(new Color(0.05f, 0.6f, 1f, 1f));
|
||||
[HarmonyPatch(nameof(MapBehaviour.ShowSabotageMap))]
|
||||
[HarmonyPrefix]
|
||||
public static bool ShowSabotageMap_Prefix(MapBehaviour __instance)
|
||||
{
|
||||
if (!PlayerControl.LocalPlayer.CanMove && !PlayerControl.LocalPlayer.IsInVent() && !PlayerControl.LocalPlayer.onLadder && !PlayerControl.LocalPlayer.inMovingPlat)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
PlayerControl.LocalPlayer.SetPlayerMaterialColors(__instance.HerePoint);
|
||||
__instance.GenericShow();
|
||||
__instance.infectedOverlay.gameObject.SetActive(true);
|
||||
__instance.taskOverlay.Show();
|
||||
__instance.ColorControl.SetColor(new Color(1f, 0.3f, 0f, 1f));
|
||||
return false;
|
||||
}
|
||||
[HarmonyPostfix]
|
||||
public static void ShowSabotageMap_Postfix(MapBehaviour __instance) => __instance.ColorControl.SetColor(new Color(1f, 0.3f, 0f, 1f));
|
||||
[HarmonyPatch(nameof(MapBehaviour.ShowCountOverlay))]
|
||||
[HarmonyPostfix]
|
||||
public static void ShowCountOverlay_Postfix(MapBehaviour __instance) => __instance.ColorControl.SetColor(new Color(0.2f, 0.5f, 0f, 1f));
|
||||
|
||||
@@ -10,7 +10,7 @@ public class ModManagerPatch
|
||||
[HarmonyPostfix]
|
||||
public static void LateUpdate_Postfix(ModManager __instance)
|
||||
{
|
||||
// __instance.ShowModStamp();
|
||||
__instance.ShowModStamp();
|
||||
|
||||
if (__instance.ModStamp.gameObject.active == true)
|
||||
__instance.ModStamp.GetComponent<SpriteRenderer>().sprite = Utils.LoadSprite("BetterAmongUs.Resources.Images.BetterAmongUs-Mod.png", 250f);
|
||||
|
||||
Reference in new issue
Block a user