Skip to content

Commit 8a0751e

Browse files
committed
Small improvements
1 parent 5c83069 commit 8a0751e

File tree

4 files changed

+32
-13
lines changed

4 files changed

+32
-13
lines changed

src/RPCExploit/MassMedScanPatch.cs renamed to src/RPCExploit/AllMedScanPatch.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
namespace MalumMenu;
44

55
[HarmonyPatch(typeof(PlayerPhysics), nameof(PlayerPhysics.LateUpdate))]
6-
public static class MassMedScan_PlayerPhysics_LateUpdate_Postfix
6+
public static class AllMedScan_PlayerPhysics_LateUpdate_Postfix
77
{
88
//Postfix patch of PlayerPhysics.LateUpdate to play the MedBay scan animation for all players
99
public static bool isActive;
1010
public static void Postfix(PlayerPhysics __instance){
11-
if (CheatToggles.massMedScan != isActive)
11+
if (CheatToggles.allMedScan != isActive)
1212
{
1313
var HostData = AmongUsClient.Instance.GetHost();
1414
if (HostData != null && !HostData.Character.Data.Disconnected){
@@ -17,13 +17,13 @@ public static void Postfix(PlayerPhysics __instance){
1717
foreach (var recipient in PlayerControl.AllPlayerControls)
1818
{
1919
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(sender.NetId, (byte)RpcCalls.SetScanner, SendOption.None, AmongUsClient.Instance.GetClientIdFromCharacter(recipient));
20-
writer.Write(CheatToggles.massMedScan);
20+
writer.Write(CheatToggles.allMedScan);
2121
AmongUsClient.Instance.FinishRpcImmediately(writer);
2222
}
2323
}
2424
}
2525

26-
isActive = CheatToggles.massMedScan;
26+
isActive = CheatToggles.allMedScan;
2727
}
2828
}
2929
}

src/RPCExploit/TeleportPatches.cs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,33 @@ namespace MalumMenu;
88
[HarmonyPatch(typeof(PlayerPhysics), nameof(PlayerPhysics.LateUpdate))]
99
public static class TeleportCursor_PlayerPhysics_LateUpdate_Postfix
1010
{
11-
// Postfix patch of PlayerPhysics.LateUpdate to teleport to cursor position on right-click
11+
private static bool previousTeleportMeCursorState = false;
12+
private static bool previousTeleportAllCursorState = false;
13+
14+
// Postfix patch of PlayerPhysics.LateUpdate to teleport players to cursor position on right-click
1215
public static void Postfix(PlayerPhysics __instance)
1316
{
14-
if (Input.GetMouseButtonDown(1))
17+
//Code to make sure only one of these cheats is enabled at a time
18+
if (CheatToggles.teleportMeCursor && !previousTeleportMeCursorState)
19+
{
20+
CheatToggles.teleportAllCursor = false;
21+
previousTeleportMeCursorState = true;
22+
previousTeleportAllCursorState = false;
23+
}
24+
else if (CheatToggles.teleportAllCursor && !previousTeleportAllCursorState)
1525
{
16-
if (CheatToggles.teleportMeCursor)
26+
CheatToggles.teleportMeCursor = false;
27+
previousTeleportAllCursorState = true;
28+
previousTeleportMeCursorState = false;
29+
}
30+
31+
if (Input.GetMouseButtonDown(1)) //Register right-click
32+
{
33+
if (CheatToggles.teleportMeCursor) //Teleport LocalPlayer to cursor position
1734
{
1835
Utils.TeleportPlayer(PlayerControl.LocalPlayer, Camera.main.ScreenToWorldPoint(Input.mousePosition));
1936
}
20-
else if (CheatToggles.teleportAllCursor)
37+
else if (CheatToggles.teleportAllCursor) //Teleport all players to cursor position
2138
{
2239
foreach (var item in PlayerControl.AllPlayerControls)
2340
{
@@ -80,7 +97,7 @@ public static void Postfix(PlayerPhysics __instance){
8097
[HarmonyPatch(typeof(PlayerPhysics), nameof(PlayerPhysics.LateUpdate))]
8198
public static class TeleportAllPlayer_PlayerPhysics_LateUpdate_Postfix
8299
{
83-
//Postfix patch of PlayerPhysics.LateUpdate to open player pick menu to teleport to player
100+
//Postfix patch of PlayerPhysics.LateUpdate to open player pick menu to teleport all players to one player
84101
public static bool isActive;
85102
public static void Postfix(PlayerPhysics __instance){
86103
if (CheatToggles.teleportAllPlayer){
@@ -104,7 +121,9 @@ public static void Postfix(PlayerPhysics __instance){
104121
Utils_PlayerPickMenu.openPlayerPickMenu(playerList, (Action) (() =>
105122
{
106123
foreach (var item in PlayerControl.AllPlayerControls){
107-
Utils.TeleportPlayer(item, Utils_PlayerPickMenu.targetPlayer.transform.position);
124+
if (item.PlayerId != Utils_PlayerPickMenu.targetPlayer.PlayerId){
125+
Utils.TeleportPlayer(item, Utils_PlayerPickMenu.targetPlayer.transform.position);
126+
}
108127
}
109128

110129
}));

src/UI/CheatToggles.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public struct CheatToggles
1818

1919
//RPC Exploit
2020
public static bool kickPlayer;
21-
public static bool massMedScan;
21+
public static bool allMedScan;
2222
public static bool reportBody;
2323
public static bool murderPlayer;
2424
public static bool murderAll;

src/UI/MenuUI.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private void Start()
5757
groups.Add(new GroupInfo("RPC Exploit", false, new List<ToggleInfo>() {
5858
new ToggleInfo(" KickPlayer", () => CheatToggles.kickPlayer, x => CheatToggles.kickPlayer = x),
5959
new ToggleInfo(" ReportBody", () => CheatToggles.reportBody, x => CheatToggles.reportBody = x),
60-
new ToggleInfo(" MassMedScan", () => CheatToggles.massMedScan, x => CheatToggles.massMedScan = x),
60+
new ToggleInfo(" All MedScan", () => CheatToggles.allMedScan, x => CheatToggles.allMedScan = x),
6161
}, new List<SubmenuInfo> {
6262
new SubmenuInfo("Teleport", false, new List<ToggleInfo>() {
6363
new ToggleInfo(" Me to Cursor", () => CheatToggles.teleportMeCursor, x => CheatToggles.teleportMeCursor = x),
@@ -170,7 +170,7 @@ private void Update(){
170170
}
171171

172172
if(!CheatChecks.isPlayer){
173-
CheatToggles.copyPlayerFC = CheatToggles.massMedScan = CheatToggles.copyPlayerPUID = CheatToggles.spamChat = CheatToggles.chatMimic = CheatToggles.spectate = CheatToggles.freeCam = CheatToggles.kickPlayer = CheatToggles.murderPlayer = CheatToggles.mimicOutfit = CheatToggles.mimicAllOutfits = false;
173+
CheatToggles.copyPlayerFC = CheatToggles.allMedScan = CheatToggles.copyPlayerPUID = CheatToggles.spamChat = CheatToggles.chatMimic = CheatToggles.spectate = CheatToggles.freeCam = CheatToggles.kickPlayer = CheatToggles.murderPlayer = CheatToggles.mimicOutfit = CheatToggles.mimicAllOutfits = false;
174174
}
175175
}
176176

0 commit comments

Comments
 (0)