Пример #1
0
        internal override bool IsValidCommand(Game game)
        {
            if (CommandHelpers.IsCommandValid(game.GlobalManager, RequestingFactionGuid, EntityCommandingGuid, out _factionEntity, out _entityCommanding))
            {
                var instancesdb = _entityCommanding.GetDataBlob <ComponentInstancesDB>();

                if (instancesdb.AllComponents.TryGetValue(FireControlGuid, out var fc))
                {
                    if (fc.HasAblity <FireControlAbilityState>())
                    {
                        _fireControlComponent = fc;

                        foreach (var wpnGuid in WeaponsAssigned)
                        {
                            if (instancesdb.AllComponents.TryGetValue(wpnGuid, out var wpn))
                            {
                                if (wpn.HasAblity <WeaponState>())
                                {
                                    _weaponsAssigned.Add(wpn);
                                }
                            }
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }
Пример #2
0
        internal override bool IsValidCommand(Game game)
        {
            //see if we can successfully turn the guids into entites.
            //the reason we use guids is to make it easier to serialise for network play.
            //getting the entites makes it a bit easier to ActionCommand though
            //it may also be a good idea to double check that the entites we're looking for have specific DBs to prevent a crash...
            //IsCommandValid also checks that the entity we're commanding is owned by our faction.
            if (CommandHelpers.IsCommandValid(game.GlobalManager, RequestingFactionGuid, EntityCommandingGuid, out _factionEntity, out _entityCommanding))
            {
                if (game.GlobalManager.FindEntityByGuid(TargetSensorEntityGuid, out _targetSensorEntity))
                {
                    if (_targetSensorEntity.HasDataBlob <SensorInfoDB>()) //we want to damage the actual entity, not the sensor clone.
                    {
                        _targetActualEntity = _targetSensorEntity.GetDataBlob <SensorInfoDB>().DetectedEntity;
                    }
                    else
                    {
                        _targetActualEntity = _targetSensorEntity;
                    }
                    var instancesdb = _entityCommanding.GetDataBlob <ComponentInstancesDB>();

                    if (instancesdb.AllComponents.TryGetValue(FireControlGuid, out var fc))
                    {
                        if (fc.HasAblity <FireControlAbilityState>())
                        {
                            _fireControlComponent = fc;

                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Пример #3
0
 private bool IsOrderValid(EntityManager globalManager)
 {
     if (CommandHelpers.IsCommandValid(globalManager, RequestingFactionGuid, EntityCommandingGuid, out _factionEntity, out _entityCommanding))
     {
         return(true);
     }
     return(false);
 }
Пример #4
0
 internal override bool IsValidCommand(Game game)
 {
     if (CommandHelpers.IsCommandValid(game.GlobalManager, RequestingFactionGuid, EntityCommandingGuid, out _factionEntity, out _entityCommanding))
     {
         return(true);
     }
     return(false);
 }
 internal override bool IsValidCommand(Game game)
 {
     if (CommandHelpers.IsCommandValid(game.GlobalManager, RequestingFactionGuid, EntityCommandingGuid, out factionEntity, out _entityCommanding))
     {
         if (game.GlobalManager.TryGetEntityByGuid(LoadCargoFromEntityGuid, out loadFromEntity))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #6
0
 internal override bool IsValidCommand(Game game)
 {
     if (CommandHelpers.IsCommandValid(game.GlobalManager, RequestingFactionGuid, EntityCommandingGuid, out _factionEntity, out _entityCommanding))
     {
         if (game.GlobalManager.FindEntityByGuid(FireControlGuid, out _fireControlComponent))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #7
0
 internal override bool IsValidCommand(Game game)
 {
     if (CommandHelpers.IsCommandValid(game.GlobalManager, RequestingFactionGuid, EntityCommandingGuid, out factionEntity, out _entityCommanding))
     {
         if (game.GlobalManager.FindEntityByGuid(SendCargoToEntityGuid, out sendToEntity))
         {
             GetItemsToTransfer(game.StaticData);//should I try catch this? nah it's unlikely to be bad here.
             return(true);
         }
     }
     return(false);
 }
Пример #8
0
 internal override bool IsValidCommand(Game game)
 {
     _staticData = game.StaticData;
     if (CommandHelpers.IsCommandValid(game.GlobalManager, RequestingFactionGuid, EntityCommandingGuid, out _factionEntity, out _entityCommanding))
     {
         if (_staticData.ProcessedMaterials.ContainsKey(MaterialGuid))
         {
             int pointCost = _staticData.ProcessedMaterials[MaterialGuid].RefineryPointCost;
             _job = new RefineingJob(MaterialGuid, NumberOrderd, pointCost, RepeatJob);
             return(true);
         }
     }
     return(false);
 }
Пример #9
0
        internal override bool IsValidCommand(Game game)
        {
            if (CommandHelpers.IsCommandValid(game.GlobalManager, RequestingFactionGuid, EntityCommandingGuid, out _factionEntity, out _entityCommanding))
            {
                var instancesdb = _entityCommanding.GetDataBlob <ComponentInstancesDB>();

                if (instancesdb.AllComponents.TryGetValue(WeaponGuid, out ComponentInstance wpn))
                {
                    _ordnanceAssigned = _factionEntity.GetDataBlob <FactionInfoDB>().MissileDesigns[OrdnanceAssigned];
                    if (wpn.TryGetAbilityState(out WeaponState wpnState))
                    {
                        _weaponInstance = wpn;
                        return(wpnState.FireWeaponInstructions.CanLoadOrdnance(_ordnanceAssigned));
                    }
                }
            }
            return(false);
        }
Пример #10
0
 internal override bool IsValidCommand(Game game)
 {
     if (CommandHelpers.IsCommandValid(game.GlobalManager, RequestingFactionGuid, EntityCommandingGuid, out _factionEntity, out _entityCommanding))
     {
         if (game.GlobalManager.FindEntityByGuid(FireControlGuid, out _fireControlComponent))
         {
             Entity weaponEntity;
             foreach (var item in WeaponsAssigned)
             {
                 if (game.GlobalManager.FindEntityByGuid(item, out weaponEntity))
                 {
                     _weaponsAssigned.Add(weaponEntity);
                 }
             }
             return(true);
         }
     }
     return(false);
 }