Add optional parent path to projection info

This commit is contained in:
Noah Pilarski 2022-07-26 12:25:15 -04:00
parent a28542ea2d
commit 1f43af4807
2 changed files with 28 additions and 2 deletions

View File

@ -65,6 +65,12 @@ namespace NewHorizons.Builder.Props
}
slideReelObj.transform.parent = sector?.transform ?? planetGO.transform;
if (!string.IsNullOrEmpty(info.parentPath))
{
slideReelObj.transform.parent = planetGO.transform.Find(info.parentPath);
}
slideReelObj.transform.position = planetGO.transform.TransformPoint((Vector3)(info.position ?? Vector3.zero));
slideReelObj.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler((Vector3)(info.rotation ?? Vector3.zero)));
@ -156,6 +162,12 @@ namespace NewHorizons.Builder.Props
var slideCollectionContainer = autoProjector.GetRequiredComponent<SlideCollectionContainer>();
autoProjector.transform.parent = sector?.transform ?? planetGO.transform;
if (!string.IsNullOrEmpty(info.parentPath))
{
autoProjector.transform.parent = planetGO.transform.Find(info.parentPath);
}
autoProjector.transform.position = planetGO.transform.TransformPoint((Vector3)(info.position ?? Vector3.zero));
autoProjector.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler((Vector3)(info.rotation ?? Vector3.zero)));
@ -196,6 +208,11 @@ namespace NewHorizons.Builder.Props
var path = "DreamWorld_Body/Sector_DreamWorld/Sector_Underground/Sector_PrisonCell/Ghosts_PrisonCell/GhostNodeMap_PrisonCell_Lower/Prefab_IP_GhostBird_Prisoner/Ghostbird_IP_ANIM/Ghostbird_Skin_01:Ghostbird_Rig_V01:Base/Ghostbird_Skin_01:Ghostbird_Rig_V01:Root/Ghostbird_Skin_01:Ghostbird_Rig_V01:Spine01/Ghostbird_Skin_01:Ghostbird_Rig_V01:Spine02/Ghostbird_Skin_01:Ghostbird_Rig_V01:Spine03/Ghostbird_Skin_01:Ghostbird_Rig_V01:Spine04/Ghostbird_Skin_01:Ghostbird_Rig_V01:Neck01/Ghostbird_Skin_01:Ghostbird_Rig_V01:Neck02/Ghostbird_Skin_01:Ghostbird_Rig_V01:Head/PrisonerHeadDetector";
var g = DetailBuilder.MakeDetail(planetGO, sector, path, info.position, Vector3.zero, 2, false);
if (!string.IsNullOrEmpty(info.parentPath))
{
g.transform.SetParent(planetGO.transform.Find(info.parentPath), true);
}
if (g == null)
{
Logger.LogWarning($"Tried to make a vision torch target but couldn't. Do you have the DLC installed?");
@ -224,8 +241,7 @@ namespace NewHorizons.Builder.Props
}
imageLoader.imageLoadedEvent.AddListener((Texture2D tex, int index) => { slideCollection.slides[index]._image = tex; });
// attatch a component to store all the data for the slides that play when a vision torch scans this target
// attach a component to store all the data for the slides that play when a vision torch scans this target
var target = g.AddComponent<VisionTorchTarget>();
var slideCollectionContainer = g.AddComponent<SlideCollectionContainer>();
slideCollectionContainer.slideCollection = slideCollection;
@ -247,6 +263,11 @@ namespace NewHorizons.Builder.Props
var path = "RingWorld_Body/Sector_RingWorld/Sector_SecretEntrance/Interactibles_SecretEntrance/Experiment_1/VisionTorchApparatus/VisionTorchRoot/Prefab_IP_VisionTorchProjector";
var standingTorch = DetailBuilder.MakeDetail(planetGO, sector, path, info.position, info.rotation, 1, false);
if (!string.IsNullOrEmpty(info.parentPath))
{
standingTorch.transform.SetParent(planetGO.transform.Find(info.parentPath), true);
}
if (standingTorch == null)
{
Logger.LogWarning($"Tried to make a vision torch target but couldn't. Do you have the DLC installed?");

View File

@ -604,6 +604,11 @@ namespace NewHorizons.External.Modules
/// The type of object this is.
/// </summary>
[DefaultValue("slideReel")] public SlideShowType type = SlideShowType.SlideReel;
/// <summary>
/// The relative path from the planet to the parent of this slideshow. Optional (will default to the root sector).
/// </summary>
public string parentPath;
}
[JsonObject]