Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optifine like zoom #166

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Cheats/MalumESP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ public static bool fullBrightActive()
return CheatToggles.fullBright || Camera.main.orthographicSize > 3f || Camera.main.gameObject.GetComponent<FollowerCamera>().Target != PlayerControl.LocalPlayer;
}

public static void zoomToggle(HudManager hudManager)
{
// Funktion to zoom out 2 times
Camera.main.orthographicSize++;
hudManager.UICamera.orthographicSize++;
Camera.main.orthographicSize++;
hudManager.UICamera.orthographicSize++;
}

public static void zoomOut(HudManager hudManager)
{
if(CheatToggles.zoomOut){
Expand Down
6 changes: 6 additions & 0 deletions src/MalumMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public partial class MalumMenu : BasePlugin
public static ConfigEntry<string> guestFriendCode;
public static ConfigEntry<bool> guestMode;
public static ConfigEntry<bool> noTelemetry;
public static ConfigEntry<string> ToggleZoom;

public override void Load()
{
Expand Down Expand Up @@ -72,6 +73,11 @@ public override void Load()
true,
"When enabled it will stop Among Us from collecting analytics of your games and sending them to Innersloth using Unity Analytics");

ToggleZoom = Config.Bind("MalumMenu.Cheats",
"ToggleZoom",
"c",
"The keyboard key used to toggle the zoom hack on on press and off on release. List of supported keycodes: https://docs.unity3d.com/Packages/[email protected]/api/Unity.Tiny.Input.KeyCode.html");



Harmony.PatchAll();
Expand Down
16 changes: 16 additions & 0 deletions src/UI/MenuUI.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using UnityEngine;
using System.Collections.Generic;
using System;
using JetBrains.Annotations;

namespace MalumMenu;
public class MenuUI : MonoBehaviour
Expand All @@ -10,6 +12,7 @@ public class MenuUI : MonoBehaviour
private Rect windowRect = new Rect(10, 10, 300, 500);
private bool isGUIActive = false;
private GUIStyle submenuButtonStyle;


// Create all groups (buttons) and their toggles on start
private void Start()
Expand Down Expand Up @@ -147,6 +150,19 @@ private void Update(){
windowRect.position = new Vector2(mousePosition.x, Screen.height - mousePosition.y);
}

if (Input.GetKeyDown(Utils.stringToKeycode(MalumMenu.ToggleZoom.Value)) && DestroyableSingleton<HudManager>.Instance.Chat.IsClosedOrClosing)
{
// Toggle zoom hack with c key
CheatToggles.zoomOut = true;

// Also zoom out 2 times for immediate use and easy usablity
MalumESP.zoomToggle(DestroyableSingleton<HudManager>.Instance);
}
else if (Input.GetKeyUp(Utils.stringToKeycode(MalumMenu.ToggleZoom.Value)) && DestroyableSingleton<HudManager>.Instance.Chat.IsClosedOrClosing)
{
CheatToggles.zoomOut = false;
}

//Passive cheats are always on to avoid problems
CheatToggles.unlockFeatures = CheatToggles.freeCosmetics = CheatToggles.avoidBans = true;

Expand Down