예제 #1
0
        public static bool Prefix(EntityHornet __instance, Context ___utilityAIContext, EntitySeeCache ___seeCache, EntityLookHelper ___lookHelper, ref int ___aggroCooldown)
        {
            if (!__instance.HasAnyTags(FastTags.Parse("allowEAI")))
            {
                return(true);
            }

            if (GamePrefs.GetBool(EnumGamePrefs.DebugStopEnemiesMoving))
            {
                __instance.SetMoveForwardWithModifiers(0f, 0f, false);
                if (__instance.aiManager != null)
                {
                    __instance.aiManager.UpdateDebugName();
                }
                return(true);
            }

            if (__instance.GetAttackTarget() != null)
            {
                __instance.SetRevengeTarget(__instance.GetAttackTarget());
            }

            __instance.CheckDespawn();
            ___seeCache.ClearIfExpired();
            using (ProfilerUsingFactory.Profile("entities.live.ai.manager"))
            {
                __instance.aiManager.Update();
            }

            using (ProfilerUsingFactory.Profile("entities.live.ai.getpath"))
            {
                PathInfo path = PathFinderThread.Instance.GetPath(__instance.entityId);
                if (path.path != null)
                {
                    bool flag = true;
                    flag = __instance.aiManager.CheckPath(path);

                    if (flag)
                    {
                        __instance.navigator.SetPath(path, path.speed);
                    }
                }
                __instance.navigator.UpdateNavigation();
            }
            __instance.moveHelper.UpdateMoveHelper();
            ___lookHelper.onUpdateLook();
            if (__instance.distraction != null && (__instance.distraction.IsDead() || __instance.distraction.IsMarkedForUnload()))
            {
                __instance.distraction = null;
            }
            if (__instance.pendingDistraction != null && (__instance.pendingDistraction.IsDead() || __instance.pendingDistraction.IsMarkedForUnload()))
            {
                __instance.pendingDistraction = null;
            }

            return(true);
        }
    // The vulture updateTasks() doesn't call down the chain, so it never does any checks on the AI Tasks.
    protected override void updateTasks()
    {
        base.updateTasks();

        if (!GamePrefs.GetBool(EnumGamePrefs.DebugStopEnemiesMoving))
        {
            if (!EntityClass.list[this.entityClass].UseAIPackages)
            {
                using (ProfilerUsingFactory.Profile("entities.live.ai.tasks"))
                {
                    this.TaskList.OnUpdateTasks();
                    this.TargetList.OnUpdateTasks();
                }
            }
        }
    }
 // The vulture updateTasks() doesn't call down the chain, so it never does any checks on the AI Tasks.
 protected override void updateTasks()
 {
     if (!useVanillaAI)
     {
         flockTasks(); // flocking logic, if needed
     }
     else
     {
         base.updateTasks();
         if (!GamePrefs.GetBool(EnumGamePrefs.DebugStopEnemiesMoving))
         {
             if (!EntityClass.list[entityClass].UseAIPackages)
             {
                 using (ProfilerUsingFactory.Profile("entities.live.ai.tasks"))
                 {
                     TaskList.OnUpdateTasks();
                     TargetList.OnUpdateTasks();
                 }
             }
         }
     }
 }