add: load slaughterhouse, optimized crosshair

i don't lose a single fps when using the crosshair now
This commit is contained in:
2023-03-11 10:29:34 +01:00
parent 7aeacb2991
commit 9fbabb2de1

View File

@@ -59,11 +59,15 @@ namespace DevourClient
static bool fullbright = false;
static bool need_fly_reset = false;
static bool crosshair = false;
static Texture2D crosshairTexture;
static bool in_game_cache = false;
static Texture2D crosshairTexture = default!;
public override void OnInitializeMelon()
{
MelonLogger.Msg("For the Queen !");
crosshairTexture = Helpers.GUIHelper.GetCircularTexture(5, 5);
MelonCoroutines.Start(Helpers.Entities.GetLocalPlayer());
MelonCoroutines.Start(Helpers.Entities.GetGoatsAndRats());
MelonCoroutines.Start(Helpers.Entities.GetSurvivalInteractables());
@@ -77,13 +81,6 @@ namespace DevourClient
MelonCoroutines.Start(Helpers.Entities.GetAllPlayers());
}
public override void OnSceneWasInitialized(int buildIndex, string sceneName)
{
MelonLogger.Warning($"{sceneName}[{buildIndex}] initialized..");
crosshairTexture = Helpers.GUIHelper.GetCircularTexture(5, 5);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override void OnUpdate()
{
@@ -130,6 +127,11 @@ namespace DevourClient
{
Hacks.Misc.AutoRespawn();
}
if (crosshair && !in_game_cache)
{
in_game_cache = true;
}
}
else
{
@@ -142,6 +144,11 @@ namespace DevourClient
{
Hacks.Misc.SetSteamName("patate");
}
if (crosshair && in_game_cache)
{
in_game_cache = false;
}
}
if (spam_message)
@@ -343,18 +350,22 @@ namespace DevourClient
}
}
}
}
if (crosshair && Player.IsInGame() && !Player.IsPlayerCrawling())
if (crosshair && in_game_cache) //&& !Player.IsPlayerCrawling())
{
float crosshairSize = 4;
const float crosshairSize = 4;
float xMin = (Settings.Settings.width) - (crosshairSize / 2);
float yMin = (Settings.Settings.height) - (crosshairSize / 2);
if (crosshairTexture == null)
{
crosshairTexture = Helpers.GUIHelper.GetCircularTexture(5, 5);
}
GUI.DrawTexture(new Rect(xMin, yMin, crosshairSize, crosshairSize), crosshairTexture);
}
}
if (Settings.Settings.menu_enable) //Si on appuie sur INSERT
{
@@ -767,7 +778,10 @@ namespace DevourClient
Helpers.Map.LoadMap("Town");
}
if (GUI.Button(new Rect(Settings.Settings.x + 450, Settings.Settings.y + 240, 100, 30), "Slaughterhouse") && BoltNetwork.IsServer)
{
Helpers.Map.LoadMap("Slaughterhouse");
}
}
private static void EspTab()