Skip to content

Commit

Permalink
Add Mushrooms group to GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
scp222thj committed Dec 27, 2023
1 parent 5365837 commit 396d4a9
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 60 deletions.
18 changes: 0 additions & 18 deletions src/ESP/EspMushroomPatches.cs

This file was deleted.

64 changes: 64 additions & 0 deletions src/Mushrooms/MushroomPatches.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using HarmonyLib;

namespace MalumMenu;

[HarmonyPatch(typeof(Mushroom), nameof(Mushroom.FixedUpdate))]
public static class Mushrooms_SporeCloudVisionPostfix
{
public static void Postfix(Mushroom __instance)
{
if (CheatSettings.sporeVision)
{
__instance.sporeMask.transform.position = new UnityEngine.Vector3(__instance.sporeMask.transform.position.x, __instance.sporeMask.transform.position.y, -1);
return;
}

__instance.sporeMask.transform.position = new UnityEngine.Vector3(__instance.sporeMask.transform.position.x, __instance.sporeMask.transform.position.y, 5f);
}
}

[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.FixedUpdate))]
public static class Mushrooms_MushroomMixupPostfix
{
//Postfix patch of ShipStatus.FixedUpdate to sabotage different systems
public static void Postfix(ShipStatus __instance)
{
if (CheatSettings.mushSab){
byte currentMapID = Utils.getCurrentMapID();

if (currentMapID == 5){ //MushroomMixup only works on Fungle
__instance.RpcUpdateSystem(SystemTypes.MushroomMixupSabotage, 1); //Sabotage MushroomMixup
}else{
HudManager.Instance.Notifier.AddItem("Mushrooms not present on this map");
}

CheatSettings.mushSab = false; //Button behaviour
}

}
}

[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.FixedUpdate))]
public static class Mushrooms_SporeTriggerPostfix
{
public static void Postfix(FungleShipStatus __instance)
{
if (CheatSettings.mushSpore)
{
byte currentMapID = Utils.getCurrentMapID();
if (currentMapID == 5)
{
foreach (Mushroom mushroom in __instance.sporeMushrooms.Values)
{
PlayerControl.LocalPlayer.CmdCheckSporeTrigger(mushroom);
}
}
else
{
HudManager.Instance.Notifier.AddItem("Mushrooms not present on this map");
}

CheatSettings.mushSpore = false;
}
}
}
36 changes: 0 additions & 36 deletions src/Sabotage/SabotagePatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,6 @@ public static void Postfix(ShipStatus __instance)

CheatSettings.oxygenSab = false; //Button behaviour

}else if (CheatSettings.mushSab){
if (currentMapID == 5){ //MushroomMixup only works on Fungle
__instance.RpcUpdateSystem(SystemTypes.MushroomMixupSabotage, 1); //Sabotage MushroomMixup
}else{
HudManager.Instance.Notifier.AddItem("MushroomMixup not possible on this map");
}

CheatSettings.mushSab = false; //Button behaviour


}else if (CheatSettings.commsSab){ //Communications sabotages

if (currentMapID == 1 || currentMapID == 5){ //MiraHQ and Fungle use HqHudSystemType to sabotage communications
Expand Down Expand Up @@ -193,30 +183,4 @@ public static void Postfix(ShipStatus __instance)
CheatSettings.blackOut = false;
}
}
}


[HarmonyPatch(typeof(ShipStatus), nameof(ShipStatus.FixedUpdate))]
public static class MushroomSporePostfix
{
public static void Postfix(FungleShipStatus __instance)
{
if (CheatSettings.mushSpore)
{
byte currentMapID = Utils.getCurrentMapID();
if (currentMapID == 5)
{
foreach (Mushroom mushroom in __instance.sporeMushrooms.Values)
{
PlayerControl.LocalPlayer.CmdCheckSporeTrigger(mushroom);
}
}
else
{
HudManager.Instance.Notifier.AddItem("Mushrooms not present on this map");
}

CheatSettings.mushSpore = false;
}
}
}
9 changes: 6 additions & 3 deletions src/UI/CheatSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ public struct CheatSettings
public static bool elecSab;
public static bool reactorSab;
public static bool oxygenSab;
public static bool mushSab;
public static bool mushSpore;

//Meetings
public static bool closeMeeting;
Expand All @@ -58,11 +56,16 @@ public struct CheatSettings
public static bool ventVision;


//Host-Only
//Mushrooms
public static bool godMode;
public static bool evilVote;
public static bool voteImmune;

//Host-Only
public static bool mushSab;
public static bool mushSpore;
public static bool sporeVision;

//Passive
public static bool unlockFeatures = true;
public static bool freeCosmetics = true;
Expand Down
10 changes: 7 additions & 3 deletions src/UI/MenuUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ private void Start()
new ToggleInfo(" Reactor", () => CheatSettings.reactorSab, x => CheatSettings.reactorSab = x),
new ToggleInfo(" Oxygen", () => CheatSettings.oxygenSab, x => CheatSettings.oxygenSab = x),
new ToggleInfo(" Electrical", () => CheatSettings.elecSab, x => CheatSettings.elecSab = x),
new ToggleInfo(" Comms", () => CheatSettings.commsSab, x => CheatSettings.commsSab = x),
new ToggleInfo(" MushroomMixup", () => CheatSettings.mushSab, x => CheatSettings.mushSab = x),
new ToggleInfo(" SporesTrigger", () => CheatSettings.mushSpore, x => CheatSettings.mushSpore = x)
new ToggleInfo(" Comms", () => CheatSettings.commsSab, x => CheatSettings.commsSab = x)
}));

groups.Add(new GroupInfo("Vents", false, new List<ToggleInfo>() {
Expand All @@ -74,6 +72,12 @@ private void Start()
new ToggleInfo(" CallMeeting", () => CheatSettings.callMeeting, x => CheatSettings.callMeeting = x)
}));

groups.Add(new GroupInfo("Mushrooms", false, new List<ToggleInfo>() {
new ToggleInfo(" MushroomMixup", () => CheatSettings.mushSab, x => CheatSettings.mushSab = x),
new ToggleInfo(" SporesTrigger", () => CheatSettings.mushSpore, x => CheatSettings.mushSpore = x),
new ToggleInfo(" SporeCloudVision", () => CheatSettings.sporeVision, x => CheatSettings.sporeVision = x),
}));

groups.Add(new GroupInfo("Host-Only", false, new List<ToggleInfo>() {
new ToggleInfo(" ImpostorHack", () => CheatSettings.impostorHack, x => CheatSettings.impostorHack = x),
new ToggleInfo(" Godmode", () => CheatSettings.godMode, x => CheatSettings.godMode = x),
Expand Down

0 comments on commit 396d4a9

Please sign in to comment.