mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Migrate more modules to the GeneralPropBuilder
This commit is contained in:
parent
cc9e86d712
commit
3ca6d9a3db
@ -12,7 +12,7 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
public static class GeneralPropBuilder
|
||||
{
|
||||
public static GameObject MakeFromExisting(GameObject go, GameObject planetGO, Sector sector, PropModule.PositionedPropInfo info, bool alignToBody)
|
||||
public static GameObject MakeFromExisting(GameObject go, GameObject planetGO, Sector sector, PropModule.PositionedPropInfo info, bool alignToBody = false, MVector3 normal = null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(info.rename))
|
||||
{
|
||||
@ -52,24 +52,25 @@ namespace NewHorizons.Builder.Props
|
||||
if (alignToBody)
|
||||
{
|
||||
var up = (go.transform.position - planetGO.transform.position).normalized;
|
||||
if (normal != null) up = planetGO.transform.TransformDirection(normal);
|
||||
go.transform.rotation = Quaternion.FromToRotation(Vector3.up, up);
|
||||
go.transform.rotation *= rot;
|
||||
}
|
||||
return go;
|
||||
}
|
||||
|
||||
public static GameObject MakeNew(string defaultName, GameObject planetGO, Sector sector, PropModule.PositionedPropInfo info, bool alignToBody)
|
||||
public static GameObject MakeNew(string defaultName, GameObject planetGO, Sector sector, PropModule.PositionedPropInfo info, bool alignToBody = false, MVector3 normal = null)
|
||||
{
|
||||
GameObject go = new GameObject(defaultName);
|
||||
go.SetActive(false);
|
||||
return MakeFromExisting(go, planetGO, sector, info, alignToBody);
|
||||
return MakeFromExisting(go, planetGO, sector, info, alignToBody, normal);
|
||||
}
|
||||
|
||||
public static GameObject MakeFromPrefab(GameObject prefab, string defaultName, GameObject planetGO, Sector sector, PropModule.PositionedPropInfo info, bool alignToBody)
|
||||
public static GameObject MakeFromPrefab(GameObject prefab, string defaultName, GameObject planetGO, Sector sector, PropModule.PositionedPropInfo info, bool alignToBody = false, MVector3 normal = null)
|
||||
{
|
||||
GameObject go = prefab.InstantiateInactive();
|
||||
go.name = defaultName;
|
||||
return MakeFromExisting(go, planetGO, sector, info, alignToBody);
|
||||
return MakeFromExisting(go, planetGO, sector, info, alignToBody, normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
if (_slideReelPrefab == null) return null;
|
||||
|
||||
var slideReelObj = GeneralPropBuilder.MakeFromPrefab(_slideReelPrefab, $"Prefab_IP_Reel_{mod.ModHelper.Manifest.Name}", planetGO, sector, info, false);
|
||||
var slideReelObj = GeneralPropBuilder.MakeFromPrefab(_slideReelPrefab, $"Prefab_IP_Reel_{mod.ModHelper.Manifest.Name}", planetGO, sector, info);
|
||||
|
||||
var slideReel = slideReelObj.GetComponent<SlideReelItem>();
|
||||
slideReel.SetSector(sector);
|
||||
@ -166,7 +166,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
if (_autoPrefab == null) return null;
|
||||
|
||||
var projectorObj = GeneralPropBuilder.MakeFromPrefab(_autoPrefab, $"Prefab_IP_AutoProjector_{mod.ModHelper.Manifest.Name}", planetGO, sector, info, false);
|
||||
var projectorObj = GeneralPropBuilder.MakeFromPrefab(_autoPrefab, $"Prefab_IP_AutoProjector_{mod.ModHelper.Manifest.Name}", planetGO, sector, info);
|
||||
|
||||
var autoProjector = projectorObj.GetComponent<AutoSlideProjector>();
|
||||
autoProjector._sector = sector;
|
||||
|
||||
@ -50,7 +50,7 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
var socketInfo = quantumGroup.sockets[i];
|
||||
|
||||
var socket = GeneralPropBuilder.MakeNew("Socket " + i, go, sector, socketInfo, false);
|
||||
var socket = GeneralPropBuilder.MakeNew("Socket " + i, go, sector, socketInfo);
|
||||
|
||||
if (socketInfo.isRelativeToGroup)
|
||||
{
|
||||
|
||||
@ -52,7 +52,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
if (_prefab == null || sector == null) return null;
|
||||
|
||||
GameObject raftObject = GeneralPropBuilder.MakeFromPrefab(_prefab, "Raft_Body", planetGO, sector, info, false);
|
||||
GameObject raftObject = GeneralPropBuilder.MakeFromPrefab(_prefab, "Raft_Body", planetGO, sector, info);
|
||||
|
||||
StreamingHandler.SetUpStreaming(raftObject, sector);
|
||||
|
||||
|
||||
@ -109,26 +109,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
public static GameObject Make(GameObject planetGO, Sector sector, SignalModule.SignalInfo info, IModBehaviour mod)
|
||||
{
|
||||
var signalGO = new GameObject($"Signal_{info.name}");
|
||||
signalGO.SetActive(false);
|
||||
signalGO.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.parentPath))
|
||||
{
|
||||
var newParent = planetGO.transform.Find(info.parentPath);
|
||||
if (newParent != null)
|
||||
{
|
||||
signalGO.transform.parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||
}
|
||||
}
|
||||
|
||||
var pos = (Vector3)(info.position ?? Vector3.zero);
|
||||
if (info.isRelativeToParent) signalGO.transform.localPosition = pos;
|
||||
else signalGO.transform.position = planetGO.transform.TransformPoint(pos);
|
||||
var signalGO = GeneralPropBuilder.MakeNew($"Signal_{info.name}", planetGO, sector, info);
|
||||
signalGO.layer = LayerMask.NameToLayer("AdvancedEffectVolume");
|
||||
|
||||
var source = signalGO.AddComponent<AudioSource>();
|
||||
|
||||
@ -100,7 +100,9 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
var prefab = downwards ? _downPrefab.InstantiateInactive() : _upPrefab.InstantiateInactive();
|
||||
var tornadoGO = GeneralPropBuilder.MakeFromPrefab(prefab, downwards ? "Tornado_Down" : "Tornado_Up", planetGO, sector, info, true);
|
||||
if (info.position == null && !info.isRelativeToParent)
|
||||
|
||||
// Override general prop position with randomized default position
|
||||
if (info.position == null)
|
||||
{
|
||||
tornadoGO.transform.position = planetGO.transform.TransformPoint(position);
|
||||
}
|
||||
|
||||
@ -131,64 +131,25 @@ namespace NewHorizons.Builder.Props
|
||||
case PropModule.NomaiTextInfo.NomaiTextType.Wall:
|
||||
{
|
||||
var nomaiWallTextObj = MakeWallText(planetGO, sector, info, xmlPath, nhBody).gameObject;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.rename))
|
||||
|
||||
if (info.normal != null)
|
||||
{
|
||||
nomaiWallTextObj.name = info.rename;
|
||||
}
|
||||
// In global coordinates (normal was in local coordinates)
|
||||
var up = (nomaiWallTextObj.transform.position - planetGO.transform.position).normalized;
|
||||
var forward = planetGO.transform.TransformDirection(info.normal).normalized;
|
||||
|
||||
nomaiWallTextObj.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.parentPath))
|
||||
{
|
||||
var newParent = planetGO.transform.Find(info.parentPath);
|
||||
if (newParent != null)
|
||||
if (info.isRelativeToParent)
|
||||
{
|
||||
nomaiWallTextObj.transform.parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||
}
|
||||
}
|
||||
|
||||
var pos = (Vector3)(info.position ?? Vector3.zero);
|
||||
if (info.isRelativeToParent)
|
||||
{
|
||||
nomaiWallTextObj.transform.localPosition = pos;
|
||||
if (info.normal != null)
|
||||
{
|
||||
// In global coordinates (normal was in local coordinates)
|
||||
var up = (nomaiWallTextObj.transform.position - planetGO.transform.position).normalized;
|
||||
var forward = planetGO.transform.TransformDirection(info.normal).normalized;
|
||||
|
||||
nomaiWallTextObj.transform.up = up;
|
||||
nomaiWallTextObj.transform.forward = forward;
|
||||
}
|
||||
if (info.rotation != null)
|
||||
} else
|
||||
{
|
||||
nomaiWallTextObj.transform.localRotation = Quaternion.Euler(info.rotation);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nomaiWallTextObj.transform.position = planetGO.transform.TransformPoint(pos);
|
||||
if (info.normal != null)
|
||||
{
|
||||
// In global coordinates (normal was in local coordinates)
|
||||
var up = (nomaiWallTextObj.transform.position - planetGO.transform.position).normalized;
|
||||
var forward = planetGO.transform.TransformDirection(info.normal).normalized;
|
||||
|
||||
nomaiWallTextObj.transform.forward = forward;
|
||||
|
||||
var desiredUp = Vector3.ProjectOnPlane(up, forward);
|
||||
var zRotation = Vector3.SignedAngle(nomaiWallTextObj.transform.up, desiredUp, forward);
|
||||
nomaiWallTextObj.transform.RotateAround(nomaiWallTextObj.transform.position, forward, zRotation);
|
||||
}
|
||||
if (info.rotation != null)
|
||||
{
|
||||
nomaiWallTextObj.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(info.rotation));
|
||||
}
|
||||
}
|
||||
|
||||
// nomaiWallTextObj.GetComponent<NomaiTextArcArranger>().DrawBoundsWithDebugSpheres();
|
||||
@ -200,16 +161,7 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
case PropModule.NomaiTextInfo.NomaiTextType.Scroll:
|
||||
{
|
||||
var customScroll = _scrollPrefab.InstantiateInactive();
|
||||
|
||||
if (!string.IsNullOrEmpty(info.rename))
|
||||
{
|
||||
customScroll.name = info.rename;
|
||||
}
|
||||
else
|
||||
{
|
||||
customScroll.name = _scrollPrefab.name;
|
||||
}
|
||||
var customScroll = GeneralPropBuilder.MakeFromPrefab(_scrollPrefab, _scrollPrefab.name, planetGO, sector, info);
|
||||
|
||||
var nomaiWallText = MakeWallText(planetGO, sector, info, xmlPath, nhBody);
|
||||
nomaiWallText.transform.parent = customScroll.transform;
|
||||
@ -237,36 +189,6 @@ namespace NewHorizons.Builder.Props
|
||||
// Else when you put them down you can't pick them back up
|
||||
customScroll.GetComponent<OWCollider>()._physicsRemoved = false;
|
||||
|
||||
// Place scroll
|
||||
customScroll.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.parentPath))
|
||||
{
|
||||
var newParent = planetGO.transform.Find(info.parentPath);
|
||||
if (newParent != null)
|
||||
{
|
||||
customScroll.transform.parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||
}
|
||||
}
|
||||
|
||||
var pos = (Vector3)(info.position ?? Vector3.zero);
|
||||
if (info.isRelativeToParent) customScroll.transform.localPosition = pos;
|
||||
else customScroll.transform.position = planetGO.transform.TransformPoint(pos);
|
||||
|
||||
var up = planetGO.transform.InverseTransformPoint(customScroll.transform.position).normalized;
|
||||
if (info.rotation != null)
|
||||
{
|
||||
customScroll.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(info.rotation));
|
||||
}
|
||||
else
|
||||
{
|
||||
customScroll.transform.rotation = Quaternion.FromToRotation(customScroll.transform.up, up) * customScroll.transform.rotation;
|
||||
}
|
||||
|
||||
customScroll.SetActive(true);
|
||||
|
||||
Delay.FireOnNextUpdate(
|
||||
@ -291,39 +213,7 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
case PropModule.NomaiTextInfo.NomaiTextType.Computer:
|
||||
{
|
||||
var computerObject = _computerPrefab.InstantiateInactive();
|
||||
|
||||
if (!string.IsNullOrEmpty(info.rename))
|
||||
{
|
||||
computerObject.name = info.rename;
|
||||
}
|
||||
else
|
||||
{
|
||||
computerObject.name = _computerPrefab.name;
|
||||
}
|
||||
|
||||
computerObject.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.parentPath))
|
||||
{
|
||||
var newParent = planetGO.transform.Find(info.parentPath);
|
||||
if (newParent != null)
|
||||
{
|
||||
computerObject.transform.parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||
}
|
||||
}
|
||||
|
||||
var pos = (Vector3)(info.position ?? Vector3.zero);
|
||||
if (info.isRelativeToParent) computerObject.transform.localPosition = pos;
|
||||
else computerObject.transform.position = planetGO.transform.TransformPoint(pos);
|
||||
|
||||
var up = computerObject.transform.position - planetGO.transform.position;
|
||||
if (info.normal != null) up = planetGO.transform.TransformDirection(info.normal);
|
||||
computerObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, up) * computerObject.transform.rotation;
|
||||
var computerObject = GeneralPropBuilder.MakeFromPrefab(_computerPrefab, _computerPrefab.name, planetGO, sector, info, true, info.normal);
|
||||
|
||||
var computer = computerObject.GetComponent<NomaiComputer>();
|
||||
computer.SetSector(sector);
|
||||
@ -395,48 +285,8 @@ namespace NewHorizons.Builder.Props
|
||||
case PropModule.NomaiTextInfo.NomaiTextType.Cairn:
|
||||
case PropModule.NomaiTextInfo.NomaiTextType.CairnVariant:
|
||||
{
|
||||
var cairnObject = (info.type == PropModule.NomaiTextInfo.NomaiTextType.CairnVariant ? _cairnVariantPrefab : _cairnPrefab).InstantiateInactive();
|
||||
|
||||
if (!string.IsNullOrEmpty(info.rename))
|
||||
{
|
||||
cairnObject.name = info.rename;
|
||||
}
|
||||
else
|
||||
{
|
||||
cairnObject.name = _cairnPrefab.name;
|
||||
}
|
||||
|
||||
cairnObject.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.parentPath))
|
||||
{
|
||||
var newParent = planetGO.transform.Find(info.parentPath);
|
||||
if (newParent != null)
|
||||
{
|
||||
cairnObject.transform.parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||
}
|
||||
}
|
||||
|
||||
var pos = (Vector3)(info.position ?? Vector3.zero);
|
||||
if (info.isRelativeToParent) cairnObject.transform.localPosition = pos;
|
||||
else cairnObject.transform.position = planetGO.transform.TransformPoint(pos);
|
||||
|
||||
if (info.rotation != null)
|
||||
{
|
||||
var rot = Quaternion.Euler(info.rotation);
|
||||
if (info.isRelativeToParent) cairnObject.transform.localRotation = rot;
|
||||
else cairnObject.transform.rotation = planetGO.transform.TransformRotation(rot);
|
||||
}
|
||||
else
|
||||
{
|
||||
// By default align it to normal
|
||||
var up = (cairnObject.transform.position - planetGO.transform.position).normalized;
|
||||
cairnObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, up) * cairnObject.transform.rotation;
|
||||
}
|
||||
var cairnPrefab = info.type == PropModule.NomaiTextInfo.NomaiTextType.CairnVariant ? _cairnVariantPrefab : _cairnPrefab;
|
||||
var cairnObject = GeneralPropBuilder.MakeFromPrefab(cairnPrefab, _cairnPrefab.name, planetGO, sector, info, info.rotation == null);
|
||||
|
||||
// Idk do we have to set it active before finding things?
|
||||
cairnObject.SetActive(true);
|
||||
@ -476,17 +326,12 @@ namespace NewHorizons.Builder.Props
|
||||
rotation = info.rotation,
|
||||
position = info.position,
|
||||
isRelativeToParent = info.isRelativeToParent,
|
||||
rename = info.rename
|
||||
rename = info.rename,
|
||||
alignToNormal = info.rotation == null,
|
||||
};
|
||||
var recorderObject = DetailBuilder.Make(planetGO, sector, prefab, detailInfo);
|
||||
recorderObject.SetActive(false);
|
||||
|
||||
if (info.rotation == null)
|
||||
{
|
||||
var up = recorderObject.transform.position - planetGO.transform.position;
|
||||
recorderObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, up) * recorderObject.transform.rotation;
|
||||
}
|
||||
|
||||
var nomaiText = recorderObject.GetComponentInChildren<NomaiText>();
|
||||
nomaiText.SetSector(sector);
|
||||
|
||||
@ -504,52 +349,11 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
case PropModule.NomaiTextInfo.NomaiTextType.Trailmarker:
|
||||
{
|
||||
var trailmarkerObject = _trailmarkerPrefab.InstantiateInactive();
|
||||
|
||||
if (!string.IsNullOrEmpty(info.rename))
|
||||
{
|
||||
trailmarkerObject.name = info.rename;
|
||||
}
|
||||
else
|
||||
{
|
||||
trailmarkerObject.name = _trailmarkerPrefab.name;
|
||||
}
|
||||
|
||||
trailmarkerObject.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.parentPath))
|
||||
{
|
||||
var newParent = planetGO.transform.Find(info.parentPath);
|
||||
if (newParent != null)
|
||||
{
|
||||
trailmarkerObject.transform.parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||
}
|
||||
}
|
||||
|
||||
var pos = (Vector3)(info.position ?? Vector3.zero);
|
||||
if (info.isRelativeToParent) trailmarkerObject.transform.localPosition = pos;
|
||||
else trailmarkerObject.transform.position = planetGO.transform.TransformPoint(pos);
|
||||
var trailmarkerObject = GeneralPropBuilder.MakeFromPrefab(_trailmarkerPrefab, _trailmarkerPrefab.name, planetGO, sector, info, info.rotation == null);
|
||||
|
||||
// shrink because that is what mobius does on all trailmarkers or else they are the size of the player
|
||||
trailmarkerObject.transform.localScale = Vector3.one * 0.75f;
|
||||
|
||||
if (info.rotation != null)
|
||||
{
|
||||
var rot = Quaternion.Euler(info.rotation);
|
||||
if (info.isRelativeToParent) trailmarkerObject.transform.localRotation = rot;
|
||||
else trailmarkerObject.transform.rotation = planetGO.transform.TransformRotation(rot);
|
||||
}
|
||||
else
|
||||
{
|
||||
// By default align it to normal
|
||||
var up = (trailmarkerObject.transform.position - planetGO.transform.position).normalized;
|
||||
trailmarkerObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, up) * trailmarkerObject.transform.rotation;
|
||||
}
|
||||
|
||||
// Idk do we have to set it active before finding things?
|
||||
trailmarkerObject.SetActive(true);
|
||||
|
||||
@ -576,8 +380,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
private static NomaiWallText MakeWallText(GameObject go, Sector sector, PropModule.NomaiTextInfo info, string xmlPath, NewHorizonsBody nhBody)
|
||||
{
|
||||
GameObject nomaiWallTextObj = new GameObject("NomaiWallText");
|
||||
nomaiWallTextObj.SetActive(false);
|
||||
GameObject nomaiWallTextObj = GeneralPropBuilder.MakeNew("NomaiWallText", go, sector, info);
|
||||
|
||||
var box = nomaiWallTextObj.AddComponent<BoxCollider>();
|
||||
box.center = new Vector3(-0.0643f, 1.1254f, 0f);
|
||||
|
||||
@ -12,7 +12,7 @@ namespace NewHorizons.Builder.ShipLog
|
||||
private static readonly List<ShipLogEntryLocation> _locationsToInitialize = new List<ShipLogEntryLocation>();
|
||||
public static void Make(GameObject go, Sector sector, PropModule.EntryLocationInfo info, IModBehaviour mod)
|
||||
{
|
||||
GameObject entryLocationGameObject = GeneralPropBuilder.MakeNew("Entry Location (" + info.id + ")", go, sector, info, false);
|
||||
GameObject entryLocationGameObject = GeneralPropBuilder.MakeNew("Entry Location (" + info.id + ")", go, sector, info);
|
||||
|
||||
ShipLogEntryLocation newLocation = entryLocationGameObject.AddComponent<ShipLogEntryLocation>();
|
||||
newLocation._entryID = info.id;
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
using NewHorizons.Builder.Props;
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.External.Modules;
|
||||
using UnityEngine;
|
||||
@ -9,32 +10,7 @@ namespace NewHorizons.Builder.Volumes
|
||||
{
|
||||
public static TVolume Make<TVolume>(GameObject planetGO, Sector sector, VolumesModule.VolumeInfo info) where TVolume : MonoBehaviour //Could be BaseVolume but I need to create vanilla volumes too.
|
||||
{
|
||||
var go = new GameObject(typeof(TVolume).Name);
|
||||
go.SetActive(false);
|
||||
|
||||
go.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
|
||||
if (!string.IsNullOrEmpty(info.rename))
|
||||
{
|
||||
go.name = info.rename;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(info.parentPath))
|
||||
{
|
||||
var newParent = planetGO.transform.Find(info.parentPath);
|
||||
if (newParent != null)
|
||||
{
|
||||
go.transform.parent = newParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
||||
}
|
||||
}
|
||||
|
||||
var pos = (Vector3)(info.position ?? Vector3.zero);
|
||||
if (info.isRelativeToParent) go.transform.localPosition = pos;
|
||||
else go.transform.position = planetGO.transform.TransformPoint(pos);
|
||||
var go = GeneralPropBuilder.MakeNew(typeof(TVolume).Name, planetGO, sector, info);
|
||||
go.layer = LayerMask.NameToLayer("BasicEffectVolume");
|
||||
|
||||
var shape = go.AddComponent<SphereShape>();
|
||||
|
||||
17
NewHorizons/External/Modules/SignalModule.cs
vendored
17
NewHorizons/External/Modules/SignalModule.cs
vendored
@ -15,7 +15,7 @@ namespace NewHorizons.External.Modules
|
||||
public SignalInfo[] signals;
|
||||
|
||||
[JsonObject]
|
||||
public class SignalInfo
|
||||
public class SignalInfo : PropModule.PositionedPropInfo
|
||||
{
|
||||
[Obsolete("audioClip is deprecated, please use audio instead")]
|
||||
public string audioClip;
|
||||
@ -61,11 +61,6 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
[DefaultValue(true)] public bool onlyAudibleToScope = true;
|
||||
|
||||
/// <summary>
|
||||
/// Position of the signal's source
|
||||
/// </summary>
|
||||
public MVector3 position;
|
||||
|
||||
/// <summary>
|
||||
/// A ship log fact to reveal when the signal is identified.
|
||||
/// </summary>
|
||||
@ -75,16 +70,6 @@ namespace NewHorizons.External.Modules
|
||||
/// Radius of the sphere giving off the signal.
|
||||
/// </summary>
|
||||
[DefaultValue(1f)] public float sourceRadius = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// The relative path from the planet to the parent of this signal. 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
NewHorizons/External/Modules/VolumesModule.cs
vendored
22
NewHorizons/External/Modules/VolumesModule.cs
vendored
@ -117,33 +117,13 @@ namespace NewHorizons.External.Modules
|
||||
public LoadCreditsVolumeInfo[] creditsVolume;
|
||||
|
||||
[JsonObject]
|
||||
public class VolumeInfo
|
||||
public class VolumeInfo : PropModule.PositionedPropInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The location of this volume. Optional (will default to 0,0,0).
|
||||
/// </summary>
|
||||
public MVector3 position;
|
||||
|
||||
/// <summary>
|
||||
/// The radius of this volume.
|
||||
/// </summary>
|
||||
[DefaultValue(1f)]
|
||||
public float radius = 1f;
|
||||
|
||||
/// <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 coordinates are relative to parent instead of the root planet object.
|
||||
/// </summary>
|
||||
public bool isRelativeToParent;
|
||||
|
||||
/// <summary>
|
||||
/// An optional rename of this volume.
|
||||
/// </summary>
|
||||
public string rename;
|
||||
}
|
||||
|
||||
[JsonObject]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user