├── .appveyor.yml ├── .editorconfig ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ └── bug_report.md └── workflows │ ├── Benchmarks.yml │ └── Build_and_run_tests.yml ├── .gitignore ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── CONTRIBUTING.md ├── LICENSE ├── MITLicense.rtf ├── MpegServer.cs ├── Pulsar4X ├── .idea │ └── .idea.Pulsar4X │ │ └── .idea │ │ ├── .gitignore │ │ ├── codeStyles │ │ └── codeStyleConfig.xml │ │ ├── dictionaries │ │ └── se5a.xml │ │ ├── indexLayout.xml │ │ ├── projectSettingsUpdater.xml │ │ └── vcs.xml ├── Benchmarks │ ├── Benchmarks.cs │ ├── Benchmarks.csproj │ └── Program.cs ├── DebugReloadClient │ ├── DebugReloadClient.csproj │ ├── Program.cs │ └── packages.config ├── GameEngine │ ├── Colonies │ │ ├── ColonizeableDB.cs │ │ ├── ColonyBonusesDB.cs │ │ ├── ColonyFactory.cs │ │ ├── ColonyInfoDB.cs │ │ ├── ColonyLifeSupportDB.cs │ │ ├── CreateColonyOrder.cs │ │ └── PopulationProcessor.cs │ ├── Damage │ │ ├── DamageComplex │ │ │ ├── ComponentPlacement.cs │ │ │ ├── DamageProcessor.cs │ │ │ ├── DamageTools.cs │ │ │ ├── EntityDamageProfileDB.cs │ │ │ └── HowDamageWorks.txt │ │ └── Simple │ │ │ └── SimpleDamage.cs │ ├── Data │ │ ├── basemod │ │ │ ├── Industry.mmd │ │ │ ├── blueprints │ │ │ │ ├── alphaCentauri.json │ │ │ │ ├── armor.json │ │ │ │ ├── atmosphereGases.json │ │ │ │ ├── cargoTypes.json │ │ │ │ ├── comets.json │ │ │ │ ├── componentDesigns.json │ │ │ │ ├── damageResistance.json │ │ │ │ ├── dwarfPlanets.json │ │ │ │ ├── earth.json │ │ │ │ ├── electronics.json │ │ │ │ ├── energy.json │ │ │ │ ├── engines.json │ │ │ │ ├── industryTypes.json │ │ │ │ ├── installations.json │ │ │ │ ├── jupiter.json │ │ │ │ ├── luna.json │ │ │ │ ├── mars.json │ │ │ │ ├── materials.json │ │ │ │ ├── mercury.json │ │ │ │ ├── minerals.json │ │ │ │ ├── neptune.json │ │ │ │ ├── ordnance.json │ │ │ │ ├── saturn.json │ │ │ │ ├── shipDesigns.json │ │ │ │ ├── sol.json │ │ │ │ ├── species.json │ │ │ │ ├── storage.json │ │ │ │ ├── techCategories.json │ │ │ │ ├── techs.json │ │ │ │ ├── uranus.json │ │ │ │ ├── venus.json │ │ │ │ └── weapons.json │ │ │ ├── defaultStart │ │ │ │ ├── opposition.json │ │ │ │ ├── ordnanceDesigns │ │ │ │ │ └── missile-250.json │ │ │ │ └── uef.json │ │ │ ├── defaultTheme.json │ │ │ ├── modInfo.json │ │ │ └── systemGenSettings.json │ │ ├── oldjson │ │ │ ├── ArmorTypeData.json │ │ │ ├── AtmosphericData.json │ │ │ ├── AtmosphericDataAurora.json │ │ │ ├── CargoTypeData.json │ │ │ ├── Commander Name Theme - The Creators.json │ │ │ ├── ComponentDataElectronics.json │ │ │ ├── ComponentDataEnergy.json │ │ │ ├── ComponentDataMisc.json │ │ │ ├── ComponentDataOrdnance.json │ │ │ ├── ComponentDataPropulsion.json │ │ │ ├── ComponentDataWeapons.json │ │ │ ├── DefaultTheme.json │ │ │ ├── GameStarts │ │ │ │ └── DefaultStart │ │ │ │ │ └── Components.json │ │ │ ├── IndustryTypeData.json │ │ │ ├── InstallationData.json │ │ │ ├── Minerals.json │ │ │ ├── MineralsAurora.json │ │ │ ├── RefinedMaterialsData.json │ │ │ ├── SystemGenSettings.json │ │ │ ├── TechnologyData.json │ │ │ ├── TechnologyData.json.OLD │ │ │ ├── VersionInfo.vinfo │ │ │ └── mineralsAurora.json │ │ └── testingmod │ │ │ ├── modInfo.json │ │ │ └── testData.json │ ├── Energy │ │ ├── EnergyGenAbilityDB.cs │ │ ├── EnergyGenProcessor.cs │ │ ├── EnergyGenerationAtb.cs │ │ └── EnergyStoreAtb.cs │ ├── Engine │ │ ├── Auth │ │ │ ├── AccessControl.cs │ │ │ ├── AccessRole.cs │ │ │ ├── AuthenticationToken.cs │ │ │ └── Player.cs │ │ ├── Blueprints │ │ │ ├── ArmorBlueprint.cs │ │ │ ├── Blueprint.cs │ │ │ ├── CargoTypeBlueprint.cs │ │ │ ├── ColonyBlueprint.cs │ │ │ ├── ComponentDesignBlueprint.cs │ │ │ ├── ComponentTemplateBlueprint.cs │ │ │ ├── ComponentTemplatePropertyBlueprint.cs │ │ │ ├── GasBlueprint.cs │ │ │ ├── IndustryTypeBlueprint.cs │ │ │ ├── MineralBlueprint.cs │ │ │ ├── ProcessedMaterialBlueprint.cs │ │ │ ├── ShipDesignBlueprint.cs │ │ │ ├── SpeciesBlueprint.cs │ │ │ ├── StarBlueprint.cs │ │ │ ├── SystemBlueprint.cs │ │ │ ├── SystemBodyBlueprint.cs │ │ │ ├── SystemGenSettingsBlueprint.cs │ │ │ ├── TechBlueprint.cs │ │ │ ├── TechCategoryBlueprint.cs │ │ │ └── ThemeBlueprint.cs │ │ ├── Components │ │ │ ├── ChainedExpression.cs │ │ │ ├── ComponentAbilityState.cs │ │ │ ├── ComponentDesign.cs │ │ │ ├── ComponentDesignFromJson.cs │ │ │ ├── ComponentDesignProperty.cs │ │ │ ├── ComponentDesigner.cs │ │ │ ├── ComponentInstance.cs │ │ │ ├── ComponentInstancesDB.cs │ │ │ ├── ComponentInstancesDBExtensions.cs │ │ │ ├── ComponentTreeHeirarchyAbilityState.cs │ │ │ ├── IComponentDesignAttribute.cs │ │ │ ├── InstallComponentInstanceOrder.cs │ │ │ └── UninstallComponentInstanceOrder.cs │ │ ├── DataStructures │ │ │ ├── ComparableBitArray.cs │ │ │ ├── ConcurrentHashSet.cs │ │ │ ├── DictionaryExtensions.cs │ │ │ ├── EntityFilter.cs │ │ │ ├── EnumExtensions.cs │ │ │ ├── Enums.cs │ │ │ ├── FilterLogic.cs │ │ │ ├── ManueverState.cs │ │ │ ├── PercentValue.cs │ │ │ ├── RawBmp.cs │ │ │ ├── SafeDictionary.cs │ │ │ ├── SafeList.cs │ │ │ ├── SystemEntityJumpPair.cs │ │ │ ├── ValueRange.cs │ │ │ ├── ValueTypeStruct.cs │ │ │ ├── WeightedList.cs │ │ │ ├── WeightedValue.cs │ │ │ └── XThreadData.cs │ │ ├── Datablobs │ │ │ ├── BaseDataBlob.cs │ │ │ ├── DesignInfoDB.cs │ │ │ ├── PositionDB.cs │ │ │ └── TreeHierarchyDB.cs │ │ ├── Entities │ │ │ ├── Entity.cs │ │ │ ├── EntityExtensions.cs │ │ │ ├── EntityIDGenerator.cs │ │ │ ├── EntityManager.cs │ │ │ ├── IHasDataBlobs.cs │ │ │ ├── ProtoEntity.cs │ │ │ ├── StarSystem.cs │ │ │ └── StarSystemExtensions.cs │ │ ├── Events │ │ │ ├── Event.cs │ │ │ ├── EventManager.cs │ │ │ ├── EventTypes.cs │ │ │ ├── IEventLog.cs │ │ │ └── SpaceMasterEventLog.cs │ │ ├── Extensions │ │ │ ├── ObjectExtensions.cs │ │ │ ├── PositionExtensions.cs │ │ │ ├── StringExtensions.cs │ │ │ └── SystemGenSettingsExtensions.cs │ │ ├── Factories │ │ │ └── DefaultStartFactory.cs │ │ ├── Game.cs │ │ ├── GameFactory.cs │ │ ├── GameSettings.cs │ │ ├── Interfaces │ │ │ ├── ICondition.cs │ │ │ ├── IConstructableDesign.cs │ │ │ ├── IPosition.cs │ │ │ └── IRecalcProcessor.cs │ │ ├── ManagerSubPulse.cs │ │ ├── MasterTimePulse.cs │ │ ├── Messaging │ │ │ ├── Message.cs │ │ │ ├── MessagePublisher.cs │ │ │ └── MessageTypes.cs │ │ ├── Modding │ │ │ ├── ModDataStore.cs │ │ │ ├── ModInstruction.cs │ │ │ ├── ModLoader.cs │ │ │ └── ModManifest.cs │ │ ├── OrbitMath.cs │ │ ├── Orders │ │ │ ├── ConditionalOrder.cs │ │ │ ├── Conditions │ │ │ │ ├── ComparisonCondition.cs │ │ │ │ ├── CompoundCondition.cs │ │ │ │ ├── ConditionItem.cs │ │ │ │ └── FuelCondition.cs │ │ │ ├── EntityCommand.cs │ │ │ ├── IOrderHandler.cs │ │ │ ├── OrderableDB.cs │ │ │ └── StandAloneOrderHandler.cs │ │ ├── PerformanceStopwatch.cs │ │ ├── ProcessManager.cs │ │ ├── Processors │ │ │ ├── IHotloopProcessor.cs │ │ │ ├── IInstanceProcessor.cs │ │ │ ├── OrderableProcessor.cs │ │ │ ├── PulseActionProcessor.cs │ │ │ └── RecalcProcessor.cs │ │ ├── SaveLoad │ │ │ └── JsonUtils.cs │ │ └── Utils │ │ │ ├── GaussianRandom.cs │ │ │ ├── Pressure.cs │ │ │ ├── Stringify.cs │ │ │ └── Temperature.cs │ ├── Factions │ │ ├── FactionAbilitiesDB.cs │ │ ├── FactionDataStore.cs │ │ ├── FactionEventLog.cs │ │ ├── FactionFactory.cs │ │ ├── FactionInfoDB.cs │ │ ├── FactionOwnerDB.cs │ │ ├── FactionSystemInfoDB.cs │ │ └── FactionTechDB.cs │ ├── Fleets │ │ ├── FleetDB.cs │ │ ├── FleetFactory.cs │ │ ├── FleetOrder.cs │ │ ├── FleetOrderProcessor.cs │ │ ├── RefuelAction.cs │ │ ├── ResupplyAction.cs │ │ └── ServeyAnomalyAction.cs │ ├── Galaxy │ │ ├── AsteroidDamageDB.cs │ │ ├── AsteroidFactory.cs │ │ ├── AtmosphereDB.cs │ │ ├── AtmosphereDBExtensions.cs │ │ ├── AtmosphereProcessor.cs │ │ ├── GalaxyFactory.cs │ │ ├── MassVolumeDB.cs │ │ ├── MassVolumeProcessor.cs │ │ ├── PopulationSupportAtbDB.cs │ │ ├── RuinsDB.cs │ │ ├── StarFactory.cs │ │ ├── StarInfoDB.cs │ │ ├── StarSystemFactory.cs │ │ ├── SystemBodyFactory.cs │ │ ├── SystemBodyInfoDB.cs │ │ └── VisibleByDefaultDB.cs │ ├── GameEngine.csproj │ ├── GeoSurveys │ │ ├── GeoSurveyAbilityDB.cs │ │ ├── GeoSurveyAtb.cs │ │ ├── GeoSurveyOrder.cs │ │ ├── GeoSurveyProcessor.cs │ │ ├── GeoSurveyableDB.cs │ │ └── GeoSurveyableDBExtensions.cs │ ├── Industry │ │ ├── IndustryAbilityDB.cs │ │ ├── IndustryAtb.cs │ │ ├── IndustryJob.cs │ │ ├── IndustryOrder.cs │ │ ├── IndustryProcessor.cs │ │ ├── IndustryTools.cs │ │ ├── InstallationsDB.cs │ │ ├── JobBase.cs │ │ ├── MineResourcesAtbDB.cs │ │ ├── MineResourcesProcessor.cs │ │ ├── Mineral.cs │ │ ├── MineralDepositFactory.cs │ │ ├── MineralsDB.cs │ │ ├── MiningDB.cs │ │ ├── MiningHelper.cs │ │ └── ProcessedMaterial.cs │ ├── JumpPoints │ │ ├── GravSurveyAtb.cs │ │ ├── JPFactory.cs │ │ ├── JPSurveyAbililtyDB.cs │ │ ├── JPSurveyDB.cs │ │ ├── JPSurveyFactory.cs │ │ ├── JPSurveyOrder.cs │ │ ├── JPSurveyProcessor.cs │ │ ├── JPSurveyableDB.cs │ │ ├── JPSurveyableDBExtensions.cs │ │ ├── JumpOrder.cs │ │ └── JumpPointDB.cs │ ├── Logistics │ │ ├── LogiBaseAtb.cs │ │ ├── LogiBaseDB.cs │ │ ├── LogiShipperDB.cs │ │ ├── LogisticsNewtonion.cs │ │ ├── LogisticsProcessor.cs │ │ ├── LogisticsSimple.cs │ │ ├── SetLogisticsOrder.cs │ │ └── ShipLogisticsOrders.cs │ ├── Movement │ │ ├── InterSystemJumpProcessor.cs │ │ ├── InterceptCalcs.cs │ │ ├── MoveMath.cs │ │ ├── MoveState.cs │ │ ├── MoveToNearestAction.cs │ │ ├── MoveToNearestAnomalyAction.cs │ │ ├── MoveToNearestColonyAction.cs │ │ ├── MoveToNearestGeoSurveyAction.cs │ │ ├── MoveToSystemBodyOrder.cs │ │ ├── NavSequence │ │ │ ├── NavSequenceCommand.cs │ │ │ ├── NavSequenceDB.cs │ │ │ └── NavSequenceProcessor.cs │ │ ├── NewtonMove │ │ │ ├── NewtonMoveDB.cs │ │ │ ├── NewtonSimpleCommand.cs │ │ │ ├── NewtonSimpleMoveDB.cs │ │ │ ├── NewtonSimpleProcessor.cs │ │ │ ├── NewtonThrustAbilityDB.cs │ │ │ ├── NewtonThrustCommand.cs │ │ │ ├── NewtonianMovementProcessor.cs │ │ │ └── NewtonionThrustAtb.cs │ │ ├── Pathfinding │ │ │ ├── EdgeToNeighbor.cs │ │ │ ├── Graph.cs │ │ │ ├── Node.cs │ │ │ ├── NodeList.cs │ │ │ └── PathfindingManager.cs │ │ └── WarpMove │ │ │ ├── WarpAbilityDB.cs │ │ │ ├── WarpDriveAtb.cs │ │ │ ├── WarpMath.cs │ │ │ ├── WarpMoveCommand.cs │ │ │ ├── WarpMoveProcessor.cs │ │ │ └── WarpMovingDB.cs │ ├── Names │ │ ├── NameDB.cs │ │ ├── NameFactory.cs │ │ ├── NameLookup.cs │ │ └── RenameCommand.cs │ ├── Orbits │ │ ├── OrbitDB.cs │ │ ├── OrbitExtensions.cs │ │ └── OrbitProcessor.cs │ ├── People │ │ ├── CommanderDB.cs │ │ ├── CommanderFactory.cs │ │ ├── NavalAcademyAtb.cs │ │ ├── NavalAcademyDB.cs │ │ ├── NavalAcademyProcessor.cs │ │ ├── SpeciesDB.cs │ │ ├── SpeciesDBExtensions.cs │ │ ├── SpeciesFactory.cs │ │ ├── TeamsDB.cs │ │ └── TeamsHousedDB.cs │ ├── Properties │ │ └── Annotations.cs │ ├── Sensors │ │ ├── EMWaveForm.cs │ │ ├── ISensorCloneMethod.cs │ │ ├── SensorAbilityDB.cs │ │ ├── SensorContact.cs │ │ ├── SensorEntityFactory.cs │ │ ├── SensorInfoDB.cs │ │ ├── SensorPositionDB.cs │ │ ├── SensorProfileDB.cs │ │ ├── SensorProfileDBExtensions.cs │ │ ├── SensorReceiverAbility.cs │ │ ├── SensorReceiverAtb.cs │ │ ├── SensorReflectionProcessor.cs │ │ ├── SensorReturnValues.cs │ │ ├── SensorScan.cs │ │ ├── SensorSignatureAtb.cs │ │ ├── SensorTools.cs │ │ └── SystemSensorContacts.cs │ ├── Ships │ │ ├── LaunchShipCommand.cs │ │ ├── ShipDesign.cs │ │ ├── ShipDesignFromJson.cs │ │ ├── ShipFactory.cs │ │ └── ShipInfoDB.cs │ ├── Storage │ │ ├── AddComponentToStorageOrder.cs │ │ ├── CargoDefinitionsLibrary.cs │ │ ├── CargoInstallOrder.cs │ │ ├── CargoMath.cs │ │ ├── CargoStorageAtb.cs │ │ ├── CargoStorageDB.cs │ │ ├── CargoTransferAtb.cs │ │ ├── CargoTransferDB.cs │ │ ├── CargoTransferDataDB.cs │ │ ├── CargoTransferOrder.cs │ │ ├── CargoTransferProcessor.cs │ │ ├── CargoableTypeDB.cs │ │ ├── ICargoable.cs │ │ ├── RemoveComponentFromStorageOrder.cs │ │ ├── StorageSpaceProcessor.cs │ │ └── TransferEntityFactory.cs │ ├── Tech │ │ ├── EntityResearchDB.cs │ │ ├── ResearchPointsAtbDB.cs │ │ ├── ResearchProcessor.cs │ │ ├── Scientist.cs │ │ ├── TeamObject.cs │ │ └── Tech.cs │ └── Weapons │ │ ├── IFireWeaponInstr.cs │ │ ├── OrdnanceDesign.cs │ │ ├── OrdnanceDesignFromJson.cs │ │ ├── OrdnancePayloadAtb.cs │ │ ├── SetFireControlOrder.cs │ │ ├── WeaponBeam │ │ ├── BeamInfoDB.cs │ │ ├── BeamWeaponProcessor.cs │ │ └── GenericBeamWeaponAtb.cs │ │ ├── WeaponFireControl │ │ ├── BeamFireControlAtbDB.cs │ │ ├── FireControlAbilityDB.cs │ │ └── FireControlAbilityState.cs │ │ ├── WeaponGeneric │ │ ├── GenericFiringWeaponsDB.cs │ │ ├── GenericFiringWeaponsProcessor.cs │ │ ├── GenericWeaponAtb.cs │ │ └── WeaponState.cs │ │ ├── WeaponMissile │ │ ├── MissleLauncherAbilityDB.cs │ │ ├── MissleLauncherAtb.cs │ │ ├── MissleProcessor.cs │ │ └── ProjectileInfoDB.cs │ │ └── WeaponUtils.cs ├── Perflog_linuxMint ├── Pulsar4X.Client │ ├── AssemblyInfo.cs │ ├── CrashReports │ │ └── DiscordCrashLogger.cs │ ├── Demos │ │ └── SizesDemo.cs │ ├── Extensions │ │ ├── EntityExtensions.cs │ │ ├── ImageLoadingExtensions.cs │ │ ├── ListExtensions.cs │ │ └── TimeSpanExtensions.cs │ ├── IMGUISDL │ │ ├── ImGuiSDL2CSHelper.cs │ │ ├── ImGuiSDL2CSWindow.cs │ │ ├── SDL2.cs │ │ ├── SDL2CSGL.cs │ │ ├── SDL2Helper.cs │ │ └── SDL2Window.cs │ ├── Input │ │ ├── IHotKeyHandler.cs │ │ └── SystemMapHotKeys.cs │ ├── Interface │ │ ├── DisplayHelpers.cs │ │ ├── Displays.cs │ │ ├── Displays │ │ │ ├── AtmosphereDBDisplay.cs │ │ │ ├── CargoStorageDBDisplay.cs │ │ │ ├── CargoTransfer │ │ │ │ ├── CargoListPanelComplex.cs │ │ │ │ ├── CargoListPanelSimple.cs │ │ │ │ └── CargoTransferWindow.cs │ │ │ ├── ColonyInfoDBDisplay.cs │ │ │ ├── ColonyLogisticsDisplay.cs │ │ │ ├── ColonyPanel.cs │ │ │ ├── ComponentDesignDisplay.cs │ │ │ ├── ComponentInstancesDBDisplay.cs │ │ │ ├── EntityDisplay.cs │ │ │ ├── ICargoableDisplay.cs │ │ │ ├── IndustryDisplay.cs │ │ │ ├── IndustryPanel.cs │ │ │ ├── MineralsDBDisplay.cs │ │ │ ├── PowerDBDisplay.cs │ │ │ └── StarInfoDBDisplay.cs │ │ ├── HUD │ │ │ ├── Selector.cs │ │ │ ├── TimeControl.cs │ │ │ └── ToolBarWindow.cs │ │ ├── Helpers.cs │ │ ├── Menus │ │ │ ├── EntityContextMenu.cs │ │ │ ├── EntityUIWindowSelector.cs │ │ │ ├── LoadGame.cs │ │ │ ├── MainMenuItems.cs │ │ │ ├── NewGameMenu.cs │ │ │ ├── SaveGame.cs │ │ │ ├── SettingsWindow.cs │ │ │ └── SystemViewPreferences.cs │ │ ├── Styles.cs │ │ ├── Themes │ │ │ ├── FuturisitcTheme.cs │ │ │ └── ITheme.cs │ │ ├── Widgets │ │ │ ├── FileDialog.cs │ │ │ ├── ImageButton.cs │ │ │ ├── TextModal.cs │ │ │ └── Window.cs │ │ └── Windows │ │ │ ├── ColonyManagementWindow.cs │ │ │ ├── CommanderWindow.cs │ │ │ ├── ComponentDesignWindow.cs │ │ │ ├── CreateTransferWindow.cs │ │ │ ├── DamageViewerWindow.cs │ │ │ ├── Debug │ │ │ ├── BlueprintsWindow.cs │ │ │ ├── DataViewerWindow.cs │ │ │ ├── DebugGUIWindow.cs │ │ │ ├── DebugWindow.cs │ │ │ ├── EntityInspector.cs │ │ │ ├── PerformanceWindow.cs │ │ │ └── SensorDraw.cs │ │ │ ├── DistanceRuler.cs │ │ │ ├── EntityInfoWindow.cs │ │ │ ├── EntitySpawnWindow.cs │ │ │ ├── EntityUIWindows.cs │ │ │ ├── EntityWindow.cs │ │ │ ├── FireControlWindow.cs │ │ │ ├── FleetWindow.cs │ │ │ ├── GalaxyWindow.cs │ │ │ ├── GameLogWindow.cs │ │ │ ├── LogisticsWindow.cs │ │ │ ├── NavWindow.cs │ │ │ ├── NewtonOrderWindow.cs │ │ │ ├── NonUniquePulsarGuiWindow.cs │ │ │ ├── OrbitalDebugWindow.cs │ │ │ ├── OrderCreationWindow.cs │ │ │ ├── OrdersListWindow.cs │ │ │ ├── OrdnanceDesignWindow.cs │ │ │ ├── PlanetaryWindow.cs │ │ │ ├── PlanetaryWindow.old.cs │ │ │ ├── PowerGenWindow.cs │ │ │ ├── PulsarGuiWindow.cs │ │ │ ├── RenameWindow.cs │ │ │ ├── ResearchWindow.cs │ │ │ ├── SMWindow.cs │ │ │ ├── ShipDesignWindow.cs │ │ │ ├── SmallBodyEntityInfoWindow.cs │ │ │ ├── SystemWindow.cs │ │ │ └── WarpOrderWindow.cs │ ├── Libs │ │ ├── SDL2-CS.dll │ │ ├── SDL2-CS.dll.config │ │ ├── SDL2-CS.dll.mdb │ │ ├── cimgui │ │ │ ├── linux-x64 │ │ │ │ ├── cimgui.so │ │ │ │ ├── libcimgui.so │ │ │ │ └── libcimgui.so.old │ │ │ ├── osx-x64 │ │ │ │ ├── cimgui.dylib │ │ │ │ └── libcimgui │ │ │ ├── win-x64 │ │ │ │ └── cimgui.dll │ │ │ └── win-x86 │ │ │ │ └── cimgui.dll │ │ └── sdl2 │ │ │ ├── linux-x64 │ │ │ ├── libSDL2.so │ │ │ ├── libSDL2_image.so │ │ │ ├── libSDL2_mixer.so │ │ │ └── libSDL2_ttf.so │ │ │ ├── win-x64 │ │ │ ├── README-SDL.txt │ │ │ ├── SDL2.dll │ │ │ └── SDL2_image.dll │ │ │ └── win-x86 │ │ │ ├── README-SDL.txt │ │ │ └── SDL2.dll │ ├── ModFileEditing │ │ ├── ArmorBlueprintUI.cs │ │ ├── AttributeBlueprintUI.cs │ │ ├── BluePrintsUI.cs │ │ ├── CargoTypeBlueprintUI.cs │ │ ├── ComponentBluprintUI.cs │ │ ├── DictEditWidget.cs │ │ ├── DoubleEditWidget.cs │ │ ├── IntEditWidget.cs │ │ ├── MineralBlueprintUI.cs │ │ ├── ModFileEditor.cs │ │ ├── ModInfoUI.cs │ │ ├── ProcessedMateralsUI.cs │ │ ├── SelectFromListWiget.cs │ │ ├── TechBlueprintUI.cs │ │ ├── TechCatBlueprintUI.cs │ │ └── TextEditWidget.cs │ ├── Program.cs │ ├── Pulsar4X.Client.csproj │ ├── PulsarMainWindow.cs │ ├── Rendering │ │ ├── Camera.cs │ │ ├── Draw.cs │ │ ├── GalacticMapRender.cs │ │ ├── GalaxyMap.cs │ │ ├── GraphicDebugWidget.cs │ │ ├── IRenderer.cs │ │ ├── Icons │ │ │ ├── BezierPath.cs │ │ │ ├── DrawPrimitive.cs │ │ │ ├── Icon.cs │ │ │ ├── NameIcon.cs │ │ │ ├── NamesWindow.cs │ │ │ ├── NewtonMoveIcon.cs │ │ │ ├── NewtonSimpleIcon.cs │ │ │ ├── OrbitEllipseIcon.cs │ │ │ ├── OrbitHyperbolicIcon2.cs │ │ │ ├── OrbitHypobolicIcon.cs │ │ │ ├── OrbitIconBase.cs │ │ │ ├── OrbitOrderIcon.cs │ │ │ ├── PointOfInterestIcon.cs │ │ │ ├── ShipIcon.cs │ │ │ ├── StarIcon.cs │ │ │ ├── SysBodyIcon.cs │ │ │ ├── TestDrawIconData.cs │ │ │ ├── WarpMoveOrderWidget.cs │ │ │ └── WarpMovingIcon.cs │ │ ├── ManuverNodes │ │ │ ├── ManuverNode.cs │ │ │ ├── ManuverNodesDraw2.cs │ │ │ ├── NewtonManuvers.txt │ │ │ └── RouteLines.cs │ │ ├── Matrix.cs │ │ ├── OpenGLRenderer.cs │ │ ├── RendererFactory.cs │ │ └── SystemMapRendering.cs │ ├── Resources │ │ ├── ARIALUNI.TTF │ │ ├── CancelIco.bmp │ │ ├── CargoIco.bmp │ │ ├── Cousine-Regular.ttf │ │ ├── DejaVuMathTeXGyre.ttf │ │ ├── DejaVuSans.ttf │ │ ├── DesignComponentIco.bmp │ │ ├── DesignOrdnanceIco.bmp │ │ ├── DesignShipIco.bmp │ │ ├── DnArrow.bmp │ │ ├── DroidSans.ttf │ │ ├── FireconIco.bmp │ │ ├── GalaxyMapIco.bmp │ │ ├── ImgTest.bmp │ │ ├── IndustryIco.bmp │ │ ├── OneStep.bmp │ │ ├── OneStep.xcf │ │ ├── Pause.bmp │ │ ├── PinIco.bmp │ │ ├── Play.bmp │ │ ├── PowerIco.bmp │ │ ├── ProggyClean.ttf │ │ ├── Pulsar4xSquare.png │ │ ├── PulsarLogo.bmp │ │ ├── PulsarLogo.png │ │ ├── RenameIco.bmp │ │ ├── RepeatIco.bmp │ │ ├── ResearchIco.bmp │ │ ├── Roboto-Medium.ttf │ │ ├── RulerIco.bmp │ │ ├── SelectIco.bmp │ │ ├── TreeIco.bmp │ │ ├── UpArrow.bmp │ │ ├── discord-mark-white.png │ │ ├── pulsar4x-menu.bmp │ │ ├── pulsar4x-menu.png │ │ └── pulsaricon.ico │ └── State │ │ ├── EntityState.cs │ │ ├── GlobalUIState.cs │ │ ├── ModsState.cs │ │ ├── OrderRegistry.cs │ │ ├── SystemState.cs │ │ ├── UpdateWindowState.cs │ │ └── UserOrbitSettings.cs ├── Pulsar4X.FileTemplates.DotSettings ├── Pulsar4X.OrbitalMath │ ├── DataStructures │ │ ├── EntityBase.cs │ │ ├── KeplerElements.cs │ │ ├── Matrix2d.cs │ │ ├── Matrix3d.cs │ │ ├── Vector2.cs │ │ └── Vector3.cs │ ├── EllipseMath.cs │ ├── Exceptions │ │ └── OrbitProcessorException.cs │ ├── GeneralMath.cs │ ├── Helpers │ │ ├── Angle.cs │ │ ├── Distance.cs │ │ └── PositionHelper.cs │ ├── OrbitalMath.cs │ ├── Pulsar4X.Orbital.csproj │ └── UniversalConstants.cs ├── Pulsar4X.Tests │ ├── AngleHelper.cs │ ├── AtmosphereAndSpeciesTests.cs │ ├── AtmosphereDBExtensionsTests.cs │ ├── CargoSpaceTests.cs │ ├── ChangeLog │ ├── Data │ │ ├── MalformedData │ │ │ ├── Commander Name Theme - The Creators.json │ │ │ ├── Minerals.json │ │ │ └── VersionInfo.vinfo │ │ └── Other │ │ │ ├── Minerals.json │ │ │ └── VersionInfo.vinfo │ ├── DataBlobEqualityChecker.cs │ ├── DataBlobTests.cs │ ├── DataStructureTests.cs │ ├── EntityManagerTests.cs │ ├── EventLogTests.cs │ ├── FactoryTests.cs │ ├── MatrixTests.cs │ ├── MiningTests.cs │ ├── Modding │ │ └── ModLoaderTests.cs │ ├── NetworkTests.cs │ ├── OrbitFuzzTesting.cs │ ├── OrbitTests.cs │ ├── PathfindingTests.cs │ ├── PopulationProcessorTest.cs │ ├── ProcessorTests.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ProtoEntityTests.cs │ ├── Pulsar4X.Tests.csproj │ ├── Pulsar4X.Tests.csproj.DotSettings │ ├── SavingAndLoadingTests.cs │ ├── Serialization │ │ ├── SerializationEquivalenceTester.cs │ │ └── SerializationTests.cs │ ├── SerializationManagerTests.cs │ ├── ShipComponentTests.cs │ ├── ShipTests.cs │ ├── SpeciesDBExtensionsTests.cs │ ├── StaticDataTests.cs │ ├── SystemGenTests.cs │ ├── TestHelper.cs │ ├── TestingUtilities.cs │ ├── UnitHelperTests.cs │ ├── Vector3Tests.cs │ ├── ViewModelTests.cs │ ├── WarpMoveTests.cs │ ├── WeightedListsTests.cs │ └── packages.config ├── Pulsar4X.sln ├── Pulsar4X.sln.DotSettings ├── Untitled Document ├── ViewModelLib │ ├── GLUtilities │ │ ├── CircleElement.cs │ │ ├── GLCircle.cs │ │ ├── GLEffect.cs │ │ ├── GLEffectBasic21.cs │ │ ├── GLEffectBasic30.cs │ │ ├── GLFont.cs │ │ ├── GLLine.cs │ │ ├── GLPrimitive.cs │ │ ├── GLQuad.cs │ │ ├── GLVertex.cs │ │ ├── ResourceManager.cs │ │ ├── SceenElement.cs │ │ └── StarElement.cs │ ├── Helpers │ │ ├── Commands.cs │ │ ├── DictionaryVM.cs │ │ ├── ItemPair.cs │ │ ├── ObservableDictionary.cs │ │ ├── RangeEnableObservibleCollection.cs │ │ └── RelayCommand.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Pulsar4X.ViewModels.csproj │ ├── ViewModels │ │ ├── ColonyScreenVM.cs │ │ ├── ComponentDesignVM.cs │ │ ├── ComponentListVM.cs │ │ ├── ComponentTemplateDesigner │ │ │ ├── ComponentAbilityTemplateVM.cs │ │ │ ├── ComponentTemplateMainPropertiesVM.cs │ │ │ ├── ComponentTemplateParentVM.cs │ │ │ ├── FormulaEditorVM.cs │ │ │ ├── MineralFormulaVM.cs │ │ │ └── TechListVM.cs │ │ ├── ConstructionAbilityVM.cs │ │ ├── FactionVM.cs │ │ ├── GameVM.cs │ │ ├── IViewModel.cs │ │ ├── JobVM.cs │ │ ├── LogViewerVM.cs │ │ ├── MinMaxSliderVM.cs │ │ ├── MissileDesignVM.cs │ │ ├── NewGameOptionsVM.cs │ │ ├── NewSpeciesVM.cs │ │ ├── PlanetVM.cs │ │ ├── PlayerOptionsVM.cs │ │ ├── RefineryAbilityVM.cs │ │ ├── ResearchVM.cs │ │ ├── ShipDesignVM.cs │ │ ├── ShipOrderVM.cs │ │ ├── SpeciesVM.cs │ │ ├── StarVM.cs │ │ ├── SystemInfoVM.cs │ │ ├── SystemVM.cs │ │ ├── SystemView │ │ │ ├── RenderVM.cs │ │ │ ├── Scene.cs │ │ │ ├── StarSystemVM.cs │ │ │ └── SystemMap_DrawableVM.cs │ │ ├── TimeControlVM.cs │ │ └── ViewModelBase.cs │ └── packages.config └── global.json ├── README.md ├── contributor.txt └── doc ├── AvgQualityDetection.png ├── AvgQualityDetection.xcf ├── Doxyfile.txt ├── Drawing ellipses.pdf ├── GuidanceMethod for Dv Constrained.pdf ├── IdealDetails.png ├── IdealDetails.xcf ├── IdealDetection.png ├── IdealDetection.xcf ├── Industryflowchart.jpg ├── MulticonstrainedAccentGuidenceforSolidRockets.pdf ├── PoorQualityDetection.png ├── PoorQualityDetection.xcf ├── PulsarIndustry2.jpg ├── PulsarIndustry2.odg ├── Readme.txt ├── doxygen └── output_here.txt ├── entityflowchart.jpg ├── entityflowchart.odg ├── planetflowchart.odg └── pulsar ECS-MVVM implimentation.png /.appveyor.yml: -------------------------------------------------------------------------------- 1 | #.appveyor.yml reference: http://www.appveyor.com/docs/appveyor-yml 2 | #.appveyor.yml validation: https://ci.appveyor.com/tools/validate-yaml 3 | #verify WHOLE file after EVERY change or it could crash cause of whitespaces or tabulation 4 | 5 | version: 0.4.{build} 6 | # branches to build 7 | branches: 8 | # whitelist 9 | only: 10 | - master 11 | 12 | # blacklist 13 | # except: 14 | 15 | 16 | os: Visual Studio 2015 17 | cache: 18 | - packages -> **\packages.config 19 | before_build: 20 | - nuget restore Pulsar4X/Pulsar4X.sln 21 | platform: 22 | - Windows_x64 23 | configuration: 24 | - Debug 25 | build: 26 | project: Pulsar4X/Pulsar4X.sln 27 | 28 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.{cs,vb}] 4 | dotnet_diagnostic.CS0436.severity = none -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | 24 | # Binary files 25 | *.exe binary 26 | *.png binary 27 | *.jpg binary 28 | *.gif binary -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Device(please complete the following information):** 27 | - OS: [e.g. Windows] 28 | - IDE: [e.g. Visual Studios] 29 | - Branch: [e.g. dev] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /.github/workflows/Benchmarks.yml: -------------------------------------------------------------------------------- 1 | name: Performance Benchmarks 2 | 3 | on: 4 | push: 5 | branches: [ DevBranch ] 6 | paths: 7 | - 'Pulsar4X/GameEngine/**' # Only trigger on changes to GameEngine 8 | 9 | jobs: 10 | benchmark: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | 15 | - name: Setup .NET 16 | uses: actions/setup-dotnet@v3 17 | with: 18 | dotnet-version: 8.0.x 19 | 20 | - name: Build 21 | run: | 22 | cd Pulsar4X/Benchmarks 23 | dotnet build -c Release 24 | 25 | - name: Run benchmarks 26 | run: | 27 | cd Pulsar4X/Benchmarks 28 | dotnet run -c Release --filter '*' 29 | 30 | - name: Store benchmark results 31 | uses: actions/upload-artifact@v4 32 | with: 33 | name: benchmark-results 34 | path: Pulsar4X/Benchmarks/BenchmarkDotNet.Artifacts/results 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Pulsar Specific Folders 2 | Pulsar4X/*/bin 3 | Pulsar4X/*/obj 4 | Pulsar4X/packages/* 5 | Pulsar4X/Pulsar4X.Client/*.ini 6 | Pulsar4X/Pulsar4X.Client/Data/* 7 | Pulsar4X/Benchmarks/BenchmarksDotNet.Artifacts/* 8 | 9 | # Doxygen output 10 | doc/doxygen/html/ 11 | # C# Temp Files: 12 | *.db 13 | *.suo 14 | *.user 15 | _ReSharper.Pulsar4X 16 | _ReSharper.AuroraExtract 17 | # Build results 18 | *_i.c 19 | *_p.c 20 | *.ilk 21 | *.meta 22 | *.obj 23 | *.pch 24 | *.pdb 25 | *.pgc 26 | *.pgd 27 | *.rsp 28 | *.sbr 29 | *.tlb 30 | *.tli 31 | *.tlh 32 | *.tmp 33 | *.log 34 | *.vspscc 35 | *.vssscc 36 | *.msi 37 | *.wixpdb 38 | # Visual Studio profiler 39 | *.psess 40 | *.vsp 41 | *.vspx 42 | /Pulsar4X/Pulsar4X.UI/StyleCop.Cache 43 | 44 | # Visual Studio 2015 cache/options directory 45 | .vs/ 46 | 47 | # Monodevelop user specific files 48 | *.userprefs 49 | *.usertasks 50 | Pulsar4X/TestResults/Pulsar4X.TE.Tests.mdf 51 | Pulsar4X/TestResults/Pulsar4X.TE.Tests_log.ldf 52 | #Jetbrains Rider files 53 | .idea/ 54 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": ".NET Core Launch (console)", 9 | "type": "coreclr", 10 | "request": "launch", 11 | "preLaunchTask": "build", 12 | "program": "${workspaceFolder}/Pulsar4X/Pulsar4X.Client/bin/Debug/net8.0/Pulsar4X.Client.dll", 13 | "args": [], 14 | "cwd": "${workspaceFolder}/Pulsar4X/Pulsar4X.Client/bin/Debug/net8.0", 15 | "stopAtEntry": false, 16 | "console": "internalConsole" 17 | }, 18 | { 19 | "name": ".NET Core Attach", 20 | "type": "coreclr", 21 | "request": "attach" 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dotnet-test-explorer.testProjectPath": "**/*.sln" 3 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020 Pulsar4xDevs 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | Aurora is Copyright Steve Walmsley 22 | 23 | The names of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. 24 | -------------------------------------------------------------------------------- /Pulsar4X/.idea/.idea.Pulsar4X/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /workspace.xml -------------------------------------------------------------------------------- /Pulsar4X/.idea/.idea.Pulsar4X/.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /Pulsar4X/.idea/.idea.Pulsar4X/.idea/dictionaries/se5a.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Pulsar4X/.idea/.idea.Pulsar4X/.idea/indexLayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Pulsar4X/.idea/.idea.Pulsar4X/.idea/projectSettingsUpdater.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /Pulsar4X/.idea/.idea.Pulsar4X/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Pulsar4X/Benchmarks/Benchmarks.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Pulsar4X/Benchmarks/Program.cs: -------------------------------------------------------------------------------- 1 | using BenchmarkDotNet.Running; 2 | 3 | namespace BenchmarkProject; 4 | 5 | public class Program 6 | { 7 | public static void Main(string[] args) 8 | { 9 | BenchmarkRunner.Run(); 10 | } 11 | } -------------------------------------------------------------------------------- /Pulsar4X/DebugReloadClient/DebugReloadClient.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Pulsar4X/DebugReloadClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using System.Reflection; 6 | using MyvarReload; 7 | using Pulsar4X.SDL2UI; 8 | 9 | namespace DebugReloadClient 10 | { 11 | internal class Program 12 | { 13 | [STAThread] 14 | public static void Main(string[] args) 15 | { 16 | var filpth = Path.GetFullPath("../../../Pulsar4X.Client/bin/Debug/net47/Pulsar4X.Client.exe"); 17 | var ass = new ReloadAssembly(filpth); 18 | 19 | dynamic pmw = ass.NewType(); 20 | 21 | 22 | pmw.Run(); 23 | pmw.Dispose(); 24 | 25 | 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Pulsar4X/DebugReloadClient/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Colonies/ColonizeableDB.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Datablobs; 2 | 3 | namespace Pulsar4X.Colonies; 4 | 5 | /// 6 | /// Empty class, used as a tag 7 | /// 8 | public class ColonizeableDB : BaseDataBlob 9 | { 10 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Colonies/ColonyBonusesDB.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Pulsar4X.Datablobs; 4 | using Pulsar4X.DataStructures; 5 | using Pulsar4X.Engine; 6 | using Pulsar4X.Factions; 7 | 8 | namespace Pulsar4X.Colonies 9 | { 10 | public class ColonyBonusesDB : BaseDataBlob 11 | { 12 | public new static List GetDependencies() => new List() { typeof(ColonyInfoDB) }; 13 | 14 | private Dictionary FactionBonus => OwningEntity != Entity.InvalidEntity && OwningEntity.HasDataBlob() ? OwningEntity.GetDataBlob().AbilityBonuses : new Dictionary(); 15 | 16 | /// 17 | /// Returns the Bonus Modifier for a given ability 18 | /// 19 | /// Ability to check for 20 | /// 1 if no bonus exists or has been applied 21 | public float GetBonus(AbilityType type) 22 | { 23 | if (!FactionBonus.ContainsKey(type)) 24 | { 25 | return 1; 26 | } 27 | 28 | return FactionBonus[type]; //* SectorBonus[type] * SystemBonus[type] * PlanetBonus[type] * //RaceBonus[race][type] ?? 29 | } 30 | 31 | public ColonyBonusesDB() 32 | { 33 | 34 | } 35 | 36 | public ColonyBonusesDB(ColonyBonusesDB db) 37 | { 38 | 39 | } 40 | 41 | public override object Clone() 42 | { 43 | return new ColonyBonusesDB(this); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Colonies/ColonyLifeSupportDB.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Datablobs; 2 | 3 | namespace Pulsar4X.Colonies 4 | { 5 | public class ColonyLifeSupportDB : BaseDataBlob 6 | { 7 | public long MaxPopulation { get; set; } 8 | 9 | public ColonyLifeSupportDB() 10 | { 11 | MaxPopulation = new long(); 12 | } 13 | 14 | public ColonyLifeSupportDB(ColonyLifeSupportDB db) 15 | { 16 | MaxPopulation = db.MaxPopulation; 17 | } 18 | 19 | public override object Clone() 20 | { 21 | return new ColonyLifeSupportDB(this); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/Industry.mmd: -------------------------------------------------------------------------------- 1 | flowchart LR 2 | subgraph Raw Materials 3 | A1[Hydrocarbons] 4 | A2[Iron] 5 | A3[Aluminium] 6 | A4[Copper] 7 | A5[Titanium] 8 | A6[Lithium] 9 | A7[Chromium] 10 | A8[Fissionables] 11 | A9[Silicon] 12 | A10[Graphite] 13 | A11[Tungsten] 14 | A12[Nickel] 15 | A13[Water] 16 | end 17 | 18 | subgraph Farming 19 | E1[Food] 20 | end 21 | 22 | subgraph Production 23 | B1[Electronics] 24 | B2[Consumer Goods] 25 | end 26 | 27 | subgraph Refining 28 | C1[Stainless Steel] 29 | C2[RP-1] 30 | C3[Methalox] 31 | C4[Hydrolox] 32 | C5[Hydronuke] 33 | C6[Plastic] 34 | C7[Fissile Fuels] 35 | end 36 | 37 | subgraph Consumption 38 | D1[Civilian Use] 39 | end 40 | 41 | A1 --> C1 42 | A2 --> C1 43 | A7 --> C1 44 | A1 --> C2 45 | A1 --> C3 46 | A1 --> C4 47 | A1 --> C5 48 | A8 --> C5 49 | A1 --> C6 50 | A8 --> C7 51 | A4 --> B1 52 | A3 --> B1 53 | C6 --> B1 54 | A9 --> B1 55 | B1 --> B2 56 | B2 --> D1 57 | A13 --> D1 58 | E1 --> D1 -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/alphaCentauri.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "System", 4 | "Payload": { 5 | "UniqueID": "system-alpha-centauri", 6 | "Name": "Alpha Centauri", 7 | "Stars": [ 8 | "alpha-centauri-a", 9 | "alpha-centauri-b" 10 | ], 11 | "Bodies": [], 12 | "SurveyRings": [ 13 | { "RingRadiusInAU": 1, "Count": 3 }, 14 | { "RingRadiusInAU": 8, "Count": 9 }, 15 | { "RingRadiusInAU": 20, "Count": 17 } 16 | ] 17 | } 18 | }, 19 | { 20 | "Type": "Star", 21 | "Payload": { 22 | "UniqueID": "alpha-centauri-a", 23 | "Name":"Alpha Centauri A", 24 | "Info": { 25 | "Mass": 2E30, 26 | "Radius": 847000, 27 | "Age": 4.85E9, 28 | "Class": "G", 29 | "Temperature": 5790, 30 | "Luminosity": 1.5, 31 | "LuminosityClass": "V", 32 | "SpectralType": "G" 33 | } 34 | } 35 | }, 36 | { 37 | "Type": "Star", 38 | "Payload": { 39 | "UniqueID": "alpha-centauri-b", 40 | "Name":"Alpha Centauri B", 41 | "Info": { 42 | "Mass": 1.5E30, 43 | "Radius": 598000, 44 | "Age": 5.3E9, 45 | "Class": "K", 46 | "Temperature": 5260, 47 | "Luminosity": 1.5, 48 | "LuminosityClass": "V", 49 | "SpectralType": "K" 50 | }, 51 | "Orbit": { 52 | "SemiMajorAxis": 149597887, 53 | "Eccentricity": 0.51947, 54 | "EclipticInclination": 79.243, 55 | "LoAN": 205.073, 56 | "AoP": 231.519, 57 | "MeanAnomaly": 0 58 | } 59 | } 60 | } 61 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/armor.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "Armor", 4 | "Payload": { 5 | "UniqueID": "stainless-steel-armor", 6 | "ResourceID": "stainless-steel", 7 | "Density": "7900" 8 | } 9 | }, 10 | { 11 | "Type": "Armor", 12 | "Payload": { 13 | "UniqueID": "plastic-armor", 14 | "ResourceID": "plastic", 15 | "Density": "1175" 16 | } 17 | }, 18 | { 19 | "Type": "Armor", 20 | "Payload": { 21 | "UniqueID": "aluminium-armor", 22 | "ResourceID": "aluminium", 23 | "Density": "2700" 24 | } 25 | }, 26 | { 27 | "Type": "Armor", 28 | "Payload": { 29 | "UniqueID": "titanium-armor", 30 | "ResourceID": "titanium", 31 | "Density": "4540" 32 | } 33 | } 34 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/cargoTypes.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "CargoType", 4 | "Payload": { 5 | "UniqueID": "general-storage", 6 | "Name": "General", 7 | "Description": "Storage for general cargo items" 8 | } 9 | }, 10 | { 11 | "Type": "CargoType", 12 | "Payload": { 13 | "UniqueID": "fuel-storage", 14 | "Name": "Fuel", 15 | "Description": "Storage for fuel" 16 | } 17 | }, 18 | { 19 | "Type": "CargoType", 20 | "Payload": { 21 | "UniqueID": "battery-storage", 22 | "Name": "Battery", 23 | "Description": "Storage for energy" 24 | } 25 | }, 26 | { 27 | "Type": "CargoType", 28 | "Payload": { 29 | "UniqueID": "cryogenic-storage", 30 | "Name": "Cryogenic Storage", 31 | "Description": "Storage for frozen people" 32 | } 33 | }, 34 | { 35 | "Type": "CargoType", 36 | "Payload": { 37 | "UniqueID": "passenger-storage", 38 | "Name": "Passengers", 39 | "Description": "Storage for people" 40 | } 41 | }, 42 | { 43 | "Type": "CargoType", 44 | "Payload": { 45 | "UniqueID": "ordnance-storage", 46 | "Name": "Ordnance Storage", 47 | "Description": "Storage for ammo, missiles etc" 48 | } 49 | } 50 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/comets.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "SystemBody", 4 | "Payload": { 5 | "UniqueID": "comet-halleys", 6 | "Name": "Halleys Comet", 7 | "Colonizable": false, 8 | "MineralGeneration": "random", 9 | "GeoSurveyPointsRequired": 575, 10 | "Info": { 11 | "Gravity": 0, 12 | "Type": "comet", 13 | "Albedo": 0.04, 14 | "Mass": 2.2E14, 15 | "Radius": 11 16 | }, 17 | "Orbit": { 18 | "SemiMajorAxis": 2.6679E9, 19 | "Eccentricity": 0.96714, 20 | "EclipticInclination": 180, 21 | "LoAN": 58.42, 22 | "AoP": 111.33, 23 | "MeanAnomaly": 38.38 24 | } 25 | } 26 | } 27 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/damageResistance.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "DamageResistance", 4 | "Payload": { 5 | "UniqueID": "0", 6 | "MaterialID": "", 7 | "HitPoints": "0", 8 | "MeltingPoint": "0", 9 | "Density": "0" 10 | } 11 | }, 12 | { 13 | "Type": "DamageResistance", 14 | "Payload": { 15 | "UniqueID": "100", 16 | "MaterialID": "plastic", 17 | "HitPoints": "255", 18 | "MeltingPoint": "170", 19 | "Density": "1175" 20 | } 21 | }, 22 | { 23 | "Type": "DamageResistance", 24 | "Payload": { 25 | "UniqueID": "150", 26 | "MaterialID": "aluminium", 27 | "HitPoints": "0", 28 | "MeltingPoint": "660", 29 | "Density": "2700" 30 | } 31 | }, 32 | { 33 | "Type": "DamageResistance", 34 | "Payload": { 35 | "UniqueID": "200", 36 | "MaterialID": "titanium", 37 | "HitPoints": "255", 38 | "MeltingPoint": "1668", 39 | "Density": "4540" 40 | } 41 | }, 42 | { 43 | "Type": "DamageResistance", 44 | "Payload": { 45 | "UniqueID": "255", 46 | "MaterialID": "stainless-steel", 47 | "HitPoints": "255", 48 | "MeltingPoint": "1400", 49 | "Density": "7900" 50 | } 51 | } 52 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/industryTypes.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "IndustryType", 4 | "Payload": { 5 | "UniqueID": "refining", 6 | "Name": "Refining" 7 | } 8 | }, 9 | { 10 | "Type": "IndustryType", 11 | "Payload": { 12 | "UniqueID": "component-construction", 13 | "Name": "Component Construction" 14 | } 15 | }, 16 | { 17 | "Type": "IndustryType", 18 | "Payload": { 19 | "UniqueID": "installation-construction", 20 | "Name": "Installation Construction" 21 | } 22 | }, 23 | { 24 | "Type": "IndustryType", 25 | "Payload": { 26 | "UniqueID": "ordnance-construction", 27 | "Name": "Ordnance Construction" 28 | } 29 | }, 30 | { 31 | "Type": "IndustryType", 32 | "Payload": { 33 | "UniqueID": "ship-assembly", 34 | "Name": "Ship Assembly" 35 | } 36 | } 37 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/luna.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "SystemBody", 4 | "Payload": { 5 | "UniqueID": "moon-luna", 6 | "Name": "Luna", 7 | "Parent": "Earth", 8 | "Colonizable": true, 9 | "GeoSurveyPointsRequired": 250, 10 | "Info": { 11 | "Gravity": 1.625, 12 | "Type": "moon", 13 | "Mass": 7.34767309E22, 14 | "Radius": 6378.1 15 | }, 16 | "Orbit": { 17 | "SemiMajorAxis_km": 384399, 18 | "Eccentricity": 0.0549, 19 | "EclipticInclination_d": 5.145, 20 | "LoAN_d": 125.08, 21 | "AoP_d": 318.0634, 22 | "MeanAnomaly_d": 115.3654 23 | }, 24 | "Minerals": [ 25 | { "Id": "iron", "Abundance": 0.5, "Accessibility": 1 } 26 | ] 27 | } 28 | } 29 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/mars.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "SystemBody", 4 | "Payload": { 5 | "UniqueID": "mars", 6 | "Name": "Mars", 7 | "Colonizable": true, 8 | "GeoSurveyPointsRequired": 575, 9 | "GenerateMinerals": "random", 10 | "Info": { 11 | "Gravity": 3.72076, 12 | "Type": "terrestrial", 13 | "Albedo": 0.25, 14 | "Mass": 0.64174E24, 15 | "Radius": 3396.2, 16 | "Tectonics": "earth-like" 17 | }, 18 | "Orbit": { 19 | "SemiMajorAxis_km": 227939366, 20 | "Eccentricity": 0.0934, 21 | "EclipticInclination_d": 1.85, 22 | "LoAN_d": 49.57854, 23 | "AoP_d": 286.5, 24 | "MeanAnomaly_d": 19.412 25 | }, 26 | "Atmosphere": { 27 | "Pressure": 0.87, 28 | "Hydrosphere": false, 29 | "HyrdoExtent": 0, 30 | "GreenhouseFactor": 0, 31 | "GreenhousePressure": 0, 32 | "SurfaceTemperature": -63, 33 | "Gases": [ 34 | { "Symbol": "CO2", "Percent": 0.9597 }, 35 | { "Symbol": "Ar", "Percent": 0.0193 }, 36 | { "Symbol": "N2", "Percent": 0.0189 }, 37 | { "Symbol": "O2", "Percent": 0.00146 }, 38 | { "Symbol": "CO", "Percent": 0.000557 }, 39 | { "Symbol": "H2O", "Percent": 0.00021 }, 40 | { "Symbol": "NO", "Percent": 0.0001 }, 41 | { "Symbol": "Ne", "Percent": 0.0000025 }, 42 | { "Symbol": "Kr", "Percent": 0.0000003 }, 43 | { "Symbol": "Xe", "Percent": 0.0000001 } 44 | ] 45 | } 46 | } 47 | } 48 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/mercury.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "SystemBody", 4 | "Payload": { 5 | "UniqueID": "mercury", 6 | "Name": "Mercury", 7 | "Colonizable": true, 8 | "GeoSurveyPointsRequired": 1500, 9 | "GenerateMinerals": "random", 10 | "Info": { 11 | "Gravity": 3.7, 12 | "Type": "terrestrial", 13 | "Albedo": 0.088, 14 | "AxialTilt": 2.04, 15 | "Mass": 3.3022E23, 16 | "Radius": 2439.7, 17 | "Tectonics": "earth-like" 18 | }, 19 | "Orbit": { 20 | "SemiMajorAxis_km": 57.91E6, 21 | "Eccentricity": 0.205630, 22 | "EclipticInclination_d": 7.005, 23 | "LoAN_d": 48.331, 24 | "AoP_d": 29.124, 25 | "MeanAnomaly_d": 174.796 26 | } 27 | } 28 | } 29 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/neptune.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "SystemBody", 4 | "Payload": { 5 | "UniqueID": "neptune", 6 | "Name": "Neptune", 7 | "Colonizable": true, 8 | "GeoSurveyPointsRequired": 2500, 9 | "GenerateMinerals": "random", 10 | "Info": { 11 | "Gravity": 11.15, 12 | "Type": "ice-giant", 13 | "Albedo": 0.29, 14 | "AxialTilt": 28.32, 15 | "Mass": 1.02413E26, 16 | "Radius": 24764 17 | }, 18 | "Orbit": { 19 | "SemiMajorAxis": 4.5E9, 20 | "Eccentricity": 0.008678, 21 | "EclipticInclination": 1.77, 22 | "LoAN": 131.783, 23 | "AoP": 273.187, 24 | "MeanAnomaly": 259.883 25 | }, 26 | "Atmosphere": { 27 | "Pressure": 986.923267, 28 | "Hydrosphere": false, 29 | "HyrdoExtent": 0, 30 | "GreenhouseFactor": 0, 31 | "GreenhousePressure": 0, 32 | "SurfaceTemperature": -201, 33 | "Gases": [ 34 | { "Symbol": "H2", "Percent": 0.8 }, 35 | { "Symbol": "He", "Percent": 0.19 }, 36 | { "Symbol": "CH4", "Percent": 0.015 }, 37 | { "Symbol": "HD", "Percent": 0.00019 }, 38 | { "Symbol": "C2H6", "Percent": 0.0000015 } 39 | ] 40 | } 41 | } 42 | } 43 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/sol.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "Star", 4 | "Payload": { 5 | "UniqueID": "sol", 6 | "Name": "Sol", 7 | "Info": { 8 | "Mass": 1.98855E30, 9 | "Radius": 696342, 10 | "Age": 4.6E9, 11 | "Class": "G", 12 | "Temperature": 5778, 13 | "Luminosity": 1, 14 | "LuminosityClass": "V", 15 | "SpectralType": "G" 16 | } 17 | } 18 | }, 19 | { 20 | "Type": "System", 21 | "Payload": { 22 | "UniqueID": "system-sol", 23 | "Name": "Sol", 24 | "Stars": [ 25 | "sol" 26 | ], 27 | "Bodies": [ 28 | "mercury", 29 | "venus", 30 | "planet-earth", 31 | "moon-luna", 32 | "mars", 33 | "jupiter", 34 | "moon-io", 35 | "moon-europa", 36 | "moon-ganymede", 37 | "moon-callisto", 38 | "moon-amalthea", 39 | "moon-elara", 40 | "moon-himalia", 41 | "moon-lysithea", 42 | "moon-pasiphae", 43 | "moon-sinope", 44 | "saturn", 45 | "moon-dione", 46 | "moon-enceladus", 47 | "moon-mimas", 48 | "moon-rhea", 49 | "moon-tethys", 50 | "moon-titan", 51 | "uranus", 52 | "neptune", 53 | "dwarf-ceres", 54 | "dwarf-eris", 55 | "dwarf-haumea", 56 | "dwarf-makemake", 57 | "dwarf-pluto", 58 | "comet-halleys" 59 | ], 60 | "SurveyRings": [ 61 | { "RingRadiusInAU": 2, "Count": 2 } 62 | ] 63 | } 64 | } 65 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/species.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "Species", 4 | "Payload": { 5 | "UniqueID": "species-human", 6 | "Name": "Human", 7 | "Playable": true, 8 | "BreathableGasSymbol": "O2", 9 | "Gravity": { 10 | "Ideal": 9.8, 11 | "Minimum": 0.1, 12 | "Maximum": 18.62 13 | }, 14 | "Pressure": { 15 | "Ideal": 1, 16 | "Minimum": 0.4, 17 | "Maximum": 4 18 | }, 19 | "Temperature": { 20 | "Ideal": 14, 21 | "Minimum": -15, 22 | "Maximum": 45 23 | } 24 | } 25 | }, 26 | { 27 | "Type": "Species", 28 | "Payload": { 29 | "UniqueID": "species-xenos", 30 | "Name": "Xenos", 31 | "Playable": false, 32 | "BreathableGasSymbol": "Xe", 33 | "Gravity": { 34 | "Ideal": 9.8, 35 | "Minimum": 0.1, 36 | "Maximum": 18.62 37 | }, 38 | "Pressure": { 39 | "Ideal": 1, 40 | "Minimum": 0.4, 41 | "Maximum": 4 42 | }, 43 | "Temperature": { 44 | "Ideal": 14, 45 | "Minimum": -15, 46 | "Maximum": 45 47 | } 48 | } 49 | } 50 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/uranus.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "SystemBody", 4 | "Payload": { 5 | "UniqueID": "uranus", 6 | "Name": "Uranus", 7 | "Colonizable": true, 8 | "GeoSurveyPointsRequired": 2500, 9 | "GenerateMinerals": "random", 10 | "Info": { 11 | "Gravity": 8.69, 12 | "Type": "ice-giant", 13 | "Albedo": 0.3, 14 | "AxialTilt": 82.23, 15 | "Mass": 8.6810E25, 16 | "Radius": 25559 17 | }, 18 | "Orbit": { 19 | "SemiMajorAxis": 2.870972E9, 20 | "Eccentricity": 0.04717, 21 | "EclipticInclination": 0.773, 22 | "LoAN": 74.006, 23 | "AoP": 96.998857, 24 | "MeanAnomaly": 142.2386 25 | }, 26 | "Atmosphere": { 27 | "Pressure": 1.28300025, 28 | "Hydrosphere": false, 29 | "HyrdoExtent": 0, 30 | "GreenhouseFactor": 0, 31 | "GreenhousePressure": 0, 32 | "SurfaceTemperature": -197.2, 33 | "Gases": [ 34 | { "Symbol": "H2", "Percent": 0.83 }, 35 | { "Symbol": "He", "Percent": 0.15 }, 36 | { "Symbol": "CH4", "Percent": 0.023 }, 37 | { "Symbol": "HD", "Percent": 0.00009 } 38 | ] 39 | } 40 | } 41 | } 42 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/blueprints/venus.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "SystemBody", 4 | "Payload": { 5 | "UniqueID": "venus", 6 | "Name": "Venus", 7 | "Colonizable": true, 8 | "GeoSurveyPointsRequired": 1500, 9 | "GenerateMinerals": "random", 10 | "Info": { 11 | "Gravity": 8.87, 12 | "Type": "terrestrial", 13 | "Albedo": 0.76, 14 | "AxialTilt": 177.36, 15 | "Mass": 4.8675E24, 16 | "Radius": 6051.8, 17 | "Tectonics": "earth-like" 18 | }, 19 | "Orbit": { 20 | "SemiMajorAxis_km": 108.21E6, 21 | "Eccentricity": 0.006772, 22 | "EclipticInclination_d": 3.39458, 23 | "LoAN_d": 76.680, 24 | "AoP_d": 54.884, 25 | "MeanAnomaly_d": 50.115 26 | }, 27 | "Atmosphere": { 28 | "Pressure": 92, 29 | "Hydrosphere": false, 30 | "HydroExtent": 0, 31 | "GreenhouseFactor": 0, 32 | "GreenhousePressure": 0, 33 | "SurfaceTemperature": 464, 34 | "Gases": [ 35 | { "Symbol": "CO2", "Percent": 0.965 }, 36 | { "Symbol": "N2", "Percent": 0.035 }, 37 | { "Symbol": "SO2", "Percent": 0.00015 }, 38 | { "Symbol": "Ar", "Percent": 0.00007 }, 39 | { "Symbol": "H2O", "Percent": 0.00002 }, 40 | { "Symbol": "CO", "Percent": 0.000017 }, 41 | { "Symbol": "He", "Percent": 0.000012 }, 42 | { "Symbol": "Ne", "Percent": 0.000007 } 43 | ] 44 | } 45 | } 46 | } 47 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/defaultStart/opposition.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Opposition Forces", 3 | "componentDesigns": [ 4 | "componentDesigns/passiveScannerS50.json", 5 | "componentDesigns/fuelTank-1000.json", 6 | "componentDesigns/alcuberiWhite-500.json", 7 | "componentDesigns/battery-2t.json", 8 | "componentDesigns/reactor-15k.json", 9 | "componentDesigns/merlin.json" 10 | ], 11 | "ordnanceDesigns": [ 12 | ], 13 | "shipDesigns": [ 14 | "shipDesigns/targetDrone.json" 15 | ], 16 | "species": [ 17 | "species-humans.json" 18 | ], 19 | "fleets": [ 20 | { 21 | "name": "Target Drone Fleet", 22 | "location": { 23 | "systemId": "sol", 24 | "body": "Luna" 25 | }, 26 | "ships": [ 27 | { 28 | "designId": "default-ship-design-target-drone", 29 | "name": "Target Drone 0", 30 | "cargo": [ 31 | { "id": "rp-1", "amount": 1000 } 32 | ] 33 | }, 34 | { 35 | "designId": "default-ship-design-target-drone", 36 | "name": "Target Drone 1", 37 | "cargo": [ 38 | { "id": "rp-1", "amount": 1000 } 39 | ] 40 | }, 41 | { 42 | "designId": "default-ship-design-target-drone", 43 | "name": "Target Drone 2", 44 | "cargo": [ 45 | { "id": "rp-1", "amount": 1000 } 46 | ] 47 | } 48 | ] 49 | } 50 | ] 51 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/defaultStart/ordnanceDesigns/missile-250.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "default-ordnance-missile-250", 3 | "name": "Missle 250", 4 | "fuelAmount": 225, 5 | "components": [ 6 | { "id": "default-design-prox-frag-5kg", "amount": 1 }, 7 | { "id": "default-design-missile-sensors", "amount": 1 }, 8 | { "id": "default-design-missile-srb", "amount": 1 } 9 | ] 10 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/basemod/modInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "Author": "Pulsar4x Devs", 3 | "ModName": "Pulsar4x", 4 | "Version": "0.1", 5 | "Namespace": "Pulsar4x", 6 | "DefaultEnabled": true, 7 | "DataFiles": [ 8 | "blueprints/armor.json", 9 | "blueprints/atmosphereGases.json", 10 | "blueprints/cargoTypes.json", 11 | "blueprints/electronics.json", 12 | "blueprints/energy.json", 13 | "blueprints/engines.json", 14 | "defaultTheme.json", 15 | "blueprints/industryTypes.json", 16 | "blueprints/installations.json", 17 | "blueprints/storage.json", 18 | "blueprints/materials.json", 19 | "blueprints/minerals.json", 20 | "blueprints/ordnance.json", 21 | "systemGenSettings.json", 22 | "blueprints/techCategories.json", 23 | "blueprints/techs.json", 24 | "blueprints/weapons.json", 25 | "blueprints/damageResistance.json", 26 | "blueprints/species.json", 27 | "blueprints/sol.json", 28 | "blueprints/mercury.json", 29 | "blueprints/venus.json", 30 | "blueprints/earth.json", 31 | "blueprints/luna.json", 32 | "blueprints/mars.json", 33 | "blueprints/jupiter.json", 34 | "blueprints/saturn.json", 35 | "blueprints/uranus.json", 36 | "blueprints/neptune.json", 37 | "blueprints/dwarfPlanets.json", 38 | "blueprints/comets.json", 39 | "blueprints/alphaCentauri.json", 40 | "blueprints/componentDesigns.json", 41 | "blueprints/shipDesigns.json" 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/oldjson/ArmorTypeData.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "Type": "ArmorTypes", 4 | "Data": { 5 | "Entries": [ 6 | { 7 | "Key": "05dce711-8846-488a-b0f3-57fd7924b268", 8 | "Value": { 9 | "ResourceID": "05dce711-8846-488a-b0f3-57fd7924b268", 10 | "Density": "7900" 11 | } 12 | }, 13 | { 14 | "Key": "207af637-95a0-4b89-ac4a-6d66a81cfb2f", 15 | "Value": { 16 | "ResourceID": "207af637-95a0-4b89-ac4a-6d66a81cfb2f", 17 | "Density": "1175" 18 | } 19 | }, 20 | { 21 | "Key": "d554fb70-bd28-459c-a1b3-d7b2019f685a", 22 | "Value": { 23 | "ResourceID": "d554fb70-bd28-459c-a1b3-d7b2019f685a", 24 | "Density": "2700" 25 | } 26 | }, 27 | { 28 | "Key": "A11ABDF3-C7DA-4DB2-9146-AEA0A5026B3E", 29 | "Value": { 30 | "ResourceID": "A11ABDF3-C7DA-4DB2-9146-AEA0A5026B3E", 31 | "Density": "4540" 32 | } 33 | } 34 | ] 35 | } 36 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/oldjson/Commander Name Theme - The Creators.json: -------------------------------------------------------------------------------- 1 | { 2 | "Type": "CommanderNameThemes", 3 | "Data": [ 4 | { 5 | "ThemeName": "The Creators", 6 | "NameList": [ 7 | { 8 | "First": "Greg", 9 | "Last": "Nott", 10 | "IsFemale": false 11 | }, 12 | { 13 | "First": "Rod", 14 | "Last": "Serling", 15 | "IsFemale": false 16 | } 17 | ] 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/oldjson/ComponentDataMisc.json: -------------------------------------------------------------------------------- 1 | { 2 | "Type": "ComponentTemplates", 3 | "Data": { 4 | "Entries": [ 5 | { 6 | "Key": "57614ddb-0756-44cf-857b-8a6578493792", 7 | "Value": { 8 | "Name": "TestWeight", 9 | "ComponentType": "Misc", 10 | "ID": "57614ddb-0756-44cf-857b-8a6578493792", 11 | "MassFormula": "PropertyValue('Mass')", 12 | "VolumeFormula": "[Mass]", 13 | "HTKFormula": "[Mass]", 14 | "CrewReqFormula": "[Mass]", 15 | "ResourceCostFormula": { 16 | "Entries": [ 17 | { 18 | "Key": "2dfc78ea-f8a4-4257-bc04-47279bf104ef", 19 | "Value": "[Mass]" 20 | } 21 | ] 22 | }, 23 | "ResearchCostFormula": "0", 24 | "CreditCostFormula": "[Mass]", 25 | "BuildPointCostFormula": "[Mass]", 26 | "MountType": "ShipComponent, ShipCargo", 27 | "CargoTypeID": "16b4c4f0-7292-4f4d-8fea-22103c70b288", 28 | "IndustryTypeID": "B457C6FE-07A7-4EA1-90DB-D2547245FA86", 29 | "ComponentAtbSDs": [ 30 | { 31 | "Name": "Mass", 32 | "Units": "kg", 33 | "DescriptionFormula": "'The mass of the weight'", 34 | "GuiHint": "GuiSelectionMaxMin", 35 | "DataDict": { 36 | "Entries": [] 37 | }, 38 | "MaxFormula": "10000", 39 | "MinFormula": "1", 40 | "StepFormula": "1", 41 | "PropertyFormula": "150" 42 | } 43 | ] 44 | } 45 | } 46 | ] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/oldjson/GameStarts/DefaultStart/Components.json: -------------------------------------------------------------------------------- 1 | { 2 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/oldjson/IndustryTypeData.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "Type": "IndustryTypes", 4 | "Data": { 5 | "Entries": [ 6 | { 7 | "Key": "265B36EE-BAED-4F92-9AEC-BC8A7EA0DF1F", 8 | "Value": { 9 | "Name": "Refining", 10 | "ID": "265B36EE-BAED-4F92-9AEC-BC8A7EA0DF1F" 11 | } 12 | }, 13 | { 14 | "Key": "B457C6FE-07A7-4EA1-90DB-D2547245FA86", 15 | "Value": { 16 | "Name": "Component Construction", 17 | "ID": "B457C6FE-07A7-4EA1-90DB-D2547245FA86" 18 | } 19 | }, 20 | { 21 | "Key": "EC717019-D9B2-4F24-ADE2-BFFC87294545", 22 | "Value": { 23 | "Name": "Installation Construction", 24 | "ID": "EC717019-D9B2-4F24-ADE2-BFFC87294545" 25 | } 26 | }, 27 | { 28 | "Key": "5ADBF620-3740-4FD7-98BE-E8670D58945F", 29 | "Value": { 30 | "Name": "Ordinance Construction", 31 | "ID": "5ADBF620-3740-4FD7-98BE-E8670D58945F" 32 | } 33 | }, 34 | { 35 | "Key": "91823C5B-A71A-4364-A62C-489F0183EFB5", 36 | "Value": { 37 | "Name": "Ship Assembly", 38 | "ID": "91823C5B-A71A-4364-A62C-489F0183EFB5" 39 | } 40 | } 41 | 42 | ] 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/oldjson/VersionInfo.vinfo: -------------------------------------------------------------------------------- 1 | { 2 | "Type": "VersionInfo", 3 | "Data": { 4 | "Name": "Pulsar4X", 5 | "VersionString": "0.4", 6 | "MajorVersion": 0, 7 | "MinorVersion": 4, 8 | "Directory": "Pulsar4x" 9 | } 10 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/testingmod/modInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "Author": "Pulsar4x Devs", 3 | "ModName": "Pulsar4x-Testing", 4 | "Version": "0.1", 5 | "Namespace": "Pulsar4x-Testing", 6 | "DataFiles": [ 7 | "testData.json" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Data/testingmod/testData.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Type": "Armor", 4 | "Payload": { 5 | "UniqueID": "stainless-steel-armor", 6 | "Density": "7901" 7 | } 8 | }, 9 | { 10 | "Type": "Theme", 11 | "CollectionOperation": "Add", 12 | "Payload": { 13 | "UniqueID": "default-theme", 14 | "FirstNames": [ 15 | "FakeFirstName1", "FakeFirstName2" 16 | ] 17 | } 18 | }, 19 | { 20 | "Type": "Theme", 21 | "CollectionOperation": "Remove", 22 | "Payload": { 23 | "UniqueID": "default-theme", 24 | "FirstNames": [ 25 | "Aria" 26 | ] 27 | } 28 | }, 29 | { 30 | "Type": "Theme", 31 | "CollectionOperation": "Overwrite", 32 | "Payload": { 33 | "UniqueID": "default-theme", 34 | "NavyRanks": { 35 | "1": "Fake Ensign", 36 | "2": "Fake Lieutenant (JG)", 37 | "3": "Fake Lieutenant", 38 | "4": "Fake Lieutenant Commander", 39 | "5": "Fake Commander", 40 | "6": "Fake Captain", 41 | "7": "Fake Rear Admiral (lower half)", 42 | "8": "Fake Rear Admiral", 43 | "9": "Fake Vice Admiral", 44 | "10": "Fake Admiral" 45 | } 46 | } 47 | } 48 | ] -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Auth/AuthenticationToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Pulsar4X.Engine.Auth 4 | { 5 | public class AuthenticationToken 6 | { 7 | public Guid PlayerID { get; set; } 8 | public string Password { get; set; } 9 | 10 | public AuthenticationToken() { } 11 | 12 | public AuthenticationToken(Guid playerID, string password = "") 13 | { 14 | PlayerID = playerID; 15 | Password = password; 16 | } 17 | 18 | public AuthenticationToken(Player player, string password = "") 19 | { 20 | PlayerID = player.ID; 21 | Password = password; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/ArmorBlueprint.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.Blueprints 2 | { 3 | public class ArmorBlueprint : Blueprint 4 | { 5 | public string ResourceID { get; set; } = ""; 6 | public double Density { get; set; } = 0; 7 | } 8 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/Blueprint.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Pulsar4X.Blueprints 4 | { 5 | public abstract class Blueprint 6 | { 7 | public string UniqueID { get; set; } 8 | public string FullIdentifier { get; protected set; } 9 | public string JsonFileName { get; set; } 10 | 11 | public void SetFullIdentifier(string modNamespace) 12 | { 13 | FullIdentifier = $"{modNamespace}:{UniqueID}"; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/CargoTypeBlueprint.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.Blueprints 2 | { 3 | public class CargoTypeBlueprint : Blueprint 4 | { 5 | public string Name { get; set; } 6 | public string Description { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/ColonyBlueprint.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Pulsar4X.Blueprints; 4 | 5 | public class ColonyBlueprint : Blueprint 6 | { 7 | public string Name { get; set; } 8 | public double? StartingPopulation { get; set; } 9 | 10 | public List? Installations { get; set; } 11 | public List? Cargo { get; set; } 12 | public List? ComponentDesigns { get; set; } 13 | public List? OrdnanceDesigns { get; set; } 14 | public List? ShipDesigns { get; set; } 15 | public List? StartingItems { get; set; } 16 | public List? Fleets { get; set; } 17 | 18 | public struct StartingItemBlueprint 19 | { 20 | public string Id { get; set; } 21 | public uint Amount { get; set; } 22 | public string? Type { get; set; } 23 | } 24 | 25 | public struct FleetBlueprint 26 | { 27 | public string Name { get; set; } 28 | public List? Ships { get; set; } 29 | } 30 | 31 | public struct ShipBlueprint 32 | { 33 | public string DesignId { get; set; } 34 | public string Name { get; set; } 35 | public List? Cargo { get; set; } 36 | } 37 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/ComponentDesignBlueprint.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json.Linq; 3 | using Newtonsoft.Json; 4 | 5 | namespace Pulsar4X.Blueprints; 6 | 7 | public class ComponentDesignBlueprint : Blueprint 8 | { 9 | public struct Property 10 | { 11 | public string Key { get; set; } 12 | 13 | private JToken _value; 14 | public JToken Value 15 | { 16 | get => _value; 17 | set => _value = value; 18 | } 19 | 20 | public T? GetValue() => _value.ToObject(); 21 | [JsonIgnore] 22 | public int AsInt => _value.Value(); 23 | [JsonIgnore] 24 | public double AsDouble => _value.Value(); 25 | [JsonIgnore] 26 | public string? AsString => _value.Value(); 27 | } 28 | 29 | public string Name { get; set; } 30 | public string TemplateId { get; set; } 31 | public List? Properties { get; set; } 32 | 33 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/ComponentTemplateBlueprint.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Pulsar4X.DataStructures; 3 | 4 | namespace Pulsar4X.Blueprints 5 | { 6 | public class ComponentTemplateBlueprint : Blueprint 7 | { 8 | public string Name { get; set;} 9 | 10 | /// 11 | /// Description 12 | /// Mass 13 | /// Volume 14 | /// HTK 15 | /// CrewReq 16 | /// ResourceCost 17 | /// ResearchCost 18 | /// CreditCost 19 | /// BuildPointCost 20 | /// 21 | public Dictionary Formulas { get; set;} 22 | public Dictionary ResourceCost { get; set; } 23 | public string ComponentType { get; set; } 24 | public ComponentMountType MountType { get; set; } 25 | public string IndustryTypeID { get; set;} 26 | public string CargoTypeID { get; set;} 27 | public List Properties { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/ComponentTemplatePropertyBlueprint.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Pulsar4X.DataStructures; 3 | 4 | namespace Pulsar4X.Blueprints 5 | { 6 | public class ComponentTemplatePropertyBlueprint 7 | { 8 | public string Name { get; set; } 9 | public string DescriptionFormula { get; set; } 10 | public string Units { get; set; } 11 | public GuiHint GuiHint { get; set; } 12 | public string GuiIsEnabledFormula { get; set; } 13 | public Dictionary DataDict { get; set; } 14 | public string EnumTypeName { get; set; } 15 | public string MaxFormula { get; set; } 16 | public string MinFormula { get; set; } 17 | public string StepFormula { get; set; } 18 | public string PropertyFormula { get; set; } 19 | public string AttributeType { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/IndustryTypeBlueprint.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.Blueprints 2 | { 3 | public class IndustryTypeBlueprint : Blueprint 4 | { 5 | public string Name { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/MineralBlueprint.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Pulsar4X.DataStructures; 3 | 4 | namespace Pulsar4X.Blueprints 5 | { 6 | public class MineralBlueprint : Blueprint 7 | { 8 | public string Name { get; set; } 9 | public string Description { get; set; } 10 | public string CargoTypeID { get; set; } 11 | public long MassPerUnit { get; set; } 12 | public double VolumePerUnit { get; set; } 13 | public Dictionary Abundance { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/ProcessedMaterialBlueprint.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Pulsar4X.DataStructures; 3 | 4 | namespace Pulsar4X.Blueprints 5 | { 6 | public class ProcessedMaterialBlueprint : Blueprint 7 | { 8 | public string Name { get; set; } 9 | public Dictionary Formulas { get; set;} 10 | public Dictionary ResourceCosts { get; set; } 11 | public long IndustryPointCosts { get; set; } 12 | public string IndustryTypeID { get; set; } 13 | public string Description { get; set; } 14 | public ConstructableGuiHints GuiHints { get; set; } 15 | public ushort WealthCost { get; set;} 16 | public ushort OutputAmount { get; set; } 17 | public string CargoTypeID { get; set; } 18 | public long MassPerUnit { get; set; } 19 | public double VolumePerUnit { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/ShipDesignBlueprint.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Pulsar4X.Blueprints; 4 | 5 | public class ShipDesignBlueprint : Blueprint 6 | { 7 | public struct ShipArmorBlueprint 8 | { 9 | public string Id { get; set; } 10 | public uint Thickness { get; set; } 11 | } 12 | 13 | public struct ShipComponentBlueprint 14 | { 15 | public string Id { get; set; } 16 | public uint Amount { get; set; } 17 | } 18 | 19 | public string Name { get; set; } 20 | public ShipArmorBlueprint Armor { get; set; } 21 | public List Components { get; set; } 22 | 23 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/SpeciesBlueprint.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Engine; 2 | 3 | namespace Pulsar4X.Blueprints 4 | { 5 | public class SpeciesBlueprint : Blueprint 6 | { 7 | public string Name { get; set; } 8 | public bool Playable { get; set; } = true; 9 | public string BreathableGasSymbol { get; set; } 10 | public ValueRange Gravity { get; set; } 11 | public ValueRange Pressure { get; set; } 12 | public ValueRange Temperature { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/StarBlueprint.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.Blueprints; 2 | 3 | public class StarBlueprint : Blueprint 4 | { 5 | public struct StarInfoBlueprint 6 | { 7 | public double? Mass { get; set; } 8 | public double? Radius { get; set; } 9 | public double? Age { get; set; } 10 | public string? Class { get; set; } 11 | public double? Temperature { get; set; } 12 | public double? Luminosity { get; set; } 13 | public string? LuminosityClass { get; set; } 14 | public string? SpectralType { get; set; } 15 | } 16 | 17 | public string Name { get; set; } 18 | public StarInfoBlueprint Info { get; set; } 19 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/SystemBlueprint.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Pulsar4X.Blueprints; 4 | 5 | public class SystemBlueprint : Blueprint 6 | { 7 | public struct SurveyRingValue 8 | { 9 | public uint RingRadiusInAU { get; set; } 10 | public uint Count { get; set; } 11 | } 12 | 13 | public string Name { get; set; } 14 | public int? Seed { get; set; } 15 | public List Stars { get; set; } 16 | public List Bodies { get; set; } 17 | public List SurveyRings { get; set; } 18 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/TechBlueprint.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Pulsar4X.DataStructures; 3 | 4 | namespace Pulsar4X.Blueprints 5 | { 6 | public class TechBlueprint : Blueprint 7 | { 8 | public string Name { get; set; } 9 | public string Description { get; set; } 10 | public int MaxLevel { get; set; } 11 | public string CostFormula { get; set; } 12 | public string DataFormula { get; set; } 13 | public string Category { get; set; } 14 | public Dictionary> Unlocks { get; set; } = new (); 15 | } 16 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/TechCategoryBlueprint.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.Blueprints 2 | { 3 | public class TechCategoryBlueprint : Blueprint 4 | { 5 | public string Name { get; set; } 6 | public string Description { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Blueprints/ThemeBlueprint.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Pulsar4X.Blueprints 4 | { 5 | public class ThemeBlueprint : Blueprint 6 | { 7 | public string Name { get; set; } 8 | public List FleetNames { get; set; } 9 | public List ShipNames { get; set; } 10 | public List FirstNames { get; set; } 11 | public List LastNames { get; set; } 12 | public Dictionary NavyRanks { get; set; } 13 | public Dictionary NavyRanksAbbreviations { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Components/ComponentAbilityState.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | 4 | namespace Pulsar4X.Components 5 | { 6 | 7 | public abstract class ComponentAbilityState 8 | { 9 | 10 | public string Name 11 | { 12 | get { return ComponentInstance.Design.Name; } 13 | } 14 | 15 | public string ID 16 | { 17 | get { return ComponentInstance.UniqueID; } 18 | } 19 | 20 | [JsonProperty] 21 | public ComponentInstance ComponentInstance { get; private set; } 22 | 23 | [JsonConstructor] 24 | protected ComponentAbilityState(){} 25 | 26 | public ComponentAbilityState(ComponentInstance componentInstance) 27 | { 28 | ComponentInstance = componentInstance; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Components/IComponentDesignAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Globalization; 5 | using NCalc; 6 | using NCalc.Domain; 7 | using Pulsar4X.Components; 8 | using Pulsar4X.Engine; 9 | 10 | namespace Pulsar4X.Interfaces 11 | { 12 | public interface IComponentDesignAttribute 13 | { 14 | //void OnComponentInstantiation(Entity component); 15 | void OnComponentInstallation(Entity parentEntity, ComponentInstance componentInstance); 16 | void OnComponentUninstallation(Entity parentEntity, ComponentInstance componentInstance); 17 | 18 | string AtbName(); 19 | 20 | string AtbDescription(); 21 | } 22 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/DataStructures/EntityFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Pulsar4X.DataStructures; 4 | 5 | [Flags] 6 | public enum EntityFilter 7 | { 8 | None = 0, 9 | Friendly = 1, 10 | Neutral = 2, 11 | Hostile = 4 12 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/DataStructures/EnumExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Reflection; 4 | using Pulsar4X.DataStructures; 5 | 6 | namespace Pulsar4X.Extensions 7 | { 8 | public static class EnumExtensions 9 | { 10 | public static string ToDescription(this TEnum source) 11 | { 12 | if(source == null) throw new ArgumentNullException("source cannot be null"); 13 | var sourceStr = source.ToString(); 14 | if(string.IsNullOrEmpty(sourceStr)) throw new NullReferenceException("Somehow ToString returned null?"); 15 | FieldInfo? fi = source.GetType().GetField(sourceStr); 16 | 17 | DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes( 18 | typeof(DescriptionAttribute), false); 19 | 20 | if (attributes != null && attributes.Length > 0) 21 | { 22 | return attributes[0].Description; 23 | } 24 | return sourceStr; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/DataStructures/FilterLogic.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.DataStructures; 2 | 3 | public enum FilterLogic 4 | { 5 | And, 6 | Or 7 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/DataStructures/ManueverState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Pulsar4X.Orbital; 3 | 4 | namespace Pulsar4X.DataStructures 5 | { 6 | public struct ManuverState 7 | { 8 | public DateTime At; 9 | public double Mass; 10 | public Vector3 Position; 11 | public Vector3 Velocity; 12 | } 13 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/DataStructures/SystemEntityJumpPair.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Engine; 2 | 3 | namespace Pulsar4X.DataStructures 4 | { 5 | internal struct SystemEntityJumpPair 6 | { 7 | internal StarSystem JumpSystem; 8 | internal Entity JumpingEntity; 9 | } 10 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/DataStructures/ValueRange.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.Engine; 2 | 3 | public struct ValueRange 4 | { 5 | public double? Ideal { get; set; } 6 | public double? Maximum { get; set; } 7 | public double? Minimum { get; set; } 8 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/DataStructures/ValueTypeStruct.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.DataStructures 2 | { 3 | public struct ValueTypeStruct 4 | { 5 | public enum ValueTypes 6 | { 7 | Power, 8 | Distance, 9 | Volume, 10 | Mass, 11 | Velocity, 12 | Force, 13 | Number, 14 | } 15 | 16 | public enum ValueSizes 17 | { 18 | Pico = -12, 19 | Nano = -9, 20 | Micro = -6, 21 | Milli = - 3, 22 | Centi = -2, 23 | Deci = -1, 24 | BaseUnit = 0, 25 | Deca = 1, 26 | Hecto = 2, 27 | Kilo = 3, 28 | Mega = 6, 29 | Giga = 9, 30 | Tera = 12, 31 | } 32 | 33 | public ValueTypes ValueType; 34 | public ValueSizes ValueSize; 35 | 36 | public ValueTypeStruct(ValueTypes type, ValueSizes size) 37 | { 38 | ValueType = type; 39 | ValueSize = size; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/DataStructures/WeightedValue.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Pulsar4X.DataStructures 4 | { 5 | public class WeightedValue 6 | { 7 | public double Weight { get; set; } 8 | public T Value { get; set; } 9 | 10 | protected bool Equals(WeightedValue other) 11 | { 12 | return EqualityComparer.Default.Equals(Value, other.Value); 13 | } 14 | 15 | public override bool Equals(object? obj) 16 | { 17 | if(obj == null) return false; 18 | 19 | if (ReferenceEquals(null, obj)) 20 | { 21 | return false; 22 | } 23 | if (ReferenceEquals(this, obj)) 24 | { 25 | return true; 26 | } 27 | if (obj.GetType() != GetType()) 28 | { 29 | return false; 30 | } 31 | return Equals((WeightedValue)obj); 32 | } 33 | 34 | public override int GetHashCode() 35 | { 36 | return Value is null ? 0 : EqualityComparer.Default.GetHashCode(Value); 37 | } 38 | 39 | } 40 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/DataStructures/XThreadData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | 3 | namespace Pulsar4X.DataStructures 4 | { 5 | public class XThreadData 6 | { 7 | ConcurrentHashSet> _subscribers = new ConcurrentHashSet>(); 8 | 9 | public void Write(T data) 10 | { 11 | foreach (ConcurrentQueue sub in _subscribers) 12 | { 13 | sub.Enqueue(data); 14 | } 15 | 16 | } 17 | 18 | public ConcurrentQueue Subscribe() 19 | { 20 | ConcurrentQueue newQueue = new ConcurrentQueue(); 21 | _subscribers.Add(newQueue); 22 | return newQueue; 23 | } 24 | 25 | public void Unsubscribe(ConcurrentQueue queue) 26 | { 27 | _subscribers.Remove(queue); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Datablobs/DesignInfoDB.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Pulsar4X.Engine; 4 | using Pulsar4X.Interfaces; 5 | 6 | namespace Pulsar4X.Datablobs 7 | { 8 | /// 9 | /// stores the Design entity for specific instances of a ship, component, or other designed entity. 10 | /// 11 | public class DesignInfoDB : BaseDataBlob 12 | { 13 | internal Entity DesignEntity { get; private set; } 14 | 15 | internal List DesignAttributes = new List(); 16 | 17 | public DesignInfoDB() { } 18 | 19 | public DesignInfoDB(Entity designEntity) 20 | { 21 | DesignEntity = designEntity; 22 | } 23 | 24 | public DesignInfoDB(DesignInfoDB db) 25 | { 26 | DesignEntity = db.DesignEntity; 27 | } 28 | 29 | public override object Clone() 30 | { 31 | return new DesignInfoDB(this); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Entities/EntityIDGenerator.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Pulsar4X.Engine; 4 | 5 | public static class EntityIDGenerator 6 | { 7 | [JsonProperty] 8 | internal static int NextId { get; set; } = 0; 9 | public static int GenerateUniqueID() => NextId++; 10 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Entities/IHasDataBlobs.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Pulsar4X.Datablobs; 3 | 4 | namespace Pulsar4X.Engine; 5 | 6 | public interface IHasDataBlobs 7 | { 8 | public void SetDataBlob(T dataBlob) where T : BaseDataBlob; 9 | public T GetDataBlob() where T : BaseDataBlob; 10 | public bool TryGetDatablob(out T? value) where T : BaseDataBlob; 11 | List GetAllDataBlobs(); 12 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Events/Event.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Pulsar4X.Events; 5 | 6 | public class Event 7 | { 8 | public EventType EventType { get; private set; } 9 | public DateTime StarDate { get; private set; } 10 | public string Message { get; private set; } 11 | public int? FactionId { get; private set; } 12 | public string? SystemId { get; private set; } 13 | public int? EntityId { get; private set; } 14 | public List ConcernedFactions { get; private set; } = new (); 15 | 16 | private Event() { } 17 | 18 | public static Event Create( 19 | EventType eventType, 20 | DateTime dateTime, 21 | string message, 22 | int? factionId = null, 23 | string? systemId = null, 24 | int? entityId = null, 25 | List? concernedFactions = null) 26 | { 27 | return new Event() 28 | { 29 | EventType = eventType, 30 | StarDate = dateTime, 31 | Message = message, 32 | FactionId = factionId, 33 | SystemId = systemId, 34 | EntityId = entityId, 35 | ConcernedFactions = concernedFactions ?? new List() 36 | }; 37 | } 38 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Events/EventManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Pulsar4X.Events; 5 | 6 | public class EventManager 7 | { 8 | private static readonly EventManager instance = new EventManager(); 9 | 10 | private Dictionary> _subscribers = new(); 11 | private EventManager() {} 12 | 13 | public static EventManager Instance => instance; 14 | 15 | public void Clear() 16 | { 17 | _subscribers.Clear(); 18 | } 19 | 20 | public void Subscribe(EventType eventType, Action subscriber) 21 | { 22 | if(!_subscribers.ContainsKey(eventType)) 23 | { 24 | _subscribers[eventType] = subscriber; 25 | } 26 | else 27 | { 28 | _subscribers[eventType] += subscriber; 29 | } 30 | } 31 | 32 | public void Unsubscribe(EventType eventType, Action subscriber) 33 | { 34 | if(_subscribers.ContainsKey(eventType)) 35 | { 36 | _subscribers[eventType] -= subscriber; 37 | } 38 | } 39 | 40 | public void Publish(Event e) 41 | { 42 | foreach(var (eventType, subscriber) in _subscribers) 43 | { 44 | if((e.EventType & eventType) != 0) 45 | { 46 | subscriber?.Invoke(e); 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Events/IEventLog.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.DataStructures; 2 | 3 | namespace Pulsar4X.Events; 4 | 5 | public interface IEventLog 6 | { 7 | public void Subscribe(); 8 | public void Unsubscribe(); 9 | public SafeList GetEvents(); 10 | 11 | public void ToggleHaltsOn(EventType eventType); 12 | public bool HaltsOn(EventType eventType); 13 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Events/SpaceMasterEventLog.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Pulsar4X.DataStructures; 3 | 4 | namespace Pulsar4X.Events; 5 | 6 | public class SpaceMasterEventLog : IEventLog 7 | { 8 | [JsonProperty] 9 | private SafeList _events = new (); 10 | 11 | private SpaceMasterEventLog() { } 12 | 13 | public static SpaceMasterEventLog Create() 14 | { 15 | return new SpaceMasterEventLog(); 16 | } 17 | 18 | public SafeList GetEvents() => _events; 19 | 20 | public void Subscribe() 21 | { 22 | var allEvents = EventTypeHelper.GetAllEventTypes(); 23 | EventManager.Instance.Subscribe(allEvents, OnEvent); 24 | } 25 | 26 | public void Unsubscribe() 27 | { 28 | var allEvents = EventTypeHelper.GetAllEventTypes(); 29 | EventManager.Instance.Unsubscribe(allEvents, OnEvent); 30 | } 31 | 32 | public void ToggleHaltsOn(EventType eventType) 33 | { 34 | // Do nothing, the SM log shouldn't ever halt the game 35 | } 36 | 37 | public bool HaltsOn(EventType eventType) 38 | { 39 | return false; 40 | } 41 | 42 | private void OnEvent(Event e) 43 | { 44 | _events.Add(e); 45 | } 46 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Extensions/ObjectExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.Extensions 2 | { 3 | public static class ObjectExtensions 4 | { 5 | /// 6 | /// Values the hash. 7 | /// 8 | /// The hash. 9 | /// Object. 10 | /// if mulitiple values need to be hashed, include the previous hash 11 | public static int ValueHash(object obj, int hash = 17) 12 | { 13 | if (obj != null) 14 | { 15 | unchecked { hash = hash * 31 + obj.GetHashCode(); } 16 | } 17 | return hash; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Extensions/PositionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Orbital; 2 | using Pulsar4X.Datablobs; 3 | using Pulsar4X.Interfaces; 4 | using Pulsar4X.Movement; 5 | 6 | namespace Pulsar4X.Extensions 7 | { 8 | public static class PositionExtensions 9 | { 10 | /// 11 | /// Static function to find the distance in m between two positions. 12 | /// 13 | /// Distance between posA and posB. 14 | public static double GetDistanceTo_m(this IPosition posA, IPosition posB) 15 | { 16 | return (posA.AbsolutePosition - posB.AbsolutePosition).Length(); 17 | } 18 | 19 | public static double GetDistanceTo_m(this IPosition posA, Vector3 posB) 20 | { 21 | return (posA.AbsolutePosition - posB).Length(); 22 | } 23 | 24 | public static double GetDistanceTo_m(this Vector3 posA, PositionDB posB) 25 | { 26 | return (posA - posB.AbsolutePosition).Length(); 27 | } 28 | 29 | public static double GetDistanceTo_m(this Vector3 posA, Vector3 posB) 30 | { 31 | return (posA - posB).Length(); 32 | } 33 | 34 | /// 35 | /// Static Function to find the Distance Squared betweeen two positions. 36 | /// 37 | public static double GetDistanceToSqrd(this PositionDB posA, PositionDB posB) 38 | { 39 | return (posA.AbsolutePosition - posB.AbsolutePosition).LengthSquared(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Extensions/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Pulsar4X.Extensions 4 | { 5 | public static class StringExtensions 6 | { 7 | public static bool IsNullOrEmpty(this string s) 8 | { 9 | return String.IsNullOrEmpty(s); 10 | } 11 | 12 | public static bool IsNotNullOrEmpty(this string s) 13 | { 14 | return !String.IsNullOrEmpty(s); 15 | } 16 | 17 | public static bool IsNullOrWhitespace(this string s) 18 | { 19 | return String.IsNullOrWhiteSpace(s); 20 | } 21 | 22 | public static bool IsNotNullOrWhitespace(this string s) 23 | { 24 | return !String.IsNullOrWhiteSpace(s); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Extensions/SystemGenSettingsExtensions.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Blueprints; 2 | using Pulsar4X.DataStructures; 3 | 4 | namespace Pulsar4X.Extensions 5 | { 6 | public static class SystemGenSettingsExtensions 7 | { 8 | public static WeightedList GetBandBodyTypeWeight(this SystemGenSettingsBlueprint blueprint, SystemBand systemBand) 9 | { 10 | switch (systemBand) 11 | { 12 | case SystemBand.InnerBand: 13 | return blueprint.InnerBandTypeWeights; 14 | case SystemBand.HabitableBand: 15 | return blueprint.HabitableBandTypeWeights; 16 | case SystemBand.OuterBand: 17 | default: 18 | return blueprint.OuterBandTypeWeights; 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/GameFactory.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Modding; 2 | 3 | namespace Pulsar4X.Engine; 4 | 5 | public static class GameFactory 6 | { 7 | public static Game CreateGame(string[] modFiles, NewGameSettings newGameSettings) 8 | { 9 | ModLoader modLoader = new ModLoader(); 10 | ModDataStore modDataStore = new ModDataStore(); 11 | 12 | foreach (var mod in modFiles) 13 | { 14 | modLoader.LoadModManifest(mod, modDataStore); 15 | } 16 | 17 | return new Game(newGameSettings, modDataStore); 18 | } 19 | 20 | public static Game CreateGame(ModDataStore modDataStore, NewGameSettings newGameSettings) 21 | { 22 | return new Game(newGameSettings, modDataStore); 23 | } 24 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Interfaces/ICondition.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Pulsar4X.DataStructures; 3 | using Pulsar4X.Engine; 4 | 5 | namespace Pulsar4X.Interfaces 6 | { 7 | public interface ICondition 8 | { 9 | public ConditionDisplayType DisplayType { get; } 10 | bool Evaluate(Entity fleet); 11 | } 12 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Interfaces/IConstructableDesign.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Pulsar4X.DataStructures; 3 | using Pulsar4X.Engine; 4 | using Pulsar4X.Industry; 5 | using Pulsar4X.Storage; 6 | 7 | namespace Pulsar4X.Interfaces 8 | { 9 | public interface IConstructableDesign 10 | { 11 | ConstructableGuiHints GuiHints { get; } 12 | 13 | string UniqueID { get; } 14 | string Name { get; } //player defined name. ie "5t 2kn Thruster". 15 | 16 | bool IsValid { get; } 17 | 18 | Dictionary ResourceCosts { get; } 19 | 20 | long IndustryPointCosts { get; } 21 | string IndustryTypeID { get; } 22 | ushort OutputAmount { get; } 23 | void OnConstructionComplete(Entity industryEntity, CargoStorageDB storage, string productionLine, IndustryJob batchJob, IConstructableDesign designInfo); 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Interfaces/IPosition.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Pulsar4X.Orbital; 3 | 4 | namespace Pulsar4X.Interfaces 5 | { 6 | public interface IPosition 7 | { 8 | Vector3 AbsolutePosition { get; } 9 | [JsonProperty] 10 | Vector3 RelativePosition { get; } 11 | } 12 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Interfaces/IRecalcProcessor.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Engine; 2 | 3 | namespace Pulsar4X.Interfaces 4 | { 5 | /// 6 | /// Recalc processor. - this processor is called when something on the entity changes. 7 | /// ie if a ship gets damaged, or modified, etc. the max speed and other stuff may need to be recalculated. 8 | /// 9 | internal interface IRecalcProcessor 10 | { 11 | /// 12 | /// This is used so that some recalc processors can be run before others 13 | /// 14 | /// The process priority. 15 | byte ProcessPriority { get; set; } 16 | /// 17 | /// function to recalculate an entity. 18 | /// 19 | /// Entity. 20 | void RecalcEntity(Entity entity); 21 | } 22 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Messaging/Message.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Datablobs; 2 | 3 | namespace Pulsar4X.Messaging; 4 | 5 | public class Message 6 | { 7 | public MessageTypes MessageType { get; private set; } 8 | public int? EntityId { get; private set; } 9 | public string? SystemId { get; private set; } 10 | public int? FactionId { get; private set; } 11 | public BaseDataBlob? DataBlob { get; private set; } 12 | 13 | private Message() { } 14 | 15 | public static Message Create( 16 | MessageTypes messageType, 17 | int? entityId = null, 18 | string? systemId = null, 19 | int? factionId = null, 20 | BaseDataBlob? dataBlob = null) 21 | { 22 | return new Message() 23 | { 24 | MessageType = messageType, 25 | EntityId = entityId, 26 | SystemId = systemId, 27 | FactionId = factionId, 28 | DataBlob = dataBlob 29 | }; 30 | } 31 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Messaging/MessagePublisher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | using Pulsar4X.DataStructures; 5 | 6 | namespace Pulsar4X.Messaging; 7 | 8 | public class MessagePublisher 9 | { 10 | private static readonly MessagePublisher instance = new MessagePublisher(); 11 | private MessagePublisher() {} 12 | public static MessagePublisher Instance => instance; 13 | public delegate Task MessageHandler(Message message); 14 | private static SafeDictionary? Filter)>> subscribers = new (); 15 | 16 | public void Subscribe(MessageTypes messageType, MessageHandler handler, Func? filter = null) 17 | { 18 | if(!subscribers.ContainsKey(messageType)) 19 | { 20 | subscribers[messageType] = new (); 21 | } 22 | 23 | subscribers[messageType].Add((handler, filter)); 24 | } 25 | 26 | public void Unsubscribe(MessageTypes messageType, MessageHandler handler) 27 | { 28 | if(subscribers.ContainsKey(messageType)) 29 | { 30 | subscribers[messageType].RemoveAll(sub => sub.Handler == handler); 31 | } 32 | } 33 | 34 | public async Task Publish(Message message) 35 | { 36 | if (subscribers.TryGetValue(message.MessageType, out var handlers)) 37 | { 38 | var tasks = handlers 39 | .Where(h => h.Filter?.Invoke(message) ?? true) 40 | .Select(h => h.Handler(message)); 41 | 42 | await Task.WhenAll(tasks); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Messaging/MessageTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.Messaging; 2 | 3 | public enum MessageTypes 4 | { 5 | EntityAdded, 6 | EntityRemoved, 7 | EntityHidden, 8 | EntityRevealed, 9 | DBAdded, 10 | DBRemoved, 11 | StarSystemRevealed 12 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Modding/ModManifest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Pulsar4X.Modding 4 | { 5 | public class ModManifest 6 | { 7 | public string ModDirectory { get; set; } 8 | public string Author { get; set; } 9 | public string ModName { get; set; } 10 | public string Version { get; set; } 11 | public string Namespace { get; set; } // Unique mod identifier 12 | public List DataFiles { get; set; } // List of paths to mod data files 13 | public string PlayerFactionStartingItems { get; set; } 14 | public string AIFactionStartingItems { get; set; } 15 | public bool DefaultEnabled { get; set; } = false; 16 | } 17 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Orders/ConditionalOrder.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Pulsar4X.DataStructures; 3 | 4 | namespace Pulsar4X.Engine.Orders 5 | { 6 | public class ConditionalOrder 7 | { 8 | [JsonProperty] 9 | public string Name { get; set; } 10 | 11 | [JsonProperty] 12 | public CompoundCondition Condition { get; set; } = new CompoundCondition(); 13 | 14 | [JsonProperty] 15 | public SafeList Actions { get; set; } = new (); 16 | 17 | [JsonIgnore] 18 | public bool IsValid 19 | { 20 | get 21 | { 22 | return Condition != null && Actions != null; 23 | } 24 | } 25 | 26 | public ConditionalOrder() { } 27 | 28 | public ConditionalOrder(CompoundCondition condition, SafeList actions) 29 | { 30 | Condition = condition; 31 | Actions = actions; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Orders/Conditions/ComparisonCondition.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.DataStructures; 2 | using Pulsar4X.Interfaces; 3 | using Pulsar4X.Engine; 4 | 5 | namespace Pulsar4X.Engine.Orders 6 | { 7 | public abstract class ComparisonCondition : ICondition 8 | { 9 | public ComparisonType ComparisionType { get; set; } 10 | 11 | public float Threshold { get; set; } 12 | public float MaxValue { get; internal set; } 13 | public float MinValue {get; internal set; } 14 | public string Description { get; internal set; } = ""; 15 | public ConditionDisplayType DisplayType { get; } = ConditionDisplayType.Comparison; 16 | 17 | public ComparisonCondition(float threshold, ComparisonType comparisonType) 18 | { 19 | Threshold = threshold; 20 | ComparisionType = comparisonType; 21 | } 22 | 23 | public abstract bool Evaluate(Entity fleet); 24 | } 25 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Orders/Conditions/ConditionItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Pulsar4X.DataStructures; 3 | using Pulsar4X.Interfaces; 4 | 5 | namespace Pulsar4X.Engine.Orders 6 | { 7 | public class ConditionItem 8 | { 9 | public string UniqueID { get; init; } 10 | public ICondition Condition { get; set; } 11 | public LogicalOperation? LogicalOperation { get; set; } 12 | 13 | public ConditionItem(ICondition condition, LogicalOperation? logicalOperation = null) 14 | { 15 | UniqueID = Guid.NewGuid().ToString(); 16 | Condition = condition; 17 | LogicalOperation = logicalOperation; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Orders/IOrderHandler.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Engine; 2 | using Pulsar4X.Engine.Orders; 3 | 4 | namespace Pulsar4X.Interfaces 5 | { 6 | public interface IOrderHandler 7 | { 8 | Game Game { get; } 9 | 10 | void HandleOrder(EntityCommand entityCommand); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Orders/OrderableDB.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Pulsar4X.DataStructures; 3 | using Pulsar4X.Engine.Orders; 4 | 5 | namespace Pulsar4X.Datablobs 6 | { 7 | public class OrderableDB : BaseDataBlob 8 | { 9 | [JsonProperty] 10 | public SafeList ActionList { get; } = new SafeList(); 11 | 12 | public OrderableDB() 13 | { 14 | } 15 | 16 | public OrderableDB(OrderableDB db) 17 | { 18 | ActionList = new SafeList(db.ActionList); 19 | } 20 | 21 | public override object Clone() 22 | { 23 | return new OrderableDB(this); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Processors/IInstanceProcessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Pulsar4X.Engine; 3 | 4 | namespace Pulsar4X.Interfaces 5 | { 6 | /// 7 | /// Instance processor. - This processor is fired at a specific timedate or on command. 8 | /// 9 | public abstract class IInstanceProcessor 10 | { 11 | internal string TypeName { get { return GetType().Name; } } 12 | internal abstract void ProcessEntity(Entity entity, DateTime atDateTime); 13 | } 14 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/SaveLoad/JsonUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Newtonsoft.Json; 3 | using Newtonsoft.Json.Serialization; 4 | 5 | namespace Pulsar4X.Engine; 6 | 7 | public class NonPublicResolver : DefaultContractResolver { 8 | protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) 9 | { 10 | var prop = base.CreateProperty(member, memberSerialization); 11 | if (!prop.Writable) { 12 | var property = member as PropertyInfo; 13 | var hasNonPublicSetter = property?.GetSetMethod(true) != null; 14 | prop.Writable = hasNonPublicSetter; 15 | } 16 | return prop; 17 | } 18 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Utils/GaussianRandom.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Pulsar4X.Engine 4 | { 5 | public class GaussianRandom 6 | { 7 | public double NextGaussian(Random rng, double mean, double standardDeviation) 8 | { 9 | double u1 = 1.0 - rng.NextDouble(); 10 | double u2 = 1.0 - rng.NextDouble(); 11 | 12 | double standardNormal = Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2); 13 | 14 | return mean + standardDeviation * standardNormal; 15 | } 16 | 17 | /// 18 | /// Get a random value on a bell curve 19 | /// 20 | /// 21 | /// The minimum value that can be returned 22 | /// The maximum value that can be returned 23 | /// The mean of the bell curve 24 | /// The standard deviation of the bell curve 25 | /// 26 | public int NextBellCurve(Random rng, int min, int max, double mean, double standardDeviation) 27 | { 28 | int result; 29 | do 30 | { 31 | result = (int)NextGaussian(rng, mean, standardDeviation); 32 | } while(result < min || result > max); 33 | 34 | return result; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Utils/Pressure.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Orbital; 2 | 3 | namespace Pulsar4X.Engine 4 | { 5 | /// 6 | /// Small helper class for Pressure unit conversions 7 | /// 8 | public static class Pressure 9 | { 10 | public static float AtmToKPa(float atm) 11 | { 12 | return atm * UniversalConstants.Units.PascalsPerATM / 1000f; 13 | } 14 | 15 | public static float KPaToAtm(float kpa) 16 | { 17 | return kpa * 1000f * UniversalConstants.Units.ATMPerPascal; 18 | } 19 | public static float AtmToPa(float atm) 20 | { 21 | return atm * UniversalConstants.Units.PascalsPerATM; 22 | } 23 | 24 | public static float PaToAtm(float pa) 25 | { 26 | return pa * UniversalConstants.Units.ATMPerPascal; 27 | } 28 | 29 | public static float AtmToBar(float atm) 30 | { 31 | return atm * UniversalConstants.Units.BarPerATM; 32 | } 33 | 34 | public static float BarToAtm(float bar) 35 | { 36 | return bar * UniversalConstants.Units.ATMPerBar; 37 | } 38 | 39 | public static float AtmToTorr(float atm) 40 | { 41 | return atm * UniversalConstants.Units.TorrPerATM; 42 | } 43 | 44 | public static float TorrToAtm(float torr) 45 | { 46 | return torr * UniversalConstants.Units.ATMPerTorr; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Engine/Utils/Temperature.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Orbital; 2 | using System; 3 | 4 | namespace Pulsar4X.Engine 5 | { 6 | /// 7 | /// Small helper class for Temperature unit conversions 8 | /// 9 | public static class Temperature 10 | { 11 | public static double ToKelvin(double celsius) 12 | { 13 | return celsius + UniversalConstants.Units.DegreesCToKelvin; 14 | } 15 | 16 | public static float ToKelvin(float celsius) 17 | { 18 | return Convert.ToSingle(celsius + UniversalConstants.Units.DegreesCToKelvin); 19 | } 20 | 21 | public static double ToCelsius(double kelvin) 22 | { 23 | return kelvin + UniversalConstants.Units.KelvinToDegreesC; 24 | } 25 | 26 | public static float ToCelsius(float kelvin) 27 | { 28 | return Convert.ToSingle(kelvin + UniversalConstants.Units.KelvinToDegreesC); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Factions/FactionOwnerDB.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json; 3 | using Pulsar4X.Datablobs; 4 | using Pulsar4X.Engine; 5 | 6 | namespace Pulsar4X.Factions 7 | { 8 | public class FactionOwnerDB : BaseDataBlob 9 | { 10 | [JsonProperty] 11 | internal Dictionary OwnedEntities { get; set; } = new (); 12 | private Dictionary> ByStarSystem { get; set; } = new (); 13 | public FactionOwnerDB() { } 14 | 15 | public FactionOwnerDB(FactionOwnerDB db) 16 | { 17 | OwnedEntities = new Dictionary(db.OwnedEntities); 18 | } 19 | 20 | internal void SetOwned(Entity entity) 21 | { 22 | OwnedEntities[entity.Id] = entity; 23 | // FIXME: was overwriting Id's set from ColonyFactory 24 | //entity.FactionOwnerID = this.OwningEntity.Id; 25 | } 26 | 27 | internal void AddEntity(Entity entity) 28 | { 29 | OwnedEntities[entity.Id] = entity; 30 | entity.FactionOwnerID = this.OwningEntity.FactionOwnerID; 31 | } 32 | 33 | internal void RemoveEntity(Entity entity) 34 | { 35 | if (OwnedEntities.ContainsKey(entity.Id)) 36 | { 37 | OwnedEntities.Remove(entity.Id); 38 | entity.FactionOwnerID = -1; 39 | } 40 | } 41 | 42 | 43 | public override object Clone() 44 | { 45 | return new FactionOwnerDB(this); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Factions/FactionSystemInfoDB.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Datablobs; 2 | using Pulsar4X.Engine; 3 | using Pulsar4X.Galaxy; 4 | using System.Collections.Generic; 5 | 6 | namespace Pulsar4X.Factions 7 | { 8 | public class FactionSystemInfoDB : BaseDataBlob 9 | { 10 | internal StarSystem StarSystem; 11 | internal HashSet OwnedEntitesInSystem = new HashSet(); 12 | internal HashSet KnownSystemBodies = new HashSet(); 13 | 14 | public FactionSystemInfoDB() { } 15 | 16 | public FactionSystemInfoDB(StarSystem starSystem) 17 | { 18 | this.StarSystem = starSystem; 19 | //TODO move this to a processor and require sensors of some kind. 20 | //will also need to figure out how much a faction knows about the body. 21 | foreach (var body in starSystem.GetAllEntitiesWithDataBlob()) 22 | { 23 | KnownSystemBodies.Add(body); 24 | } 25 | } 26 | 27 | public FactionSystemInfoDB(FactionSystemInfoDB db) 28 | { 29 | StarSystem = db.StarSystem; 30 | OwnedEntitesInSystem = new HashSet(db.OwnedEntitesInSystem); 31 | KnownSystemBodies = new HashSet(db.KnownSystemBodies); 32 | } 33 | 34 | public override object Clone() 35 | { 36 | return new FactionSystemInfoDB(this); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Factions/FactionTechDB.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | using Pulsar4X.Engine; 4 | using Pulsar4X.Datablobs; 5 | using Pulsar4X.Technology; 6 | 7 | namespace Pulsar4X.Factions 8 | { 9 | public class FactionTechDB : BaseDataBlob 10 | { 11 | [PublicAPI] 12 | [JsonProperty] 13 | public int ResearchPoints { get; internal set; } 14 | 15 | public List<(Scientist scientist, Entity atEntity)> AllScientists { get; internal set; } = new List<(Scientist, Entity)>(); 16 | 17 | public FactionTechDB() { } 18 | 19 | public FactionTechDB(FactionTechDB techDB) 20 | { 21 | ResearchPoints = techDB.ResearchPoints; 22 | AllScientists = techDB.AllScientists; 23 | } 24 | 25 | public override object Clone() 26 | { 27 | return new FactionTechDB(this); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Fleets/FleetDB.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Pulsar4X.Datablobs; 3 | using Pulsar4X.DataStructures; 4 | using Pulsar4X.Engine.Orders; 5 | 6 | namespace Pulsar4X.Fleets 7 | { 8 | public class FleetDB : TreeHierarchyDB 9 | { 10 | [JsonProperty] 11 | public int FlagShipID { get; internal set; } = -1; 12 | 13 | [JsonProperty] 14 | public bool InheritOrders { get; internal set; } = true; 15 | 16 | [JsonProperty] 17 | public SafeList StandingOrders { get; internal set; } = new (); 18 | 19 | public FleetDB() : base(null) {} 20 | 21 | public override object Clone() 22 | { 23 | return new FleetDB(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Fleets/FleetFactory.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Collections.Generic; 4 | using Pulsar4X.Datablobs; 5 | using Pulsar4X.Engine; 6 | using Pulsar4X.Names; 7 | 8 | namespace Pulsar4X.Fleets 9 | { 10 | public static class FleetFactory 11 | { 12 | public static Entity Create(EntityManager? manager, int factionID, string name) 13 | { 14 | if(manager == null) throw new ArgumentNullException("manager cannot be null"); 15 | 16 | var dataBlobs = new List(); 17 | var nameDB = new NameDB(name, factionID, name); 18 | dataBlobs.Add(nameDB); 19 | 20 | var fleetDB = new FleetDB(); 21 | dataBlobs.Add(fleetDB); 22 | 23 | var orderableDB = new OrderableDB(); 24 | dataBlobs.Add(orderableDB); 25 | 26 | var entity = Entity.Create(); 27 | entity.FactionOwnerID = factionID; 28 | manager.AddEntity(entity, dataBlobs); 29 | 30 | return entity; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Fleets/ServeyAnomalyAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Pulsar4X.Engine; 3 | using Pulsar4X.Engine.Orders; 4 | 5 | namespace Pulsar4X.Fleets; 6 | 7 | public class ServeyAnomalyAction : EntityCommand 8 | { 9 | public override ActionLaneTypes ActionLanes { get; } 10 | public override bool IsBlocking { get; } 11 | public override string Name { get; } 12 | public override string Details { get; } 13 | internal override Entity EntityCommanding { get; } 14 | internal override bool IsValidCommand(Game game) 15 | { 16 | throw new NotImplementedException(); 17 | } 18 | 19 | internal override void Execute(DateTime atDateTime) 20 | { 21 | throw new NotImplementedException(); 22 | } 23 | 24 | internal override bool IsFinished() 25 | { 26 | return _isFinished; 27 | } 28 | 29 | public override EntityCommand Clone() 30 | { 31 | throw new NotImplementedException(); 32 | } 33 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Galaxy/GalaxyFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Pulsar4X.Blueprints; 4 | 5 | namespace Pulsar4X.Galaxy 6 | { 7 | public class GalaxyFactory 8 | { 9 | 10 | public SystemGenSettingsBlueprint Settings; 11 | 12 | public Dictionary SystemIndexes; 13 | 14 | internal readonly StarSystemFactory StarSystemFactory; 15 | 16 | public GalaxyFactory(SystemGenSettingsBlueprint settings) 17 | { 18 | Settings = settings; 19 | 20 | 21 | StarSystemFactory = new StarSystemFactory(this); 22 | } 23 | 24 | private GalaxyFactory() 25 | { } 26 | } 27 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Galaxy/MassVolumeProcessor.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Engine; 2 | using Pulsar4X.Storage; 3 | 4 | namespace Pulsar4X.Galaxy; 5 | 6 | public class MassVolumeProcessor 7 | { 8 | public static double CalculateDryMass(double volume, double density) 9 | { 10 | return density * volume; 11 | } 12 | 13 | /// 14 | /// Calculates the volume given mass and density. 15 | /// 16 | /// Mass in Kg 17 | /// Density in Kg/cm^3 18 | /// Volume_km3 in Km^3 19 | public static double CalculateVolume_Km3_FromMassAndDesity(double mass, double density) 20 | { 21 | double volumeInCm3 = mass / density; 22 | 23 | // now return after converting to Km^3 24 | return volumeInCm3 * 1.0e-15; 25 | } 26 | 27 | 28 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Galaxy/VisibleByDefaultDB.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Datablobs; 2 | 3 | namespace Pulsar4X.Galaxy; 4 | 5 | public class VisibleByDefaultDB : BaseDataBlob { } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/GameEngine.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Pulsar4XDevs 5 | Pulsar4X 6 | GameEngine 7 | 1.0.0 8 | GameEngine 9 | enable 10 | net8.0 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 0414;0649;0169;8601,8602,8618,8714 23 | 24 | 25 | 26 | PreserveNewest 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/GeoSurveys/GeoSurveyAbilityDB.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Pulsar4X.Datablobs; 3 | 4 | namespace Pulsar4X.GeoSurveys; 5 | 6 | public class GeoSurveyAbilityDB : BaseDataBlob 7 | { 8 | [JsonProperty] 9 | public uint Speed { get; set; } 10 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/GeoSurveys/GeoSurveyAtb.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Pulsar4X.Components; 3 | using Pulsar4X.Engine; 4 | using Pulsar4X.Interfaces; 5 | 6 | namespace Pulsar4X.GeoSurveys; 7 | 8 | public class GeoSurveyAtb : IComponentDesignAttribute 9 | { 10 | [JsonProperty] 11 | public uint Speed { get; set; } = 1; 12 | 13 | public GeoSurveyAtb(int speed) 14 | { 15 | Speed = (uint)speed; 16 | } 17 | 18 | public void OnComponentInstallation(Entity parentEntity, ComponentInstance componentInstance) 19 | { 20 | if(parentEntity.TryGetDatablob(out var geoSurveyAbilityDB)) 21 | { 22 | geoSurveyAbilityDB.Speed += Speed; 23 | } 24 | else 25 | { 26 | parentEntity.SetDataBlob(new GeoSurveyAbilityDB() { Speed = Speed }); 27 | } 28 | } 29 | 30 | public void OnComponentUninstallation(Entity parentEntity, ComponentInstance componentInstance) 31 | { 32 | if(parentEntity.TryGetDatablob(out var geoSurveyAbilityDB)) 33 | { 34 | if(Speed >= geoSurveyAbilityDB.Speed) 35 | { 36 | parentEntity.RemoveDataBlob(); 37 | } 38 | else 39 | { 40 | geoSurveyAbilityDB.Speed -= Speed; 41 | } 42 | } 43 | } 44 | 45 | public string AtbName() 46 | { 47 | return "Geological Surveyor"; 48 | } 49 | 50 | public string AtbDescription() 51 | { 52 | return $"Speed {Speed}"; 53 | } 54 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/GeoSurveys/GeoSurveyableDB.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Pulsar4X.Datablobs; 3 | using Pulsar4X.DataStructures; 4 | 5 | namespace Pulsar4X.GeoSurveys; 6 | 7 | public class GeoSurveyableDB : BaseDataBlob 8 | { 9 | [JsonProperty] 10 | public uint PointsRequired { get; set; } 11 | 12 | /// 13 | /// Stores the status of the geosurveys that have been conducted by each faction 14 | /// Key: faction id 15 | /// Value: the points remaining to complete the survey 16 | /// 17 | [JsonProperty] 18 | public SafeDictionary GeoSurveyStatus { get; set; } = new (); 19 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/GeoSurveys/GeoSurveyableDBExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.GeoSurveys; 2 | 3 | public static class GeoSurveyableDBExtensions 4 | { 5 | public static bool IsSurveyComplete(this GeoSurveyableDB geoSurveyableDB, int factionId) 6 | { 7 | return geoSurveyableDB.GeoSurveyStatus.ContainsKey(factionId) 8 | && geoSurveyableDB.GeoSurveyStatus[factionId] == 0; 9 | } 10 | 11 | public static bool HasSurveyStarted(this GeoSurveyableDB geoSurveyableDB, int factionId) 12 | { 13 | return geoSurveyableDB.GeoSurveyStatus.ContainsKey(factionId); 14 | } 15 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Industry/IndustryProcessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Pulsar4X.Interfaces; 3 | using Pulsar4X.Engine; 4 | 5 | namespace Pulsar4X.Industry 6 | { 7 | public class IndustryProcessor : IHotloopProcessor 8 | { 9 | public TimeSpan RunFrequency 10 | { 11 | get { return TimeSpan.FromDays(1); } 12 | } 13 | 14 | public TimeSpan FirstRunOffset => TimeSpan.FromHours(3); 15 | 16 | public Type GetParameterType => typeof(IndustryAbilityDB); 17 | 18 | public void Init(Game game) 19 | { 20 | //unneeded. 21 | } 22 | 23 | public void ProcessEntity(Entity entity, int deltaSeconds) 24 | { 25 | IndustryTools.ConstructStuff(entity); 26 | } 27 | 28 | public int ProcessManager(EntityManager manager, int deltaSeconds) 29 | { 30 | var entities = manager.GetAllEntitiesWithDataBlob(); 31 | foreach (var entity in entities) 32 | { 33 | ProcessEntity(entity, deltaSeconds); 34 | } 35 | 36 | return entities.Count; 37 | 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Industry/JobBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Pulsar4X.Industry 5 | { 6 | public abstract class JobBase 7 | { 8 | public virtual string Name { get; internal set; } 9 | public string JobID = Guid.NewGuid().ToString(); 10 | public string ItemGuid { get; protected set; } 11 | public ushort NumberOrdered { get; set; } 12 | public ushort NumberCompleted { get; internal set; } 13 | 14 | /// 15 | /// for single item under construction. 16 | /// 17 | public long ProductionPointsLeft 18 | { 19 | get; 20 | internal set; 21 | } 22 | 23 | /// 24 | /// Per Item 25 | /// 26 | public long ProductionPointsCost { get; protected set; } 27 | public bool Auto { get; internal set; } 28 | 29 | public Dictionary ResourcesRequiredRemaining { get; internal set; } = new (); 30 | public Dictionary ResourcesCosts { get; internal set; } = new (); 31 | 32 | public JobBase() 33 | { 34 | } 35 | 36 | public JobBase(string guid, ushort numberOrderd, int jobPoints, bool auto) 37 | { 38 | ItemGuid = guid; 39 | NumberOrdered = numberOrderd; 40 | NumberCompleted = 0; 41 | ProductionPointsLeft = jobPoints; 42 | ProductionPointsCost = jobPoints; 43 | Auto = auto; 44 | } 45 | 46 | public abstract void InitialiseJob(ushort numberOrderd, bool auto); 47 | 48 | } 49 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Industry/Mineral.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Blueprints; 2 | using Pulsar4X.Engine; 3 | using Pulsar4X.Storage; 4 | 5 | namespace Pulsar4X.Industry 6 | { 7 | public class Mineral : MineralBlueprint, ICargoable 8 | { 9 | public int ID { get; private set; } = Game.GetEntityID(); 10 | 11 | public Mineral() {} 12 | 13 | public Mineral(MineralBlueprint blueprint) 14 | { 15 | FullIdentifier = blueprint.FullIdentifier; 16 | UniqueID = blueprint.UniqueID; 17 | Name = blueprint.Name; 18 | Description = blueprint.Description; 19 | CargoTypeID = blueprint.CargoTypeID; 20 | MassPerUnit = blueprint.MassPerUnit; 21 | VolumePerUnit = blueprint.VolumePerUnit; 22 | Abundance = blueprint.Abundance; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Industry/MineralsDB.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Newtonsoft.Json; 4 | using Pulsar4X.Datablobs; 5 | using Pulsar4X.Engine; 6 | 7 | namespace Pulsar4X.Industry 8 | { 9 | public class MineralDeposit 10 | { 11 | [JsonProperty] 12 | public long Amount { get; internal set; } 13 | [JsonProperty] 14 | public long HalfOriginalAmount { get; internal set; } 15 | [JsonProperty] 16 | public double Accessibility { get; internal set; } 17 | } 18 | 19 | public class MineralsDB : BaseDataBlob 20 | { 21 | [PublicAPI] 22 | [JsonProperty] 23 | public Dictionary Minerals { get; internal set; } 24 | 25 | public MineralsDB() 26 | { 27 | Minerals = new(); 28 | } 29 | 30 | public MineralsDB(MineralsDB other) 31 | { 32 | Minerals = new Dictionary(other.Minerals); 33 | } 34 | 35 | public override object Clone() 36 | { 37 | return new MineralsDB(this); 38 | } 39 | 40 | public new static List GetDependencies() => new List(); 41 | } 42 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Industry/MiningHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Pulsar4X.Engine; 5 | using Pulsar4X.DataStructures; 6 | using Pulsar4X.Colonies; 7 | 8 | namespace Pulsar4X.Industry 9 | { 10 | public static class MiningHelper 11 | { 12 | public static Dictionary CalculateActualMiningRates(Entity colonyEntity) 13 | { 14 | var mineRates = colonyEntity.GetDataBlob().BaseMiningRate.ToDictionary(k => k.Key, v => v.Value); 15 | var planetMinerals = colonyEntity.GetDataBlob().PlanetEntity.GetDataBlob().Minerals; 16 | float miningBonuses = colonyEntity.HasDataBlob() ? colonyEntity.GetDataBlob().GetBonus(AbilityType.Mine) : 1.0f; 17 | 18 | foreach (var key in mineRates.Keys.ToArray()) 19 | { 20 | long baseRateFromMiningInstallations = mineRates[key]; 21 | double accessibility = planetMinerals.ContainsKey(key) ? planetMinerals[key].Accessibility : 0; 22 | double actualRate = baseRateFromMiningInstallations * miningBonuses * accessibility; 23 | mineRates[key] = Convert.ToInt64(actualRate); 24 | } 25 | 26 | return mineRates; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/JumpPoints/GravSurveyAtb.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Pulsar4X.Components; 3 | using Pulsar4X.Datablobs; 4 | using Pulsar4X.Engine; 5 | using Pulsar4X.Interfaces; 6 | 7 | namespace Pulsar4X.JumpPoints; 8 | 9 | public class GravSurveyAtb : IComponentDesignAttribute 10 | { 11 | [JsonProperty] 12 | public uint Speed { get; set; } = 1; 13 | 14 | public GravSurveyAtb(int speed) 15 | { 16 | Speed = (uint)speed; 17 | } 18 | 19 | public void OnComponentInstallation(Entity parentEntity, ComponentInstance componentInstance) 20 | { 21 | if(parentEntity.TryGetDatablob(out var gravSurveyAbilityDB)) 22 | { 23 | gravSurveyAbilityDB.Speed += Speed; 24 | } 25 | else 26 | { 27 | parentEntity.SetDataBlob(new JPSurveyAbilityDB() { Speed = Speed }); 28 | } 29 | } 30 | 31 | public void OnComponentUninstallation(Entity parentEntity, ComponentInstance componentInstance) 32 | { 33 | if(parentEntity.TryGetDatablob(out var gravSurveyAbilityDB)) 34 | { 35 | if(Speed >= gravSurveyAbilityDB.Speed) 36 | { 37 | parentEntity.RemoveDataBlob(); 38 | } 39 | else 40 | { 41 | gravSurveyAbilityDB.Speed -= Speed; 42 | } 43 | } 44 | } 45 | 46 | public string AtbName() 47 | { 48 | return "Gravitational Surveyor"; 49 | } 50 | 51 | public string AtbDescription() 52 | { 53 | return $"Speed {Speed}"; 54 | } 55 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/JumpPoints/JPSurveyAbililtyDB.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Pulsar4X.Datablobs; 3 | 4 | namespace Pulsar4X.JumpPoints; 5 | 6 | public class JPSurveyAbilityDB : BaseDataBlob 7 | { 8 | [JsonProperty] 9 | public uint Speed { get; set; } 10 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/JumpPoints/JPSurveyDB.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Datablobs; 2 | 3 | namespace Pulsar4X.JumpPoints; 4 | 5 | public class JPSurveyDB : BaseDataBlob 6 | { 7 | // The entity Id this entity is attempting to survey 8 | public int TargetId { get; set; } 9 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/JumpPoints/JPSurveyableDBExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.JumpPoints; 2 | 3 | public static class JPSurveyableDBExtensions 4 | { 5 | public static bool IsSurveyComplete(this JPSurveyableDB geoSurveyableDB, int factionId) 6 | { 7 | return geoSurveyableDB.SurveyPointsRemaining.ContainsKey(factionId) 8 | && geoSurveyableDB.SurveyPointsRemaining[factionId] == 0; 9 | } 10 | 11 | public static bool HasSurveyStarted(this JPSurveyableDB geoSurveyableDB, int factionId) 12 | { 13 | return geoSurveyableDB.SurveyPointsRemaining.ContainsKey(factionId); 14 | } 15 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/JumpPoints/JumpPointDB.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json; 3 | using Pulsar4X.Datablobs; 4 | using Pulsar4X.Engine; 5 | 6 | namespace Pulsar4X.JumpPoints 7 | { 8 | /// 9 | /// JumpPointDB defines a jump point 10 | /// 11 | public class JumpPointDB : BaseDataBlob 12 | { 13 | /// 14 | /// The Id of the entity that this jump point goes to 15 | /// 16 | [JsonProperty] 17 | public int DestinationId { get; internal set; } 18 | 19 | /// 20 | /// Determination if this jump point has a "gate" on it. 21 | /// 22 | /// 23 | /// TODO: Gameplay Review 24 | /// We might want to use a TransitType enum, to allow different types of FTL using the same type of DB 25 | /// 26 | [JsonProperty] 27 | public bool IsStabilized { get; internal set; } 28 | 29 | [JsonProperty] 30 | public HashSet IsDiscovered { get; internal set; } = new HashSet(); 31 | 32 | public JumpPointDB() { } 33 | 34 | public JumpPointDB(int destinationId, bool isStabilized = false) 35 | { 36 | DestinationId = destinationId; 37 | IsStabilized = isStabilized; 38 | } 39 | 40 | public JumpPointDB(Entity destination, bool isStabilized = false) 41 | : this(destination.Id, isStabilized) 42 | { 43 | } 44 | 45 | public override object Clone() 46 | { 47 | return new JumpPointDB(DestinationId, IsStabilized); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Movement/InterSystemJumpProcessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Pulsar4X.DataStructures; 3 | using Pulsar4X.Engine; 4 | 5 | namespace Pulsar4X.Movement 6 | { 7 | public static class InterSystemJumpProcessor 8 | { 9 | //TODO look at turning the entity into a ProtoEntity instead of shifting it to the GlobalManager 10 | internal static void JumpOut(Game game, SystemEntityJumpPair jumpPair) 11 | { 12 | game.GlobalManager.Transfer(jumpPair.JumpingEntity); 13 | } 14 | internal static void JumpIn(Game game, SystemEntityJumpPair jumpPair) 15 | { 16 | jumpPair.JumpSystem.Transfer(jumpPair.JumpingEntity); 17 | } 18 | 19 | public static void SetJump(Game game, DateTime exitTime, StarSystem entrySystem, DateTime entryTime, Entity jumpingEntity) 20 | { 21 | SystemEntityJumpPair jumpPair = new SystemEntityJumpPair 22 | { 23 | JumpSystem = entrySystem, 24 | JumpingEntity = jumpingEntity 25 | }; 26 | game.TimePulse.AddSystemInteractionInterupt(exitTime, PulseActionEnum.JumpOutProcessor, jumpPair); 27 | 28 | game.TimePulse.AddSystemInteractionInterupt(entryTime, PulseActionEnum.JumpInProcessor, jumpPair); 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Movement/MoveToNearestAnomalyAction.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Engine; 2 | using Pulsar4X.JumpPoints; 3 | 4 | namespace Pulsar4X.Movement 5 | { 6 | public class MoveToNearestAnomalyAction : MoveToNearestAction 7 | { 8 | public override string Name => "Anomaly Survey Nearest"; 9 | public override string Details => "Moves the fleet to the nearest Grav Anomaly that can be surveyed."; 10 | private bool GravSurveyFilter(Entity entity) 11 | { 12 | return entity.HasDataBlob() 13 | && !entity.GetDataBlob().IsSurveyComplete(RequestingFactionGuid); 14 | } 15 | 16 | public static MoveToNearestAnomalyAction CreateCommand(int factionId, Entity commandingEntity) 17 | { 18 | var command = new MoveToNearestAnomalyAction() 19 | { 20 | _entityCommanding = commandingEntity, 21 | UseActionLanes = true, 22 | RequestingFactionGuid = factionId, 23 | EntityCommandingGuid = commandingEntity.Id, 24 | EntityFactionFilter = DataStructures.EntityFilter.Neutral 25 | }; 26 | command.Filter = command.GravSurveyFilter; 27 | return command; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Movement/MoveToNearestColonyAction.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Colonies; 2 | using Pulsar4X.Engine; 3 | 4 | namespace Pulsar4X.Movement 5 | { 6 | public class MoveToNearestColonyAction : MoveToNearestAction 7 | { 8 | public override string Name => "Move to Nearest Colony"; 9 | public override string Details => "Moves the fleet to the nearest colony."; 10 | private static bool ColonyFilter(Entity entity) 11 | { 12 | return entity.HasDataBlob(); 13 | } 14 | 15 | private static Entity ColonySelector(Entity entity) 16 | { 17 | return entity.GetDataBlob().Parent ?? entity; 18 | } 19 | 20 | public static MoveToNearestColonyAction CreateCommand(int factionId, Entity commandingEntity) 21 | { 22 | var command = MoveToNearestAction.CreateCommand(factionId, commandingEntity); 23 | command.Filter = ColonyFilter; 24 | command.TargetSelector = ColonySelector; 25 | return command; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Movement/MoveToNearestGeoSurveyAction.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Engine; 2 | using Pulsar4X.GeoSurveys; 3 | 4 | namespace Pulsar4X.Movement 5 | { 6 | public class MoveToNearestGeoSurveyAction : MoveToNearestAction 7 | { 8 | public override string Name => "Geo Survey Nearest"; 9 | public override string Details => "Moves the fleet to the nearest system body that can be geo surveyed."; 10 | private bool GeoSurveyFilter(Entity entity) 11 | { 12 | return entity.HasDataBlob() 13 | && !entity.GetDataBlob().IsSurveyComplete(RequestingFactionGuid); 14 | } 15 | 16 | public static MoveToNearestGeoSurveyAction CreateCommand(int factionId, Entity commandingEntity) 17 | { 18 | var command = new MoveToNearestGeoSurveyAction() 19 | { 20 | _entityCommanding = commandingEntity, 21 | UseActionLanes = true, 22 | RequestingFactionGuid = factionId, 23 | EntityCommandingGuid = commandingEntity.Id, 24 | EntityFactionFilter = DataStructures.EntityFilter.Friendly | DataStructures.EntityFilter.Neutral 25 | }; 26 | command.Filter = command.GeoSurveyFilter; 27 | return command; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Movement/NewtonMove/NewtonSimpleMoveDB.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | using Pulsar4X.Datablobs; 4 | using Pulsar4X.Engine; 5 | using Pulsar4X.Galaxy; 6 | using Pulsar4X.Orbital; 7 | 8 | namespace Pulsar4X.Movement 9 | { 10 | public class NewtonSimpleMoveDB : BaseDataBlob 11 | { 12 | [JsonProperty] 13 | internal DateTime LastProcessDateTime = new DateTime(); 14 | [JsonProperty] 15 | public DateTime ActionOnDateTime { get; internal set; } 16 | [JsonProperty] 17 | public KeplerElements CurrentTrajectory { get; internal set; } 18 | [JsonProperty] 19 | public KeplerElements TargetTrajectory { get; internal set; } 20 | [JsonProperty] 21 | 22 | public bool IsComplete = false; 23 | [JsonProperty] 24 | public Entity SOIParent { get; internal set; } 25 | [JsonProperty] 26 | public double ParentMass { get; internal set; } 27 | 28 | [JsonConstructor] 29 | private NewtonSimpleMoveDB() { } 30 | 31 | public NewtonSimpleMoveDB(Entity soiParent, KeplerElements start, KeplerElements end, DateTime onDateTime) 32 | { 33 | LastProcessDateTime = onDateTime; 34 | ActionOnDateTime = onDateTime; 35 | CurrentTrajectory = start; 36 | TargetTrajectory = end; 37 | SOIParent = soiParent; 38 | ParentMass = SOIParent.GetDataBlob().MassTotal; 39 | } 40 | 41 | public override object Clone() 42 | { 43 | throw new NotImplementedException(); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Movement/Pathfinding/EdgeToNeighbor.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.Movement 2 | { 3 | /// 4 | /// EdgeToNeighbor represents an edge eminating from one Node to its neighbor. The EdgeToNeighbor 5 | /// class, then, contains a reference to the neighbor and the weight of the edge. 6 | /// 7 | public class EdgeToNeighbor 8 | { 9 | /// 10 | /// The neighbor the edge is leading to. 11 | /// 12 | public Node Neighbor { get; } 13 | 14 | /// 15 | /// The weight of the edge. 16 | /// 17 | /// 18 | /// A value of 0 would indicate that there is no weight, and is the value used when an unweighted 19 | /// edge is added via the Graph class. 20 | /// 21 | public double Cost { get; } 22 | 23 | public EdgeToNeighbor(Node neighbor) : this (neighbor, 0) { } 24 | 25 | public EdgeToNeighbor(Node neighbor, double cost) 26 | { 27 | Neighbor = neighbor; 28 | Cost = cost; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Names/NameFactory.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Blueprints; 2 | using Pulsar4X.Engine; 3 | 4 | namespace Pulsar4X.Names 5 | { 6 | public class NameFactory 7 | { 8 | public static string GetShipName(Game game) 9 | { 10 | var theme = GetTheme(game); 11 | return theme.ShipNames[game.RNG.Next(0, theme.ShipNames.Count)]; 12 | } 13 | 14 | public static string GetFleetName(Game game) 15 | { 16 | var theme = GetTheme(game); 17 | return theme.FleetNames[game.RNG.Next(0, theme.FleetNames.Count)]; 18 | } 19 | 20 | public static string GetCommanderName(Game game) 21 | { 22 | var theme = GetTheme(game); 23 | var rng = game.RNG; 24 | var name = theme.FirstNames[rng.Next(0, theme.FirstNames.Count)] + " " + theme.LastNames[rng.Next(0, theme.LastNames.Count)]; 25 | return name; 26 | } 27 | 28 | private static ThemeBlueprint GetTheme(Game game) 29 | { 30 | return game.Themes[game.Settings.CurrentTheme]; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/People/NavalAcademyDB.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Pulsar4X.Datablobs; 3 | using Pulsar4X.DataStructures; 4 | 5 | namespace Pulsar4X.People 6 | { 7 | public struct NavalAcademy 8 | { 9 | public int ClassSize; 10 | public DateTime GraduationDate; 11 | public int TrainingPeriodInMonths; 12 | } 13 | 14 | public class NavalAcademyDB : BaseDataBlob 15 | { 16 | public SafeList Academies = new SafeList(); 17 | 18 | public NavalAcademyDB() { } 19 | public NavalAcademyDB(int classSize, DateTime graduationDate, int trainingPeriod) 20 | { 21 | Academies.Add(new NavalAcademy(){ 22 | ClassSize = classSize, 23 | GraduationDate = graduationDate, 24 | TrainingPeriodInMonths = trainingPeriod 25 | }); 26 | } 27 | 28 | public NavalAcademyDB(NavalAcademyDB db) 29 | { 30 | Academies = new SafeList(db.Academies); 31 | } 32 | 33 | public override object Clone() 34 | { 35 | return new NavalAcademyDB(this); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/People/TeamsHousedDB.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json; 3 | using Pulsar4X.Datablobs; 4 | using Pulsar4X.DataStructures; 5 | using Pulsar4X.Technology; 6 | 7 | namespace Pulsar4X.People 8 | { 9 | public class TeamsHousedDB : BaseDataBlob 10 | { 11 | [JsonProperty] 12 | public Dictionary> TeamsByType = new Dictionary>(); 13 | 14 | 15 | [JsonConstructor] 16 | internal TeamsHousedDB() 17 | { 18 | } 19 | 20 | internal TeamsHousedDB(TeamsHousedDB db) 21 | { 22 | TeamsByType = new Dictionary>(db.TeamsByType); 23 | } 24 | 25 | public void AddTeam(TeamObject team) 26 | { 27 | if (!TeamsByType.ContainsKey(team.TeamType)) 28 | { 29 | TeamsByType.Add(team.TeamType, new List()); 30 | } 31 | TeamsByType[team.TeamType].Add(team); 32 | } 33 | 34 | public void RemoveTeam(TeamObject team) 35 | { 36 | TeamsByType[team.TeamType].Remove(team); 37 | } 38 | 39 | public override object Clone() 40 | { 41 | return new TeamsHousedDB(this); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Sensors/ISensorCloneMethod.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Datablobs; 2 | 3 | namespace Pulsar4X.Sensors 4 | { 5 | public interface ISensorCloneMethod 6 | { 7 | BaseDataBlob SensorClone(SensorInfoDB sensorInfo); 8 | void SensorUpdate(SensorInfoDB sensorInfo); 9 | } 10 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Sensors/SensorAbilityDB.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Pulsar4X.Datablobs; 4 | using Pulsar4X.Engine.Sensors; 5 | 6 | namespace Pulsar4X.Sensors 7 | { 8 | public class SensorAbilityDB : BaseDataBlob 9 | { 10 | public new static List GetDependencies() => new List() { typeof(ComponentInstancesDB) }; 11 | 12 | internal Dictionary CurrentContacts = new (); 13 | internal Dictionary OldContacts = new (); 14 | 15 | public SensorAbilityDB() 16 | { 17 | } 18 | 19 | public SensorAbilityDB(SensorAbilityDB db) 20 | { 21 | CurrentContacts = new Dictionary(db.CurrentContacts); 22 | OldContacts = new Dictionary(db.OldContacts); 23 | } 24 | 25 | public override object Clone() 26 | { 27 | return new SensorAbilityDB(this); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Sensors/SensorReceiverAbility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Newtonsoft.Json; 4 | using Pulsar4X.Components; 5 | 6 | namespace Pulsar4X.Sensors 7 | { 8 | public class SensorReceiverAbility : ComponentAbilityState 9 | { 10 | [JsonProperty] 11 | public Dictionary CurrentContacts = new (); 12 | [JsonProperty] 13 | public Dictionary OldContacts = new (); 14 | [JsonConstructor] 15 | private SensorReceiverAbility(){} 16 | public SensorReceiverAbility(ComponentInstance componentInstance) : base(componentInstance) 17 | { 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Sensors/SensorReflectionProcessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Pulsar4X.Engine; 3 | using Pulsar4X.Interfaces; 4 | using Pulsar4X.Movement; 5 | 6 | namespace Pulsar4X.Sensors; 7 | 8 | public class SensorReflectionProcessor : IHotloopProcessor 9 | { 10 | public TimeSpan RunFrequency => TimeSpan.FromHours(1); 11 | 12 | public TimeSpan FirstRunOffset => TimeSpan.FromMinutes(30); 13 | 14 | public Type GetParameterType => typeof(SensorProfileDB); 15 | 16 | public void Init(Game game) 17 | { 18 | } 19 | 20 | public void ProcessEntity(Entity entity, int deltaSeconds) 21 | { 22 | if(!entity.TryGetDatablob(out var detectablePosDB)) 23 | { 24 | return; 25 | } 26 | 27 | entity.GetDataBlob().SetReflectionProfile(entity.StarSysDateTime); 28 | } 29 | 30 | public int ProcessManager(EntityManager manager, int deltaSeconds) 31 | { 32 | var entities = manager.GetAllEntitiesWithDataBlob(); 33 | foreach(var entity in entities) 34 | { 35 | ProcessEntity(entity, deltaSeconds); 36 | } 37 | 38 | return entities.Count; 39 | } 40 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Sensors/SensorReturnValues.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.DataStructures; 2 | 3 | namespace Pulsar4X.Sensors 4 | { 5 | public struct SensorReturnValues 6 | { 7 | public double SignalStrength_kW; 8 | public PercentValue SignalQuality; 9 | } 10 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Storage/ICargoable.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.Storage 2 | { 3 | public interface ICargoable 4 | { 5 | int ID { get; } 6 | string UniqueID { get; } 7 | string CargoTypeID { get; } 8 | string Name { get; } 9 | long MassPerUnit { get; } 10 | double VolumePerUnit { get; } 11 | } 12 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Storage/TransferEntityFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Pulsar4X.Datablobs; 4 | using Pulsar4X.Engine; 5 | using Pulsar4X.Factions; 6 | 7 | namespace Pulsar4X.Storage; 8 | 9 | public static class TransferEntityFactory 10 | { 11 | public static Entity CreateTransferEntity(EntityManager globalManager, int factionID, CargoTransferDataDB trasferDataDB) 12 | { 13 | List dblist = new(); 14 | dblist.Add(trasferDataDB); 15 | var protoEntity = new ProtoEntity(dblist); 16 | Entity entity = globalManager.CreateAndAddEntity(protoEntity); 17 | entity.FactionOwnerID = factionID; 18 | return entity; 19 | } 20 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Tech/EntityResearchDB.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Pulsar4X.Components; 3 | using Pulsar4X.Datablobs; 4 | 5 | namespace Pulsar4X.Technology 6 | { 7 | public class EntityResearchDB : BaseDataBlob, IAbilityDescription 8 | { 9 | public Dictionary Labs = new Dictionary(); 10 | public EntityResearchDB() 11 | { 12 | } 13 | 14 | public EntityResearchDB(EntityResearchDB db) 15 | { 16 | 17 | } 18 | 19 | public override object Clone() 20 | { 21 | return new EntityResearchDB(this); 22 | } 23 | 24 | public string AbilityName() 25 | { 26 | return "Research Point Production"; 27 | } 28 | 29 | public string AbilityDescription() 30 | { 31 | int labcount = Labs.Count; 32 | int total = 0; 33 | string desc = ""; 34 | foreach (var line in Labs) 35 | { 36 | total += line.Value; 37 | string labname = line.Key.Name; 38 | desc += labname + "\t" + line.Value + "\n"; 39 | } 40 | 41 | desc += labcount.ToString() + " Labs, generating a total of " + total.ToString() + " Research Points"; 42 | return desc; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Weapons/IFireWeaponInstr.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Engine; 2 | using System.Diagnostics.CodeAnalysis; 3 | 4 | namespace Pulsar4X.Weapons 5 | { 6 | public interface IFireWeaponInstr 7 | { 8 | public string WeaponType { get; } 9 | 10 | public void SetWeaponState(WeaponState state); 11 | 12 | public bool CanLoadOrdnance(OrdnanceDesign ordnanceDesign); 13 | public bool AssignOrdnance(OrdnanceDesign ordnanceDesign); 14 | 15 | public bool TryGetOrdnance([NotNullWhen(true)] out OrdnanceDesign? ordnanceDesign); 16 | public void FireWeapon(Entity launchingEntity, Entity tgtEntity, int count); 17 | 18 | public float ToHitChance(Entity launchingEntity, Entity tgtEntity); 19 | 20 | } 21 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Weapons/OrdnanceDesignFromJson.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using Newtonsoft.Json.Linq; 4 | using Pulsar4X.Components; 5 | using Pulsar4X.Engine; 6 | using Pulsar4X.Factions; 7 | 8 | namespace Pulsar4X.Weapons; 9 | 10 | public static class OrdnanceDesignFromJson 11 | { 12 | public static OrdnanceDesign Create(Entity faction, string filePath) 13 | { 14 | string fileContents = File.ReadAllText(filePath); 15 | var rootJson = JObject.Parse(fileContents); 16 | 17 | var designName = rootJson["name"].ToString(); 18 | var id = rootJson["id"] == null ? null : rootJson["id"].ToString(); 19 | var fuelAmount = (double?)rootJson["fuelAmount"] ?? 0; 20 | 21 | var factionInfoDB = faction.GetDataBlob(); 22 | var ordnanceComponents = new List<(ComponentDesign, int)>(); 23 | 24 | 25 | var components = (JArray?)rootJson["components"]; 26 | if(components != null) 27 | { 28 | foreach(var component in components) 29 | { 30 | var componentId = component["id"].ToString(); 31 | var amount = (int?)component["amount"] ?? 0; 32 | 33 | ordnanceComponents.Add(( 34 | factionInfoDB.InternalComponentDesigns[componentId], 35 | amount 36 | )); 37 | } 38 | } 39 | 40 | return new OrdnanceDesign(factionInfoDB, designName, fuelAmount, ordnanceComponents, id, true); 41 | } 42 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Weapons/WeaponBeam/BeamInfoDB.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Pulsar4X.Datablobs; 3 | using Pulsar4X.Engine; 4 | using Pulsar4X.Movement; 5 | using Pulsar4X.Orbital; 6 | 7 | namespace Pulsar4X.Weapons; 8 | public class BeamInfoDB : BaseDataBlob 9 | { 10 | public enum BeamStates 11 | { 12 | Fired, 13 | AtTarget, 14 | HitTarget, 15 | MissedTarget 16 | }; 17 | 18 | public BeamStates BeamState; 19 | public double Frequency; 20 | public double Energy; 21 | public double StartingEnergy; 22 | public int FiredBy; 23 | public Vector3 VelocityVector; 24 | public (Vector3, Vector3) Positions; 25 | public bool HitsTarget; 26 | public Entity TargetEntity; 27 | public Vector3 LaunchPosition; 28 | private PositionDB _posDB; 29 | public PositionDB PosDB { 30 | get 31 | { 32 | if (_posDB == null) 33 | _posDB = OwningEntity.GetDataBlob(); 34 | return _posDB; 35 | }} 36 | 37 | public BeamInfoDB(int launchedBy, Entity targetEntity, bool hitsTarget, double energy) 38 | { 39 | FiredBy = launchedBy; 40 | TargetEntity = targetEntity; 41 | HitsTarget = hitsTarget; 42 | BeamState = BeamStates.Fired; 43 | Energy = energy; 44 | StartingEnergy = Energy; 45 | } 46 | 47 | public override object Clone() 48 | { 49 | throw new NotImplementedException(); 50 | } 51 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Weapons/WeaponMissile/MissleLauncherAbilityDB.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Datablobs; 2 | using Pulsar4X.Ships; 3 | 4 | namespace Pulsar4X.Weapons; 5 | 6 | public class MissileLaunchersAbilityDB : BaseDataBlob 7 | { 8 | public MissileLauncherAtb[] Launchers; 9 | public ShipDesign[] LoadedMissiles; 10 | 11 | 12 | public override object Clone() 13 | { 14 | throw new System.NotImplementedException(); 15 | } 16 | } -------------------------------------------------------------------------------- /Pulsar4X/GameEngine/Weapons/WeaponMissile/ProjectileInfoDB.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Pulsar4X.Datablobs; 3 | 4 | namespace Pulsar4X.Weapons 5 | { 6 | public class ProjectileInfoDB : BaseDataBlob 7 | { 8 | public int LaunchedBy { get; set; } = -1; 9 | public int Count = 1; 10 | 11 | [JsonConstructor] 12 | private ProjectileInfoDB() 13 | { 14 | } 15 | 16 | public ProjectileInfoDB(int launchedBy, int count) 17 | { 18 | LaunchedBy = launchedBy; 19 | Count = count; 20 | } 21 | 22 | public override object Clone() 23 | { 24 | throw new System.NotImplementedException(); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Extensions/EntityExtensions.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Engine; 2 | using Pulsar4X.Datablobs; 3 | using Pulsar4X.Colonies; 4 | using Pulsar4X.Industry; 5 | using Pulsar4X.Names; 6 | using Pulsar4X.Storage; 7 | 8 | namespace Pulsar4X.SDL2UI 9 | { 10 | public static class EntityExtensions 11 | { 12 | public static bool CanShowMiningTab(this Entity entity) 13 | { 14 | if(!entity.HasDataBlob()) return false; 15 | if(!entity.HasDataBlob()) return false; 16 | if(!entity.GetDataBlob().PlanetEntity.HasDataBlob()) return false; 17 | if(!entity.HasDataBlob()) return false; 18 | 19 | return true; 20 | } 21 | 22 | public static string GetFactionName(this Entity entity) 23 | { 24 | if(entity.FactionOwnerID == Game.NeutralFactionId) 25 | { 26 | return "Neutral"; 27 | } 28 | else if(entity.FactionOwnerID != -1 && entity.Manager != null) 29 | { 30 | var ownerFaction = entity.Manager.Game.Factions[entity.FactionOwnerID]; 31 | return ownerFaction.GetDataBlob().OwnersName; 32 | } 33 | else 34 | { 35 | return entity.FactionOwnerID.ToString(); 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Extensions/ListExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace Pulsar4X.SDL2UI 5 | { 6 | public static class ListExtensions 7 | { 8 | public static void Resize(this List list, int sz, T c) 9 | { 10 | int cur = list.Count; 11 | if(sz < cur) 12 | list.RemoveRange(sz, cur - sz); 13 | else if(sz > cur) 14 | { 15 | if(sz > list.Capacity)//this bit is purely an optimisation, to avoid multiple automatic capacity changes. 16 | list.Capacity = sz; 17 | list.AddRange(Enumerable.Repeat(c, sz - cur)); 18 | } 19 | } 20 | public static void Resize(this List list, int sz) where T : new() 21 | { 22 | Resize(list, sz, new T()); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Extensions/TimeSpanExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Pulsar4X.ImGuiNetUI 4 | { 5 | public static class TimeSpanExtensions 6 | { 7 | private const double DaysInAYear = 365.25; 8 | 9 | public static double ToYears(this TimeSpan timespan) 10 | { 11 | return timespan.TotalDays / DaysInAYear; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Input/IHotKeyHandler.cs: -------------------------------------------------------------------------------- 1 | using SDL2; 2 | 3 | namespace Pulsar4X.Input; 4 | 5 | public interface IHotKeyHandler 6 | { 7 | void HandleEvent(SDL.SDL_Event e); 8 | } 9 | 10 | public abstract class HotKeyFactory 11 | { 12 | public static IHotKeyHandler CreateDefault() => new SystemMapHotKeys(); 13 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Interface/Displays/AtmosphereDBDisplay.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ImGuiNET; 3 | using Pulsar4X.Engine; 4 | using Pulsar4X.Galaxy; 5 | 6 | namespace Pulsar4X.SDL2UI 7 | { 8 | public static class AtmosphereDBDisplay 9 | { 10 | public static void Display(this AtmosphereDB atmosphereDB, EntityState entityState, GlobalUIState uiState) 11 | { 12 | if(ImGui.CollapsingHeader("Atmosphere", ImGuiTreeNodeFlags.DefaultOpen)) 13 | { 14 | ImGui.Columns(2); 15 | DisplayHelpers.PrintRow("Surface Temp", atmosphereDB.SurfaceTemperature.ToString("###,##0.00") + "°C"); 16 | DisplayHelpers.PrintRow("Pressure", atmosphereDB.Pressure + " atm"); 17 | if(atmosphereDB.Hydrosphere) 18 | { 19 | DisplayHelpers.PrintRow("Hydrosphere", atmosphereDB.HydrosphereExtent.ToString() + "%%"); 20 | } 21 | 22 | foreach(var (gas, amount) in atmosphereDB.CompositionByPercent) 23 | { 24 | var blueprint = uiState.Game.AtmosphericGases[gas]; 25 | var amountString = Math.Round(amount, 4) > 0 ? Stringify.Quantity(Math.Round(amount, 4)) + " %%" : "trace amounts"; 26 | DisplayHelpers.PrintRow(blueprint.Name, amountString); 27 | } 28 | } 29 | ImGui.Columns(1); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Interface/Displays/ColonyInfoDBDisplay.cs: -------------------------------------------------------------------------------- 1 | using ImGuiNET; 2 | using Pulsar4X.Engine; 3 | using Pulsar4X.Datablobs; 4 | using Pulsar4X.Extensions; 5 | using Pulsar4X.Colonies; 6 | 7 | namespace Pulsar4X.SDL2UI 8 | { 9 | public static class ColonyInfoDBDisplay 10 | { 11 | public static void Display(this ColonyInfoDB colony, EntityState entityState, GlobalUIState uiState) 12 | { 13 | ImGui.PushID("###Population " + entityState.Id); 14 | ImGui.Columns(1); 15 | if(ImGui.CollapsingHeader("Population", ImGuiTreeNodeFlags.DefaultOpen)) 16 | { 17 | ImGui.Columns(2); 18 | 19 | foreach(var (species, population) in colony.Population) 20 | { 21 | var speciesEntity = uiState.Game.GlobalManager.GetGlobalEntityById(species); 22 | ImGui.PushStyleColor(ImGuiCol.Text, Styles.DescriptiveColor); 23 | ImGui.Text(speciesEntity.GetDefaultName()); 24 | ImGui.PopStyleColor(); 25 | ImGui.NextColumn(); 26 | ImGui.Text(Stringify.Quantity(population, "0.##", true)); 27 | ImGui.NextColumn(); 28 | } 29 | 30 | ImGui.Columns(1); 31 | } 32 | ImGui.PopID(); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Interface/Displays/StarInfoDBDisplay.cs: -------------------------------------------------------------------------------- 1 | using ImGuiNET; 2 | using Pulsar4X.Engine; 3 | using Pulsar4X.Extensions; 4 | using Pulsar4X.Galaxy; 5 | 6 | namespace Pulsar4X.SDL2UI 7 | { 8 | public static class StarInfoDBDisplay 9 | { 10 | public static void Display(this StarInfoDB starInfo, EntityState entityState, GlobalUIState uiState) 11 | { 12 | ImGui.Columns(2); 13 | DisplayHelpers.PrintRow("Spectral Type", starInfo.SpectralType.ToDescription() + starInfo.SpectralSubDivision); 14 | DisplayHelpers.PrintRow("Luminosity", starInfo.Luminosity + " " + starInfo.LuminosityClass.ToString() + " (" + starInfo.LuminosityClass.ToDescription() + ")"); 15 | DisplayHelpers.PrintRow("Class", starInfo.Class); 16 | DisplayHelpers.PrintRow("Age", Stringify.Quantity(starInfo.Age)); 17 | DisplayHelpers.PrintRow("Habitable Zone", starInfo.MinHabitableRadius_AU.ToString("0.##") + "AU - " + starInfo.MaxHabitableRadius_AU.ToString("0.##") + "AU"); 18 | ImGui.Columns(1); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Interface/Menus/SaveGame.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Pulsar4X.Client.Interface.Widgets; 4 | using Pulsar4X.Engine; 5 | using Pulsar4X.SDL2UI; 6 | using Pulsar4X.SDL2UI.ModFileEditing; 7 | 8 | namespace Pulsar4X.Client.Interface.Menus; 9 | 10 | public class SaveGame : PulsarGuiWindow 11 | { 12 | private string _filePath = Path.Combine(PulsarMainWindow.GetAppDataPath(), PulsarMainWindow.SavesPath); 13 | private string _fileName = "savegame.sav"; 14 | 15 | private SaveGame() {} 16 | 17 | internal static SaveGame GetInstance() 18 | { 19 | if (!_uiState.LoadedWindows.ContainsKey(typeof(SaveGame))) 20 | { 21 | return new SaveGame(); 22 | } 23 | return (SaveGame)_uiState.LoadedWindows[typeof(SaveGame)]; 24 | } 25 | 26 | internal override void Display() 27 | { 28 | if (IsActive && FileDialog.DisplaySave(ref _filePath, ref _fileName, ref IsActive)) 29 | { 30 | if (String.IsNullOrEmpty(_fileName) || String.IsNullOrEmpty(_filePath)) 31 | { 32 | IsActive = false; 33 | return; 34 | } 35 | // Update the save git hash 36 | _uiState.Game.LastSaveGitHash = AssemblyInfo.GetGitHash(); 37 | 38 | string gameJson = Game.Save(_uiState.Game); 39 | File.WriteAllText(Path.Combine(_filePath, _fileName), gameJson); 40 | } 41 | } 42 | 43 | public void UpdateSaveName(string name) 44 | { 45 | _fileName = name + ".sav"; 46 | } 47 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Interface/Themes/ITheme.cs: -------------------------------------------------------------------------------- 1 | namespace Pulsar4X.Client.Interface.Themes; 2 | 3 | public interface ITheme 4 | { 5 | public void Apply(); 6 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Interface/Windows/GalaxyWindow.cs: -------------------------------------------------------------------------------- 1 | using ImGuiNET; 2 | using Pulsar4X.Client.Interface.Widgets; 3 | 4 | namespace Pulsar4X.SDL2UI 5 | { 6 | public class GalaxyWindow : PulsarGuiWindow 7 | { 8 | 9 | private GalaxyWindow() 10 | { 11 | 12 | //_flags = ImGuiWindowFlags.NoCollapse; 13 | } 14 | 15 | 16 | 17 | internal static GalaxyWindow GetInstance() 18 | { 19 | 20 | GalaxyWindow thisItem; 21 | if (!_uiState.LoadedWindows.ContainsKey(typeof(GalaxyWindow))) 22 | { 23 | thisItem = new GalaxyWindow(); 24 | } 25 | thisItem = (GalaxyWindow)_uiState.LoadedWindows[typeof(GalaxyWindow)]; 26 | 27 | return thisItem; 28 | 29 | } 30 | 31 | internal override void Display() 32 | { 33 | 34 | //ImGui.SetNextWindowSize(); 35 | if (IsActive && Window.Begin("Galaxy Browser", ref IsActive, _flags)) 36 | { 37 | 38 | uint iterations = 0; 39 | foreach (var starSystem in _uiState.StarSystemStates) 40 | { 41 | ImGui.PushID(iterations.ToString()); 42 | if (ImGui.SmallButton(starSystem.Value.StarSystem.NameDB.DefaultName)) 43 | { 44 | _uiState.SetActiveSystem(starSystem.Key); 45 | } 46 | ImGui.PopID(); 47 | iterations++; 48 | } 49 | Window.End(); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/SDL2-CS.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/SDL2-CS.dll -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/SDL2-CS.dll.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/SDL2-CS.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/SDL2-CS.dll.mdb -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/cimgui/linux-x64/cimgui.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/cimgui/linux-x64/cimgui.so -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/cimgui/linux-x64/libcimgui.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/cimgui/linux-x64/libcimgui.so -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/cimgui/linux-x64/libcimgui.so.old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/cimgui/linux-x64/libcimgui.so.old -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/cimgui/osx-x64/cimgui.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/cimgui/osx-x64/cimgui.dylib -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/cimgui/osx-x64/libcimgui: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/cimgui/osx-x64/libcimgui -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/cimgui/win-x64/cimgui.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/cimgui/win-x64/cimgui.dll -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/cimgui/win-x86/cimgui.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/cimgui/win-x86/cimgui.dll -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/sdl2/linux-x64/libSDL2.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/sdl2/linux-x64/libSDL2.so -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/sdl2/linux-x64/libSDL2_image.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/sdl2/linux-x64/libSDL2_image.so -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/sdl2/linux-x64/libSDL2_mixer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/sdl2/linux-x64/libSDL2_mixer.so -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/sdl2/linux-x64/libSDL2_ttf.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/sdl2/linux-x64/libSDL2_ttf.so -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/sdl2/win-x64/README-SDL.txt: -------------------------------------------------------------------------------- 1 | 2 | Please distribute this file with the SDL runtime environment: 3 | 4 | The Simple DirectMedia Layer (SDL for short) is a cross-platform library 5 | designed to make it easy to write multi-media software, such as games 6 | and emulators. 7 | 8 | The Simple DirectMedia Layer library source code is available from: 9 | https://www.libsdl.org/ 10 | 11 | This library is distributed under the terms of the zlib license: 12 | http://www.zlib.net/zlib_license.html 13 | 14 | -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/sdl2/win-x64/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/sdl2/win-x64/SDL2.dll -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/sdl2/win-x64/SDL2_image.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/sdl2/win-x64/SDL2_image.dll -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/sdl2/win-x86/README-SDL.txt: -------------------------------------------------------------------------------- 1 | 2 | Please distribute this file with the SDL runtime environment: 3 | 4 | The Simple DirectMedia Layer (SDL for short) is a cross-platform library 5 | designed to make it easy to write multi-media software, such as games 6 | and emulators. 7 | 8 | The Simple DirectMedia Layer library source code is available from: 9 | https://www.libsdl.org/ 10 | 11 | This library is distributed under the terms of the zlib license: 12 | http://www.zlib.net/zlib_license.html 13 | 14 | -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Libs/sdl2/win-x86/SDL2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Libs/sdl2/win-x86/SDL2.dll -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/ModFileEditing/DoubleEditWidget.cs: -------------------------------------------------------------------------------- 1 | using ImGuiNET; 2 | 3 | namespace Pulsar4X.SDL2UI.ModFileEditing; 4 | 5 | public static class DoubleEditWidget 6 | { 7 | private static string? _editingID; 8 | 9 | public static bool Display(string label, ref double num, string format = "") 10 | { 11 | bool hasChanged = false; 12 | if(label != _editingID) 13 | { 14 | ImGui.Text(num.ToString()); 15 | if(ImGui.IsItemClicked()) 16 | { 17 | _editingID = label; 18 | } 19 | } 20 | else 21 | { 22 | if (ImGui.InputDouble(label, ref num, 1, 1, format, ImGuiInputTextFlags.EnterReturnsTrue)) 23 | { 24 | _editingID = null; 25 | hasChanged = true; 26 | } 27 | } 28 | 29 | return hasChanged; 30 | } 31 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/ModFileEditing/IntEditWidget.cs: -------------------------------------------------------------------------------- 1 | using ImGuiNET; 2 | 3 | namespace Pulsar4X.SDL2UI.ModFileEditing; 4 | 5 | public static class IntEditWidget 6 | { 7 | private static string? _editingID; 8 | 9 | public static bool Display(string label, ref int num) 10 | { 11 | bool hasChanged = false; 12 | if(label != _editingID) 13 | { 14 | ImGui.Text(num.ToString()); 15 | if(ImGui.IsItemClicked()) 16 | { 17 | _editingID = label; 18 | } 19 | } 20 | else 21 | { 22 | if (ImGui.InputInt(label, ref num, 1, 1, ImGuiInputTextFlags.EnterReturnsTrue)) 23 | { 24 | _editingID = null; 25 | hasChanged = true; 26 | } 27 | } 28 | 29 | return hasChanged; 30 | } 31 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/ModFileEditing/TextEditWidget.cs: -------------------------------------------------------------------------------- 1 | using ImGuiNET; 2 | using ImGuiSDL2CS; 3 | 4 | namespace Pulsar4X.SDL2UI.ModFileEditing; 5 | 6 | public static class TextEditWidget 7 | { 8 | private static uint _buffSize = 128; 9 | private static byte[] _strInputBuffer = new byte[128]; 10 | private static string? _editingID; 11 | 12 | public static uint BufferSize 13 | { 14 | get { return _buffSize ;} 15 | set 16 | { 17 | _buffSize = value; 18 | _strInputBuffer = new byte[value]; 19 | } 20 | } 21 | 22 | public static bool Display(string label, ref string text) 23 | { 24 | bool hasChanged = false; 25 | if(string.IsNullOrEmpty(text)) 26 | text = "null"; 27 | if(label != _editingID) 28 | { 29 | ImGui.Text(text); 30 | if(ImGui.IsItemClicked()) 31 | { 32 | _editingID = label; 33 | _strInputBuffer = ImGuiSDL2CSHelper.BytesFromString(text); 34 | 35 | } 36 | } 37 | else 38 | { 39 | if (ImGui.InputText(label, _strInputBuffer, _buffSize, ImGuiInputTextFlags.EnterReturnsTrue)) 40 | { 41 | text = ImGuiSDL2CSHelper.StringFromBytes(_strInputBuffer); 42 | _editingID = null; 43 | hasChanged = true; 44 | } 45 | } 46 | 47 | return hasChanged; 48 | } 49 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using ImGuiSDL2CS; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Pulsar4X.Client.CrashReports; 7 | 8 | namespace Pulsar4X.SDL2UI 9 | { 10 | public class Program 11 | { 12 | static SDL2Window? Instance; 13 | [STAThread] 14 | public static async Task Main(string[] args) 15 | { 16 | // Webhook URL to the #crash-reports channel 17 | var crashLogger = new DiscordCrashLogger("https://discord.com/api/webhooks/1313608706172125305/pE4jhTyUviwomqfmZcJB-QWayFBwgTVR_o_6SSO_q91c1TI0QKTKNmuBgJl1o0Q7S7Vy"); 18 | 19 | try 20 | { 21 | SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); 22 | Instance = new PulsarMainWindow(); 23 | Instance.Run(); 24 | Instance.Dispose(); 25 | } 26 | catch (Exception e) 27 | { 28 | // Log the crash 29 | await crashLogger.LogCrashAsync(e, $"Git Hash: {AssemblyInfo.GetGitHash()}"); 30 | 31 | // Throw again to allow the local debugger to handle the exception 32 | throw; 33 | } 34 | 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Rendering/IRenderer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ImGuiNET; 3 | 4 | namespace Pulsar4X.Client.Rendering; 5 | 6 | public enum RendererType 7 | { 8 | OpenGL, 9 | // TODO: someone can write these renderers if they desire :D 10 | //Vulkan, 11 | //DirectX 12 | } 13 | 14 | public interface IRenderer : IDisposable 15 | { 16 | void Initialize(IntPtr windowHandle); 17 | void BeginFrame(); 18 | void EndFrame(); 19 | void Clear(float r, float g, float b, float a); 20 | 21 | int CreateDefaultFontTexture(int width, int height, IntPtr pixels); 22 | void RenderImGui(ImDrawDataPtr drawData, int displayWidth, int displayHeight); 23 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Rendering/ManuverNodes/NewtonManuvers.txt: -------------------------------------------------------------------------------- 1 | This file explains how I'm intending to implement newton manuvers. 2 | 3 | We need to describe: 4 | 5 | 6 | A Manuver Node 7 | this describes how much thrust in the prograde & radial directions. 8 | 9 | An Orbit 10 | this describes the orbit the object is on, before, and after the manuver. 11 | This is just kepler elements. 12 | 13 | An Orbit Segment: 14 | this is an orbit arc between two Manuvers, at it's most basic it's two time positions on an Orbit. 15 | However we're going to use this to also hold the ui drawing code. 16 | 17 | 18 | Manuver Sequence: 19 | This is basicaly a ui object, to accomplish manuvers a ship really just needs a flat list of manuvers 20 | and when they should happen. however in the ui multiple manuvers kind of should be grouped together into a tree. 21 | For example: 22 | Get To Luna orbit (from Earth orbit) 23 | |_PhaseChange Manver 24 | |_Manuver 1 25 | |_Manuver 2 26 | |_Homman Manuver 27 | |_Manuver 1 28 | |_Manuver 2 -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Rendering/RendererFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Pulsar4X.Client.Rendering; 4 | 5 | public static class RendererFactory 6 | { 7 | public static IRenderer CreateRenderer(RendererType rendererType) 8 | { 9 | return rendererType switch 10 | { 11 | RendererType.OpenGL => new OpenGLRenderer(), 12 | _ => throw new ArgumentException("Unsupported renderer backend") 13 | }; 14 | } 15 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/ARIALUNI.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/ARIALUNI.TTF -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/CancelIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/CancelIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/CargoIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/CargoIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/Cousine-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/Cousine-Regular.ttf -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/DejaVuMathTeXGyre.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/DejaVuMathTeXGyre.ttf -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/DejaVuSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/DejaVuSans.ttf -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/DesignComponentIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/DesignComponentIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/DesignOrdnanceIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/DesignOrdnanceIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/DesignShipIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/DesignShipIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/DnArrow.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/DnArrow.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/DroidSans.ttf -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/FireconIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/FireconIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/GalaxyMapIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/GalaxyMapIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/ImgTest.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/ImgTest.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/IndustryIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/IndustryIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/OneStep.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/OneStep.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/OneStep.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/OneStep.xcf -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/Pause.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/Pause.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/PinIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/PinIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/Play.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/Play.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/PowerIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/PowerIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/ProggyClean.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/ProggyClean.ttf -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/Pulsar4xSquare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/Pulsar4xSquare.png -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/PulsarLogo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/PulsarLogo.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/PulsarLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/PulsarLogo.png -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/RenameIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/RenameIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/RepeatIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/RepeatIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/ResearchIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/ResearchIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/Roboto-Medium.ttf -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/RulerIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/RulerIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/SelectIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/SelectIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/TreeIco.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/TreeIco.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/UpArrow.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/UpArrow.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/discord-mark-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/discord-mark-white.png -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/pulsar4x-menu.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/pulsar4x-menu.bmp -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/pulsar4x-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/pulsar4x-menu.png -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/Resources/pulsaricon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/Pulsar4X/Pulsar4X.Client/Resources/pulsaricon.ico -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/State/ModsState.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using Newtonsoft.Json; 4 | using Pulsar4X.Modding; 5 | using Pulsar4X.SDL2UI; 6 | 7 | namespace Pulsar4X.Client.State; 8 | 9 | public class ModsState 10 | { 11 | public struct ModMetaData 12 | { 13 | public string Path; 14 | public ModManifest Mod; 15 | } 16 | 17 | public static List AvailableMods { get; private set; } = new (); 18 | public static Dictionary IsModEnabled { get; private set; } = new (); 19 | 20 | public static void RefreshModListFromModsDirectory() 21 | { 22 | AvailableMods.Clear(); 23 | IsModEnabled.Clear(); 24 | 25 | var modsDirectory = Path.Combine(PulsarMainWindow.GetAppDataPath(), PulsarMainWindow.ModsPath); 26 | 27 | foreach(var directory in Directory.GetDirectories(modsDirectory)) 28 | { 29 | var manifestPath = Path.Combine(directory, "modInfo.json"); 30 | if(File.Exists(manifestPath)) 31 | { 32 | var modManifest = JsonConvert.DeserializeObject(File.ReadAllText(manifestPath)); 33 | if(modManifest != null) 34 | { 35 | AvailableMods.Add(new ModMetaData() { Mod = modManifest, Path = manifestPath }); 36 | IsModEnabled.Add(modManifest.ModName, modManifest.DefaultEnabled); 37 | } 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Client/State/UpdateWindowState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Pulsar4X.SDL2UI 4 | { 5 | public abstract class UpdateWindowState 6 | { 7 | internal static GlobalUIState _uiState; 8 | 9 | public abstract bool GetActive(); 10 | 11 | public abstract void OnGameTickChange(DateTime newDate); 12 | public abstract void OnSystemTickChange(DateTime newDate); 13 | 14 | protected UpdateWindowState() 15 | { 16 | _uiState.UpdateableWindows.Add(this); 17 | } 18 | 19 | public void Deconstructor() 20 | { 21 | _uiState.UpdateableWindows.Remove(this); 22 | } 23 | 24 | } 25 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.OrbitalMath/DataStructures/EntityBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Pulsar4X.Orbital 6 | { 7 | public class EntityBase 8 | { 9 | public bool IsStationary { get; set; } 10 | 11 | public KeplerElements Orbit { get; set; } 12 | 13 | public double DryMassInKG { get; set; } 14 | 15 | public Vector3 PositionInMetres { get; set; } 16 | 17 | public EntityBase Parent { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.OrbitalMath/Exceptions/OrbitProcessorException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Pulsar4X.Orbital 6 | { 7 | public class OrbitProcessorException : Exception 8 | { 9 | public override string Message { get; } 10 | public KeplerElements Entity { get; } 11 | 12 | public OrbitProcessorException(string message, KeplerElements entity) 13 | { 14 | Message = message; 15 | Entity = entity; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.OrbitalMath/Helpers/PositionHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Pulsar4X.Orbital.Helpers 6 | { 7 | public static class PositionHelper 8 | { 9 | public static Vector3 GetAbsolutePositionInAU(EntityBase entity) 10 | { 11 | return Distance.MToAU(GetAbsolutePositionInMetres(entity)); 12 | } 13 | 14 | public static Vector3 GetAbsolutePositionInMetres(EntityBase entity) 15 | { 16 | if (entity.Parent == null || entity.Parent == entity) 17 | return entity.PositionInMetres; 18 | 19 | Vector3 parentpos = GetAbsolutePositionInMetres(entity.Parent); 20 | return parentpos + entity.PositionInMetres; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.OrbitalMath/Pulsar4X.Orbital.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | enable 5 | net8.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | ..\..\..\..\..\..\home\se5a\.nuget\packages\newtonsoft.json\13.0.3\lib\net6.0\Newtonsoft.Json.dll 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/AngleHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace NUnit.Framework; 4 | 5 | public class AssertExtensions 6 | { 7 | public static void AreAngleEqual(double expected, double actual, double delta) 8 | { 9 | double value = Math.PI - Math.Abs(Math.Abs(expected - actual) % Math.Tau - Math.PI); 10 | Assert.IsTrue(value <= delta); 11 | } 12 | public static void AreAngleNotEqual(double expected, double actual, double delta) 13 | { 14 | double value = Math.PI - Math.Abs(Math.Abs(expected - actual) % Math.Tau - Math.PI); 15 | Assert.IsFalse(value <= delta); 16 | 17 | } 18 | 19 | public static void AreAngleEqual(double expected, double actual, double delta, string message) 20 | { 21 | double value = Math.PI - Math.Abs(Math.Abs(expected - actual) % Math.Tau - Math.PI); 22 | Assert.IsTrue(value <= delta, message); 23 | } 24 | public static void AreAngleNotEqual(double expected, double actual, double delta, string message) 25 | { 26 | double value = Math.PI - Math.Abs(Math.Abs(expected - actual) % Math.Tau - Math.PI); 27 | Assert.IsFalse(value <= delta, message); 28 | 29 | } 30 | 31 | 32 | [Test] 33 | public void TestAreAnglesEqual() 34 | { 35 | AreAngleEqual(0, Math.Tau,0); 36 | AreAngleEqual(Math.Tau, 0,0); 37 | AreAngleEqual(0, -Math.Tau,0); 38 | AreAngleEqual(-Math.Tau, 0,0); 39 | AreAngleEqual(0, 6.2831853071795845,1.0E-10); 40 | AreAngleEqual(6.2831853071795845, 0,1.0E-10); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/Data/MalformedData/Commander Name Theme - The Creators.json: -------------------------------------------------------------------------------- 1 | { 2 | "Type": "CommanderNameThemes", 3 | "Data": [ 4 | { 5 | "ThemeName": "The Creators", 6 | "NameList": [ 7 | { 8 | "First": "PartialStaticDataCorruption", 9 | "Last": "BAD", 10 | "IsFemale": false 11 | } 12 | ] 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/Data/MalformedData/Minerals.json: -------------------------------------------------------------------------------- 1 | { 2 | "Type": "Minerals", 3 | "Data": [ 4 | { 5 | "Name": "Sorium2", 6 | "Description": "des", 7 | "ID": "bbfb5681-9bc2-46b6-b93d-ea4d410ca0da", 8 | "Abundance": [ 9 | { 10 | "Key": "Asteroid", 11 | "Value": 0.01 12 | }, 13 | { 14 | "Key": "Comet", 15 | "Value": 0.05 16 | }, 17 | { 18 | "Key": "DwarfPlanet", 19 | "Value": 0.075 20 | } 21 | { 22 | "Key": "GasDwarf", 23 | "Value": 0.1 24 | } 25 | { 26 | "Key": "GasGiant", 27 | "Value": 1.0 28 | } 29 | { 30 | "Key": "IceGiant", 31 | "Value": 0.5 32 | }, 33 | { 34 | "Key": "Moon", 35 | "Value": 0.5 36 | }, 37 | { 38 | "Key": "Terrestrial", -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/Data/MalformedData/VersionInfo.vinfo: -------------------------------------------------------------------------------- 1 | { 2 | "Type": "VersionInfo", 3 | "Data": { 4 | "Name": "Bad Data Test", 5 | "VersionString": "0.4", 6 | "MajorVersion": 0, 7 | "MinorVersion": 4, 8 | "Directory": "MalformedData" 9 | } 10 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/Data/Other/Minerals.json: -------------------------------------------------------------------------------- 1 | { 2 | "Type": "Minerals", 3 | "Data": { 4 | "List": [ 5 | { 6 | "Key": "08f15d35-ea1d-442f-a2e3-bde04c5c22e9", 7 | "Value": { 8 | "Name": "Sorium2", 9 | "Description": "Gas used to convert into fuel.", 10 | "ID": "08f15d35-ea1d-442f-a2e3-bde04c5c22e9", 11 | "CargoType": "16B4C4F0-7292-4F4D-8FEA-22103C70B288", 12 | "Weight": 1.0, 13 | "Abundance": { 14 | "List": [ 15 | { 16 | "Key": "Asteroid", 17 | "Value": 0.01 18 | }, 19 | { 20 | "Key": "Comet", 21 | "Value": 0.05 22 | }, 23 | { 24 | "Key": "DwarfPlanet", 25 | "Value": 0.075 26 | }, 27 | { 28 | "Key": "GasDwarf", 29 | "Value": 0.1 30 | }, 31 | { 32 | "Key": "GasGiant", 33 | "Value": 1.0 34 | }, 35 | { 36 | "Key": "IceGiant", 37 | "Value": 0.5 38 | }, 39 | { 40 | "Key": "Moon", 41 | "Value": 0.5 42 | }, 43 | { 44 | "Key": "Terrestrial", 45 | "Value": 1.0 46 | } 47 | ] 48 | } 49 | } 50 | } 51 | ] 52 | } 53 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/Data/Other/VersionInfo.vinfo: -------------------------------------------------------------------------------- 1 | { 2 | "Type": "VersionInfo", 3 | "Data": { 4 | "Name": "Pulsar4XSoriumMod", 5 | "VersionString": "0.4", 6 | "MajorVersion": 0, 7 | "MinorVersion": 4, 8 | "Directory": "Other" 9 | } 10 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/DataStructureTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | using Newtonsoft.Json; 4 | using Pulsar4X.DataStructures; 5 | 6 | namespace Pulsar4X.Tests 7 | { 8 | [TestFixture] 9 | [Description("Tests the SerialzationManagers Import/Export capabilities.")] 10 | internal class DataStructureTests 11 | { 12 | [Test] 13 | public void SafeDictionarySerialization() 14 | { 15 | SafeDictionary safeDictionary = new SafeDictionary(); 16 | 17 | for(int i = 0; i < 100; i++) 18 | { 19 | safeDictionary.Add(Guid.NewGuid(), i); 20 | } 21 | 22 | string json = JsonConvert.SerializeObject(safeDictionary); 23 | 24 | SafeDictionary deserializedDictionary = JsonConvert.DeserializeObject>(json); 25 | 26 | Assert.IsTrue(safeDictionary.Equals(deserializedDictionary)); 27 | } 28 | 29 | [Test] 30 | public void SafeListSerialization() 31 | { 32 | SafeList safeList = new SafeList(); 33 | 34 | for(int i = 0; i < 100; i++) 35 | { 36 | safeList.Add(Guid.NewGuid()); 37 | } 38 | 39 | string json = JsonConvert.SerializeObject(safeList); 40 | 41 | SafeList deserializedList = JsonConvert.DeserializeObject>(json); 42 | 43 | Assert.IsTrue(safeList.Equals(deserializedList)); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/Modding/ModLoaderTests.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.Modding; 2 | using NUnit.Framework; 3 | using System.Data; 4 | 5 | namespace Pulsar4X.Tests 6 | { 7 | [TestFixture] 8 | [Description("Tests the ModLoader class")] 9 | internal class ModLoaderTests 10 | { 11 | ModLoader _modLoader; 12 | ModDataStore _modDataStore; 13 | 14 | [SetUp] 15 | public void Setup() 16 | { 17 | _modLoader = new ModLoader(); 18 | _modDataStore = new ModDataStore(); 19 | } 20 | 21 | [Test] 22 | [Description("Tests loading a mod")] 23 | public void TestModLoader() 24 | { 25 | _modLoader.LoadModManifest("Data/basemod/modInfo.json", _modDataStore); 26 | 27 | Assert.AreEqual(1, _modLoader.LoadedMods.Count); 28 | } 29 | 30 | [Test] 31 | public void TestDuplicateMods() 32 | { 33 | _modLoader.LoadModManifest("Data/basemod/modInfo.json", _modDataStore); 34 | 35 | var ex = Assert.Throws(() => { 36 | // Load the same mod again 37 | _modLoader.LoadModManifest("Data/basemod/modInfo.json", _modDataStore); 38 | }); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/NetworkTests.cs: -------------------------------------------------------------------------------- 1 | // using NUnit.Framework; 2 | // using Pulsar4X.ECSLib; 3 | // using System; 4 | 5 | // namespace Pulsar4X.Tests 6 | // { 7 | // [Description("Network Tests")] 8 | // public class NetworkTests 9 | // { 10 | // TestGame _host; 11 | 12 | // Game _client; 13 | // Networking.NetworkClient _netClient; 14 | // private DateTime _currentDateTime { get { return StaticRefLib.CurrentDateTime; } } 15 | 16 | 17 | 18 | // [SetUp] 19 | // public void Init() 20 | // { 21 | // _host = new TestGame(1); 22 | // //_host.Game.OrderHandler = new ServerOrderHandler(_host.Game, 4888); 23 | 24 | // _client = new Game(); 25 | // _netClient = new Networking.NetworkClient("localhost", 4888, new GameVM());//ugly, refactor so GameVM isn't required and or network isnt needed to be created here? 26 | // //_client.OrderHandler = new ClientOrderHandler(_client, _netClient); 27 | // } 28 | 29 | // //[Test] 30 | // public void TestFactionConnect() 31 | // { 32 | // _netClient.ClientConnect(); 33 | // //TODO: set up events so we can listen for updates. 34 | // //_netClient.Messages.Contains( 35 | // //_netClient.SendFactionDataRequest("New Terran Utopian Empire", "");//name is hardcoded in TestGame.cs 36 | // } 37 | // } 38 | // } 39 | -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Pulsar4X.Tests")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Pulsar4X.Tests")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("3658b470-d042-451a-8ff4-b40c3380e07e")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/Pulsar4X.Tests.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/TestHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Pulsar4X.Blueprints; 3 | using Pulsar4X.Datablobs; 4 | using Pulsar4X.DataStructures; 5 | using Pulsar4X.Engine; 6 | using Pulsar4X.Galaxy; 7 | using Pulsar4X.Names; 8 | using Pulsar4X.People; 9 | 10 | namespace Pulsar4X.Tests 11 | { 12 | internal class TestHelper 13 | { 14 | protected Game _game; 15 | protected EntityManager _entityManager; 16 | protected Dictionary _gasDictionary; 17 | protected SpeciesDB _humans; 18 | protected AtmosphereDB _atmosphere; 19 | 20 | protected Entity GetPlanet(float baseTemperature, float albedo, double gravity, AtmosphereDB atmosphere = null) 21 | { 22 | SystemBodyInfoDB planetBodyDB = new() { 23 | BodyType = BodyType.Terrestrial, 24 | SupportsPopulations = true, 25 | Gravity = gravity, 26 | BaseTemperature = baseTemperature, 27 | Albedo = new PercentValue(albedo) 28 | }; 29 | NameDB planetNameDB = new("Test Planet"); 30 | 31 | var result = Entity.Create(); 32 | _entityManager.AddEntity(result, new List { planetBodyDB, planetNameDB, atmosphere }); 33 | 34 | return result; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/ViewModelTests.cs: -------------------------------------------------------------------------------- 1 | // using NUnit.Framework; 2 | // using Pulsar4X.ECSLib; 3 | // using System; 4 | // using System.Collections.Generic; 5 | // using System.Linq; 6 | // using System.Threading; 7 | // using GameVM = Pulsar4X.ECSLib.GameVM; 8 | 9 | // namespace Pulsar4X.Tests 10 | // { 11 | // [TestFixture] 12 | // [Description("ViewModel and Generic Game Tests")] 13 | // class ViewModelTests 14 | // { 15 | // // private Game _game; 16 | // private GameVM _gameVM; 17 | // // private NewGameOptionsVM _newGameOptions; 18 | 19 | // [Test] 20 | // public void NewGame() 21 | // { 22 | // _gameVM = new GameVM(); 23 | // //_newGameOptions = NewGameOptionsVM.Create(_gameVM); 24 | // //Assert.DoesNotThrow(() => _gameVM.CreateGame(_newGameOptions)); 25 | // } 26 | 27 | 28 | // } 29 | // } 30 | -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/WarpMoveTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace Pulsar4X.Tests 4 | { 5 | public class WarpMoveTests 6 | { 7 | 8 | 9 | [Test] 10 | public void TestVelocity() 11 | { 12 | 13 | } 14 | 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /Pulsar4X/Pulsar4X.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Pulsar4X/Untitled Document: -------------------------------------------------------------------------------- 1 | change atbDB to not be datablobs. 2 | designs don't need to be entites. 3 | moving away from this should make things a bit less confusing. 4 | it will allow different designs and ships themselfs to share the atb file. 5 | -------------------------------------------------------------------------------- /Pulsar4X/ViewModelLib/Helpers/Commands.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.ECSLib; 2 | using System; 3 | using System.Windows.Input; 4 | 5 | namespace Pulsar4X.ViewModel 6 | { 7 | public class JobPriorityCommand : ICommand 8 | where TDataBlob : BaseDataBlob 9 | { 10 | JobVM _jobVM { get; set; } 11 | 12 | public int DeltaUp { get; set; } 13 | public int DeltaDown { get; set; } 14 | 15 | public JobPriorityCommand(JobVM jobVM) 16 | { 17 | _jobVM = jobVM; 18 | DeltaUp = -1; 19 | DeltaDown = 1; 20 | } 21 | 22 | public bool CanExecute(object parameter) 23 | { 24 | return true; 25 | } 26 | 27 | public void Execute(object parameter) 28 | { 29 | //_jobVM.ChangePriority((int)parameter); 30 | } 31 | 32 | public event EventHandler CanExecuteChanged; 33 | } 34 | 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Pulsar4X/ViewModelLib/Helpers/ItemPair.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Runtime.CompilerServices; 3 | 4 | 5 | namespace Pulsar4X.ViewModel 6 | { 7 | public class ItemPair : INotifyPropertyChanged 8 | { 9 | private T1 _item1; 10 | public T1 Item1 11 | { 12 | get { return _item1; } 13 | set { _item1 = value; OnPropertyChanged(); } 14 | } 15 | 16 | private T2 _item2; 17 | public T2 Item2 18 | { 19 | get { return _item2; } 20 | set { _item2 = value; OnPropertyChanged(); } 21 | } 22 | 23 | public ItemPair(T1 item1, T2 item2) 24 | { 25 | Item1 = item1; 26 | Item2 = item2; 27 | } 28 | 29 | public event PropertyChangedEventHandler PropertyChanged; 30 | private void OnPropertyChanged([CallerMemberName] string propertyName = null) 31 | { 32 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Pulsar4X/ViewModelLib/Helpers/RangeEnableObservibleCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Collections.ObjectModel; 3 | using System.Collections.Specialized; 4 | 5 | namespace Pulsar4X.ViewModel 6 | { 7 | public class RangeEnabledObservableCollection : ObservableCollection 8 | { 9 | public void AddRange(IEnumerable items) 10 | { 11 | this.CheckReentrancy(); 12 | foreach (var item in items) 13 | this.Items.Add(item); 14 | this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Pulsar4X/ViewModelLib/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("ViewModelLib")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("ViewModelLib")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("d2b75583-a08f-42eb-8227-e5cc5da9634a")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Pulsar4X/ViewModelLib/ViewModels/FactionVM.cs: -------------------------------------------------------------------------------- 1 | using Pulsar4X.ECSLib; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | 6 | namespace Pulsar4X.ViewModel 7 | { 8 | public class FactionVM 9 | { 10 | private Entity _entity; 11 | 12 | /// 13 | /// The default name of the faction, i.e. the name it knows itself by. 14 | /// 15 | public string Name { get { return _entity.GetDataBlob().DefaultName; } } 16 | 17 | public List Species; 18 | 19 | public FactionVM() 20 | { 21 | } 22 | 23 | private FactionVM(Entity factionEntity) 24 | { 25 | _entity = factionEntity; 26 | Species = new List(); 27 | foreach (var speciesEntity in factionEntity.GetDataBlob().Species) 28 | { 29 | Species.Add(SpeciesVM.Create(speciesEntity)); 30 | } 31 | } 32 | 33 | public static FactionVM Create(Entity factionEntity) 34 | { 35 | if (!factionEntity.HasDataBlob()) 36 | throw new Exception("Entity is not a faction or does not have a FactionInfoDB"); 37 | return new FactionVM(factionEntity); 38 | } 39 | 40 | #region IViewModel 41 | 42 | public event PropertyChangedEventHandler PropertyChanged; 43 | 44 | #endregion 45 | } 46 | } -------------------------------------------------------------------------------- /Pulsar4X/ViewModelLib/ViewModels/IViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Pulsar4X.ViewModel 4 | { 5 | public interface IViewModel : INotifyPropertyChanged 6 | { 7 | /// 8 | /// Refreshes the properties of this ViewModel. 9 | /// 10 | /// If partialRefresh is set to true, the ViewModel will try to update only data that changes during a pulse. 11 | /// 12 | void Refresh(bool partialRefresh = false); 13 | } 14 | } -------------------------------------------------------------------------------- /Pulsar4X/ViewModelLib/ViewModels/PlayerOptionsVM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Pulsar4X.ViewModel; 7 | using Pulsar4X.ECSLib; 8 | using System.Windows.Input; 9 | 10 | namespace Pulsar4X.ViewModel 11 | { 12 | public class PlayerOptionsVM : ViewModelBase 13 | { 14 | private GameVM _gameVM; 15 | public DictionaryVM Players { get; } = new DictionaryVM(); 16 | 17 | public string PassWord 18 | { 19 | get { return _password; } 20 | set { _password = value; OnPropertyChanged(); } 21 | } 22 | private string _password = ""; 23 | 24 | public ICommand SwitchToPlayerCMD { get { return new RelayCommand(obj => ChangeToPlayer(PassWord)); } } 25 | 26 | 27 | public PlayerOptionsVM(GameVM gameVM) 28 | { 29 | _gameVM = gameVM; 30 | Players.Add(_gameVM.Game.SpaceMaster, _gameVM.Game.SpaceMaster.Name); 31 | foreach (var player in gameVM.Game.Players) 32 | { 33 | Players.Add(player, player.Name); 34 | } 35 | Players.SelectedIndex = 0; 36 | Players.SelectionChangedEvent += Factions_SelectionChangedEvent; 37 | } 38 | 39 | private void Factions_SelectionChangedEvent(int oldSelection, int newSelection) 40 | { 41 | 42 | } 43 | 44 | 45 | private void ChangeToPlayer(string password) 46 | { 47 | _gameVM.SetPlayer(Players.SelectedKey, password); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Pulsar4X/ViewModelLib/ViewModels/SystemView/SystemMap_DrawableVM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Pulsar4X.ECSLib; 4 | using System.Windows.Threading; 5 | 6 | namespace Pulsar4X.ViewModel.SystemView 7 | { 8 | public class SystemMap_DrawableVM : ViewModelBase 9 | { 10 | 11 | 12 | public List IconableEntitys { get; } = new List(); 13 | public ManagerSubPulse SystemSubpulse { get; private set; } 14 | 15 | public void Initialise(GameVM gameVM, StarSystem starSys) 16 | { 17 | 18 | IconableEntitys.Clear(); 19 | IconableEntitys.AddRange(starSys.SystemManager.GetAllEntitiesWithDataBlob(gameVM.CurrentAuthToken)); 20 | SystemSubpulse = starSys.SystemManager.ManagerSubpulses; 21 | starSys.SystemManager.GetAllEntitiesWithDataBlob(gameVM.CurrentAuthToken); 22 | 23 | OnPropertyChanged(nameof(IconableEntitys)); 24 | } 25 | 26 | } 27 | 28 | 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Pulsar4X/ViewModelLib/ViewModels/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Runtime.CompilerServices; 3 | 4 | namespace Pulsar4X.ViewModel 5 | { 6 | public class ViewModelBase : INotifyPropertyChanged 7 | { 8 | 9 | public event PropertyChangedEventHandler PropertyChanged; 10 | protected void OnPropertyChanged([CallerMemberName] string propertyName = null) 11 | { 12 | 13 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Pulsar4X/ViewModelLib/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Pulsar4X/global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "8.0.303", 4 | "rollForward": "latestMinor", 5 | "allowPrerelease": true 6 | } 7 | } -------------------------------------------------------------------------------- /contributor.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/contributor.txt -------------------------------------------------------------------------------- /doc/AvgQualityDetection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/AvgQualityDetection.png -------------------------------------------------------------------------------- /doc/AvgQualityDetection.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/AvgQualityDetection.xcf -------------------------------------------------------------------------------- /doc/Drawing ellipses.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/Drawing ellipses.pdf -------------------------------------------------------------------------------- /doc/GuidanceMethod for Dv Constrained.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/GuidanceMethod for Dv Constrained.pdf -------------------------------------------------------------------------------- /doc/IdealDetails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/IdealDetails.png -------------------------------------------------------------------------------- /doc/IdealDetails.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/IdealDetails.xcf -------------------------------------------------------------------------------- /doc/IdealDetection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/IdealDetection.png -------------------------------------------------------------------------------- /doc/IdealDetection.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/IdealDetection.xcf -------------------------------------------------------------------------------- /doc/Industryflowchart.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/Industryflowchart.jpg -------------------------------------------------------------------------------- /doc/MulticonstrainedAccentGuidenceforSolidRockets.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/MulticonstrainedAccentGuidenceforSolidRockets.pdf -------------------------------------------------------------------------------- /doc/PoorQualityDetection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/PoorQualityDetection.png -------------------------------------------------------------------------------- /doc/PoorQualityDetection.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/PoorQualityDetection.xcf -------------------------------------------------------------------------------- /doc/PulsarIndustry2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/PulsarIndustry2.jpg -------------------------------------------------------------------------------- /doc/PulsarIndustry2.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/PulsarIndustry2.odg -------------------------------------------------------------------------------- /doc/Readme.txt: -------------------------------------------------------------------------------- 1 | This directory is for Doxygen content. Doxygen generates 2 | HTML and other documentation based on the source code. 3 | 4 | Run in this directory: 5 | 6 | `doxygen Doxyfile.txt` 7 | 8 | The output will be in the `doxygen` folder. 9 | -------------------------------------------------------------------------------- /doc/doxygen/output_here.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/doxygen/output_here.txt -------------------------------------------------------------------------------- /doc/entityflowchart.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/entityflowchart.jpg -------------------------------------------------------------------------------- /doc/entityflowchart.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/entityflowchart.odg -------------------------------------------------------------------------------- /doc/planetflowchart.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/planetflowchart.odg -------------------------------------------------------------------------------- /doc/pulsar ECS-MVVM implimentation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pulsar4xDevs/Pulsar4x/bd74d78871ae85c1563f0f9745170d3e3138b0ee/doc/pulsar ECS-MVVM implimentation.png --------------------------------------------------------------------------------