use nullable values instead of separate keepAutoPlacement thing

This commit is contained in:
JohnCorby 2023-03-21 17:44:50 -07:00
parent b495b1ea2a
commit a88f3c16a8
2 changed files with 13 additions and 17 deletions

View File

@ -499,16 +499,16 @@ 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);
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

View File

@ -590,17 +590,12 @@ namespace NewHorizons.External.Modules
}
/// <summary>
/// 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.
/// </summary>
public bool keepAutoPlacement;
public bool? mirror;
/// <summary>
/// Whether to flip the spiral from left-curling to right-curling or vice versa.
/// </summary>
public bool mirror;
/// <summary>
/// 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.
/// </summary>
public MVector2 position;
@ -612,12 +607,13 @@ namespace NewHorizons.External.Modules
/// <summary>
/// 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.
/// </summary>
[Obsolete("only used in old nomai text")]
[DefaultValue(-1)] public int variation = -1;
/// <summary>
/// The z euler angle for this arc.
/// The z euler angle for this arc. If not specified, will use auto spiral generated value.
/// </summary>
[Range(0f, 360f)] public float zRotation;
[Range(0f, 360f)] public float? zRotation;
}
[JsonObject]