From 73e3cfbbb3adecb7aa1e70cfe9d2fd6e176c509b Mon Sep 17 00:00:00 2001 From: Ben C Date: Sun, 22 May 2022 13:36:10 -0400 Subject: [PATCH] Fix leftover errors after merge --- NewHorizons/Builder/Body/FunnelBuilder.cs | 8 ------- NewHorizons/Builder/Props/TornadoBuilder.cs | 4 ++-- NewHorizons/External/Configs/PlanetConfig.cs | 7 +++--- .../External/Configs/StarSystemConfig.cs | 10 +++++++++ .../External/Modules/AsteroidBeltModule.cs | 8 +++---- NewHorizons/External/Modules/BaseModule.cs | 4 ++-- NewHorizons/External/Modules/OrbitModule.cs | 2 +- NewHorizons/External/Modules/PropModule.cs | 22 +++++++++++++++++-- .../Modules/VariableSize/StarModule.cs | 8 +++---- 9 files changed, 45 insertions(+), 28 deletions(-) diff --git a/NewHorizons/Builder/Body/FunnelBuilder.cs b/NewHorizons/Builder/Body/FunnelBuilder.cs index 21169231..5331d4c4 100644 --- a/NewHorizons/Builder/Body/FunnelBuilder.cs +++ b/NewHorizons/Builder/Body/FunnelBuilder.cs @@ -13,14 +13,6 @@ namespace NewHorizons.Builder.Body private static readonly int EmissionColor = Shader.PropertyToID("_EmissionColor"); private static readonly int HeightScale = Shader.PropertyToID("_HeightScale"); - private enum FunnelType - { - SAND, - WATER, - LAVA, - STAR - } - public static void Make(GameObject planetGO, ConstantForceDetector detector, OWRigidbody rigidbody, FunnelModule module) { var funnelType = module.Type; diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index 3bbe97c3..b7f0d6ef 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -77,8 +77,8 @@ namespace NewHorizons.Builder.Props return; } - if (info.type.ToLower() == "hurricane") MakeHurricane(planetGO, sector, info, position, hasClouds); - else MakeTornado(planetGO, sector, info, position, info.type.ToLower() == "downwards"); + if (info.type == PropModule.TornadoInfo.TornadoType.Hurricane) MakeHurricane(planetGO, sector, info, position, hasClouds); + else MakeTornado(planetGO, sector, info, position, info.type == PropModule.TornadoInfo.TornadoType.Downwards); } private static void MakeTornado(GameObject planetGO, Sector sector, PropModule.TornadoInfo info, Vector3 position, bool downwards) diff --git a/NewHorizons/External/Configs/PlanetConfig.cs b/NewHorizons/External/Configs/PlanetConfig.cs index b76f6c78..1efd8520 100644 --- a/NewHorizons/External/Configs/PlanetConfig.cs +++ b/NewHorizons/External/Configs/PlanetConfig.cs @@ -27,7 +27,7 @@ namespace NewHorizons.External.Configs /// /// Unique star system containing your planet /// - [DefaultValue("SolarSystem")] + [System.ComponentModel.DefaultValue("SolarSystem")] public string StarSystem = "SolarSystem"; /// @@ -43,7 +43,7 @@ namespace NewHorizons.External.Configs /// /// Set to a higher number if you wish for this body to be built sooner /// - [DefaultValue(-1)] + [System.ComponentModel.DefaultValue(-1)] public int BuildPriority = -1; /// @@ -246,10 +246,9 @@ namespace NewHorizons.External.Configs { foreach(var tornado in Props.Tornados) { - if (tornado.downwards) tornado.type = "downwards"; + if (tornado.downwards) tornado.type = PropModule.TornadoInfo.TornadoType.Downwards; } } -#pragma warning restore 612, 618 } } } \ No newline at end of file diff --git a/NewHorizons/External/Configs/StarSystemConfig.cs b/NewHorizons/External/Configs/StarSystemConfig.cs index 5a3e3420..ca8359fb 100644 --- a/NewHorizons/External/Configs/StarSystemConfig.cs +++ b/NewHorizons/External/Configs/StarSystemConfig.cs @@ -28,11 +28,21 @@ namespace NewHorizons.External.Configs /// Do you want a clean slate for this star system? Or will it be a modified version of the original. /// public bool destroyStockPlanets = true; + + /// + /// Should the time loop be enabled in this system? + /// + [DefaultValue(true)] + public bool enableTimeLoop = true; /// /// Set to the FactID that must be revealed before it can be warped to. Don't set `CanEnterViaWarpDrive` to `false` if you're using this, that would make no sense. /// public string factRequiredForWarp; + + /// + /// Should the player not be able to view the map in this system? + /// public bool mapRestricted; /// diff --git a/NewHorizons/External/Modules/AsteroidBeltModule.cs b/NewHorizons/External/Modules/AsteroidBeltModule.cs index 62086ea5..1b8fc86a 100644 --- a/NewHorizons/External/Modules/AsteroidBeltModule.cs +++ b/NewHorizons/External/Modules/AsteroidBeltModule.cs @@ -1,6 +1,4 @@ using Newtonsoft.Json; -using UnityEngine.Internal; -using System.ComponentModel; namespace NewHorizons.External.Modules { @@ -20,19 +18,19 @@ namespace NewHorizons.External.Modules /// /// Minimum size of the asteroids. /// - [DefaultValue(20)] + [System.ComponentModel.DefaultValue(20)] public float MinSize = 20; /// /// Maximum size of the asteroids. /// - [DefaultValue(50)] + [System.ComponentModel.DefaultValue(50)] public float MaxSize = 50f; /// /// Amount of asteroids to create. /// - [DefaultValue(-1)] + [System.ComponentModel.DefaultValue(-1)] public int Amount = -1; /// diff --git a/NewHorizons/External/Modules/BaseModule.cs b/NewHorizons/External/Modules/BaseModule.cs index 477d0403..eb956135 100644 --- a/NewHorizons/External/Modules/BaseModule.cs +++ b/NewHorizons/External/Modules/BaseModule.cs @@ -67,7 +67,7 @@ namespace NewHorizons.External.Modules /// /// Allows the object to be targeted on the map. /// - [DefaultValue(true)] + [System.ComponentModel.DefaultValue(true)] public bool HasReferenceFrame = true; /// @@ -88,7 +88,7 @@ namespace NewHorizons.External.Modules /// /// Do we show the minimap when walking around this planet? /// - [DefaultValue(true)] + [System.ComponentModel.DefaultValue(true)] public bool ShowMinimap = true; #region Obsolete diff --git a/NewHorizons/External/Modules/OrbitModule.cs b/NewHorizons/External/Modules/OrbitModule.cs index 180c0a19..4a70e4ab 100644 --- a/NewHorizons/External/Modules/OrbitModule.cs +++ b/NewHorizons/External/Modules/OrbitModule.cs @@ -73,7 +73,7 @@ namespace NewHorizons.External.Modules /// /// Referring to the orbit line in the map screen. /// - [DefaultValue(true)] + [System.ComponentModel.DefaultValue(true)] public bool ShowOrbitLine { get; set; } = true; /// diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index 3fdb9f74..eb22ec56 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -184,6 +184,18 @@ namespace NewHorizons.External.Modules [JsonObject] public class TornadoInfo { + public enum TornadoType + { + [EnumMember(Value = @"downwards")] + Downwards = 0, + + [EnumMember(Value = @"upwards")] + Upwards = 1, + + [EnumMember(Value = @"hurricane")] + Hurricane = 2 + } + /// /// Position of the tornado /// @@ -204,9 +216,15 @@ namespace NewHorizons.External.Modules /// The colour of the tornado. /// public MColor tint; - + /// - /// Should it pull things downwards? Will push them upwards by default. + /// What type of cyclone should this be? Upwards and downwards are both tornados and will push in that direction. + /// + [JsonConverter(typeof(StringEnumConverter))] + public TornadoType type = TornadoType.Downwards; + + /// + /// [DEPRECATED] Should this tornado shoot you down instead of up? /// public bool downwards; diff --git a/NewHorizons/External/Modules/VariableSize/StarModule.cs b/NewHorizons/External/Modules/VariableSize/StarModule.cs index 75741e43..b2d03662 100644 --- a/NewHorizons/External/Modules/VariableSize/StarModule.cs +++ b/NewHorizons/External/Modules/VariableSize/StarModule.cs @@ -11,7 +11,7 @@ namespace NewHorizons.External.Modules.VariableSize /// /// Radius of the star. /// - [DefaultValue(2000f)] + [System.ComponentModel.DefaultValue(2000f)] public float Size = 2000f; /// @@ -37,19 +37,19 @@ namespace NewHorizons.External.Modules.VariableSize /// /// Relative strength of the light compared to the sun. /// - [DefaultValue(1f)] + [System.ComponentModel.DefaultValue(1f)] public float SolarLuminosity = 1f; /// /// The default sun has its own atmosphere that is different from regular planets. If you want that, set this to `true`. /// - [DefaultValue(true)] + [System.ComponentModel.DefaultValue(true)] public bool HasAtmosphere = true; /// /// Should this star explode after 22 minutes? /// - [DefaultValue(true)] + [System.ComponentModel.DefaultValue(true)] public bool GoSupernova = true; } }