Esempio n. 1
0
        //internal void Process(Game game, List<StarSystem> systems, int deltaSeconds)
        //{
        //    if (game.CurrentDateTime - _lastRun < game.Settings.EconomyCycleTime)
        //    {
        //        return;
        //    }

        //    _lastRun = game.CurrentDateTime;

        //    if (game.Settings.EnableMultiThreading ?? false)
        //    {
        //        Parallel.ForEach(systems, system => ProcessSystem(system));
        //    }
        //    else
        //    {
        //        foreach (var system in systems) //TODO thread this
        //        {
        //            ProcessSystem(system);
        //        }
        //    }
        //}

        internal static void ProcessSystem(EntityManager manager)
        {
            Game game = manager.Game;

            //Action<StarSystem> economyMethod = ProcessSystem;
            //system.SystemSubpulses.AddSystemInterupt(system.Game.CurrentDateTime + system.Game.Settings.EconomyCycleTime, economyMethod);
            manager.ManagerSubpulses.AddSystemInterupt(manager.Game.CurrentDateTime + manager.Game.Settings.EconomyCycleTime, PulseActionEnum.EconProcessor);


            TechProcessor.ProcessSystem(manager, game);

            foreach (Entity colonyEntity in manager.GetAllEntitiesWithDataBlob <ColonyMinesDB>())
            {
                MineProcessor.MineResources(colonyEntity);
            }
            foreach (Entity colonyEntity in manager.GetAllEntitiesWithDataBlob <ColonyRefiningDB>())
            {
                RefiningProcessor.RefineMaterials(colonyEntity, game);
            }
            foreach (Entity colonyEntity in manager.GetAllEntitiesWithDataBlob <ColonyConstructionDB>())
            {
                ConstructionProcessor.ConstructStuff(colonyEntity, game);
            }
            foreach (Entity colonyEntity in manager.GetAllEntitiesWithDataBlob <ColonyInfoDB>())
            {
                PopulationProcessor.GrowPopulation(colonyEntity);
            }
        }
        void CreateFactionInfo(EntityManager manager, Entity faction)
        {
            List <Entity> entitesWithOrbits  = new List <Entity>(manager.GetAllEntitiesWithDataBlob <OrbitDB>());
            List <Entity> entitiesWithOwners = new List <Entity>(manager.GetAllEntitiesWithDataBlob <OwnedDB>());

            FactionSystemKnowledge factionKen = new FactionSystemKnowledge();

            foreach (var item in entitiesWithOwners)
            {
                if (item.GetDataBlob <OwnedDB>().OwnedByFaction == faction)
                {
                    factionKen.OwnedEntites.Add(item);
                }
            }
        }
Esempio n. 3
0
 static public void ProcessSystem(EntityManager manager)
 {
     foreach (Entity ship in manager.GetAllEntitiesWithDataBlob <ShipInfoDB>())
     {
         ProcessShip(ship);
     }
 }
Esempio n. 4
0
        //thinking about doing this where entity is the sensor component not the ship,
        //that way, a ship can have multiple different sensors which run at different intervals.
        //I'll need to get the parent ship... or maybe just the systemfactionInfo to store the detected ships though.
        //having the ships      what they detect could be usefull info to display though.
        internal override void ProcessEntity(Entity entity, int deltaSeconds)
        {
            EntityManager manager   = entity.Manager;
            Entity        faction   = entity.GetDataBlob <OwnedDB>().OwnedByFaction;
            DateTime      atDate    = manager.ManagerSubpulses.SystemLocalDateTime + TimeSpan.FromSeconds(deltaSeconds);
            var           receverDB = entity.GetDataBlob <SensorReceverAtbDB>();

            var detectableEntitys = manager.GetAllEntitiesWithDataBlob <SensorProfileDB>();

            foreach (var detectableEntity in detectableEntitys)
            {
                //Entity detectableEntity = sensorProfile.OwningEntity;

                if (detectableEntity.HasDataBlob <OwnedDB>())
                {
                    if (detectableEntity.GetDataBlob <OwnedDB>().OwnedByFaction != faction)
                    {
                        SensorProcessorTools.DetectEntites(receverDB, detectableEntity, atDate);
                    }
                    else
                    {
                        //then the sensor profile belongs to the same faction as the recever. don't bother trying to detect it.
                    }
                }
                else
                {
                    SensorProcessorTools.DetectEntites(receverDB, detectableEntity, atDate);
                }
            }



            manager.ManagerSubpulses.AddEntityInterupt(atDate + TimeSpan.FromSeconds(receverDB.ScanTime), this.TypeName, entity);
        }
