Example #1
0
        public float TargetValue()
        {
            if (!ActiveEntity())
            {
                return(0);
            }

            return(EntityEvaluator.GridTargetValue(LinkedGrids));
        }
Example #2
0
        public float TargetValue()
        {
            if (IsClosed())
            {
                return(0);
            }

            if (IsParentEntityGrid)
            {
                var grid = ParentEntity as IMyCubeGrid;

                if (grid == null)
                {
                    return(0);
                }

                return(EntityEvaluator.GridTargetValue(LinkedGrids));
            }
            else
            {
                var character = ParentEntity as IMyCharacter;

                if (character == null)
                {
                    return(0);
                }

                float threat = 0;

                if (!character.HasInventory)
                {
                    return(0);
                }

                var items = new List <VRage.Game.ModAPI.Ingame.MyInventoryItem>();
                character.GetInventory().GetItems(items);

                foreach (var item in items)
                {
                    if (item.Type.TypeId.EndsWith("PhysicalGunObject"))
                    {
                        threat += 25;
                        continue;
                    }

                    if (item.Type.TypeId.EndsWith("AmmoMagazine"))
                    {
                        threat += 3;
                        continue;
                    }

                    if (item.Type.TypeId.EndsWith("ContainerObject"))
                    {
                        threat += 10;
                        continue;
                    }
                }

                return(threat);
            }
        }
Example #3
0
 public float TargetValue()
 {
     return(EntityEvaluator.GridTargetValue(LinkedGrids));
 }