diff --git a/DevourClient/Helpers/StateHelper.cs b/DevourClient/Helpers/StateHelper.cs index 694aaa8..756cb7b 100644 --- a/DevourClient/Helpers/StateHelper.cs +++ b/DevourClient/Helpers/StateHelper.cs @@ -1,3 +1,5 @@ +using UnityEngine; + namespace DevourClient.Helpers { public class Player @@ -7,5 +9,22 @@ OptionsHelpers optionsHelpers = UnityEngine.Object.FindObjectOfType(); return optionsHelpers.inGame; } + + public static bool IsInGameOrLobby() + { + return GetPlayer() != null; + } + + public static NolanBehaviour GetPlayer() + { + foreach (NolanBehaviour nb in UnityEngine.Object.FindObjectsOfType()) + { + if (nb.entity.IsOwner) + { + return nb; + } + } + return null; + } } } diff --git a/DevourClient/MelonMain.cs b/DevourClient/MelonMain.cs index bb148ed..eca022d 100644 --- a/DevourClient/MelonMain.cs +++ b/DevourClient/MelonMain.cs @@ -87,7 +87,7 @@ namespace DevourClient Hacks.Misc.SetSteamName("patate"); } - if (this.fly && Player.IsInGame()) + if (this.fly && Player.IsInGameOrLobby()) { Hacks.Misc.Fly(this.fly_speed); }