mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add rename and parentPath to more modules and infos (#468)
This commit is contained in:
commit
0a8e3bb643
@ -9,7 +9,7 @@ namespace NewHorizons.Builder.Atmosphere
|
|||||||
var airGO = new GameObject("Air");
|
var airGO = new GameObject("Air");
|
||||||
airGO.SetActive(false);
|
airGO.SetActive(false);
|
||||||
airGO.layer = 17;
|
airGO.layer = 17;
|
||||||
airGO.transform.parent = sector?.transform ? sector.transform : planetGO.transform;
|
airGO.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
|
|
||||||
var sc = airGO.AddComponent<SphereCollider>();
|
var sc = airGO.AddComponent<SphereCollider>();
|
||||||
sc.isTrigger = true;
|
sc.isTrigger = true;
|
||||||
|
|||||||
@ -88,9 +88,8 @@ namespace NewHorizons.Builder.Body
|
|||||||
Vector3 localPosition = singularity?.position == null ? Vector3.zero : singularity.position;
|
Vector3 localPosition = singularity?.position == null ? Vector3.zero : singularity.position;
|
||||||
Vector3 localRotation = singularity?.rotation == null ? Vector3.zero : singularity.rotation;
|
Vector3 localRotation = singularity?.rotation == null ? Vector3.zero : singularity.rotation;
|
||||||
|
|
||||||
GameObject newSingularity = null;
|
GameObject newSingularity = MakeSingularity(go, sector, localPosition, localRotation, polarity, horizonRadius, distortRadius,
|
||||||
newSingularity = MakeSingularity(go, sector, localPosition, localRotation, polarity, horizonRadius, distortRadius,
|
hasHazardVolume, singularity.targetStarSystem, singularity.curve, singularity.hasWarpEffects, singularity.renderQueueOverride, singularity.rename, singularity.parentPath, singularity.isRelativeToParent);
|
||||||
hasHazardVolume, singularity.targetStarSystem, singularity.curve, singularity.hasWarpEffects, singularity.renderQueueOverride);
|
|
||||||
|
|
||||||
var uniqueID = string.IsNullOrEmpty(singularity.uniqueID) ? config.name : singularity.uniqueID;
|
var uniqueID = string.IsNullOrEmpty(singularity.uniqueID) ? config.name : singularity.uniqueID;
|
||||||
_singularitiesByID.Add(uniqueID, newSingularity);
|
_singularitiesByID.Add(uniqueID, newSingularity);
|
||||||
@ -134,15 +133,32 @@ namespace NewHorizons.Builder.Body
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static GameObject MakeSingularity(GameObject planetGO, Sector sector, Vector3 position, Vector3 rotation, bool polarity, float horizon, float distort,
|
public static GameObject MakeSingularity(GameObject planetGO, Sector sector, Vector3 position, Vector3 rotation, bool polarity, float horizon, float distort,
|
||||||
bool hasDestructionVolume, string targetStarSystem = null, TimeValuePair[] curve = null, bool warpEffects = true, int renderQueue = 2985)
|
bool hasDestructionVolume, string targetStarSystem = null, TimeValuePair[] curve = null, bool warpEffects = true, int renderQueue = 2985, string rename = null, string parentPath = null, bool isRelativeToParent = false)
|
||||||
{
|
{
|
||||||
InitPrefabs();
|
InitPrefabs();
|
||||||
|
|
||||||
// polarity true = black, false = white
|
// polarity true = black, false = white
|
||||||
|
|
||||||
var singularity = new GameObject(polarity ? "BlackHole" : "WhiteHole");
|
var singularity = new GameObject(!string.IsNullOrEmpty(rename) ? rename : (polarity ? "BlackHole" : "WhiteHole"));
|
||||||
singularity.transform.parent = sector?.transform ?? planetGO.transform;
|
singularity.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
singularity.transform.position = planetGO.transform.TransformPoint(position);
|
|
||||||
|
if (!string.IsNullOrEmpty(parentPath))
|
||||||
|
{
|
||||||
|
var newParent = planetGO.transform.Find(parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
singularity.transform.parent = newParent;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{parentPath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isRelativeToParent)
|
||||||
|
singularity.transform.localPosition = position;
|
||||||
|
else
|
||||||
|
singularity.transform.position = planetGO.transform.TransformPoint(position);
|
||||||
|
|
||||||
var singularityRenderer = MakeSingularityGraphics(singularity, polarity, horizon, distort, renderQueue);
|
var singularityRenderer = MakeSingularityGraphics(singularity, polarity, horizon, distort, renderQueue);
|
||||||
|
|
||||||
@ -257,7 +273,11 @@ namespace NewHorizons.Builder.Body
|
|||||||
whiteHoleFluidVolume.enabled = true;
|
whiteHoleFluidVolume.enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
singularity.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(rotation));
|
var rot = Quaternion.Euler(rotation);
|
||||||
|
if (isRelativeToParent)
|
||||||
|
singularity.transform.localRotation = rot;
|
||||||
|
else
|
||||||
|
singularity.transform.rotation = planetGO.transform.TransformRotation(rot);
|
||||||
|
|
||||||
singularity.SetActive(true);
|
singularity.SetActive(true);
|
||||||
return singularity;
|
return singularity;
|
||||||
|
|||||||
@ -192,7 +192,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
var outerFogWarpVolume = GetOuterFogWarpVolumeFromAstroObject(go);
|
var outerFogWarpVolume = GetOuterFogWarpVolumeFromAstroObject(go);
|
||||||
var fogLight = brambleNode.GetComponent<FogLight>();
|
var fogLight = brambleNode.GetComponent<FogLight>();
|
||||||
|
|
||||||
brambleNode.transform.parent = sector.transform;
|
brambleNode.transform.parent = sector?.transform ?? go.transform;
|
||||||
brambleNode.transform.position = go.transform.TransformPoint(config.position ?? Vector3.zero);
|
brambleNode.transform.position = go.transform.TransformPoint(config.position ?? Vector3.zero);
|
||||||
brambleNode.transform.rotation = go.transform.TransformRotation(Quaternion.Euler(config.rotation ?? Vector3.zero));
|
brambleNode.transform.rotation = go.transform.TransformRotation(Quaternion.Euler(config.rotation ?? Vector3.zero));
|
||||||
brambleNode.name = config.name ?? "Bramble Node to " + config.linksTo;
|
brambleNode.name = config.name ?? "Bramble Node to " + config.linksTo;
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Props
|
namespace NewHorizons.Builder.Props
|
||||||
{
|
{
|
||||||
public static class GeyserBuilder
|
public static class GeyserBuilder
|
||||||
@ -17,8 +19,21 @@ namespace NewHorizons.Builder.Props
|
|||||||
InitPrefab();
|
InitPrefab();
|
||||||
|
|
||||||
var geyserGO = _geyserPrefab.InstantiateInactive();
|
var geyserGO = _geyserPrefab.InstantiateInactive();
|
||||||
|
geyserGO.name = !string.IsNullOrEmpty(info.rename) ? info.rename : "Geyser";
|
||||||
geyserGO.transform.parent = sector?.transform ?? planetGO.transform;
|
geyserGO.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
geyserGO.name = "Geyser";
|
|
||||||
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
|
{
|
||||||
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
geyserGO.transform.parent = newParent;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var pos = (Vector3)info.position;
|
var pos = (Vector3)info.position;
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
if (_slideReelPrefab == null) return null;
|
if (_slideReelPrefab == null) return null;
|
||||||
|
|
||||||
var slideReelObj = _slideReelPrefab.InstantiateInactive();
|
var slideReelObj = _slideReelPrefab.InstantiateInactive();
|
||||||
slideReelObj.name = $"Prefab_IP_Reel_{mod.ModHelper.Manifest.Name}";
|
slideReelObj.name = !string.IsNullOrEmpty(info.rename) ? info.rename : $"Prefab_IP_Reel_{mod.ModHelper.Manifest.Name}";
|
||||||
|
|
||||||
var slideReel = slideReelObj.GetComponent<SlideReelItem>();
|
var slideReel = slideReelObj.GetComponent<SlideReelItem>();
|
||||||
slideReel.SetSector(sector);
|
slideReel.SetSector(sector);
|
||||||
@ -196,7 +196,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
if (_autoPrefab == null) return null;
|
if (_autoPrefab == null) return null;
|
||||||
|
|
||||||
var projectorObj = _autoPrefab.InstantiateInactive();
|
var projectorObj = _autoPrefab.InstantiateInactive();
|
||||||
projectorObj.name = $"Prefab_IP_AutoProjector_{mod.ModHelper.Manifest.Name}";
|
projectorObj.name = !string.IsNullOrEmpty(info.rename) ? info.rename : $"Prefab_IP_AutoProjector_{mod.ModHelper.Manifest.Name}";
|
||||||
|
|
||||||
var autoProjector = projectorObj.GetComponent<AutoSlideProjector>();
|
var autoProjector = projectorObj.GetComponent<AutoSlideProjector>();
|
||||||
autoProjector._sector = sector;
|
autoProjector._sector = sector;
|
||||||
@ -276,7 +276,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
g.name = "VisionStaffDetector";
|
g.name = !string.IsNullOrEmpty(info.rename) ? info.rename : "VisionStaffDetector";
|
||||||
|
|
||||||
// The number of slides is unlimited, 15 is only for texturing the actual slide reel item. This is not a slide reel item
|
// The number of slides is unlimited, 15 is only for texturing the actual slide reel item. This is not a slide reel item
|
||||||
var slides = info.slides;
|
var slides = info.slides;
|
||||||
@ -312,7 +312,8 @@ namespace NewHorizons.Builder.Props
|
|||||||
position = info.position,
|
position = info.position,
|
||||||
rotation = info.rotation,
|
rotation = info.rotation,
|
||||||
parentPath = info.parentPath,
|
parentPath = info.parentPath,
|
||||||
isRelativeToParent = info.isRelativeToParent
|
isRelativeToParent = info.isRelativeToParent,
|
||||||
|
rename = info.rename
|
||||||
};
|
};
|
||||||
var standingTorch = DetailBuilder.Make(planetGO, sector, _standingVisionTorchPrefab, detailInfo);
|
var standingTorch = DetailBuilder.Make(planetGO, sector, _standingVisionTorchPrefab, detailInfo);
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
public static void MakeSocketGroup(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, PropModule.QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
|
public static void MakeSocketGroup(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, PropModule.QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
|
||||||
{
|
{
|
||||||
var groupRoot = new GameObject("Quantum Sockets - " + quantumGroup.id);
|
var groupRoot = new GameObject("Quantum Sockets - " + quantumGroup.id);
|
||||||
groupRoot.transform.parent = sector.transform;
|
groupRoot.transform.parent = sector?.transform ?? go.transform;
|
||||||
groupRoot.transform.localPosition = Vector3.zero;
|
groupRoot.transform.localPosition = Vector3.zero;
|
||||||
groupRoot.transform.localEulerAngles = Vector3.zero;
|
groupRoot.transform.localEulerAngles = Vector3.zero;
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
public static void MakeStateGroup(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, PropModule.QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
|
public static void MakeStateGroup(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, PropModule.QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
|
||||||
{
|
{
|
||||||
var groupRoot = new GameObject("Quantum States - " + quantumGroup.id);
|
var groupRoot = new GameObject("Quantum States - " + quantumGroup.id);
|
||||||
groupRoot.transform.parent = sector.transform;
|
groupRoot.transform.parent = sector?.transform ?? go.transform;
|
||||||
groupRoot.transform.localPosition = Vector3.zero;
|
groupRoot.transform.localPosition = Vector3.zero;
|
||||||
|
|
||||||
var states = new List<QuantumState>();
|
var states = new List<QuantumState>();
|
||||||
@ -128,7 +128,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
//var averagePosition = propsInGroup.Aggregate(Vector3.zero, (avg, prop) => avg + prop.transform.position) / propsInGroup.Count();
|
//var averagePosition = propsInGroup.Aggregate(Vector3.zero, (avg, prop) => avg + prop.transform.position) / propsInGroup.Count();
|
||||||
GameObject shuffleParent = new GameObject("Quantum Shuffle - " + quantumGroup.id);
|
GameObject shuffleParent = new GameObject("Quantum Shuffle - " + quantumGroup.id);
|
||||||
shuffleParent.SetActive(false);
|
shuffleParent.SetActive(false);
|
||||||
shuffleParent.transform.parent = sector.transform;
|
shuffleParent.transform.parent = sector?.transform ?? go.transform;
|
||||||
shuffleParent.transform.localPosition = Vector3.zero;
|
shuffleParent.transform.localPosition = Vector3.zero;
|
||||||
propsInGroup.ToList().ForEach(p => p.transform.parent = shuffleParent.transform);
|
propsInGroup.ToList().ForEach(p => p.transform.parent = shuffleParent.transform);
|
||||||
|
|
||||||
|
|||||||
@ -53,10 +53,34 @@ namespace NewHorizons.Builder.Props
|
|||||||
if (_prefab == null || sector == null) return null;
|
if (_prefab == null || sector == null) return null;
|
||||||
|
|
||||||
GameObject raftObject = _prefab.InstantiateInactive();
|
GameObject raftObject = _prefab.InstantiateInactive();
|
||||||
raftObject.name = "Raft_Body";
|
raftObject.name = !string.IsNullOrEmpty(info.rename) ? info.rename : "Raft_Body";
|
||||||
raftObject.transform.parent = sector?.transform ?? planetGO.transform;
|
raftObject.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
raftObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
|
||||||
raftObject.transform.rotation = planetGO.transform.TransformRotation(Quaternion.identity);
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
|
{
|
||||||
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
raftObject.transform.parent = newParent;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var pos = (Vector3)(info.position ?? Vector3.zero);
|
||||||
|
var rot = Quaternion.identity;
|
||||||
|
if (info.isRelativeToParent)
|
||||||
|
{
|
||||||
|
raftObject.transform.localPosition = pos;
|
||||||
|
raftObject.transform.localRotation = rot;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
raftObject.transform.position = planetGO.transform.TransformPoint(pos);
|
||||||
|
raftObject.transform.rotation = planetGO.transform.TransformRotation(rot);
|
||||||
|
}
|
||||||
|
|
||||||
StreamingHandler.SetUpStreaming(raftObject, sector);
|
StreamingHandler.SetUpStreaming(raftObject, sector);
|
||||||
|
|
||||||
|
|||||||
@ -252,14 +252,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
var shareStone = _shareStonePrefab.InstantiateInactive();
|
var shareStone = _shareStonePrefab.InstantiateInactive();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.rename))
|
shareStone.name = !string.IsNullOrEmpty(info.rename) ? info.rename : ("ShareStone_" + id.ToString());
|
||||||
{
|
|
||||||
shareStone.name = info.rename;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
shareStone.name = "ShareStone_" + id.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
shareStone.transform.parent = sector?.transform ?? go.transform;
|
shareStone.transform.parent = sector?.transform ?? go.transform;
|
||||||
|
|
||||||
|
|||||||
@ -99,10 +99,10 @@ namespace NewHorizons.Builder.Props
|
|||||||
private static void MakeTornado(GameObject planetGO, Sector sector, PropModule.TornadoInfo info, Vector3 position, bool downwards)
|
private static void MakeTornado(GameObject planetGO, Sector sector, PropModule.TornadoInfo info, Vector3 position, bool downwards)
|
||||||
{
|
{
|
||||||
var tornadoGO = downwards ? _downPrefab.InstantiateInactive() : _upPrefab.InstantiateInactive();
|
var tornadoGO = downwards ? _downPrefab.InstantiateInactive() : _upPrefab.InstantiateInactive();
|
||||||
tornadoGO.name = downwards ? "Tornado_Down" : "Tornado_Up";
|
tornadoGO.name = !string.IsNullOrEmpty(info.rename) ? info.rename : (downwards ? "Tornado_Down" : "Tornado_Up");
|
||||||
tornadoGO.transform.parent = sector.transform;
|
tornadoGO.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
tornadoGO.transform.position = planetGO.transform.TransformPoint(position);
|
tornadoGO.transform.position = planetGO.transform.TransformPoint(position);
|
||||||
tornadoGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, sector.transform.TransformDirection(position.normalized));
|
tornadoGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, planetGO.transform.TransformDirection(position.normalized));
|
||||||
|
|
||||||
// Add the sound thing before changing the scale
|
// Add the sound thing before changing the scale
|
||||||
var soundGO = _soundPrefab.InstantiateInactive();
|
var soundGO = _soundPrefab.InstantiateInactive();
|
||||||
@ -168,7 +168,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (info.wanderRate != 0)
|
if (info.wanderRate != 0)
|
||||||
{
|
{
|
||||||
ApplyWanderer(tornadoGO, sector, info);
|
ApplyWanderer(tornadoGO, planetGO, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
soundGO.SetActive(true);
|
soundGO.SetActive(true);
|
||||||
@ -179,9 +179,9 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
var hurricaneGO = _hurricanePrefab.InstantiateInactive();
|
var hurricaneGO = _hurricanePrefab.InstantiateInactive();
|
||||||
hurricaneGO.name = "Hurricane";
|
hurricaneGO.name = "Hurricane";
|
||||||
hurricaneGO.transform.parent = sector.transform;
|
hurricaneGO.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
hurricaneGO.transform.position = planetGO.transform.TransformPoint(position);
|
hurricaneGO.transform.position = planetGO.transform.TransformPoint(position);
|
||||||
hurricaneGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, sector.transform.TransformDirection(position.normalized));
|
hurricaneGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, planetGO.transform.TransformDirection(position.normalized));
|
||||||
|
|
||||||
var fluidVolume = hurricaneGO.GetComponentInChildren<HurricaneFluidVolume>();
|
var fluidVolume = hurricaneGO.GetComponentInChildren<HurricaneFluidVolume>();
|
||||||
fluidVolume._fluidType = info.fluidType.ConvertToOW(FluidVolume.Type.CLOUD);
|
fluidVolume._fluidType = info.fluidType.ConvertToOW(FluidVolume.Type.CLOUD);
|
||||||
@ -227,7 +227,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
if (info.wanderRate != 0)
|
if (info.wanderRate != 0)
|
||||||
{
|
{
|
||||||
ApplyWanderer(hurricaneGO, sector, info);
|
ApplyWanderer(hurricaneGO, planetGO, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
hurricaneGO.SetActive(true);
|
hurricaneGO.SetActive(true);
|
||||||
@ -263,13 +263,13 @@ namespace NewHorizons.Builder.Props
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ApplyWanderer(GameObject go, Sector sector, PropModule.TornadoInfo info)
|
private static void ApplyWanderer(GameObject go, GameObject planetGO, PropModule.TornadoInfo info)
|
||||||
{
|
{
|
||||||
var wanderer = go.AddComponent<NHTornadoWanderController>();
|
var wanderer = go.AddComponent<NHTornadoWanderController>();
|
||||||
wanderer.wanderRate = info.wanderRate;
|
wanderer.wanderRate = info.wanderRate;
|
||||||
wanderer.wanderDegreesX = info.wanderDegreesX;
|
wanderer.wanderDegreesX = info.wanderDegreesX;
|
||||||
wanderer.wanderDegreesZ = info.wanderDegreesZ;
|
wanderer.wanderDegreesZ = info.wanderDegreesZ;
|
||||||
wanderer.sector = sector;
|
wanderer.planetGO = planetGO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Props
|
namespace NewHorizons.Builder.Props
|
||||||
{
|
{
|
||||||
public static class VolcanoBuilder
|
public static class VolcanoBuilder
|
||||||
@ -44,10 +46,30 @@ namespace NewHorizons.Builder.Props
|
|||||||
InitPrefab();
|
InitPrefab();
|
||||||
|
|
||||||
var launcherGO = _meteorLauncherPrefab.InstantiateInactive();
|
var launcherGO = _meteorLauncherPrefab.InstantiateInactive();
|
||||||
launcherGO.transform.parent = sector.transform;
|
launcherGO.name = !string.IsNullOrEmpty(info.rename) ? info.rename : "MeteorLauncher";
|
||||||
|
launcherGO.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
launcherGO.transform.position = planetGO.transform.TransformPoint(info.position == null ? Vector3.zero : (Vector3)info.position);
|
launcherGO.transform.position = planetGO.transform.TransformPoint(info.position == null ? Vector3.zero : (Vector3)info.position);
|
||||||
launcherGO.transform.rotation = Quaternion.FromToRotation(launcherGO.transform.TransformDirection(Vector3.up), ((Vector3)info.position).normalized).normalized;
|
|
||||||
launcherGO.name = "MeteorLauncher";
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
|
{
|
||||||
|
var newParent = planetGO.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
launcherGO.transform.parent = newParent;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var pos = (Vector3)(info.position ?? Vector3.zero);
|
||||||
|
if (info.isRelativeToParent)
|
||||||
|
launcherGO.transform.localPosition = pos;
|
||||||
|
else
|
||||||
|
launcherGO.transform.position = planetGO.transform.TransformPoint(pos);
|
||||||
|
|
||||||
|
launcherGO.transform.rotation = Quaternion.FromToRotation(launcherGO.transform.TransformDirection(Vector3.up), pos.normalized).normalized;
|
||||||
|
|
||||||
var meteorLauncher = launcherGO.GetComponent<MeteorLauncher>();
|
var meteorLauncher = launcherGO.GetComponent<MeteorLauncher>();
|
||||||
meteorLauncher._audioSector = sector;
|
meteorLauncher._audioSector = sector;
|
||||||
|
|||||||
@ -2,6 +2,8 @@ using NewHorizons.External.Modules;
|
|||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
namespace NewHorizons.Builder.ShipLog
|
namespace NewHorizons.Builder.ShipLog
|
||||||
{
|
{
|
||||||
public static class EntryLocationBuilder
|
public static class EntryLocationBuilder
|
||||||
@ -9,10 +11,29 @@ namespace NewHorizons.Builder.ShipLog
|
|||||||
private static readonly List<ShipLogEntryLocation> _locationsToInitialize = new List<ShipLogEntryLocation>();
|
private static readonly List<ShipLogEntryLocation> _locationsToInitialize = new List<ShipLogEntryLocation>();
|
||||||
public static void Make(GameObject go, Sector sector, PropModule.EntryLocationInfo info, IModBehaviour mod)
|
public static void Make(GameObject go, Sector sector, PropModule.EntryLocationInfo info, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
GameObject entryLocationGameObject = new GameObject("Entry Location (" + info.id + ")");
|
GameObject entryLocationGameObject = new GameObject(!string.IsNullOrEmpty(info.rename) ? info.rename : ("Entry Location (" + info.id + ")"));
|
||||||
entryLocationGameObject.SetActive(false);
|
entryLocationGameObject.SetActive(false);
|
||||||
entryLocationGameObject.transform.parent = sector?.transform ?? go.transform;
|
entryLocationGameObject.transform.parent = sector?.transform ?? go.transform;
|
||||||
entryLocationGameObject.transform.position = go.transform.TransformPoint(info.position ?? Vector3.zero);
|
|
||||||
|
if (!string.IsNullOrEmpty(info.parentPath))
|
||||||
|
{
|
||||||
|
var newParent = go.transform.Find(info.parentPath);
|
||||||
|
if (newParent != null)
|
||||||
|
{
|
||||||
|
entryLocationGameObject.transform.parent = newParent;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.LogWarning($"Cannot find parent object at path: {go.name}/{info.parentPath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var pos = (Vector3)(info.position ?? Vector3.zero);
|
||||||
|
if (info.isRelativeToParent)
|
||||||
|
entryLocationGameObject.transform.localPosition = pos;
|
||||||
|
else
|
||||||
|
entryLocationGameObject.transform.position = go.transform.TransformPoint(pos);
|
||||||
|
|
||||||
ShipLogEntryLocation newLocation = entryLocationGameObject.AddComponent<ShipLogEntryLocation>();
|
ShipLogEntryLocation newLocation = entryLocationGameObject.AddComponent<ShipLogEntryLocation>();
|
||||||
newLocation._entryID = info.id;
|
newLocation._entryID = info.id;
|
||||||
newLocation._outerFogWarpVolume = go.GetComponentInChildren<OuterFogWarpVolume>();
|
newLocation._outerFogWarpVolume = go.GetComponentInChildren<OuterFogWarpVolume>();
|
||||||
|
|||||||
@ -7,7 +7,7 @@ namespace NewHorizons.Components
|
|||||||
public float wanderRate;
|
public float wanderRate;
|
||||||
public float wanderDegreesX;
|
public float wanderDegreesX;
|
||||||
public float wanderDegreesZ;
|
public float wanderDegreesZ;
|
||||||
public Sector sector;
|
public GameObject planetGO;
|
||||||
|
|
||||||
private float noiseOffset;
|
private float noiseOffset;
|
||||||
private float startDegreesX;
|
private float startDegreesX;
|
||||||
@ -47,7 +47,7 @@ namespace NewHorizons.Components
|
|||||||
var newPos = new Vector3(newX, newY, newZ);
|
var newPos = new Vector3(newX, newY, newZ);
|
||||||
|
|
||||||
transform.localPosition = newPos;
|
transform.localPosition = newPos;
|
||||||
transform.rotation = Quaternion.FromToRotation(Vector3.up, sector.transform.TransformDirection(newPos.normalized));
|
transform.rotation = Quaternion.FromToRotation(Vector3.up, planetGO.transform.TransformDirection(newPos.normalized));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
75
NewHorizons/External/Modules/PropModule.cs
vendored
75
NewHorizons/External/Modules/PropModule.cs
vendored
@ -243,6 +243,21 @@ namespace NewHorizons.External.Modules
|
|||||||
/// Acceleration of the raft. Default acceleration is 5.
|
/// Acceleration of the raft. Default acceleration is 5.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(5f)] public float acceleration = 5f;
|
[DefaultValue(5f)] public float acceleration = 5f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
|
||||||
|
/// </summary>
|
||||||
|
public string parentPath;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
|
||||||
|
/// </summary>
|
||||||
|
public bool isRelativeToParent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An optional rename of this object
|
||||||
|
/// </summary>
|
||||||
|
public string rename;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
@ -287,6 +302,16 @@ namespace NewHorizons.External.Modules
|
|||||||
/// Loudness of the geyser
|
/// Loudness of the geyser
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(0.7f)] public float volume = 0.7f;
|
[DefaultValue(0.7f)] public float volume = 0.7f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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]
|
[JsonObject]
|
||||||
@ -354,6 +379,21 @@ namespace NewHorizons.External.Modules
|
|||||||
/// Fluid type for sounds/effects when colliding with this tornado.
|
/// Fluid type for sounds/effects when colliding with this tornado.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue("cloud")] public FluidType fluidType = FluidType.Cloud;
|
[DefaultValue("cloud")] public FluidType fluidType = FluidType.Cloud;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
|
||||||
|
/// </summary>
|
||||||
|
public string parentPath;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
|
||||||
|
/// </summary>
|
||||||
|
public bool isRelativeToParent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An optional rename of this object
|
||||||
|
/// </summary>
|
||||||
|
public string rename;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
@ -402,6 +442,21 @@ namespace NewHorizons.External.Modules
|
|||||||
/// The colour of the meteor's stone.
|
/// The colour of the meteor's stone.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MColor stoneTint;
|
public MColor stoneTint;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
|
||||||
|
/// </summary>
|
||||||
|
public string parentPath;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
|
||||||
|
/// </summary>
|
||||||
|
public bool isRelativeToParent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An optional rename of this object
|
||||||
|
/// </summary>
|
||||||
|
public string rename;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
@ -489,6 +544,21 @@ namespace NewHorizons.External.Modules
|
|||||||
/// The position of this entry location
|
/// The position of this entry location
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MVector3 position;
|
public MVector3 position;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
|
||||||
|
/// </summary>
|
||||||
|
public string parentPath;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
|
||||||
|
/// </summary>
|
||||||
|
public bool isRelativeToParent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An optional rename of this object
|
||||||
|
/// </summary>
|
||||||
|
public string rename;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
@ -680,6 +750,11 @@ namespace NewHorizons.External.Modules
|
|||||||
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
|
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool isRelativeToParent;
|
public bool isRelativeToParent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An optional rename of this object
|
||||||
|
/// </summary>
|
||||||
|
public string rename;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
|
|||||||
@ -75,5 +75,20 @@ namespace NewHorizons.External.Modules.VariableSize
|
|||||||
/// Optional override for the render queue. If the singularity is rendering oddly, increasing this to 3000 can help
|
/// Optional override for the render queue. If the singularity is rendering oddly, increasing this to 3000 can help
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Range(2501f, 3500f)] public int renderQueueOverride = 2985;
|
[Range(2501f, 3500f)] public int renderQueueOverride = 2985;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
|
||||||
|
/// </summary>
|
||||||
|
public string parentPath;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
|
||||||
|
/// </summary>
|
||||||
|
public bool isRelativeToParent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An optional rename of this object
|
||||||
|
/// </summary>
|
||||||
|
public string rename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1162,6 +1162,18 @@
|
|||||||
"position": {
|
"position": {
|
||||||
"description": "The position of this entry location",
|
"description": "The position of this entry location",
|
||||||
"$ref": "#/definitions/MVector3"
|
"$ref": "#/definitions/MVector3"
|
||||||
|
},
|
||||||
|
"parentPath": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)."
|
||||||
|
},
|
||||||
|
"isRelativeToParent": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
|
||||||
|
},
|
||||||
|
"rename": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "An optional rename of this object"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1218,6 +1230,14 @@
|
|||||||
"description": "Loudness of the geyser",
|
"description": "Loudness of the geyser",
|
||||||
"format": "float",
|
"format": "float",
|
||||||
"default": 0.7
|
"default": 0.7
|
||||||
|
},
|
||||||
|
"parentPath": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)."
|
||||||
|
},
|
||||||
|
"rename": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "An optional rename of this object"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1390,6 +1410,18 @@
|
|||||||
"description": "Acceleration of the raft. Default acceleration is 5.",
|
"description": "Acceleration of the raft. Default acceleration is 5.",
|
||||||
"format": "float",
|
"format": "float",
|
||||||
"default": 5.0
|
"default": 5.0
|
||||||
|
},
|
||||||
|
"parentPath": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)."
|
||||||
|
},
|
||||||
|
"isRelativeToParent": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
|
||||||
|
},
|
||||||
|
"rename": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "An optional rename of this object"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1505,6 +1537,10 @@
|
|||||||
"isRelativeToParent": {
|
"isRelativeToParent": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
|
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
|
||||||
|
},
|
||||||
|
"rename": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "An optional rename of this object"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1707,6 +1743,18 @@
|
|||||||
"description": "Fluid type for sounds/effects when colliding with this tornado.",
|
"description": "Fluid type for sounds/effects when colliding with this tornado.",
|
||||||
"default": "cloud",
|
"default": "cloud",
|
||||||
"$ref": "#/definitions/FluidType"
|
"$ref": "#/definitions/FluidType"
|
||||||
|
},
|
||||||
|
"parentPath": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)."
|
||||||
|
},
|
||||||
|
"isRelativeToParent": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
|
||||||
|
},
|
||||||
|
"rename": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "An optional rename of this object"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1768,6 +1816,18 @@
|
|||||||
"stoneTint": {
|
"stoneTint": {
|
||||||
"description": "The colour of the meteor's stone.",
|
"description": "The colour of the meteor's stone.",
|
||||||
"$ref": "#/definitions/MColor"
|
"$ref": "#/definitions/MColor"
|
||||||
|
},
|
||||||
|
"parentPath": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)."
|
||||||
|
},
|
||||||
|
"isRelativeToParent": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
|
||||||
|
},
|
||||||
|
"rename": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "An optional rename of this object"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1828,6 +1888,18 @@
|
|||||||
"format": "int32",
|
"format": "int32",
|
||||||
"maximum": 3500.0,
|
"maximum": 3500.0,
|
||||||
"minimum": 2501.0
|
"minimum": 2501.0
|
||||||
|
},
|
||||||
|
"parentPath": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)."
|
||||||
|
},
|
||||||
|
"isRelativeToParent": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
|
||||||
|
},
|
||||||
|
"rename": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "An optional rename of this object"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net48" />
|
|
||||||
<package id="Lib.Harmony" version="2.1.1" targetFramework="net48" />
|
|
||||||
<package id="OWML" version="2.1.0" targetFramework="net48" />
|
|
||||||
</packages>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user