From a88f3c16a8a2e6d44ea56bd268394c740c095fad Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Tue, 21 Mar 2023 17:44:50 -0700 Subject: [PATCH] use nullable values instead of separate keepAutoPlacement thing --- .../TranslatorText/TranslatorTextBuilder.cs | 14 +++++++------- NewHorizons/External/Modules/PropModule.cs | 16 ++++++---------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/NewHorizons/Builder/Props/TranslatorText/TranslatorTextBuilder.cs b/NewHorizons/Builder/Props/TranslatorText/TranslatorTextBuilder.cs index 4cf69104..4967b9c5 100644 --- a/NewHorizons/Builder/Props/TranslatorText/TranslatorTextBuilder.cs +++ b/NewHorizons/Builder/Props/TranslatorText/TranslatorTextBuilder.cs @@ -499,15 +499,15 @@ namespace NewHorizons.Builder.Props.TranslatorText var arcInfo = info.arcInfo[j]; var arc = arranger.spirals[j]; - if (arcInfo.keepAutoPlacement) continue; + if (arcInfo.position != null) arc.transform.localPosition = new Vector3(arcInfo.position.x, arcInfo.position.y, 0); - if (arcInfo.position == null) arc.transform.localPosition = Vector3.zero; - else arc.transform.localPosition = new Vector3(arcInfo.position.x, arcInfo.position.y, 0); + if (arcInfo.zRotation != null) arc.transform.localRotation = Quaternion.Euler(0, 0, arcInfo.zRotation.Value); - arc.transform.localRotation = Quaternion.Euler(0, 0, arcInfo.zRotation); - - if (arcInfo.mirror) arc.transform.localScale = new Vector3(-1, 1, 1); - else arc.transform.localScale = new Vector3( 1, 1, 1); + if (arcInfo.mirror != null) + { + if (arcInfo.mirror.Value) arc.transform.localScale = new Vector3(-1, 1, 1); + else arc.transform.localScale = new Vector3(1, 1, 1); + } } // make an entry in the cache for all these spirals diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index 5772cd26..639c361c 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -590,17 +590,12 @@ namespace NewHorizons.External.Modules } /// - /// Whether to skip modifying this spiral's placement, and instead keep the automatically determined placement. + /// Whether to flip the spiral from left-curling to right-curling or vice versa. If not specified, will use auto spiral generated value. /// - public bool keepAutoPlacement; + public bool? mirror; /// - /// Whether to flip the spiral from left-curling to right-curling or vice versa. - /// - public bool mirror; - - /// - /// The local position of this object on the wall. + /// The local position of this object on the wall. If not specified, will use auto spiral generated value. /// public MVector2 position; @@ -612,12 +607,13 @@ namespace NewHorizons.External.Modules /// /// Which variation of the chosen type to place. If not specified, a random variation will be selected based on the seed provided in the parent module. /// + [Obsolete("only used in old nomai text")] [DefaultValue(-1)] public int variation = -1; /// - /// The z euler angle for this arc. + /// The z euler angle for this arc. If not specified, will use auto spiral generated value. /// - [Range(0f, 360f)] public float zRotation; + [Range(0f, 360f)] public float? zRotation; } [JsonObject]