diff --git a/NewHorizons/Builder/Props/ProjectionBuilder.cs b/NewHorizons/Builder/Props/ProjectionBuilder.cs index 0f34410e..6570033a 100644 --- a/NewHorizons/Builder/Props/ProjectionBuilder.cs +++ b/NewHorizons/Builder/Props/ProjectionBuilder.cs @@ -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(); 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(); var slideCollectionContainer = g.AddComponent(); 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?"); diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index c9b56fd9..c909ff68 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -604,6 +604,11 @@ namespace NewHorizons.External.Modules /// The type of object this is. /// [DefaultValue("slideReel")] public SlideShowType type = SlideShowType.SlideReel; + + /// + /// The relative path from the planet to the parent of this slideshow. Optional (will default to the root sector). + /// + public string parentPath; } [JsonObject]