Add optional rename to nomai text info

This commit is contained in:
Noah Pilarski 2022-07-26 11:52:36 -04:00
parent 0e9db06e21
commit 099240c87e
2 changed files with 36 additions and 0 deletions

View File

@ -110,6 +110,11 @@ namespace NewHorizons.Builder.Props
{
var nomaiWallTextObj = MakeWallText(planetGO, sector, info, xmlPath).gameObject;
if (!string.IsNullOrEmpty(info.rename))
{
nomaiWallTextObj.name = info.rename;
}
nomaiWallTextObj.transform.parent = sector?.transform ?? planetGO.transform;
if (!string.IsNullOrEmpty(info.parentPath))
@ -141,6 +146,11 @@ namespace NewHorizons.Builder.Props
{
var customScroll = _scrollPrefab.InstantiateInactive();
if (!string.IsNullOrEmpty(info.rename))
{
customScroll.name = info.rename;
}
var nomaiWallText = MakeWallText(planetGO, sector, info, xmlPath);
nomaiWallText.transform.parent = customScroll.transform;
nomaiWallText.transform.localPosition = Vector3.zero;
@ -204,6 +214,11 @@ namespace NewHorizons.Builder.Props
{
var computerObject = _computerPrefab.InstantiateInactive();
if (!string.IsNullOrEmpty(info.rename))
{
computerObject.name = info.rename;
}
computerObject.transform.parent = sector?.transform ?? planetGO.transform;
if (!string.IsNullOrEmpty(info.parentPath))
@ -238,6 +253,11 @@ namespace NewHorizons.Builder.Props
var computerObject = DetailBuilder.MakeDetail(planetGO, sector, _preCrashComputerPrefab, info.position, Vector3.zero, 1, false);
computerObject.SetActive(false);
if (!string.IsNullOrEmpty(info.rename))
{
computerObject.name = info.rename;
}
if (!string.IsNullOrEmpty(info.parentPath))
{
computerObject.transform.SetParent(planetGO.transform.Find(info.parentPath), true);
@ -278,6 +298,11 @@ namespace NewHorizons.Builder.Props
{
var cairnObject = _cairnPrefab.InstantiateInactive();
if (!string.IsNullOrEmpty(info.rename))
{
cairnObject.name = info.rename;
}
cairnObject.transform.parent = sector?.transform ?? planetGO.transform;
if (!string.IsNullOrEmpty(info.parentPath))
@ -331,6 +356,11 @@ namespace NewHorizons.Builder.Props
{
var recorderObject = (info.type == PropModule.NomaiTextInfo.NomaiTextType.PreCrashRecorder ? _preCrashRecorderPrefab : _recorderPrefab).InstantiateInactive();
if (!string.IsNullOrEmpty(info.rename))
{
recorderObject.name = info.rename;
}
recorderObject.transform.parent = sector?.transform ?? planetGO.transform;
if (!string.IsNullOrEmpty(info.parentPath))

View File

@ -517,6 +517,12 @@ namespace NewHorizons.External.Modules
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
/// </summary>
public string parentPath;
/// <summary>
/// An optional rename of this object
/// </summary>
public string rename;
}
[JsonObject]