mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add optional parent path to nomai text info
This commit is contained in:
parent
6e1480cbc4
commit
e0269d05cb
@ -111,6 +111,12 @@ namespace NewHorizons.Builder.Props
|
|||||||
var nomaiWallTextObj = MakeWallText(planetGO, sector, info, xmlPath).gameObject;
|
var nomaiWallTextObj = MakeWallText(planetGO, sector, info, xmlPath).gameObject;
|
||||||
|
|
||||||
nomaiWallTextObj.transform.parent = sector?.transform ?? planetGO.transform;
|
nomaiWallTextObj.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
|
{
|
||||||
|
nomaiWallTextObj.transform.parent = planetGO.transform.Find(info.parentPath);
|
||||||
|
}
|
||||||
|
|
||||||
nomaiWallTextObj.transform.position = planetGO.transform.TransformPoint(info.position);
|
nomaiWallTextObj.transform.position = planetGO.transform.TransformPoint(info.position);
|
||||||
if (info.normal != null)
|
if (info.normal != null)
|
||||||
{
|
{
|
||||||
@ -163,6 +169,12 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
// Place scroll
|
// Place scroll
|
||||||
customScroll.transform.parent = sector?.transform ?? planetGO.transform;
|
customScroll.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
|
{
|
||||||
|
customScroll.transform.parent = planetGO.transform.Find(info.parentPath);
|
||||||
|
}
|
||||||
|
|
||||||
customScroll.transform.position = planetGO.transform.TransformPoint(info.position ?? Vector3.zero);
|
customScroll.transform.position = planetGO.transform.TransformPoint(info.position ?? Vector3.zero);
|
||||||
|
|
||||||
var up = planetGO.transform.InverseTransformPoint(customScroll.transform.position).normalized;
|
var up = planetGO.transform.InverseTransformPoint(customScroll.transform.position).normalized;
|
||||||
@ -193,6 +205,12 @@ namespace NewHorizons.Builder.Props
|
|||||||
var computerObject = _computerPrefab.InstantiateInactive();
|
var computerObject = _computerPrefab.InstantiateInactive();
|
||||||
|
|
||||||
computerObject.transform.parent = sector?.transform ?? planetGO.transform;
|
computerObject.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
|
{
|
||||||
|
computerObject.transform.parent = planetGO.transform.Find(info.parentPath);
|
||||||
|
}
|
||||||
|
|
||||||
computerObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
computerObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
||||||
|
|
||||||
var up = computerObject.transform.position - planetGO.transform.position;
|
var up = computerObject.transform.position - planetGO.transform.position;
|
||||||
@ -220,6 +238,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
var computerObject = DetailBuilder.MakeDetail(planetGO, sector, _preCrashComputerPrefab, info.position, Vector3.zero, 1, false);
|
var computerObject = DetailBuilder.MakeDetail(planetGO, sector, _preCrashComputerPrefab, info.position, Vector3.zero, 1, false);
|
||||||
computerObject.SetActive(false);
|
computerObject.SetActive(false);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
|
{
|
||||||
|
computerObject.transform.SetParent(planetGO.transform.Find(info.parentPath), true);
|
||||||
|
}
|
||||||
|
|
||||||
var up = computerObject.transform.position - planetGO.transform.position;
|
var up = computerObject.transform.position - planetGO.transform.position;
|
||||||
if (info.normal != null) up = planetGO.transform.TransformDirection(info.normal);
|
if (info.normal != null) up = planetGO.transform.TransformDirection(info.normal);
|
||||||
computerObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, up) * computerObject.transform.rotation;
|
computerObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, up) * computerObject.transform.rotation;
|
||||||
@ -256,6 +279,12 @@ namespace NewHorizons.Builder.Props
|
|||||||
var cairnObject = _cairnPrefab.InstantiateInactive();
|
var cairnObject = _cairnPrefab.InstantiateInactive();
|
||||||
|
|
||||||
cairnObject.transform.parent = sector?.transform ?? planetGO.transform;
|
cairnObject.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
|
{
|
||||||
|
cairnObject.transform.parent = planetGO.transform.Find(info.parentPath);
|
||||||
|
}
|
||||||
|
|
||||||
cairnObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
cairnObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
||||||
|
|
||||||
if (info.rotation != null)
|
if (info.rotation != null)
|
||||||
@ -303,6 +332,12 @@ namespace NewHorizons.Builder.Props
|
|||||||
var recorderObject = (info.type == PropModule.NomaiTextInfo.NomaiTextType.PreCrashRecorder ? _preCrashRecorderPrefab : _recorderPrefab).InstantiateInactive();
|
var recorderObject = (info.type == PropModule.NomaiTextInfo.NomaiTextType.PreCrashRecorder ? _preCrashRecorderPrefab : _recorderPrefab).InstantiateInactive();
|
||||||
|
|
||||||
recorderObject.transform.parent = sector?.transform ?? planetGO.transform;
|
recorderObject.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
|
{
|
||||||
|
recorderObject.transform.parent = planetGO.transform.Find(info.parentPath);
|
||||||
|
}
|
||||||
|
|
||||||
recorderObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
recorderObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
||||||
|
|
||||||
if (info.rotation != null)
|
if (info.rotation != null)
|
||||||
@ -335,7 +370,6 @@ namespace NewHorizons.Builder.Props
|
|||||||
default:
|
default:
|
||||||
Logger.LogError($"Unsupported NomaiText type {info.type}");
|
Logger.LogError($"Unsupported NomaiText type {info.type}");
|
||||||
return null;
|
return null;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
5
NewHorizons/External/Modules/PropModule.cs
vendored
5
NewHorizons/External/Modules/PropModule.cs
vendored
@ -512,6 +512,11 @@ namespace NewHorizons.External.Modules
|
|||||||
/// The relative path to the xml file for this object.
|
/// The relative path to the xml file for this object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string xmlFile;
|
public string xmlFile;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
|
||||||
|
/// </summary>
|
||||||
|
public string parentPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user