optimizations, OnUpdate is faster now

Player.IsInGame() only called once instead of 7 in the OnUpdate function
This commit is contained in:
2023-03-04 09:47:43 +01:00
parent 886dc8d95b
commit 261f098f2d

View File

@@ -90,22 +90,42 @@ namespace DevourClient
Settings.Settings.menu_enable = !Settings.Settings.menu_enable; Settings.Settings.menu_enable = !Settings.Settings.menu_enable;
} }
if (flashlight_toggle && Player.IsInGame() && !fullbright) if (Player.IsInGame())
{ {
Hacks.Misc.BigFlashlight(false); if (flashlight_toggle && !fullbright)
} {
else if (!flashlight_toggle && Player.IsInGame() && !fullbright) Hacks.Misc.BigFlashlight(false);
{ }
Hacks.Misc.BigFlashlight(true); else if (!flashlight_toggle && !fullbright)
} {
Hacks.Misc.BigFlashlight(true);
}
if (fullbright && Player.IsInGame() && !flashlight_toggle) if (fullbright && !flashlight_toggle)
{ {
Hacks.Misc.Fullbright(false); 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) if (spam_message)
@@ -119,16 +139,6 @@ namespace DevourClient
Hacks.Misc.SetRank((int)spoofLevelValue); 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)) if (Input.GetKeyDown(Settings.Settings.flyKey))
{ {
fly = !fly; fly = !fly;
@@ -139,11 +149,6 @@ namespace DevourClient
Hacks.Misc.Fly(fly_speed); Hacks.Misc.Fly(fly_speed);
} }
if(Player.IsInGame() && _IsAutoRespawn && Helpers.Player.IsPlayerCrawling())
{
Hacks.Misc.AutoRespawn();
}
if (Helpers.Map.GetActiveScene() == "Menu") if (Helpers.Map.GetActiveScene() == "Menu")
{ {
Hacks.Misc.WalkInLobby(_walkInLobby); Hacks.Misc.WalkInLobby(_walkInLobby);