add: now using coroutines with SurvivalInteractable and KeyBehaviour
This commit is contained in:
@@ -48,13 +48,13 @@ namespace DevourClient.Hacks
|
||||
public static void WalkInLobby(bool walk)
|
||||
{
|
||||
try {
|
||||
if (Helpers.LocalPlayer.LocalPlayer_.GetComponent<UltimateCharacterLocomotionHandler>() == null)
|
||||
if (Helpers.Entities.LocalPlayer_.GetComponent<UltimateCharacterLocomotionHandler>() == null)
|
||||
{
|
||||
Helpers.LocalPlayer.LocalPlayer_.AddComponent<UltimateCharacterLocomotionHandler>();
|
||||
Helpers.LocalPlayer.LocalPlayer_.GetComponent<UltimateCharacterLocomotionHandler>().enabled = false;
|
||||
Helpers.Entities.LocalPlayer_.AddComponent<UltimateCharacterLocomotionHandler>();
|
||||
Helpers.Entities.LocalPlayer_.GetComponent<UltimateCharacterLocomotionHandler>().enabled = false;
|
||||
}
|
||||
|
||||
Helpers.LocalPlayer.LocalPlayer_.GetComponent<UltimateCharacterLocomotionHandler>().enabled = walk;
|
||||
Helpers.Entities.LocalPlayer_.GetComponent<UltimateCharacterLocomotionHandler>().enabled = walk;
|
||||
}
|
||||
catch { return; }
|
||||
}
|
||||
@@ -122,10 +122,7 @@ namespace DevourClient.Hacks
|
||||
{
|
||||
NolanBehaviour Nolan = Player.GetPlayer();
|
||||
|
||||
List<SurvivalInteractable> items = new List<SurvivalInteractable>();
|
||||
items = Object.FindObjectsOfType<SurvivalInteractable>().ToList<SurvivalInteractable>();
|
||||
|
||||
foreach (SurvivalInteractable item in items)
|
||||
foreach (SurvivalInteractable item in Helpers.Entities.SurvivalInteractables)
|
||||
{
|
||||
item.transform.position = Nolan.transform.position + Nolan.transform.forward * Random.RandomRange(1f, 3f);
|
||||
}
|
||||
@@ -215,7 +212,7 @@ namespace DevourClient.Hacks
|
||||
{
|
||||
NolanBehaviour Nolan = Player.GetPlayer(); //UnityEngine.Object.FindObjectOfType<NolanBehaviour>();
|
||||
|
||||
foreach (KeyBehaviour keyBehaviour in UnityEngine.Object.FindObjectsOfType<KeyBehaviour>())
|
||||
foreach (KeyBehaviour keyBehaviour in Helpers.Entities.Keys)
|
||||
{
|
||||
bool flag = keyBehaviour == null;
|
||||
if (flag)
|
||||
|
||||
@@ -20,12 +20,12 @@ namespace DevourClient.Helpers
|
||||
|
||||
public static NolanBehaviour GetPlayer()
|
||||
{
|
||||
if (LocalPlayer.LocalPlayer_ == null)
|
||||
if (Entities.LocalPlayer_ == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return LocalPlayer.LocalPlayer_.GetComponent<NolanBehaviour>();
|
||||
return Entities.LocalPlayer_.GetComponent<NolanBehaviour>();
|
||||
}
|
||||
|
||||
public static bool IsPlayerCrawling()
|
||||
@@ -42,9 +42,12 @@ namespace DevourClient.Helpers
|
||||
|
||||
}
|
||||
|
||||
public class LocalPlayer
|
||||
public class Entities
|
||||
{
|
||||
public static GameObject LocalPlayer_;
|
||||
public static GoatBehaviour[] GoatsAndRats;
|
||||
public static SurvivalInteractable[] SurvivalInteractables;
|
||||
public static KeyBehaviour[] Keys;
|
||||
|
||||
public static IEnumerator GetLocalPlayer()
|
||||
{
|
||||
@@ -79,5 +82,38 @@ namespace DevourClient.Helpers
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public static IEnumerator GetGoatsAndRats()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
GoatsAndRats = GoatBehaviour.FindObjectsOfType<GoatBehaviour>();
|
||||
|
||||
// Wait 5 seconds before caching objects again.
|
||||
yield return new WaitForSeconds(5f);
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerator GetSurvivalInteractables()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
SurvivalInteractables = SurvivalInteractable.FindObjectsOfType<SurvivalInteractable>();
|
||||
|
||||
// Wait 5 seconds before caching objects again.
|
||||
yield return new WaitForSeconds(5f);
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerator GetKeys()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
Keys = KeyBehaviour.FindObjectsOfType<KeyBehaviour>();
|
||||
|
||||
// Wait 5 seconds before caching objects again.
|
||||
yield return new WaitForSeconds(5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,10 @@ namespace DevourClient
|
||||
public override void OnApplicationStart()
|
||||
{
|
||||
MelonLogger.Msg("For the Queen !");
|
||||
MelonCoroutines.Start(Helpers.LocalPlayer.GetLocalPlayer());
|
||||
MelonCoroutines.Start(Helpers.Entities.GetLocalPlayer());
|
||||
MelonCoroutines.Start(Helpers.Entities.GetGoatsAndRats());
|
||||
MelonCoroutines.Start(Helpers.Entities.GetSurvivalInteractables());
|
||||
MelonCoroutines.Start(Helpers.Entities.GetKeys());
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -130,7 +133,7 @@ namespace DevourClient
|
||||
{
|
||||
try
|
||||
{
|
||||
Helpers.LocalPlayer.LocalPlayer_.GetComponent<Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion>().TimeScale = this._PlayerSpeedMultiplier;
|
||||
Helpers.Entities.LocalPlayer_.GetComponent<Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion>().TimeScale = this._PlayerSpeedMultiplier;
|
||||
}
|
||||
catch { return; }
|
||||
}
|
||||
@@ -179,12 +182,11 @@ namespace DevourClient
|
||||
|
||||
if (this.goat_rat_esp)
|
||||
{
|
||||
foreach (GoatBehaviour goat in UnityEngine.Object.FindObjectsOfType<GoatBehaviour>() as UnhollowerBaseLib.Il2CppReferenceArray<GoatBehaviour>)
|
||||
foreach (GoatBehaviour goat in Helpers.Entities.GoatsAndRats)
|
||||
{
|
||||
if (goat != null)
|
||||
{
|
||||
|
||||
|
||||
Vector3 pivotPos = goat.transform.position; //Pivot point NOT at the origin, at the center
|
||||
Vector3 playerFootPos; playerFootPos.x = pivotPos.x; playerFootPos.z = pivotPos.z; playerFootPos.y = pivotPos.y - 2f; //At the feet
|
||||
Vector3 playerHeadPos;
|
||||
@@ -211,7 +213,7 @@ namespace DevourClient
|
||||
|
||||
if (this.item_esp)
|
||||
{
|
||||
foreach (SurvivalInteractable obj in UnityEngine.Object.FindObjectsOfType<SurvivalInteractable>() as UnhollowerBaseLib.Il2CppReferenceArray<SurvivalInteractable>)
|
||||
foreach (SurvivalInteractable obj in Helpers.Entities.SurvivalInteractables)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
@@ -242,7 +244,7 @@ namespace DevourClient
|
||||
}
|
||||
}
|
||||
|
||||
foreach (KeyBehaviour key in UnityEngine.Object.FindObjectsOfType<KeyBehaviour>() as UnhollowerBaseLib.Il2CppReferenceArray<KeyBehaviour>)
|
||||
foreach (KeyBehaviour key in Helpers.Entities.Keys)
|
||||
{
|
||||
if (key != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user