Ejemplo n.º 1
0
        private void LongDistanceNavigate(PlayerMove_Sail __instance)
        {
            VectorLF3 dir = target.GetDir(this, __instance.player);

            Sail.SetDir(__instance, dir);

            VectorLF3 advisePoint = VectorLF3.zero;

            if (AdvisePointIfOcclusion(__instance, ref advisePoint, longNavUncoverRange))
            {
#if DEBUG
                ModDebug.Log("LongDistanceNavigate - ToAdvisePoint:" + advisePoint);
#endif

                dir = (advisePoint - __instance.player.uPosition).normalized;
                Sail.SetDir(__instance, dir);
                Sail.TrySpeedUp(this, __instance);
            }
            else if (Target.IsFocusingNormalized(dir, __instance.player.uVelocity.normalized) && !__instance.player.warping)
            {
                if (__instance.player.mecha.coreEnergy >= wrapEnergylimit && Warp.TryWrap(this, __instance))
                {
#if DEBUG
                    ModDebug.Log("Enter Wrap");
#endif
                    return;
                }
                else if (IsCurNavPlanet() && target.IsLocalStarPlanet() == true)
                {
#if DEBUG
                    ModDebug.Log("Local Planet Nav No Wrap Chance SpeedUp");
#endif
                    Sail.TrySpeedUp(this, __instance);
                    return;
                }
                else if (LongDistanceNavigateNeedSpeedUp())
                {
#if DEBUG
                    ModDebug.Log("Long Distance Navigate Need SpeedUp");
#endif
                    Sail.TrySpeedUp(this, __instance);
                }
                else
                {
#if DEBUG
                    ModDebug.Log("Long Distance Navigate No SpeedUp And Wrap");
#endif
                }
            }

            bool LongDistanceNavigateNeedSpeedUp()
            {
                if (__instance.player.mecha.coreEnergy >= speedUpEnergylimit)
                {
                    if (__instance.player.mecha.thrusterLevel < 3)
                    {
                        return(true);
                    }
                    else if (Warp.GetWraperCount(__instance) <= 0)
                    {
                        return(true);
                    }
                }
                //Prepare wrap
                if (__instance.player.mecha.coreEnergy < wrapEnergylimit)
                {
                    return(false);
                }
                return(false);
            }
        }