Esempio n. 5
0
 internal static void ProcessSystem(EntityManager manager, Game game)
 {
     foreach (Entity colonyEntity in manager.GetAllEntitiesWithDataBlob <ColonyInfoDB>())
     {
         DoResearch(colonyEntity, game);
     }
 }
Esempio n. 6
0
 public void ProcessManager(EntityManager manager, int deltaSeconds)
 {
     foreach (var entity in manager.GetAllEntitiesWithDataBlob <MiningDB>())
     {
         ProcessEntity(entity, deltaSeconds);
     }
 }
Esempio n. 7
0
        public void ProcessManager(EntityManager manager, int deltaSeconds)
        {
            List <Entity> entitysWithReserch = manager.GetAllEntitiesWithDataBlob <EntityResearchDB>();

            foreach (var entity in entitysWithReserch)
            {
                ProcessEntity(entity, deltaSeconds);
            }
        }
Esempio n. 8
0
        public void ProcessManager(EntityManager manager, int deltaSeconds)
        {
            List <Entity> entitysWithCargoTransfers = manager.GetAllEntitiesWithDataBlob <OrderableDB>();

            foreach (var entity in entitysWithCargoTransfers)
            {
                ProcessEntity(entity, deltaSeconds);
            }
        }
        void CreateFactionInfo(EntityManager manager, Entity faction)
        {
            List <Entity> entitesWithOrbits  = new List <Entity>(manager.GetAllEntitiesWithDataBlob <OrbitDB>());
            List <Entity> entitiesWithOwners = new List <Entity>(manager.GetEntitiesByFaction(faction.Guid));

            FactionSystemKnowledge factionKen = new FactionSystemKnowledge();

            factionKen.OwnedEntites.AddRange(entitiesWithOwners);
        }
Esempio n. 10
0
        public void ProcessManager(EntityManager manager, int deltaSeconds)
        {
            List <Entity> entites = manager.GetAllEntitiesWithDataBlob <NewtonMoveDB>();

            foreach (var entity in entites)
            {
                ProcessEntity(entity, deltaSeconds);
            }
        }
