mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-19 15:51:52 +00:00
Disable sabotaging locally as host
This commit is contained in:
1 parent
fcc57f9a9b
commit
a172f97696
2 files changed
+37
-21
No files matched your search
@@ -489,27 +489,6 @@ internal static class NetworkManager
|
||||
[HarmonyPatch]
|
||||
internal static class MessageReaderUpdateSystemPatch
|
||||
{
|
||||
[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.UpdateSystem), typeof(SystemTypes), typeof(PlayerControl), typeof(byte))]
|
||||
[HarmonyPrefix]
|
||||
internal static bool ShipStatus_UpdateSystemLocal_Prefix(SystemTypes systemType, PlayerControl player, byte amount)
|
||||
{
|
||||
if (!GameState.IsFreePlay) return true;
|
||||
|
||||
MessageWriter messageWriter = MessageWriter.Get(0);
|
||||
messageWriter.Write(amount);
|
||||
MessageReader messageReader = MessageReader.Get(messageWriter.ToByteArray(false));
|
||||
messageWriter.Recycle();
|
||||
|
||||
if (BetterAntiCheat.RpcUpdateSystemCheck(player, systemType, messageReader) != true)
|
||||
{
|
||||
messageReader.Recycle();
|
||||
return false;
|
||||
}
|
||||
messageReader.Recycle();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.UpdateSystem), typeof(SystemTypes), typeof(PlayerControl), typeof(MessageReader))]
|
||||
[HarmonyPrefix]
|
||||
internal static bool ShipStatus_UpdateSystem_Prefix(SystemTypes systemType, PlayerControl player, MessageReader msgReader)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using BetterAmongUs.Helpers;
|
||||
using BetterAmongUs.Modules;
|
||||
using BetterAmongUs.Patches.Gameplay.UI.Settings;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace BetterAmongUs.Patches.Gameplay.Ship;
|
||||
|
||||
[HarmonyPatch]
|
||||
internal static class DisableSabotagePatch
|
||||
{
|
||||
[HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageReactor))]
|
||||
[HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageHeli))]
|
||||
[HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageComms))]
|
||||
[HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageOxygen))]
|
||||
[HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageLights))]
|
||||
[HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageSeismic))]
|
||||
[HarmonyPatch(typeof(MapRoom), nameof(MapRoom.SabotageMushroomMixup))]
|
||||
[HarmonyPrefix]
|
||||
internal static bool MapRoom_Sabotage_Prefix()
|
||||
{
|
||||
if (GameState.IsHost)
|
||||
{
|
||||
if (BetterGameSettings.DisableSabotages.GetBool())
|
||||
return false;
|
||||
|
||||
if (BetterGameSettings.DisableSabotagesForDead.GetBool())
|
||||
{
|
||||
if (!PlayerControl.LocalPlayer.IsAlive())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user