mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add proxy details
This commit is contained in:
parent
c04626b4b0
commit
b6e2c1906f
@ -1,4 +1,5 @@
|
||||
using NewHorizons.Builder.Atmosphere;
|
||||
using NewHorizons.Builder.Props;
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.Components.SizeControllers;
|
||||
using NewHorizons.External.VariableSize;
|
||||
@ -23,7 +24,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
public static void Make(GameObject gameObject, NewHorizonsBody body)
|
||||
{
|
||||
if(lavaMaterial == null) lavaMaterial = SearchUtilities.FindObjectOfTypeAndName<ProxyOrbiter>("VolcanicMoon_Body").transform.Find("LavaSphere").GetComponent<MeshRenderer>().material;
|
||||
if (lavaMaterial == null) lavaMaterial = SearchUtilities.FindObjectOfTypeAndName<ProxyOrbiter>("VolcanicMoon_Body").transform.Find("LavaSphere").GetComponent<MeshRenderer>().material;
|
||||
|
||||
var proxyName = $"{body.Config.Name}_Proxy";
|
||||
|
||||
@ -91,7 +92,7 @@ namespace NewHorizons.Builder.Body
|
||||
// Could improve this to actually use the proper renders and materials
|
||||
if (body.Config.Singularity != null)
|
||||
{
|
||||
if(body.Config.Singularity.Type == "BlackHole")
|
||||
if (body.Config.Singularity.Type == "BlackHole")
|
||||
{
|
||||
MakeBlackHole(newProxy, body.Config.Singularity.Size);
|
||||
}
|
||||
@ -106,6 +107,13 @@ namespace NewHorizons.Builder.Body
|
||||
{
|
||||
CometTailBuilder.Make(newProxy, null, body.Config);
|
||||
}
|
||||
if (body.Config.Props?.ProxyDetails != null)
|
||||
{
|
||||
foreach (var detailInfo in body.Config.Props.ProxyDetails)
|
||||
{
|
||||
DetailBuilder.Make(newProxy, null, body.Config, body.Mod, body.Mod.ModHelper.Manifest.UniqueName, detailInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all collisions if there are any
|
||||
foreach (var col in newProxy.GetComponentsInChildren<Collider>())
|
||||
|
||||
@ -33,7 +33,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
sunAudio.name = "Audio_Star";
|
||||
|
||||
if(starModule.HasAtmosphere)
|
||||
if (starModule.HasAtmosphere)
|
||||
{
|
||||
var sunAtmosphere = GameObject.Instantiate(GameObject.Find("Sun_Body/Atmosphere_SUN"), planetGO.transform);
|
||||
sunAtmosphere.transform.position = planetGO.transform.position;
|
||||
|
||||
@ -42,9 +42,9 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
else detailGO = MakeDetail(go, sector, detail.path, detail.position, detail.rotation, detail.scale, detail.alignToNormal);
|
||||
|
||||
if(detailGO != null && detail.removeChildren != null)
|
||||
if (detailGO != null && detail.removeChildren != null)
|
||||
{
|
||||
foreach(var childPath in detail.removeChildren)
|
||||
foreach (var childPath in detail.removeChildren)
|
||||
{
|
||||
var childObj = detailGO.transform.Find(childPath);
|
||||
if (childObj != null) childObj.gameObject.SetActive(false);
|
||||
@ -52,7 +52,7 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
|
||||
if(detailGO != null && detail.removeComponents)
|
||||
if (detailGO != null && detail.removeComponents)
|
||||
{
|
||||
// Just swap all the children to a new game object
|
||||
var newDetailGO = new GameObject(detailGO.name);
|
||||
@ -60,11 +60,11 @@ namespace NewHorizons.Builder.Props
|
||||
newDetailGO.transform.parent = detailGO.transform.parent;
|
||||
// Can't modify parents while looping through children bc idk
|
||||
var children = new List<Transform>();
|
||||
foreach(Transform child in detailGO.transform)
|
||||
foreach (Transform child in detailGO.transform)
|
||||
{
|
||||
children.Add(child);
|
||||
}
|
||||
foreach(var child in children)
|
||||
foreach (var child in children)
|
||||
{
|
||||
child.parent = newDetailGO.transform;
|
||||
}
|
||||
@ -87,7 +87,7 @@ namespace NewHorizons.Builder.Props
|
||||
GameObject prop = GameObject.Instantiate(prefab, sector.transform);
|
||||
prop.SetActive(false);
|
||||
|
||||
sector.OnOccupantEnterSector += (SectorDetector sd) => OWAssetHandler.OnOccupantEnterSector(prop, sd, sector);
|
||||
if (sector != null) sector.OnOccupantEnterSector += (SectorDetector sd) => OWAssetHandler.OnOccupantEnterSector(prop, sd, sector);
|
||||
OWAssetHandler.LoadObject(prop);
|
||||
|
||||
foreach (var component in prop.GetComponents<Component>().Concat(prop.GetComponentsInChildren<Component>()))
|
||||
@ -96,7 +96,10 @@ namespace NewHorizons.Builder.Props
|
||||
var enabledField = component?.GetType()?.GetField("enabled");
|
||||
if (enabledField != null && enabledField.FieldType == typeof(bool)) Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => enabledField.SetValue(component, true));
|
||||
|
||||
if(component is Sector)
|
||||
// Fix a bunch of sector stuff
|
||||
if (sector != null)
|
||||
{
|
||||
if (component is Sector)
|
||||
{
|
||||
(component as Sector)._parentSector = sector;
|
||||
}
|
||||
@ -105,7 +108,7 @@ namespace NewHorizons.Builder.Props
|
||||
if (component is GhostIK) (component as GhostIK).enabled = false;
|
||||
if (component is GhostEffects) (component as GhostEffects).enabled = false;
|
||||
|
||||
if(component is DarkMatterVolume)
|
||||
if (component is DarkMatterVolume)
|
||||
{
|
||||
var probeVisuals = component.gameObject.transform.Find("ProbeVisuals");
|
||||
if (probeVisuals != null) probeVisuals.gameObject.SetActive(true);
|
||||
@ -134,15 +137,16 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
|
||||
// Fix slide reel
|
||||
if(component is SlideCollectionContainer)
|
||||
if (component is SlideCollectionContainer)
|
||||
{
|
||||
sector.OnOccupantEnterSector.AddListener((_) => (component as SlideCollectionContainer).LoadStreamingTextures());
|
||||
}
|
||||
|
||||
if(component is OWItemSocket)
|
||||
if (component is OWItemSocket)
|
||||
{
|
||||
(component as OWItemSocket)._sector = sector;
|
||||
}
|
||||
}
|
||||
|
||||
// Fix a bunch of stuff when done loading
|
||||
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () =>
|
||||
|
||||
1
NewHorizons/External/PropModule.cs
vendored
1
NewHorizons/External/PropModule.cs
vendored
@ -20,6 +20,7 @@ namespace NewHorizons.External
|
||||
public EntryLocationInfo[] EntryLocation;
|
||||
public NomaiTextInfo[] NomaiText;
|
||||
public ProjectionInfo[] SlideShows;
|
||||
public DetailInfo[] ProxyDetails;
|
||||
|
||||
public class ScatterInfo
|
||||
{
|
||||
|
||||
@ -112,6 +112,48 @@
|
||||
"description": "Colour of the terrain."
|
||||
}
|
||||
}
|
||||
},
|
||||
"detail": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string",
|
||||
"description": "Either the path in the scene hierarchy of the item to copy or the path to the object in the supplied asset bundle"
|
||||
},
|
||||
"assetBundle": {
|
||||
"type": "string",
|
||||
"description": "Relative filepath to an asset-bundle"
|
||||
},
|
||||
"position": {
|
||||
"$ref": "#/$defs/vector3"
|
||||
},
|
||||
"rotation": {
|
||||
"$ref": "#/$defs/vector3",
|
||||
"description": "Euler angle degrees"
|
||||
},
|
||||
"scale": {
|
||||
"type": "number",
|
||||
"default": 1
|
||||
},
|
||||
"alignToNormal": {
|
||||
"type": "boolean",
|
||||
"description": "Do we override rotation and try to automatically align this object to stand upright on the body's surface?",
|
||||
"default": false
|
||||
},
|
||||
"removeChildren": {
|
||||
"type": "array",
|
||||
"description": "A list of children to remove from this detail",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"removeComponents": {
|
||||
"type": "boolean",
|
||||
"description": "Do we reset all the components on this object? Useful for certain props that have dialogue components attached to them.",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "Body",
|
||||
@ -633,46 +675,7 @@
|
||||
"details": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string",
|
||||
"description": "Either the path in the scene hierarchy of the item to copy or the path to the object in the supplied asset bundle"
|
||||
},
|
||||
"assetBundle": {
|
||||
"type": "string",
|
||||
"description": "Relative filepath to an asset-bundle"
|
||||
},
|
||||
"position": {
|
||||
"$ref": "#/$defs/vector3"
|
||||
},
|
||||
"rotation": {
|
||||
"$ref": "#/$defs/vector3",
|
||||
"description": "Euler angle degrees"
|
||||
},
|
||||
"scale": {
|
||||
"type": "number",
|
||||
"default": 1
|
||||
},
|
||||
"alignToNormal": {
|
||||
"type": "boolean",
|
||||
"description": "Do we override rotation and try to automatically align this object to stand upright on the body's surface?",
|
||||
"default": false
|
||||
},
|
||||
"removeChildren": {
|
||||
"type": "array",
|
||||
"description": "A list of children to remove from this detail",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"removeComponents": {
|
||||
"type": "boolean",
|
||||
"description": "Do we reset all the components on this object? Useful for certain props that have dialogue components attached to them.",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
"$ref": "#/$defs/detail"
|
||||
}
|
||||
},
|
||||
"dialogue": {
|
||||
@ -1065,6 +1068,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"proxyDetails": {
|
||||
"type": "array",
|
||||
"description": "Details which will be shown from 50km away. Meant to be lower resolution.",
|
||||
"items": {
|
||||
"$ref": "#/$defs/detail"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user