Add proxy details

This commit is contained in:
Nick 2022-05-15 00:28:51 -04:00
parent c04626b4b0
commit b6e2c1906f
5 changed files with 114 additions and 91 deletions

View File

@ -1,4 +1,5 @@
using NewHorizons.Builder.Atmosphere;
using NewHorizons.Builder.Props;
using NewHorizons.Components;
using NewHorizons.Components.SizeControllers;
using NewHorizons.External.VariableSize;
@ -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>())

View File

@ -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,6 +96,9 @@ 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));
// Fix a bunch of sector stuff
if (sector != null)
{
if (component is Sector)
{
(component as Sector)._parentSector = sector;
@ -143,6 +146,7 @@ namespace NewHorizons.Builder.Props
{
(component as OWItemSocket)._sector = sector;
}
}
// Fix a bunch of stuff when done loading
Main.Instance.ModHelper.Events.Unity.RunWhen(() => Main.IsSystemReady, () =>

View File

@ -20,6 +20,7 @@ namespace NewHorizons.External
public EntryLocationInfo[] EntryLocation;
public NomaiTextInfo[] NomaiText;
public ProjectionInfo[] SlideShows;
public DetailInfo[] ProxyDetails;
public class ScatterInfo
{

View File

@ -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"
}
}
}
},