Skip to content

Commit

Permalink
Add failsafe to IsGrounded check
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed May 15, 2024
1 parent 89eabd4 commit b5397fc
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions Fika.Core/Coop/Players/CoopBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ private IEnumerator WaitForPlayersToLoadBot()
Teleport(new Vector3(spawnPosition.x, spawnPosition.y + 1f, spawnPosition.z));
AIData.BotOwner.BotState = EBotState.PreActive;
isStarted = true;
yield return new WaitUntil(() => { return MovementContext.IsGrounded; });
DateTime fallStart = DateTime.Now;
yield return new WaitUntil(() => { return MovementContext.IsGrounded || Math.Abs((fallStart - DateTime.Now).TotalSeconds) < 2; });
#if DEBUG
FikaPlugin.Instance.FikaLogger.LogWarning($"{gameObject.name} is now grounded, started at Y: {randomY}, now at {Position.ToStringVerbose()}");
#endif
Expand Down Expand Up @@ -320,19 +321,6 @@ private IEnumerator DestroyNetworkedComponents()
public override void UpdateTick()
{
base.UpdateTick();

// Temp test to fix AI dying from hydration and energy...
/*if (ActiveHealthController.Energy.Current < 1)
{
logger($"Setting energy to 50 on {ProfileId}");
ActiveHealthController.ChangeEnergy(50);
}
if (ActiveHealthController.Hydration.Current < 1)
{
logger($"Setting hydration to 50 on {ProfileId}");
ActiveHealthController.ChangeHydration(50);
}*/
}

public override void OnDestroy()
Expand Down

0 comments on commit b5397fc

Please sign in to comment.