From 59624b6a2ce3ada6ba3f0c434e1a575acc249872 Mon Sep 17 00:00:00 2001 From: Nick Date: Sun, 22 May 2022 00:49:09 -0400 Subject: [PATCH] Add default values to modules --- NewHorizons/Builder/Props/DetailBuilder.cs | 1 + NewHorizons/Builder/Props/TornadoBuilder.cs | 2 -- NewHorizons/External/Configs/PlanetConfig.cs | 5 ++++- .../External/Configs/StarSystemConfig.cs | 13 ++++++++----- .../External/Modules/AsteroidBeltModule.cs | 11 ++++++++++- .../External/Modules/AtmosphereModule.cs | 3 ++- NewHorizons/External/Modules/BaseModule.cs | 14 ++++++++++++-- NewHorizons/External/Modules/OrbitModule.cs | 9 +++++++-- NewHorizons/External/Modules/PropModule.cs | 13 +++++++++++++ NewHorizons/External/Modules/ShipLogModule.cs | 11 ++++++++--- NewHorizons/External/Modules/SignalModule.cs | 19 +++++++++++++++---- .../Modules/VariableSize/FunnelModule.cs | 5 +++++ .../Modules/VariableSize/RingModule.cs | 4 ++-- .../Modules/VariableSize/SingularityModule.cs | 4 +++- .../Modules/VariableSize/StarModule.cs | 12 ++++++++++++ 15 files changed, 102 insertions(+), 24 deletions(-) diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index a87f216d..68247a08 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -19,6 +19,7 @@ namespace NewHorizons.Builder.Props if (!detailInfoToCorrespondingSpawnedGameObject.ContainsKey(detail)) return null; return detailInfoToCorrespondingSpawnedGameObject[detail]; } + public static void Make(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, string uniqueModName, PropModule.DetailInfo detail) { GameObject detailGO = null; diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index 706e788e..d44281af 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -200,8 +200,6 @@ namespace NewHorizons.Builder.Props streamingRenderMeshHandle.enabled = false; } - - // Height of the hurricane is 405 by default if (info.height != 0) hurricaneGO.transform.localScale = Vector3.one * info.height / 405f; diff --git a/NewHorizons/External/Configs/PlanetConfig.cs b/NewHorizons/External/Configs/PlanetConfig.cs index 8d3617c1..1a6e529a 100644 --- a/NewHorizons/External/Configs/PlanetConfig.cs +++ b/NewHorizons/External/Configs/PlanetConfig.cs @@ -1,6 +1,7 @@ using NewHorizons.External.Modules; using NewHorizons.External.Modules.VariableSize; using NewHorizons.Utility; +using System.ComponentModel; using UnityEngine; namespace NewHorizons.External.Configs @@ -9,9 +10,11 @@ namespace NewHorizons.External.Configs { public string Name { get; set; } public string Version { get; set; } - public string StarSystem { get; set; } = "SolarSystem"; + [DefaultValue("SolarSystem")] public string StarSystem { get; set; } = "SolarSystem"; public bool Destroy { get; set; } public string[] RemoveChildren { get; set; } + + [DefaultValue(-1)] public int BuildPriority { get; set; } = -1; public bool CanShowOnTitle { get; set; } = true; public bool IsQuantumState { get; set; } diff --git a/NewHorizons/External/Configs/StarSystemConfig.cs b/NewHorizons/External/Configs/StarSystemConfig.cs index b88c5483..196bc7b6 100644 --- a/NewHorizons/External/Configs/StarSystemConfig.cs +++ b/NewHorizons/External/Configs/StarSystemConfig.cs @@ -1,12 +1,15 @@ -namespace NewHorizons.External.Configs +using System.ComponentModel; + +namespace NewHorizons.External.Configs { public class StarSystemConfig { - public bool canEnterViaWarpDrive = true; - public bool startHere = false; - public bool destroyStockPlanets = true; + [DefaultValue(true)] public bool canEnterViaWarpDrive = true; + [DefaultValue(true)] public bool enableTimeLoop = true; + [DefaultValue(true)] public bool destroyStockPlanets = true; + + public bool startHere; public string factRequiredForWarp; - public bool enableTimeLoop = true; public bool mapRestricted; public NomaiCoordinates coords; public SkyboxConfig skybox; diff --git a/NewHorizons/External/Modules/AsteroidBeltModule.cs b/NewHorizons/External/Modules/AsteroidBeltModule.cs index a128a3b2..d30c63c6 100644 --- a/NewHorizons/External/Modules/AsteroidBeltModule.cs +++ b/NewHorizons/External/Modules/AsteroidBeltModule.cs @@ -1,12 +1,21 @@ -namespace NewHorizons.External.Modules +using System.ComponentModel; + +namespace NewHorizons.External.Modules { public class AsteroidBeltModule { public float InnerRadius { get; set; } public float OuterRadius { get; set; } + + [DefaultValue(20)] public float MinSize { get; set; } = 20; + + [DefaultValue(50)] public float MaxSize { get; set; } = 50; + + [DefaultValue(-1)] public int Amount { get; set; } = -1; + public float Inclination { get; set; } public float LongitudeOfAscendingNode { get; set; } public int RandomSeed { get; set; } diff --git a/NewHorizons/External/Modules/AtmosphereModule.cs b/NewHorizons/External/Modules/AtmosphereModule.cs index eef320fd..b8f9e408 100644 --- a/NewHorizons/External/Modules/AtmosphereModule.cs +++ b/NewHorizons/External/Modules/AtmosphereModule.cs @@ -1,4 +1,5 @@ using NewHorizons.Utility; +using System.ComponentModel; using UnityEngine; namespace NewHorizons.External.Modules @@ -24,7 +25,7 @@ namespace NewHorizons.External.Modules [System.Obsolete("CloudRamp is deprecated, please use CloudInfo instead")] public string CloudRamp { get; set; } [System.Obsolete("CloudFluidType is deprecated, please use CloudInfo instead")] public string CloudFluidType { get; set; } [System.Obsolete("UseBasicCloudShader is deprecated, please use CloudInfo instead")] public bool UseBasicCloudShader { get; set; } - [System.Obsolete("ShadowsOnClouds is deprecated, please use CloudInfo instead")] public bool ShadowsOnClouds { get; set; } = true; + [DefaultValue(true)] [System.Obsolete("ShadowsOnClouds is deprecated, please use CloudInfo instead")] public bool ShadowsOnClouds { get; set; } = true; [System.Obsolete("HasAtmosphere is deprecated, please use UseAtmosphereShader instead")] public bool HasAtmosphere { get; set; } #endregion Obsolete diff --git a/NewHorizons/External/Modules/BaseModule.cs b/NewHorizons/External/Modules/BaseModule.cs index 5b0b299e..e18fd17c 100644 --- a/NewHorizons/External/Modules/BaseModule.cs +++ b/NewHorizons/External/Modules/BaseModule.cs @@ -1,4 +1,6 @@ using NewHorizons.Utility; +using System.ComponentModel; + namespace NewHorizons.External.Modules { public class BaseModule @@ -6,16 +8,24 @@ namespace NewHorizons.External.Modules public bool HasMapMarker { get; set; } public float AmbientLight { get; set; } public float SurfaceGravity { get; set; } + + [DefaultValue("linear")] public string GravityFallOff { get; set; } = "linear"; + public float SurfaceSize { get; set; } public float SphereOfInfluence { get; set; } public float GroundSize { get; set; } public bool HasCometTail { get; set; } public MVector3 CometTailRotation { get; set; } + + [DefaultValue(true)] public bool HasReferenceFrame { get; set; } = true; - public bool CenterOfSolarSystem { get; set; } = false; - public float CloakRadius { get; set; } = 0f; + + public bool CenterOfSolarSystem { get; set; } + public float CloakRadius { get; set; } public bool InvulnerableToSun { get; set; } + + [DefaultValue(true)] public bool ShowMinimap { get; set; } = true; #region Obsolete diff --git a/NewHorizons/External/Modules/OrbitModule.cs b/NewHorizons/External/Modules/OrbitModule.cs index 93e0577f..42a6dcc3 100644 --- a/NewHorizons/External/Modules/OrbitModule.cs +++ b/NewHorizons/External/Modules/OrbitModule.cs @@ -1,5 +1,7 @@ using NewHorizons.Components.Orbital; using NewHorizons.Utility; +using System.ComponentModel; + namespace NewHorizons.External.Modules { public class OrbitModule : IOrbitalParameters @@ -16,11 +18,14 @@ namespace NewHorizons.External.Modules public float SiderealPeriod { get; set; } public bool IsTidallyLocked { get; set; } public MVector3 AlignmentAxis { get; set; } + + [DefaultValue(true)] public bool ShowOrbitLine { get; set; } = true; - public bool DottedOrbitLine { get; set; } = false; + + public bool DottedOrbitLine { get; set; } public bool IsStatic { get; set; } public MColor Tint { get; set; } - public bool TrackingOrbitLine { get; set; } = false; + public bool TrackingOrbitLine { get; set; } public OrbitalParameters GetOrbitalParameters(Gravity primaryGravity, Gravity secondaryGravity) { diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index c31ac7ec..a70f4634 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -1,4 +1,6 @@ using NewHorizons.Utility; +using System.ComponentModel; + namespace NewHorizons.External.Modules { public class PropModule @@ -35,6 +37,8 @@ namespace NewHorizons.External.Modules public string assetBundle; public MVector3 position; public MVector3 rotation; + + [DefaultValue(1f)] public float scale { get; set; } = 1f; public bool alignToNormal; public string[] removeChildren; @@ -55,11 +59,20 @@ namespace NewHorizons.External.Modules { public MVector3 position; public float elevation; + + [DefaultValue(30)] public float height = 30; + public MColor tint; public float wanderRate; + + [DefaultValue(45)] public float wanderDegreesX = 45; + + [DefaultValue(45)] public float wanderDegreesZ = 45; + + [DefaultValue("upwards")] public string type = "upwards"; [System.Obsolete("downwards is deprecated, please use type instead")] public bool downwards; diff --git a/NewHorizons/External/Modules/ShipLogModule.cs b/NewHorizons/External/Modules/ShipLogModule.cs index 0e297db4..3e24bd6d 100644 --- a/NewHorizons/External/Modules/ShipLogModule.cs +++ b/NewHorizons/External/Modules/ShipLogModule.cs @@ -1,4 +1,6 @@ using NewHorizons.Utility; +using System.ComponentModel; + namespace NewHorizons.External.Modules { public class ShipLogModule @@ -14,12 +16,15 @@ namespace NewHorizons.External.Modules { public string revealedSprite; public string outlineSprite; + + [DefaultValue(1f)] public float scale = 1f; + public bool invisibleWhenHidden; - public float offset = 0f; + public float offset; public MVector2 manualPosition; public MVector2 manualNavigationPosition; - public bool remove = false; + public bool remove; public ShipLogDetailInfo[] details; } @@ -27,7 +32,7 @@ namespace NewHorizons.External.Modules { public string revealedSprite; public string outlineSprite; - public float rotation = 0f; + public float rotation; public bool invisibleWhenHidden; public MVector2 position; public MVector2 scale; diff --git a/NewHorizons/External/Modules/SignalModule.cs b/NewHorizons/External/Modules/SignalModule.cs index 87490fae..d72d5316 100644 --- a/NewHorizons/External/Modules/SignalModule.cs +++ b/NewHorizons/External/Modules/SignalModule.cs @@ -1,4 +1,6 @@ using NewHorizons.Utility; +using System.ComponentModel; + namespace NewHorizons.External.Modules { public class SignalModule @@ -10,14 +12,23 @@ namespace NewHorizons.External.Modules public MVector3 Position; public string Frequency; public string Name; - public string AudioClip = null; - public string AudioFilePath = null; + public string AudioClip; + public string AudioFilePath; + + [DefaultValue("")] public string Reveals = ""; + + [DefaultValue(1f)] public float SourceRadius = 1f; - public float DetectionRadius = 0f; + public float DetectionRadius; + + [DefaultValue(10f)] public float IdentificationRadius = 10f; + + [DefaultValue(true)] public bool OnlyAudibleToScope = true; - public bool InsideCloak = false; + + public bool InsideCloak; } } } diff --git a/NewHorizons/External/Modules/VariableSize/FunnelModule.cs b/NewHorizons/External/Modules/VariableSize/FunnelModule.cs index 057b85a5..e9a8e16e 100644 --- a/NewHorizons/External/Modules/VariableSize/FunnelModule.cs +++ b/NewHorizons/External/Modules/VariableSize/FunnelModule.cs @@ -1,10 +1,15 @@ using NewHorizons.Utility; +using System.ComponentModel; + namespace NewHorizons.External.Modules.VariableSize { public class FunnelModule : VariableSizeModule { public string Target { get; set; } + + [DefaultValue("Sand")] public string Type { get; set; } = "Sand"; + public MColor Tint { get; set; } } } diff --git a/NewHorizons/External/Modules/VariableSize/RingModule.cs b/NewHorizons/External/Modules/VariableSize/RingModule.cs index 7cb32e48..6f516f20 100644 --- a/NewHorizons/External/Modules/VariableSize/RingModule.cs +++ b/NewHorizons/External/Modules/VariableSize/RingModule.cs @@ -7,8 +7,8 @@ public float Inclination { get; set; } public float LongitudeOfAscendingNode { get; set; } public string Texture { get; set; } - public bool Unlit { get; set; } = false; - public float RotationSpeed { get; set; } = 0f; + public bool Unlit { get; set; } + public float RotationSpeed { get; set; } public string FluidType { get; set; } } } diff --git a/NewHorizons/External/Modules/VariableSize/SingularityModule.cs b/NewHorizons/External/Modules/VariableSize/SingularityModule.cs index 4f4b0804..62326f3e 100644 --- a/NewHorizons/External/Modules/VariableSize/SingularityModule.cs +++ b/NewHorizons/External/Modules/VariableSize/SingularityModule.cs @@ -1,4 +1,6 @@ using NewHorizons.Utility; +using System.ComponentModel; + namespace NewHorizons.External.Modules.VariableSize { public class SingularityModule : VariableSizeModule @@ -8,6 +10,6 @@ namespace NewHorizons.External.Modules.VariableSize public string TargetStarSystem; public string Type; //BlackHole or WhiteHole public MVector3 Position; - public bool MakeZeroGVolume = true; + [DefaultValue(true)] public bool MakeZeroGVolume = true; } } diff --git a/NewHorizons/External/Modules/VariableSize/StarModule.cs b/NewHorizons/External/Modules/VariableSize/StarModule.cs index f75b6374..bb1a684e 100644 --- a/NewHorizons/External/Modules/VariableSize/StarModule.cs +++ b/NewHorizons/External/Modules/VariableSize/StarModule.cs @@ -1,16 +1,28 @@ using NewHorizons.Utility; +using System.ComponentModel; namespace NewHorizons.External.Modules.VariableSize { public class StarModule : VariableSizeModule { + [DefaultValue(2000)] public float Size { get; set; } = 2000f; + public MColor Tint { get; set; } + public MColor EndTint { get; set; } + public MColor SupernovaTint { get; set; } + public MColor LightTint { get; set; } + + [DefaultValue(1f)] public float SolarLuminosity { get; set; } = 1f; + + [DefaultValue(true)] public bool HasAtmosphere { get; set; } = true; + + [DefaultValue(true)] public bool GoSupernova { get; set; } = true; } }