/// <summary> /// when the faction is changed this will be run. /// </summary> private void OnFactionChanged() { MissileSeries = _CurrnetFaction.OrdnanceSeries; /// <summary> /// The 1st missile series should always be present, and cannot be deleted. it is the "No Missile Series" Series. Ain't I a stinker? /// </summary. if (MissileSeries.Count != 0) { CurrentMissileSeries = MissileSeries[0]; } MissileEngines = _CurrnetFaction.ComponentList.MissileEngineDef; if (MissileEngines.Count != 0) { CurrentMissileEngine = MissileEngines[0]; } Missiles = _CurrnetFaction.ComponentList.MissileDef; if (Missiles.Count != 0) { CurrentMissile = Missiles[0]; } if (FactionChanged != null) { FactionChanged(this, new EventArgs()); } }
/// <summary> /// Constructor for this view model. /// </summary> public MissileDesignViewModel() { _CurrnetFaction = GameState.Instance.Factions[0]; Factions = GameState.Instance.Factions; MissileEngines = _CurrnetFaction.ComponentList.MissileEngineDef; if (MissileEngines.Count != 0) { CurrentMissileEngine = MissileEngines[0]; } MissileSeries = _CurrnetFaction.OrdnanceSeries; if (MissileSeries.Count != 0) { CurrentMissileSeries = MissileSeries[0]; } Missiles = _CurrnetFaction.ComponentList.MissileDef; if (Missiles.Count != 0) { CurrentMissile = Missiles[0]; } }
/// <summary> /// Add a missile to the missile build queue. /// </summary> /// <param name="MissileDef">Missile to add</param> /// <param name="BuildAmt">missile build count</param> /// <param name="RequestedBuildPercentage">percentage of Ordnance factories to devote to construction.</param> public void BuildQueueAddMissile(OrdnanceDefTN MissileDef, float BuildAmt, float RequestedBuildPercentage) { MissileBuildQueueItem NewMBQItem = new MissileBuildQueueItem(MissileDef); NewMBQItem.UpdateBuildQueueInfo(BuildAmt, RequestedBuildPercentage, true, MissileDef.cost); MissileBuildQueue.Add(NewMBQItem); }
/// <summary> /// Constructor for individual launchers. /// </summary> /// <param name="definition">Definition for this launcher</param> public MissileLauncherTN(MissileLauncherDefTN definition) { MissileLauncherDef = definition; LoadTime = 0; LoadedOrdnance = null; MFC = null; isDestroyed = false; }
/// <summary> /// Constructor for Missile Build Queue Items /// </summary> /// <param name="Definition"></param> public MissileBuildQueueItem(OrdnanceDefTN Definition) { numToBuild = 0.0f; buildCapacity = 0.0f; productionRate = 0.0f; costPerItem = Definition.cost; inProduction = false; m_OrdanceDef = Definition; }
/// <summary> /// Loads or unloads missiles from a population. /// </summary> /// <param name="Missile">Ordnance type to be loaded or unloaded.</param> /// <param name="inc">Amount to load or unload.</param> /// <returns>Missiles placed into stockpile or taken out of it.</returns> public float LoadMissileToStockpile(OrdnanceDefTN Missile, float inc) { if (inc > 0) { if (MissileStockpile.ContainsKey(Missile)) { MissileStockpile[Missile] = MissileStockpile[Missile] + inc; } else { MissileStockpile.Add(Missile, inc); } return(inc); } else { if (MissileStockpile.ContainsKey(Missile) == false) { return(0); } else { /// <summary> /// Inc is negative here. /// </summary> float retVal = MissileStockpile[Missile]; MissileStockpile[Missile] = MissileStockpile[Missile] + inc; if (MissileStockpile[Missile] <= 0) { MissileStockpile.Remove(Missile); return(retVal); } return(inc); } } }
/// <summary> /// Every faction will start with some components defined and ready to use, though the engines and sensors shouldn't be here just yet. /// </summary> public void AddInitialComponents() { /// <summary> /// Watch total component count when adding or subtracting from this function /// </summary> TotalComponents = 0; GeneralComponentDefTN CrewQ = new GeneralComponentDefTN("Crew Quarters", 1.0f, 0, 10.0m, ComponentTypeTN.Crew); GeneralComponentDefTN CrewQS = new GeneralComponentDefTN("Crew Quarters - Small", 0.2f, 0, 2.0m, ComponentTypeTN.Crew); GeneralComponentDefTN FuelT = new GeneralComponentDefTN("Fuel Storage", 1.0f, 0, 10.0m, ComponentTypeTN.Fuel); GeneralComponentDefTN FuelTS = new GeneralComponentDefTN("Fuel Storage - Small", 0.2f, 0, 3.0m, ComponentTypeTN.Fuel); GeneralComponentDefTN EBay = new GeneralComponentDefTN("Engineering Spaces", 1.0f, 5, 10.0m, ComponentTypeTN.Engineering); GeneralComponentDefTN Bridge = new GeneralComponentDefTN("Bridge", 1.0f, 5, 10.0m, ComponentTypeTN.Bridge); TotalComponents = TotalComponents + 6; CrewQuarters.Add(CrewQ); CrewQuarters.Add(CrewQS); FuelStorage.Add(FuelT); FuelStorage.Add(FuelTS); EngineeringSpaces.Add(EBay); OtherComponents.Add(Bridge); /// <summary> /// These components aren't really basic, but I'll put them in anyway for the time being. Count 6 to 17 /// </summary> EngineDefTN EngDef = new EngineDefTN("25 EP Nuclear Thermal Engine", 5.0f, 1.0f, 1.0f, 1.0f, 1, 5, -1.0f); ActiveSensorDefTN ActDef = new ActiveSensorDefTN("Search 5M - 5000", 1.0f, 10, 5, 100, false, 1.0f, 1); PassiveSensorDefTN ThPasDef = new PassiveSensorDefTN("Thermal Sensor TH1-5", 1.0f, 5, PassiveSensorType.Thermal, 1.0f, 1); PassiveSensorDefTN EMPasDef = new PassiveSensorDefTN("EM Sensor EM1-5", 1.0f, 5, PassiveSensorType.EM, 1.0f, 1); BeamFireControlDefTN BFCDef = new BeamFireControlDefTN("Fire Control S01 10-1250", 0, 0, 1.0f, 1.0f, false, false, 1.0f, 1); BeamDefTN BeamDef = new BeamDefTN("10cm C1 Infrared Laser", ComponentTypeTN.Laser, 0, 0, 0, 1.0f); ReactorDefTN ReactDef = new ReactorDefTN("PWR S1 P2", 0, 1.0f, 1.0f); ShieldDefTN AShieldDef = new ShieldDefTN("Alpha R300/240 Shields", 0, 0, 1.0f, 1.0f, ComponentTypeTN.Shield); MissileLauncherDefTN TubeDef = new MissileLauncherDefTN("Size 1 Launcher", 1.0f, 1, false, 0); MagazineDefTN MagDef = new MagazineDefTN("Mag S1", 1.0f, 1, 0, 0, 1); ActiveSensorDefTN MFCDef = new ActiveSensorDefTN("Wasp I FC", 1.0f, 10, 5, 100, true, 1.0f, 1); TotalComponents = TotalComponents + 11; Engines.Add(EngDef); ActiveSensorDef.Add(ActDef); PassiveSensorDef.Add(ThPasDef); PassiveSensorDef.Add(EMPasDef); BeamFireControlDef.Add(BFCDef); BeamWeaponDef.Add(BeamDef); ReactorDef.Add(ReactDef); ShieldDef.Add(AShieldDef); MLauncherDef.Add(TubeDef); MagazineDef.Add(MagDef); MissileFireControlDef.Add(MFCDef); TurretableBeamDef.Add(BeamDef); /// <summary> /// Everyone starts with cargoholds. Count 17 to 19 /// </summary> CargoDefTN CargoStandard = new CargoDefTN("Cargo Hold - Standard", 500.0f, 50.0m, 5); CargoDefTN CargoSmall = new CargoDefTN("Cargo Hold - Small", 100.0f, 12.5m, 2); TotalComponents = TotalComponents + 2; CargoHoldDef.Add(CargoStandard); CargoHoldDef.Add(CargoSmall); /// <summary> /// Cryostorage is a TN only starting option. otherwise it must be researched. Count, 19 to 22 /// </summary> ColonyDefTN ColonyStandard = new ColonyDefTN("Cryogenic Transport", 50.0f, 100.0m, 10); ColonyDefTN ColonySmall = new ColonyDefTN("Cryogenic Transport - Small", 5.0f, 20.0m, 2); ColonyDefTN ColonyEmergency = new ColonyDefTN("Cryogenic Transport - Emergency", 1.0f, 5.0m, 0); TotalComponents = TotalComponents + 3; ColonyBayDef.Add(ColonyStandard); ColonyBayDef.Add(ColonySmall); ColonyBayDef.Add(ColonyEmergency); /// <summary> /// Only TN starts begin with this component for now. the improved,advanced, and grav-assisted variants have to be researched. Count 22, to 23 /// </summary> CargoHandlingDefTN CHS = new CargoHandlingDefTN("Cargo Handling System", 5, 10.0m); CargoHandleSystemDef.Add(CHS); TotalComponents = TotalComponents + 1; /// <summary> /// Alpha build components: Count 23, to 39 /// </summary> EngineDefTN AlphaEngine = new EngineDefTN("Ion Engine 120", 12.0f, 1.0f, 0.7f, 1.0f, 1, 10.0f, -1.0f); ActiveSensorDefTN AlphaBigSensor = new ActiveSensorDefTN("Search 181M - 10000", 10.0f, 16, 8, 200, false, 1.0f, 1); ActiveSensorDefTN AlphaSmallSensor = new ActiveSensorDefTN("Search 57M - 1000", 10.0f, 16, 8, 20, false, 1.0f, 1); ActiveSensorDefTN AlphaMissileSensor = new ActiveSensorDefTN("Search 1.4M - Missile", 10.0f, 16, 8, 1, false, 1.0f, 1); PassiveSensorDefTN AlphaEMSensor = new PassiveSensorDefTN("EM Detection Sensor EM10-80", 10.0f, 8, PassiveSensorType.EM, 1.0f, 1); PassiveSensorDefTN AlphaTHSensor = new PassiveSensorDefTN("TH Detection Sensor TH10-80", 10.0f, 8, PassiveSensorType.Thermal, 1.0f, 1); BeamFireControlDefTN AlphaFireControl = new BeamFireControlDefTN("Primary III FC R96K T6K", 2, 2, 4.0f, 2.0f, false, false, 1.0f, 1); BeamDefTN AlphaRailGun = new BeamDefTN("15cm Railgun V3/C3", ComponentTypeTN.Rail, 2, 2, 2, 1.0f); BeamDefTN AlphaLaser = new BeamDefTN("15cm C3 Near UV Laser", ComponentTypeTN.Laser, 2, 2, 2, 1.0f); BeamDefTN AlphaParticle = new BeamDefTN("PBW-4 150K", ComponentTypeTN.Particle, 2, 2, 2, 1.0f); BeamDefTN AlphaPlasma = new BeamDefTN("15cm C3 Plasma Beam", ComponentTypeTN.Plasma, 2, 2, 2, 1.0f); BeamDefTN AlphaMeson = new BeamDefTN("R9/C3 Meson Cannon", ComponentTypeTN.Meson, 2, 2, 2, 1.0f); BeamDefTN AlphaHPM = new BeamDefTN("R9/C3 Microwave", ComponentTypeTN.Microwave, 2, 2, 2, 1.0f); BeamDefTN AlphaGauss = new BeamDefTN("Gauss R3-100", ComponentTypeTN.Gauss, 0, 2, 2, 1.0f); ReactorDefTN AlphaReactor = new ReactorDefTN("GCFR S1 P4.5", 2, 1.0f, 1.0f); ShieldDefTN AlphaShield = new ShieldDefTN("Gamma R300/336 Shields", 2, 2, 0.7f, 1.0f, ComponentTypeTN.Shield); TotalComponents = TotalComponents + 16; Engines.Add(AlphaEngine); ActiveSensorDef.Add(AlphaBigSensor); ActiveSensorDef.Add(AlphaSmallSensor); ActiveSensorDef.Add(AlphaMissileSensor); PassiveSensorDef.Add(AlphaEMSensor); PassiveSensorDef.Add(AlphaTHSensor); BeamFireControlDef.Add(AlphaFireControl); BeamWeaponDef.Add(AlphaRailGun); BeamWeaponDef.Add(AlphaLaser); BeamWeaponDef.Add(AlphaParticle); BeamWeaponDef.Add(AlphaPlasma); BeamWeaponDef.Add(AlphaMeson); BeamWeaponDef.Add(AlphaHPM); BeamWeaponDef.Add(AlphaGauss); ReactorDef.Add(AlphaReactor); ShieldDef.Add(AlphaShield); TurretableBeamDef.Add(AlphaLaser); TurretableBeamDef.Add(AlphaMeson); TurretableBeamDef.Add(AlphaGauss); /// <summary> /// Missile Combat Alpha Components: Count at 44 from 39 OrdnanceDefTN and MissileEngineDefTN are _NOT_ included in the total count. /// </summary> EngineDefTN AlphaMCEngine = new EngineDefTN("Military 5000 EP Photonic Drive", 100.0f, 1.0f, 0.1f, 1.0f, 1, 50.0f, -1.0f); ActiveSensorDefTN AlphaMCSensor = new ActiveSensorDefTN("Active Search Sensor MR13500-R100", 10.0f, 180, 75, 100, false, 1.0f, 0); ActiveSensorDefTN AlphaMCMissileFireControl = new ActiveSensorDefTN("Missile Fire Control FC40500-R100", 10.0f, 180, 75, 100, true, 1.0f, 0); MagazineDefTN MagazineMCDef = new MagazineDefTN("Capacity 587 Magazine: Exp 1% HTK4", 30.0f, 4, 8, 8, 12); MissileLauncherDefTN TubeMCDef = new MissileLauncherDefTN("Size 4 Launcher", 4.0f, 11, false, 0); MissileEngineDefTN MissileEngineMCDef = new MissileEngineDefTN("Photonic Missile Drive", 100.0f, 1.0f, 0.1f, 1.5f); OrdnanceDefTN MissileMCDef = new OrdnanceDefTN("Size 4 Missile", null, 0.5f, 11, 1.0f, 1.0f, 11, 0.0f, 0, 0.0f, 0, 0.0f, 0, 0.0f, 0, 100, 0, 0.0f, 0.0f, 0, false, 0, false, 0, MissileEngineMCDef, 1); TotalComponents = TotalComponents + 5; Engines.Add(AlphaMCEngine); ActiveSensorDef.Add(AlphaMCSensor); MissileFireControlDef.Add(AlphaMCMissileFireControl); MagazineDef.Add(MagazineMCDef); MLauncherDef.Add(TubeMCDef); MissileEngineDef.Add(MissileEngineMCDef); MissileDef.Add(MissileMCDef); MissileLauncherDefTN TubeAMMDef = new MissileLauncherDefTN("Size 1 Launcher", 1.0f, 11, false, 0); MissileEngineDefTN MissileEngineAMMDef = new MissileEngineDefTN("Small Photonic Missile Drive", 100.0f, 6.0f, 0.1f, 0.4f); ActiveSensorDefTN AMMSensor = new ActiveSensorDefTN("AMM Sensor", 10.0f, 180, 75, 1, false, 1.0f, 0); ActiveSensorDefTN AMMMFC = new ActiveSensorDefTN("AMM MFC", 10.0f, 180, 75, 1, true, 1.0f, 0); OrdnanceDefTN MissileAMMDef = new OrdnanceDefTN("Size 1 Missile", null, 0.14f, 11, 0.23f, 0.23f, 11, 0.0f, 0, 0.0f, 0, 0.0f, 0, 0.0f, 0, 1, 0, 0.0f, 0.0f, 0, false, 0, false, 0, MissileEngineAMMDef, 1); TotalComponents = TotalComponents + 3; MLauncherDef.Add(TubeAMMDef); MissileEngineDef.Add(MissileEngineAMMDef); ActiveSensorDef.Add(AMMSensor); MissileFireControlDef.Add(AMMMFC); MissileDef.Add(MissileAMMDef); /// <summary> /// Sensor components should be added upon researching the appropriate technology, as they cannot be designed, Count should be at 46 /// </summary> SurveySensorDefTN GeoSurvey = new SurveySensorDefTN("Geological Survey Sensor", SurveySensorDefTN.SurveySensorType.Geological, 1.0f); SurveySensorDefTN GravSurvey = new SurveySensorDefTN("Gravitational Survey Sensor", SurveySensorDefTN.SurveySensorType.Gravitational, 1.0f); SurveySensorDef.Add(GeoSurvey); SurveySensorDef.Add(GravSurvey); TotalComponents = TotalComponents + 2; }
public override void Render() { switch (m_oSystemContect.SSEntity) { case StarSystemEntityType.TaskGroup: TaskGroupTN TaskGroup = m_oSystemContect.Entity as TaskGroupTN; /// <summary> /// Update this contact's sensor elements. /// </summary> if (TaskGroup.SensorUpdateAck != _LastSensorUpdateAck) { /// <summary> /// Get rid of all sensors if this taskgroup is empty. a SensorUpdateAck should be sent upon emptying a tg into another tg. /// </summary> if (TaskGroup.Ships.Count == 0) { _SensorContactElements.Clear(); } /// <summary> /// Remove those sensors that are no longer active. /// </summary> BindingList <Guid> SensorRemoveList = new BindingList <Guid>(); foreach (KeyValuePair <Guid, SensorElement> SCE in _SensorContactElements) { switch (SCE.Value._sensorType) { case ComponentTypeTN.ActiveSensor: ActiveSensorTN aSensor = (SCE.Value.SceenEntity as ActiveSensorTN); if (aSensor.isActive == false || aSensor.isDestroyed == true || ParentSceen.ShowActives == false) { SensorRemoveList.Add(SCE.Key); } break; case ComponentTypeTN.PassiveSensor: PassiveSensorTN pSensor = (SCE.Value.SceenEntity as PassiveSensorTN); /// <summary> /// Remove this sensor if it is destroyed, or if it isn't the current best thermal/em sensor. if a sensor is destroyed it should be replaced as the best em/thermal. /// </summary> if (pSensor != null) { if (pSensor.isDestroyed == true || ParentSceen.ShowPassives == false) { SensorRemoveList.Add(SCE.Key); } else { if (pSensor.pSensorDef.thermalOrEM == PassiveSensorType.Thermal) { if (pSensor != TaskGroup.BestThermal) { SensorRemoveList.Add(SCE.Key); } } else { if (pSensor != TaskGroup.BestEM) { SensorRemoveList.Add(SCE.Key); } } } } else { /// <summary> /// default passives will be null, so that should be handled here. if show passives is off, or a better passive shows up, remove the default passives. /// </summary> if (ParentSceen.ShowPassives == false || TaskGroup.BestThermal != null || TaskGroup.BestEM != null) { SensorRemoveList.Add(SCE.Key); } } break; } } if (SensorRemoveList.Count != 0) { foreach (Guid SCE in SensorRemoveList) { _SensorContactElements.Remove(SCE); } } if (ParentSceen.ShowPassives == true) { if (TaskGroup.Ships.Count != 0) { /// <summary> /// A taskgroup with no sensors still has the default package, so handle that. A taskgroup with no ships should not have a sensor presence however. /// </summary> if (TaskGroup.BestEM == null && _SensorContactElements.ContainsKey(TaskGroup.Id) == false) { PassiveSensorDefTN pSensorDef = TaskGroup.TaskGroupFaction.ComponentList.DefaultPassives; double factor = Constants.Units.KmPerAu / Constants.GameConstants.BasicUnitOfDistance; double AURadius = (double)pSensorDef.range * ((float)Constants.SensorTN.DefaultPassiveSignature / (float)ParentSceen.ShowPassiveSignatureRange) / factor; Vector3 TGPos = new Vector3((float)TaskGroup.Contact.Position.X, (float)TaskGroup.Contact.Position.Y, 0.0f); SensorElement NSE = new SensorElement(_DefaultEffect, TGPos, (float)AURadius, System.Drawing.Color.Blue, "", null, ComponentTypeTN.PassiveSensor, ParentSceen); //definitely a kludge here to make SCE work with default passives. _SensorContactElements.Add(TaskGroup.Id, NSE); } else if (TaskGroup.BestEM != null && _SensorContactElements.ContainsKey(TaskGroup.BestEM.pSensorDef.Id) == false) { PassiveSensorDefTN pSensorDef = TaskGroup.BestEM.pSensorDef; double factor = Constants.Units.KmPerAu / Constants.GameConstants.BasicUnitOfDistance; double AURadius = (double)pSensorDef.range * ((float)Constants.SensorTN.DefaultPassiveSignature / (float)ParentSceen.ShowPassiveSignatureRange) / factor; Vector3 TGPos = new Vector3((float)TaskGroup.Contact.Position.X, (float)TaskGroup.Contact.Position.Y, 0.0f); SensorElement NSE = new SensorElement(_DefaultEffect, TGPos, (float)AURadius, System.Drawing.Color.Blue, TaskGroup.BestEM.Name, TaskGroup.BestEM, TaskGroup.BestEM.pSensorDef.componentType, ParentSceen); _SensorContactElements.Add(TaskGroup.BestEM.pSensorDef.Id, NSE); } /// <summary> /// A taskgroup with no sensors still has the default package, so handle that. /// </summary> if (TaskGroup.BestThermal == null && _SensorContactElements.ContainsKey(TaskGroup.Ships[0].Id) == false) { PassiveSensorDefTN pSensorDef = TaskGroup.TaskGroupFaction.ComponentList.DefaultPassives; double factor = Constants.Units.KmPerAu / Constants.GameConstants.BasicUnitOfDistance; double AURadius = (double)pSensorDef.range * ((float)Constants.SensorTN.DefaultPassiveSignature / (float)ParentSceen.ShowPassiveSignatureRange) / factor; Vector3 TGPos = new Vector3((float)TaskGroup.Contact.Position.X, (float)TaskGroup.Contact.Position.Y, 0.0f); SensorElement NSE = new SensorElement(_DefaultEffect, TGPos, (float)AURadius, System.Drawing.Color.Red, "", null, ComponentTypeTN.PassiveSensor, ParentSceen); //yep, its a kludge. _SensorContactElements.Add(TaskGroup.Ships[0].Id, NSE); } else if (TaskGroup.BestThermal != null && _SensorContactElements.ContainsKey(TaskGroup.BestThermal.pSensorDef.Id) == false) { PassiveSensorDefTN pSensorDef = TaskGroup.BestThermal.pSensorDef; double factor = Constants.Units.KmPerAu / Constants.GameConstants.BasicUnitOfDistance; double AURadius = (double)pSensorDef.range * ((float)Constants.SensorTN.DefaultPassiveSignature / (float)ParentSceen.ShowPassiveSignatureRange) / factor; Vector3 TGPos = new Vector3((float)TaskGroup.Contact.Position.X, (float)TaskGroup.Contact.Position.Y, 0.0f); SensorElement NSE = new SensorElement(_DefaultEffect, TGPos, (float)AURadius, System.Drawing.Color.Red, TaskGroup.BestThermal.Name, TaskGroup.BestThermal, TaskGroup.BestThermal.pSensorDef.componentType, ParentSceen); _SensorContactElements.Add(pSensorDef.Id, NSE); } } } /// <summary> /// Check for newly activated sensors. /// </summary> if (ParentSceen.ShowActives == true) { foreach (ActiveSensorTN Sensor in TaskGroup.ActiveSensorQue) { /// <summary> /// This sensor survived the above cleanup, and is in the sensor contact element list, so don't re check whether it should be here. /// </summary> if (_SensorContactElements.ContainsKey(Sensor.aSensorDef.Id) == true) { continue; } ActiveSensorDefTN SensorDef = Sensor.aSensorDef; double factor = Constants.Units.KmPerAu / Constants.GameConstants.BasicUnitOfDistance; double AURadius = (double)SensorDef.maxRange / factor; Vector3 TGPos = new Vector3((float)TaskGroup.Contact.Position.X, (float)TaskGroup.Contact.Position.Y, 0.0f); SensorElement NSE = new SensorElement(_DefaultEffect, TGPos, (float)AURadius, System.Drawing.Color.Turquoise, Sensor.Name, Sensor, Sensor.aSensorDef.componentType, ParentSceen); _SensorContactElements.Add(SensorDef.Id, NSE); } } _LastSensorUpdateAck = TaskGroup.SensorUpdateAck; } break; case StarSystemEntityType.Population: Population CurrentPop = (m_oSystemContect.Entity as Population); /// <summary> /// Populations only have one sensor element. /// </summary> if (CurrentPop._sensorUpdateAck != _LastSensorUpdateAck) { _SensorContactElements.Clear(); int DSTS = (int)Math.Floor(CurrentPop.Installations[(int)Installation.InstallationType.DeepSpaceTrackingStation].Number); if (ParentSceen.ShowPassives == true && DSTS != 0) { /// <summary> /// This calculates the default detection distance for strength 1000 signatures. /// </summary> int SensorTech = CurrentPop.Faction.FactionTechLevel[(int)Faction.FactionTechnology.DSTSSensorStrength]; if (SensorTech > Constants.Colony.DeepSpaceMax) { SensorTech = Constants.Colony.DeepSpaceMax; } #warning if EM strength differs from Thermal handle that here. int ScanStrength = DSTS * Constants.Colony.ThermalDeepSpaceStrength[SensorTech] * 100; double factor = Constants.Units.KmPerAu / Constants.GameConstants.BasicUnitOfDistance; double AURadius = (double)ScanStrength * ((float)Constants.SensorTN.DefaultPassiveSignature / (float)ParentSceen.ShowPassiveSignatureRange) / factor; Vector3 PopPosition = new Vector3((float)CurrentPop.Contact.Position.X, (float)CurrentPop.Contact.Position.Y, 0.0f); /// <summary> /// Type is set to TypeCount because only the taskgroup section requires it. Likewise for CurrentPop, and CurrentPop.Id, these aren't strictly necessary, but the /// taskgroup section requires more information as more sensor contact elements can be associated with a taskgroup. /// </summary> SensorElement NSE = new SensorElement(_DefaultEffect, PopPosition, (float)AURadius, System.Drawing.Color.Purple, CurrentPop.Name + " DSTS Coverage", CurrentPop, ComponentTypeTN.TypeCount, ParentSceen); _SensorContactElements.Add(CurrentPop.Id, NSE); } _LastSensorUpdateAck = CurrentPop._sensorUpdateAck; } break; case StarSystemEntityType.Missile: OrdnanceGroupTN MissileGroup = (m_oSystemContect.Entity as OrdnanceGroupTN); /// <summary> /// This ordnance group was just created, so check whether or not any sensors need to be displayed. Or the display could request that passives or actives not be displayed. /// </summary> if (_LastSensorUpdateAck != MissileGroup._sensorUpdateAck) { _SensorContactElements.Clear(); OrdnanceDefTN OrdDef = MissileGroup.missiles[0].missileDef; if (OrdDef.aSD != null && ParentSceen.ShowActives == true) { double factor = Constants.Units.KmPerAu / Constants.GameConstants.BasicUnitOfDistance; double AURadius = (double)OrdDef.aSD.maxRange / factor; Vector3 MGPos = new Vector3((float)MissileGroup.contact.Position.X, (float)MissileGroup.contact.Position.Y, 0.0f); SensorElement NSE = new SensorElement(_DefaultEffect, MGPos, (float)AURadius, System.Drawing.Color.Turquoise, MissileGroup.missiles[0].missileDef.Name + " Active Sensor", MissileGroup, ComponentTypeTN.TypeCount, ParentSceen); _SensorContactElements.Add(OrdDef.aSD.Id, NSE); } if (OrdDef.tHD != null && ParentSceen.ShowPassives == true) { double factor = Constants.Units.KmPerAu / Constants.GameConstants.BasicUnitOfDistance; double AURadius = (double)OrdDef.tHD.range * ((float)Constants.SensorTN.DefaultPassiveSignature / (float)ParentSceen.ShowPassiveSignatureRange) / factor; Vector3 MGPos = new Vector3((float)MissileGroup.contact.Position.X, (float)MissileGroup.contact.Position.Y, 0.0f); SensorElement NSE = new SensorElement(_DefaultEffect, MGPos, (float)AURadius, System.Drawing.Color.Red, MissileGroup.missiles[0].missileDef.Name + " Thermal Sensor", MissileGroup, ComponentTypeTN.TypeCount, ParentSceen); _SensorContactElements.Add(OrdDef.tHD.Id, NSE); } if (OrdDef.eMD != null && ParentSceen.ShowPassives == true) { double factor = Constants.Units.KmPerAu / Constants.GameConstants.BasicUnitOfDistance; double AURadius = (double)OrdDef.eMD.range * ((float)Constants.SensorTN.DefaultPassiveSignature / (float)ParentSceen.ShowPassiveSignatureRange) / factor; Vector3 MGPos = new Vector3((float)MissileGroup.contact.Position.X, (float)MissileGroup.contact.Position.Y, 0.0f); SensorElement NSE = new SensorElement(_DefaultEffect, MGPos, (float)AURadius, System.Drawing.Color.Blue, MissileGroup.missiles[0].missileDef.Name + " EM Sensor", MissileGroup, ComponentTypeTN.TypeCount, ParentSceen); _SensorContactElements.Add(OrdDef.eMD.Id, NSE); } _LastSensorUpdateAck = MissileGroup._sensorUpdateAck; } break; } foreach (GLPrimitive oPrimitive in m_lPrimitives) { oPrimitive.Render(); } /// <summary> /// Adding sensor elements to children causes wierd behavior that I'd rather not deal with. /// </summary> foreach (KeyValuePair <Guid, SensorElement> sElement in _SensorContactElements) { sElement.Value.Render(); } if (RenderChildren == true) { foreach (SceenElement oElement in m_lChildren) { oElement.Render(); } } // render lable: if (m_oLable != null) { m_oLable.Render(); } }
/// <summary> /// Constructor for Missile Build Queue Items /// </summary> /// <param name="Definition"></param> public MissileBuildQueueItem(OrdnanceDefTN Definition) { m_OrdanceDef = Definition; }