mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Allow setting the parent of a detail
This commit is contained in:
parent
785f668e9d
commit
ba243648d0
@ -30,9 +30,14 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
detailGO = MakeDetail(go, sector, prefab, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
detailGO = MakeDetail(go, sector, prefab, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
||||||
}
|
}
|
||||||
else detailGO = MakeDetail(go, sector, detail.path, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
else
|
||||||
|
{
|
||||||
|
detailGO = MakeDetail(go, sector, detail.path, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
||||||
|
}
|
||||||
|
|
||||||
if (detailGO != null && detail.removeChildren != null)
|
if (detailGO == null) return;
|
||||||
|
|
||||||
|
if (detail.removeChildren != null)
|
||||||
{
|
{
|
||||||
foreach (var childPath in detail.removeChildren)
|
foreach (var childPath in detail.removeChildren)
|
||||||
{
|
{
|
||||||
@ -42,7 +47,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (detailGO != null && detail.removeComponents)
|
if (detail.removeComponents)
|
||||||
{
|
{
|
||||||
// Just swap all the children to a new game object
|
// Just swap all the children to a new game object
|
||||||
var newDetailGO = new GameObject(detailGO.name);
|
var newDetailGO = new GameObject(detailGO.name);
|
||||||
@ -67,6 +72,15 @@ namespace NewHorizons.Builder.Props
|
|||||||
detailGO.name = detail.rename;
|
detailGO.name = detail.rename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(detail.parentPath))
|
||||||
|
{
|
||||||
|
var newParent = go.transform.Find(detail.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
detailGO.transform.parent = newParent.transform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
detailInfoToCorrespondingSpawnedGameObject[detail] = detailGO;
|
detailInfoToCorrespondingSpawnedGameObject[detail] = detailGO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
5
NewHorizons/External/Modules/PropModule.cs
vendored
5
NewHorizons/External/Modules/PropModule.cs
vendored
@ -169,6 +169,11 @@ namespace NewHorizons.External.Modules
|
|||||||
/// If this value is not null, this prop will be quantum. Assign this field to the id of the quantum group it should be a part of. The group it is assigned to determines what kind of quantum object it is
|
/// If this value is not null, this prop will be quantum. Assign this field to the id of the quantum group it should be a part of. The group it is assigned to determines what kind of quantum object it is
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string quantumGroupID;
|
public string quantumGroupID;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The path (not including the root planet object) of the parent of this game object. Optional (will default to the root sector).
|
||||||
|
/// </summary>
|
||||||
|
public string parentPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user