From 261f098f2d1c51599042d33e2039b3ef631b9eac Mon Sep 17 00:00:00 2001 From: ALittlePatate Date: Sat, 4 Mar 2023 09:47:43 +0100 Subject: [PATCH] optimizations, OnUpdate is faster now Player.IsInGame() only called once instead of 7 in the OnUpdate function --- DevourClient/MelonMain.cs | 59 +++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/DevourClient/MelonMain.cs b/DevourClient/MelonMain.cs index 298e9fd..ad791e4 100644 --- a/DevourClient/MelonMain.cs +++ b/DevourClient/MelonMain.cs @@ -90,22 +90,42 @@ namespace DevourClient Settings.Settings.menu_enable = !Settings.Settings.menu_enable; } - if (flashlight_toggle && Player.IsInGame() && !fullbright) + if (Player.IsInGame()) { - Hacks.Misc.BigFlashlight(false); - } - else if (!flashlight_toggle && Player.IsInGame() && !fullbright) - { - Hacks.Misc.BigFlashlight(true); - } + if (flashlight_toggle && !fullbright) + { + Hacks.Misc.BigFlashlight(false); + } + else if (!flashlight_toggle && !fullbright) + { + Hacks.Misc.BigFlashlight(true); + } - if (fullbright && Player.IsInGame() && !flashlight_toggle) - { - Hacks.Misc.Fullbright(false); + if (fullbright && !flashlight_toggle) + { + Hacks.Misc.Fullbright(false); + } + else if (!fullbright && !flashlight_toggle) + { + Hacks.Misc.Fullbright(true); + } + + if (_IsAutoRespawn && Helpers.Player.IsPlayerCrawling()) + { + Hacks.Misc.AutoRespawn(); + } } - else if (!fullbright && Player.IsInGame() && !flashlight_toggle) + else { - Hacks.Misc.Fullbright(true); + if (change_server_name) + { + Hacks.Misc.SetServerName("patate on top !"); + } + + if (change_steam_name) + { + Hacks.Misc.SetSteamName("patate"); + } } if (spam_message) @@ -119,16 +139,6 @@ namespace DevourClient Hacks.Misc.SetRank((int)spoofLevelValue); } - if (change_server_name && !Player.IsInGame()) - { - Hacks.Misc.SetServerName("patate on top !"); - } - - if (change_steam_name && !Player.IsInGame()) - { - Hacks.Misc.SetSteamName("patate"); - } - if (Input.GetKeyDown(Settings.Settings.flyKey)) { fly = !fly; @@ -139,11 +149,6 @@ namespace DevourClient Hacks.Misc.Fly(fly_speed); } - if(Player.IsInGame() && _IsAutoRespawn && Helpers.Player.IsPlayerCrawling()) - { - Hacks.Misc.AutoRespawn(); - } - if (Helpers.Map.GetActiveScene() == "Menu") { Hacks.Misc.WalkInLobby(_walkInLobby);