2024-02-25 14:46:47 +00:00
|
|
|
#pragma once
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
#include "StarGameTypes.hpp"
|
|
|
|
#include "StarSkyTypes.hpp"
|
|
|
|
#include "StarWeatherTypes.hpp"
|
|
|
|
#include "StarForceRegions.hpp"
|
|
|
|
|
|
|
|
namespace Star {
|
|
|
|
|
|
|
|
enum class WorldParametersType : uint8_t {
|
|
|
|
TerrestrialWorldParameters,
|
|
|
|
AsteroidsWorldParameters,
|
|
|
|
FloatingDungeonWorldParameters
|
|
|
|
};
|
|
|
|
extern EnumMap<WorldParametersType> const WorldParametersTypeNames;
|
|
|
|
|
|
|
|
enum class BeamUpRule : uint8_t {
|
|
|
|
Nowhere,
|
|
|
|
Surface,
|
|
|
|
Anywhere,
|
|
|
|
AnywhereWithWarning
|
|
|
|
};
|
|
|
|
extern EnumMap<BeamUpRule> const BeamUpRuleNames;
|
|
|
|
|
|
|
|
enum class WorldEdgeForceRegionType : uint8_t {
|
|
|
|
None,
|
|
|
|
Top,
|
|
|
|
Bottom,
|
|
|
|
TopAndBottom
|
|
|
|
};
|
|
|
|
extern EnumMap<WorldEdgeForceRegionType> const WorldEdgeForceRegionTypeNames;
|
|
|
|
|
|
|
|
STAR_STRUCT(VisitableWorldParameters);
|
|
|
|
STAR_STRUCT(TerrestrialWorldParameters);
|
|
|
|
STAR_STRUCT(AsteroidsWorldParameters);
|
|
|
|
STAR_STRUCT(FloatingDungeonWorldParameters);
|
|
|
|
|
|
|
|
struct VisitableWorldParameters {
|
2024-02-28 17:11:55 +00:00
|
|
|
VisitableWorldParameters() = default;
|
|
|
|
VisitableWorldParameters(VisitableWorldParameters const& visitableWorldParameters) = default;
|
|
|
|
explicit VisitableWorldParameters(Json const& store);
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
virtual ~VisitableWorldParameters() = default;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
virtual WorldParametersType type() const = 0;
|
|
|
|
|
|
|
|
virtual Json store() const;
|
|
|
|
|
|
|
|
virtual void read(DataStream& ds);
|
|
|
|
virtual void write(DataStream& ds) const;
|
|
|
|
|
|
|
|
String typeName;
|
2024-02-28 17:11:55 +00:00
|
|
|
float threatLevel{};
|
2023-06-20 04:33:09 +00:00
|
|
|
Vec2U worldSize;
|
2024-02-28 17:11:55 +00:00
|
|
|
float gravity{};
|
|
|
|
bool airless{false};
|
2023-06-20 04:33:09 +00:00
|
|
|
WeatherPool weatherPool;
|
|
|
|
StringList environmentStatusEffects;
|
|
|
|
Maybe<StringList> overrideTech;
|
2023-06-25 06:10:57 +00:00
|
|
|
Maybe<List<Directives>> globalDirectives;
|
2023-06-20 04:33:09 +00:00
|
|
|
BeamUpRule beamUpRule;
|
2024-02-28 17:11:55 +00:00
|
|
|
bool disableDeathDrops{false};
|
|
|
|
bool terraformed{false};
|
|
|
|
WorldEdgeForceRegionType worldEdgeForceRegions{WorldEdgeForceRegionType::None};
|
2023-06-20 04:33:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TerrestrialWorldParameters : VisitableWorldParameters {
|
|
|
|
struct TerrestrialRegion {
|
|
|
|
String biome;
|
|
|
|
|
|
|
|
String blockSelector;
|
|
|
|
String fgCaveSelector;
|
|
|
|
String bgCaveSelector;
|
|
|
|
String fgOreSelector;
|
|
|
|
String bgOreSelector;
|
|
|
|
String subBlockSelector;
|
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
LiquidId caveLiquid{};
|
|
|
|
float caveLiquidSeedDensity{};
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
LiquidId oceanLiquid{};
|
|
|
|
int oceanLiquidLevel{};
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
bool encloseLiquids{false};
|
|
|
|
bool fillMicrodungeons{false};
|
2023-06-20 04:33:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TerrestrialLayer {
|
|
|
|
int layerMinHeight;
|
|
|
|
int layerBaseHeight;
|
|
|
|
|
|
|
|
StringList dungeons;
|
|
|
|
int dungeonXVariance;
|
|
|
|
|
|
|
|
TerrestrialRegion primaryRegion;
|
|
|
|
TerrestrialRegion primarySubRegion;
|
|
|
|
|
|
|
|
List<TerrestrialRegion> secondaryRegions;
|
|
|
|
List<TerrestrialRegion> secondarySubRegions;
|
|
|
|
|
|
|
|
Vec2F secondaryRegionSizeRange;
|
|
|
|
Vec2F subRegionSizeRange;
|
|
|
|
};
|
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
TerrestrialWorldParameters() = default;
|
|
|
|
TerrestrialWorldParameters(TerrestrialWorldParameters const& terrestrialWorldParameters) = default;
|
|
|
|
explicit TerrestrialWorldParameters(Json const& store);
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2023-06-26 18:48:27 +00:00
|
|
|
TerrestrialWorldParameters &operator=(TerrestrialWorldParameters const& terrestrialWorldParameters);
|
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
WorldParametersType type() const override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
Json store() const override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
void read(DataStream& ds) override;
|
|
|
|
void write(DataStream& ds) const override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
String primaryBiome;
|
2024-02-28 17:11:55 +00:00
|
|
|
LiquidId primarySurfaceLiquid{};
|
2023-06-20 04:33:09 +00:00
|
|
|
String sizeName;
|
2024-02-28 17:11:55 +00:00
|
|
|
float hueShift{};
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
SkyColoring skyColoring;
|
2024-02-28 17:11:55 +00:00
|
|
|
float dayLength{};
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
Json blockNoiseConfig;
|
|
|
|
Json blendNoiseConfig;
|
2024-02-28 17:11:55 +00:00
|
|
|
float blendSize{};
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
TerrestrialLayer spaceLayer{};
|
|
|
|
TerrestrialLayer atmosphereLayer{};
|
|
|
|
TerrestrialLayer surfaceLayer{};
|
|
|
|
TerrestrialLayer subsurfaceLayer{};
|
2023-06-20 04:33:09 +00:00
|
|
|
List<TerrestrialLayer> undergroundLayers;
|
2024-02-28 17:11:55 +00:00
|
|
|
TerrestrialLayer coreLayer{};
|
2023-06-20 04:33:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct AsteroidsWorldParameters : VisitableWorldParameters {
|
|
|
|
AsteroidsWorldParameters();
|
2024-02-28 17:11:55 +00:00
|
|
|
explicit AsteroidsWorldParameters(Json const& store);
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
WorldParametersType type() const override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
Json store() const override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
void read(DataStream& ds) override;
|
|
|
|
void write(DataStream& ds) const override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
int asteroidTopLevel{};
|
|
|
|
int asteroidBottomLevel{};
|
|
|
|
float blendSize{};
|
2023-06-20 04:33:09 +00:00
|
|
|
String asteroidBiome;
|
|
|
|
Color ambientLightLevel;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FloatingDungeonWorldParameters : VisitableWorldParameters {
|
2024-02-28 17:11:55 +00:00
|
|
|
FloatingDungeonWorldParameters() = default;
|
|
|
|
explicit FloatingDungeonWorldParameters(Json const& store);
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
WorldParametersType type() const override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
Json store() const override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
2024-02-28 17:11:55 +00:00
|
|
|
void read(DataStream& ds) override;
|
|
|
|
void write(DataStream& ds) const override;
|
2023-06-20 04:33:09 +00:00
|
|
|
|
|
|
|
int dungeonBaseHeight;
|
|
|
|
int dungeonSurfaceHeight;
|
|
|
|
int dungeonUndergroundLevel;
|
|
|
|
String primaryDungeon;
|
|
|
|
Color ambientLightLevel;
|
|
|
|
Maybe<String> biome;
|
|
|
|
Maybe<String> dayMusicTrack;
|
|
|
|
Maybe<String> nightMusicTrack;
|
|
|
|
Maybe<String> dayAmbientNoises;
|
|
|
|
Maybe<String> nightAmbientNoises;
|
|
|
|
};
|
|
|
|
|
|
|
|
Json diskStoreVisitableWorldParameters(VisitableWorldParametersConstPtr const& parameters);
|
|
|
|
VisitableWorldParametersPtr diskLoadVisitableWorldParameters(Json const& store);
|
|
|
|
|
|
|
|
ByteArray netStoreVisitableWorldParameters(VisitableWorldParametersConstPtr const& parameters);
|
|
|
|
VisitableWorldParametersPtr netLoadVisitableWorldParameters(ByteArray data);
|
|
|
|
|
|
|
|
TerrestrialWorldParametersPtr generateTerrestrialWorldParameters(String const& typeName, String const& sizeName, uint64_t seed);
|
|
|
|
AsteroidsWorldParametersPtr generateAsteroidsWorldParameters(uint64_t seed);
|
|
|
|
FloatingDungeonWorldParametersPtr generateFloatingDungeonWorldParameters(String const& dungeonWorldName);
|
|
|
|
|
|
|
|
}
|