Esempio n. 1
0
 public override bool ShouldRetry(Creature agent)
 {
     return(EntityToGather != null && !EntityToGather.IsDead && !agent.AI.GatherManager.ItemsToGather.Contains(EntityToGather) &&
            PlanAct.PathExists(EntityToGather.GetComponent <Physics>().CurrentVoxel,
                               agent.Physics.CurrentVoxel,
                               agent.AI));
 }
Esempio n. 2
0
        public override bool IsFeasible(Creature agent)
        {
            if (EntityToKill == null || EntityToKill.IsDead)
            {
                return(false);
            }
            else
            {
                Creature ai = EntityToKill.GetChildrenOfTypeRecursive <Creature>().FirstOrDefault();
                switch (Mode)
                {
                case KillType.Attack:
                {
                    if (!agent.Faction.AttackDesignations.Contains(EntityToKill))
                    {
                        return(false);
                    }
                    return(true);
                }

                case KillType.Chop:
                {
                    if (!agent.Faction.ChopDesignations.Contains(EntityToKill))
                    {
                        return(false);
                    }
                    return(true);
                }

                case KillType.Auto:
                {
                    return(true);
                }
                }

                Voxel target    = new Voxel();
                bool  voxExists = PlayState.ChunkManager.ChunkData.GetVoxel(EntityToKill.Position, ref target);
                if (!voxExists || !PlanAct.PathExists(agent.Physics.CurrentVoxel, target, agent.AI))
                {
                    return(false);
                }


                if (ai == null)
                {
                    return(true);
                }
                Relationship relation =
                    PlayState.ComponentManager.Diplomacy.GetPolitics(ai.Faction, agent.Faction).GetCurrentRelationship();
                return(relation == Relationship.Hateful || relation == Relationship.Indifferent);
            }
        }