Esempio n. 11
0
        public void ProcessManager(EntityManager manager, int deltaSeconds)
        {
            List <Entity> entitysWithTranslateMove = manager.GetAllEntitiesWithDataBlob <WarpMovingDB>();

            foreach (var entity in entitysWithTranslateMove)
            {
                ProcessEntity(entity, deltaSeconds);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// process balistic movement for a single system
        /// currently is not affected by gravity.
        /// </summary>
        /// <param name="manager">the system to process</param>
        internal static void Process(EntityManager manager)
        {
            TimeSpan orbitCycle = manager.Game.Settings.OrbitCycleTime;
            DateTime toDate     = manager.ManagerSubpulses.SystemLocalDateTime + orbitCycle;

            manager.ManagerSubpulses.AddSystemInterupt(toDate + orbitCycle, PulseActionEnum.BalisticMoveProcessor);

            List <Entity>     RemoveList   = new List <Entity>();
            List <StarSystem> RemoveSystem = new List <StarSystem>();

            foreach (Entity objectEntity in manager.GetAllEntitiesWithDataBlob <NewtonBalisticDB>())
            {
                NewtonBalisticDB balisticDB = objectEntity.GetDataBlob <NewtonBalisticDB>();
                PositionDB       position   = objectEntity.GetDataBlob <PositionDB>();
                position.RelativePosition += Distance.KmToAU(balisticDB.CurrentSpeed * orbitCycle.TotalSeconds);

                Entity     myTarget  = manager.GetLocalEntityByGuid(balisticDB.TargetGuid);
                PositionDB targetPos = myTarget.GetDataBlob <PositionDB>();

                if (targetPos.AbsolutePosition == position.AbsolutePosition)
                {
                    //do something in damage processor for asteroid hitting a planet?
                    DamageProcessor.OnTakingDamage(myTarget, 1000000); ///one. million. damage points.

                    StarSystem mySystem;
                    if (!manager.Game.Systems.TryGetValue(position.SystemGuid, out mySystem))
                    {
                        throw new GuidNotFoundException(position.SystemGuid);
                    }

                    RemoveList.Add(objectEntity);
                    RemoveSystem.Add(mySystem);

                    mySystem.SystemManager.RemoveEntity(objectEntity); //get rid of the asteroid
                }
            }

            /// <summary>
            /// Clean up the asteroids that have hit something and been put in the remove list.
            /// </summary>
            for (int removeIterator = 0; removeIterator < RemoveList.Count; removeIterator++)
            {
                RemoveSystem[removeIterator].SystemManager.RemoveEntity(RemoveList[removeIterator]);
            }

            /// <summary>
            /// This may not be necessary but clear these two lists.
            /// </summary>
            RemoveList.Clear();
            RemoveSystem.Clear();
        }
Esempio n. 13
0
        /// <summary>
        /// A horribly inefficent way of getting all the entities owned by a specific faction in a manager.
        /// TODO: maybe do ownership at a higher (or lower? whichever way around) level, ie not a datablob on entities.
        /// </summary>
        /// <returns>The entitys in manager.</returns>
        /// <param name="factionOwner">Faction owner.</param>
        /// <param name="manager">Manager.</param>
        public static List <Entity> OwnedEntitysInManager(Entity factionOwner, EntityManager manager)
        {
            var           owner = factionOwner.GetDataBlob <FactionOwnerDB>();
            List <Entity> listOfOwnedEntites = new List <Entity>();

            foreach (var item in manager.GetAllEntitiesWithDataBlob <OwnedDB>())
            {
                if (owner.OwnedEntities.ContainsKey(item.Guid))
                {
                    listOfOwnedEntites.Add(item);
                }
            }
            return(listOfOwnedEntites);
        }
        /// <summary>
        /// process balistic movement for a single system
        /// currently is not affected by gravity.
        /// </summary>
        /// <param name="manager">the system to process</param>
        internal static void Process(EntityManager manager, int deltaSeconds)
        {
            List <Entity>     RemoveList   = new List <Entity>();
            List <StarSystem> RemoveSystem = new List <StarSystem>();

            foreach (Entity objectEntity in manager.GetAllEntitiesWithDataBlob <NewtonBalisticDB>())
            {
                NewtonBalisticDB balisticDB = objectEntity.GetDataBlob <NewtonBalisticDB>();
                PositionDB       position   = objectEntity.GetDataBlob <PositionDB>();
                position.RelativePosition += Distance.KmToAU(balisticDB.CurrentSpeed * deltaSeconds);

                /*TODO: rethink how this is done, unless this is the only place we're going to do collision, then it shouldnt be done here.
                 * ALso, this currently breaks down in a network situation because we're not sending the target entity (the client probilby shouldnt know that)
                 * Entity myTarget = manager.GetLocalEntityByGuid(balisticDB.TargetGuid);
                 * PositionDB targetPos = myTarget.GetDataBlob<PositionDB>();
                 *
                 * if(targetPos.AbsolutePosition == position.AbsolutePosition)
                 * {
                 *  //do something in damage processor for asteroid hitting a planet?
                 *  DamageProcessor.OnTakingDamage(myTarget, 1000000); ///one. million. damage points.
                 *
                 *  StarSystem mySystem;
                 *  if (!manager.Game.Systems.TryGetValue(position.SystemGuid, out mySystem))
                 *      throw new GuidNotFoundException(position.SystemGuid);
                 *
                 *  RemoveList.Add(objectEntity);
                 *  RemoveSystem.Add(mySystem);
                 *
                 *  mySystem.SystemManager.RemoveEntity(objectEntity); //get rid of the asteroid
                 * }*/
            }

            /// <summary>
            /// Clean up the asteroids that have hit something and been put in the remove list.
            /// </summary>
            for (int removeIterator = 0; removeIterator < RemoveList.Count; removeIterator++)
            {
                RemoveSystem[removeIterator].RemoveEntity(RemoveList[removeIterator]);
            }

            /// <summary>
            /// This may not be necessary but clear these two lists.
            /// </summary>
            RemoveList.Clear();
            RemoveSystem.Clear();
        }
Esempio n. 15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Pulsar4X.ECSLib.EntityChangeListnerDB"/> class.
        /// </summary>
        /// <param name="factionEntity">will listen for any entites added or removed that are owned by this entity</param>
        internal EntityChangeListner(EntityManager manager, Entity factionEntity, List <int> datablobFilter) : base(manager)
        {
            ListenForFaction         = factionEntity;
            _ownerDB                 = ListenForFaction.GetDataBlob <FactionOwnerDB>();
            IncludeDBTypeIndexFilter = datablobFilter;

            if (!IncludeDBTypeIndexFilter.Contains(EntityManager.DataBlobTypes[typeof(OwnedDB)]))
            {
                IncludeDBTypeIndexFilter.Add(EntityManager.DataBlobTypes[typeof(OwnedDB)]);
            }

            bool include = false;

            foreach (var entityitem in manager.GetAllEntitiesWithDataBlob <OwnedDB>()) //TODO: this could maybe be made more efficent if GetAllEntiesWithDatablobs(mask) had some use instructions.
            {
                if (entityitem.GetDataBlob <OwnedDB>().OwnedByFaction == ListenForFaction)
                {
                    foreach (var item in IncludeDBTypeIndexFilter)
                    {
                        if (entityitem.HasDataBlob(item))
                        {
                            include = true;
                        }
                        else
                        {
                            include = false;
                            break;
                        }
                    }
                }
                if (include)
                {
                    ListningToEntites.Add(entityitem);
                }
            }
        }
Esempio n. 16
0
        /// <summary>
        /// process PropulsionDB movement for a single system
        /// </summary>
        /// <param name="manager">the system to process</param>
        /// <param name="deltaSeconds">amount of time in seconds</param>
        internal static void Process(EntityManager manager, int deltaSeconds)
        {
            OrderProcessor.ProcessSystem(manager);
            foreach (Entity shipEntity in manager.GetAllEntitiesWithDataBlob <PropulsionDB>())
            {
                PositionDB   positionDB   = shipEntity.GetDataBlob <PositionDB>();
                PropulsionDB propulsionDB = shipEntity.GetDataBlob <PropulsionDB>();


                Queue <BaseOrder> orders = shipEntity.GetDataBlob <ShipInfoDB>().Orders;

                if (orders.Count > 0)
                {
                    if (orders.Peek().OrderType == orderType.MOVETO)
                    {
                        // Check to see if we will overtake the target

                        MoveOrder order   = (MoveOrder)orders.Peek();
                        Vector4   shipPos = positionDB.AbsolutePosition;
                        Vector4   targetPos;
                        Vector4   currentSpeed = shipEntity.GetDataBlob <PropulsionDB>().CurrentSpeed;
                        Vector4   nextTPos     = shipPos + (currentSpeed * deltaSeconds);
                        Vector4   newPos       = shipPos;
                        Vector4   deltaVecToTarget;
                        Vector4   deltaVecToNextT;

                        double distanceToTarget;
                        double distanceToNextTPos;

                        double speedDelta;
                        double distanceDelta;
                        double newDistanceDelta;
                        double fuelMaxDistanceAU;

                        double currentSpeedLength = currentSpeed.Length();

                        CargoStorageDB            storedResources = shipEntity.GetDataBlob <CargoStorageDB>();
                        Dictionary <Guid, double> fuelUsePerMeter = propulsionDB.FuelUsePerKM;
                        int maxKMeters = CalcMaxFuelDistance(shipEntity);

                        if (order.PositionTarget == null)
                        {
                            targetPos = order.Target.GetDataBlob <PositionDB>().AbsolutePosition;
                        }
                        else
                        {
                            targetPos = order.PositionTarget.AbsolutePosition;
                        }

                        deltaVecToTarget = shipPos - targetPos;

                        distanceToTarget = deltaVecToTarget.Length();  //in au


                        deltaVecToNextT   = shipPos - nextTPos;
                        fuelMaxDistanceAU = GameConstants.Units.KmPerAu * maxKMeters;


                        distanceToNextTPos = deltaVecToNextT.Length();
                        if (fuelMaxDistanceAU < distanceToNextTPos)
                        {
                            newDistanceDelta = fuelMaxDistanceAU;
                            double percent = fuelMaxDistanceAU / distanceToNextTPos;
                            newPos = nextTPos + deltaVecToNextT * percent;
                            Event usedAllFuel = new Event(manager.ManagerSubpulses.SystemLocalDateTime, "Used all Fuel", shipEntity.GetDataBlob <OwnedDB>().ObjectOwner, shipEntity);
                            usedAllFuel.EventType = EventType.FuelExhausted;
                            manager.Game.EventLog.AddEvent(usedAllFuel);
                        }
                        else
                        {
                            newDistanceDelta = distanceToNextTPos;
                            newPos           = nextTPos;
                        }



                        if (distanceToTarget < newDistanceDelta) // moving would overtake target, just go directly to target
                        {
                            newDistanceDelta          = distanceToTarget;
                            propulsionDB.CurrentSpeed = new Vector4(0, 0, 0, 0);
                            newPos = targetPos;
                            if (order.Target != null && order.Target.HasDataBlob <SystemBodyInfoDB>())
                            {
                                positionDB.SetParent(order.Target);
                            }
                            if (order.Target != null)
                            {
                                if (order.Target.HasDataBlob <SystemBodyInfoDB>())  // Set position to the target body
                                {
                                    positionDB.SetParent(order.Target);
                                }
                            }

                            else // We arrived, get rid of the order
                            {
                                shipEntity.GetDataBlob <ShipInfoDB>().Orders.Dequeue();
                            }
                        }
                        positionDB.AbsolutePosition = newPos;
                        int kMetersMoved = (int)(newDistanceDelta * GameConstants.Units.KmPerAu);
                        Dictionary <Guid, int> fuelAmounts = new Dictionary <Guid, int>();
                        foreach (var item in propulsionDB.FuelUsePerKM)
                        {
                            fuelAmounts.Add(item.Key, (int)item.Value * kMetersMoved);
                        }
                        StorageSpaceProcessor.RemoveResources(storedResources, fuelAmounts);
                    }
                }
            }
        }
Esempio n. 17
0
        //TODO: ReWrite this, instead of each component trying to do a scan,
        //multiple components should mix together to form a single suite and the ship itself should scan.
        //maybe the scan freqency /attribute.scanTime should just effect the chance of a detection.
        internal override void ProcessEntity(Entity entity, DateTime atDateTime)
        {
            EntityManager manager = entity.Manager;
            Entity        faction;// = entity.GetDataBlob<OwnedDB>().OwnedByFaction;

            entity.Manager.FindEntityByGuid(entity.FactionOwner, out faction);


            var detectableEntitys = manager.GetAllEntitiesWithDataBlob <SensorProfileDB>();

            var position = entity.GetDataBlob <PositionDB>(); //recever is a componentDB. not a shipDB

            if (position == null)                             //then it's probilby a colony
            {
                position = entity.GetDataBlob <ColonyInfoDB>().PlanetEntity.GetDataBlob <PositionDB>();
            }

            if (entity.GetDataBlob <ComponentInstancesDB>().TryGetComponentsByAttribute <SensorReceverAtbDB>(out var recevers))
            {
                foreach (var recever in recevers)
                {
                    var sensorAbl = recever.GetAbilityState <SensorReceverAbility>();
                    var sensorAtb = recever.Design.GetAttribute <SensorReceverAtbDB>();

                    FactionInfoDB factionInfo = faction.GetDataBlob <FactionInfoDB>();


                    SystemSensorContacts sensorMgr;
                    if (!manager.FactionSensorContacts.ContainsKey(entity.FactionOwner))
                    {
                        sensorMgr = new SystemSensorContacts(manager, faction);
                    }
                    else
                    {
                        sensorMgr = manager.FactionSensorContacts[entity.FactionOwner];
                    }


                    var          detections = SensorProcessorTools.GetDetectedEntites(sensorAtb, position.AbsolutePosition_m, detectableEntitys, atDateTime, faction.Guid, true);
                    SensorInfoDB sensorInfo;
                    for (int i = 0; i < detections.Length; i++)
                    {
                        SensorProcessorTools.SensorReturnValues detectionValues;
                        detectionValues = detections[i];
                        var detectableEntity = detectableEntitys[i];
                        if (detectionValues.SignalStrength_kW > 0.0)
                        {
                            if (sensorMgr.SensorContactExists(detectableEntity.Guid))
                            {
                                //sensorInfo = knownContacts[detectableEntity.ID].GetDataBlob<SensorInfoDB>();
                                sensorInfo = sensorMgr.GetSensorContact(detectableEntity.Guid).SensorInfo;
                                sensorInfo.LatestDetectionQuality = detectionValues;
                                sensorInfo.LastDetection          = atDateTime;
                                if (sensorInfo.HighestDetectionQuality.SignalQuality < detectionValues.SignalQuality)
                                {
                                    sensorInfo.HighestDetectionQuality.SignalQuality = detectionValues.SignalQuality;
                                }

                                if (sensorInfo.HighestDetectionQuality.SignalStrength_kW < detectionValues.SignalStrength_kW)
                                {
                                    sensorInfo.HighestDetectionQuality.SignalStrength_kW = detectionValues.SignalStrength_kW;
                                }
                                SensorEntityFactory.UpdateSensorContact(faction, sensorInfo);
                            }
                            else
                            {
                                SensorContact contact = new SensorContact(faction, detectableEntity, atDateTime);
                                sensorMgr.AddContact(contact);
                                sensorAbl.CurrentContacts[detectableEntity.Guid] = detectionValues;

                                //knownContacts.Add(detectableEntity.ID, SensorEntityFactory.UpdateSensorContact(receverFaction, sensorInfo)); moved this line to the SensorInfoDB constructor
                            }
                        }
                        else if (sensorMgr.SensorContactExists(detectableEntity.Guid) && sensorAbl.CurrentContacts.ContainsKey(detectableEntity.Guid))
                        {
                            sensorAbl.CurrentContacts.Remove(detectableEntity.Guid);
                            sensorAbl.OldContacts[detectableEntity.Guid] = detectionValues;
                        }
                    }

                    manager.ManagerSubpulses.AddEntityInterupt(atDateTime + TimeSpan.FromSeconds(sensorAtb.ScanTime), this.TypeName, entity);
                }
            }
        }
Esempio n. 18
0
        internal static Entity GetFirstEntityWithName(EntityManager manager, string name)
        {
            List <Entity> list = manager.GetAllEntitiesWithDataBlob <NameDB>();

            return(GetFirstEntityWithName(list, name));
        }
Esempio n. 19
0
        internal static bool TryGetFirstEntityWithName(EntityManager manager, string name, out Entity entity)
        {
            List <Entity> list = manager.GetAllEntitiesWithDataBlob <NameDB>();

            return(TryGetFirstEntityWithName(list, name, out entity));
        }
Esempio n. 20
0
        //TODO: ReWrite this, instead of each component trying to do a scan,
        //multiple components should mix together to form a single suite and the ship itself should scan.
        //maybe the scan freqency /attribute.scanTime should just effect the chance of a detection.
        internal override void ProcessEntity(Entity entity, DateTime atDateTime)
        {
            EntityManager manager = entity.Manager;
            Entity        faction;// = entity.GetDataBlob<OwnedDB>().OwnedByFaction;

            entity.Manager.FindEntityByGuid(entity.FactionOwner, out faction);


            var detectableEntitys = manager.GetAllEntitiesWithDataBlob <SensorProfileDB>();

            var position = entity.GetDataBlob <PositionDB>(); //recever is a componentDB. not a shipDB

            if (position == null)                             //then it's probilby a colony
            {
                position = entity.GetDataBlob <ColonyInfoDB>().PlanetEntity.GetDataBlob <PositionDB>();
            }

            if (entity.GetDataBlob <ComponentInstancesDB>().TryGetComponentsByAttribute <SensorReceverAtbDB>(out var recevers))
            {
                foreach (var recever in recevers)
                {
                    var ability   = recever.GetAbilityState <SensorReceverAbility>();
                    var attribute = recever.Design.GetAttribute <SensorReceverAtbDB>();

                    //SensorReceverAtbDB receverDB = designEntity.GetDataBlob<SensorReceverAtbDB>();

                    FactionInfoDB factionInfo = faction.GetDataBlob <FactionInfoDB>();


                    SystemSensorContacts sensorMgr;
                    if (!manager.FactionSensorContacts.ContainsKey(entity.FactionOwner))
                    {
                        sensorMgr = new SystemSensorContacts(manager, faction);
                    }
                    else
                    {
                        sensorMgr = manager.FactionSensorContacts[entity.FactionOwner];
                    }

                    foreach (var detectableEntity in detectableEntitys)
                    {
                        //Entity detectableEntity = sensorProfile.OwningEntity;

                        if (detectableEntity.FactionOwner != Guid.Empty)
                        {
                            if (detectableEntity.FactionOwner != faction.Guid)
                            {
                                SensorProcessorTools.DetectEntites(sensorMgr, factionInfo, position, attribute, detectableEntity, atDateTime);
                            }
                            else
                            {
                                //then the sensor profile belongs to the same faction as the recever. don't bother trying to detect it.
                            }
                        }
                        else
                        {
                            SensorProcessorTools.DetectEntites(sensorMgr, factionInfo, position, attribute, detectableEntity, atDateTime);
                        }
                    }
                    manager.ManagerSubpulses.AddEntityInterupt(atDateTime + TimeSpan.FromSeconds(attribute.ScanTime), this.TypeName, entity);
                }
            }
        }