using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Runtime.Serialization; using NewHorizons.External.Configs; using NewHorizons.Utility; using Newtonsoft.Json; using Newtonsoft.Json.Converters; namespace NewHorizons.External.Modules.VariableSize { [JsonObject] public class StarModule : VariableSizeModule { /// /// Colour of the star at the end of its lifespan. /// public MColor endTint; /// /// Should this star explode at the end of its lifespan? /// [DefaultValue(true)] public bool goSupernova = true; /// /// How long in minutes this star will last until it supernovas. /// [DefaultValue(22f)] public float lifespan = 22f; /// /// Should we add a star controller to this body? If you want clouds to work on a binary brown dwarf system, set this to false. /// [DefaultValue(true)] public bool hasStarController = true; /// /// The default sun has its own atmosphere that is different from regular planets. If you want that, set this to /// `true`. /// [DefaultValue(true)] public bool hasAtmosphere = true; /// /// Colour of the light given off. Defaults to yellowish. /// public MColor lightTint; /// /// Radius of the star. /// [DefaultValue(2000f)] [Range(0f, double.MaxValue)] public float size = 2000f; /// /// Relative strength of the light compared to the sun. /// [DefaultValue(1f)] [Range(0f, double.MaxValue)] public float solarLuminosity = 1f; /// /// Radius of the supernova. Any planets within this will be destroyed. /// [DefaultValue(50000f)] [Range(0f, double.MaxValue)] public float supernovaSize = 50000f; /// /// The tint of the supernova this star creates when it dies. /// public MColor supernovaTint; /// /// Colour of the star. /// public MColor tint; /// /// Path to the texture to put as the star ramp. Optional. /// public string starRampTexture; /// /// Path to the texture to put as the star ramp while it is collapsing. Optional. /// public string starCollapseRampTexture; /// /// How far the light from the star can reach. /// [DefaultValue(50000f)] [Range(0f, double.MaxValue)] public float lightRadius = 50000f; /// /// The type of death your star will have. /// [DefaultValue("default")] public StellarDeathType stellarDeathType = StellarDeathType.Default; /// /// The type of stellar remnant your star will leave behind. /// [DefaultValue("default")] public StellarRemnantType stellarRemnantType = StellarRemnantType.Default; /// /// If you want a custom stellar remnant, use this. /// public StellarRemnantModule stellarRemnant; public class StellarRemnantModule { /// /// Describes this Body's atmosphere /// public AtmosphereModule Atmosphere; /// /// Base Properties of this Body /// public BaseModule Base; /// /// Add bramble nodes to this planet and/or make this planet a bramble dimension /// public BrambleModule Bramble; /// /// Add a cloaking field to this planet /// public CloakModule Cloak; /// /// Add funnel from this planet to another /// public FunnelModule Funnel; /// /// Generate the surface of this planet using a heightmap /// public HeightMapModule HeightMap; /// /// Add lava to this planet /// public LavaModule Lava; /// /// Procedural Generation /// public ProcGenModule ProcGen; /// /// Spawn various objects on this body /// public PropModule Props; /// /// A list of paths to child GameObjects to destroy on this planet /// public string[] removeChildren; /// /// Creates a ring around the planet /// public RingModule Ring; /// /// Add sand to this planet /// public SandModule Sand; /// /// Rotation period in minutes. /// public float siderealPeriod; /// /// Make this body a star /// public StarModule Star; /// /// Add water to this planet /// public WaterModule Water; public PlanetConfig ConvertToPlanetConfig(PlanetConfig star) { PlanetConfig planetConfig = new PlanetConfig(); planetConfig.name = star.name; planetConfig.starSystem = star.starSystem; planetConfig.Atmosphere = Atmosphere; planetConfig.Base = Base; planetConfig.Bramble = Bramble; planetConfig.Cloak = Cloak; planetConfig.Funnel = Funnel; planetConfig.HeightMap = HeightMap; planetConfig.Lava = Lava; planetConfig.Orbit = star.Orbit; planetConfig.ProcGen = ProcGen; planetConfig.Props = Props; planetConfig.removeChildren = removeChildren; planetConfig.Ring = Ring; planetConfig.Sand = Sand; planetConfig.Water = Water; planetConfig.Validate(); planetConfig.Migrate(); return planetConfig; } } } [JsonConverter(typeof(StringEnumConverter))] public enum StellarDeathType { [EnumMember(Value = @"default")] Default, [EnumMember(Value = @"planetaryNebula")] PlanetaryNebula, [EnumMember(Value = @"supernova")] Supernova } [JsonConverter(typeof(StringEnumConverter))] public enum StellarRemnantType { [EnumMember(Value = @"default")] Default, [EnumMember(Value = @"whiteDwarf")] WhiteDwarf, [EnumMember(Value = @"neutronStar")] NeutronStar, [EnumMember(Value = @"pulsar")] Pulsar, [EnumMember(Value = @"blackHole")] BlackHole, [EnumMember(Value = @"custom")] Custom } }