mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
0.13.1 (#102)
* Update PropModule.cs * Debugging FluidDetector AddVolume * Catch exceptions if they don't have the DLC * Update PropBuildManager.cs * Added the ability to make custom sky boxes * Move config reset to `ResetConfigs` in Main.cs * Bump version Co-authored-by: Nick <nicholasconnors@hotmail.ca>
This commit is contained in:
parent
e3070b2b20
commit
e19e486f9d
@ -50,7 +50,6 @@ namespace NewHorizons.Builder.Props
|
||||
_ghostArcPrefabs = new List<GameObject>();
|
||||
foreach (var existingArc in existingGhostArcs)
|
||||
{
|
||||
Logger.Log("Found ghost");
|
||||
var arc = existingArc.InstantiateInactive();
|
||||
arc.name = "Arc";
|
||||
_ghostArcPrefabs.Add(arc);
|
||||
@ -313,7 +312,7 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
arc = _childArcPrefabs[Random.Range(0, _childArcPrefabs.Count())].InstantiateInactive();
|
||||
}
|
||||
else if(type == "stranger")
|
||||
else if(type == "stranger" && _ghostArcPrefabs.Count() > 0) // It could be empty if they dont have the DLC
|
||||
{
|
||||
arc = _ghostArcPrefabs[Random.Range(0, _ghostArcPrefabs.Count())].InstantiateInactive();
|
||||
}
|
||||
|
||||
@ -28,7 +28,12 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
if (_slideReelPrefab == null)
|
||||
{
|
||||
_slideReelPrefab = GameObject.Find("RingWorld_Body/Sector_RingInterior/Sector_Zone1/Sector_SlideBurningRoom_Zone1/Interactables_SlideBurningRoom_Zone1/Prefab_IP_SecretAlcove/RotationPivot/SlideReelSocket/Prefab_IP_Reel_1_LibraryPath").gameObject.InstantiateInactive();
|
||||
_slideReelPrefab = GameObject.Find("RingWorld_Body/Sector_RingInterior/Sector_Zone1/Sector_SlideBurningRoom_Zone1/Interactables_SlideBurningRoom_Zone1/Prefab_IP_SecretAlcove/RotationPivot/SlideReelSocket/Prefab_IP_Reel_1_LibraryPath")?.gameObject?.InstantiateInactive();
|
||||
if (_slideReelPrefab == null)
|
||||
{
|
||||
Logger.LogWarning($"Tried to make a slide reel but couldn't. Do you have the DLC installed?");
|
||||
return;
|
||||
}
|
||||
_slideReelPrefab.name = "Prefab_IP_Reel";
|
||||
}
|
||||
|
||||
@ -101,7 +106,12 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
if (_autoPrefab == null)
|
||||
{
|
||||
_autoPrefab = GameObject.Find("RingWorld_Body/Sector_RingInterior/Sector_Zone4/Sector_BlightedShore/Sector_JammingControlRoom_Zone4/Interactables_JammingControlRoom_Zone4/AutoProjector_SignalJammer/Prefab_IP_AutoProjector_SignalJammer").gameObject.InstantiateInactive();
|
||||
_autoPrefab = GameObject.Find("RingWorld_Body/Sector_RingInterior/Sector_Zone4/Sector_BlightedShore/Sector_JammingControlRoom_Zone4/Interactables_JammingControlRoom_Zone4/AutoProjector_SignalJammer/Prefab_IP_AutoProjector_SignalJammer")?.gameObject?.InstantiateInactive();
|
||||
if (_autoPrefab == null)
|
||||
{
|
||||
Logger.LogWarning($"Tried to make a auto projector but couldn't. Do you have the DLC installed?");
|
||||
return;
|
||||
}
|
||||
_autoPrefab.name = "Prefab_IP_AutoProjector";
|
||||
}
|
||||
|
||||
|
||||
@ -22,77 +22,155 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
if (config.Props.Scatter != null)
|
||||
{
|
||||
ScatterBuilder.Make(go, sector, config, mod, uniqueModName);
|
||||
try
|
||||
{
|
||||
ScatterBuilder.Make(go, sector, config, mod, uniqueModName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make planet scatter for [{go.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
if(config.Props.Details != null)
|
||||
if (config.Props.Details != null)
|
||||
{
|
||||
foreach (var detail in config.Props.Details)
|
||||
{
|
||||
DetailBuilder.Make(go, sector, config, mod, uniqueModName, detail);
|
||||
try
|
||||
{
|
||||
DetailBuilder.Make(go, sector, config, mod, uniqueModName, detail);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make planet detail [{detail.path}] for [{go.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(config.Props.Geysers != null)
|
||||
if (config.Props.Geysers != null)
|
||||
{
|
||||
foreach(var geyserInfo in config.Props.Geysers)
|
||||
foreach (var geyserInfo in config.Props.Geysers)
|
||||
{
|
||||
GeyserBuilder.Make(go, sector, geyserInfo);
|
||||
try
|
||||
{
|
||||
GeyserBuilder.Make(go, sector, geyserInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make geyser for [{go.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(config.Props.Rafts != null)
|
||||
if (Main.HasDLC && config.Props.Rafts != null)
|
||||
{
|
||||
foreach(var raftInfo in config.Props.Rafts)
|
||||
foreach (var raftInfo in config.Props.Rafts)
|
||||
{
|
||||
RaftBuilder.Make(go, sector, raftInfo, planetBody);
|
||||
try
|
||||
{
|
||||
RaftBuilder.Make(go, sector, raftInfo, planetBody);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make raft for [{go.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(config.Props.Tornados != null)
|
||||
if (config.Props.Tornados != null)
|
||||
{
|
||||
foreach(var tornadoInfo in config.Props.Tornados)
|
||||
foreach (var tornadoInfo in config.Props.Tornados)
|
||||
{
|
||||
TornadoBuilder.Make(go, sector, tornadoInfo, config.Atmosphere?.Cloud != null);
|
||||
try
|
||||
{
|
||||
TornadoBuilder.Make(go, sector, tornadoInfo, config.Atmosphere?.Cloud != null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make tornado for [{go.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Props.Volcanoes != null)
|
||||
{
|
||||
foreach (var volcanoInfo in config.Props.Volcanoes)
|
||||
{
|
||||
VolcanoBuilder.Make(go, sector, volcanoInfo);
|
||||
try
|
||||
{
|
||||
VolcanoBuilder.Make(go, sector, volcanoInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make volcano for [{go.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
// Reminder that dialogue has to be built after props if they're going to be using CharacterAnimController stuff
|
||||
if (config.Props.Dialogue != null)
|
||||
{
|
||||
foreach(var dialogueInfo in config.Props.Dialogue)
|
||||
foreach (var dialogueInfo in config.Props.Dialogue)
|
||||
{
|
||||
DialogueBuilder.Make(go, sector, dialogueInfo, mod);
|
||||
try
|
||||
{
|
||||
DialogueBuilder.Make(go, sector, dialogueInfo, mod);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make dialogue [{dialogueInfo.xmlFile}] for [{go.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Props.Reveal != null)
|
||||
{
|
||||
foreach (var revealInfo in config.Props.Reveal)
|
||||
{
|
||||
RevealBuilder.Make(go, sector, revealInfo, mod);
|
||||
try
|
||||
{
|
||||
RevealBuilder.Make(go, sector, revealInfo, mod);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make reveal location [{revealInfo.reveals}] for [{go.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.Props.EntryLocation != null)
|
||||
{
|
||||
foreach (var entryLocationInfo in config.Props.EntryLocation)
|
||||
{
|
||||
EntryLocationBuilder.Make(go, sector, entryLocationInfo, mod);
|
||||
try
|
||||
{
|
||||
EntryLocationBuilder.Make(go, sector, entryLocationInfo, mod);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make entry location [{entryLocationInfo.id}] for [{go.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(config.Props.NomaiText != null)
|
||||
if (config.Props.NomaiText != null)
|
||||
{
|
||||
foreach(var nomaiTextInfo in config.Props.NomaiText)
|
||||
foreach (var nomaiTextInfo in config.Props.NomaiText)
|
||||
{
|
||||
NomaiTextBuilder.Make(go, sector, nomaiTextInfo, mod);
|
||||
}
|
||||
}
|
||||
if(config.Props.SlideShows != null)
|
||||
try
|
||||
{
|
||||
NomaiTextBuilder.Make(go, sector, nomaiTextInfo, mod);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make text [{nomaiTextInfo.xmlFile}] for [{go.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (Main.HasDLC && config.Props.SlideShows != null)
|
||||
{
|
||||
foreach (var slideReelInfo in config.Props.SlideShows)
|
||||
{
|
||||
ProjectionBuilder.Make(go, sector, slideReelInfo, mod);
|
||||
try
|
||||
{
|
||||
ProjectionBuilder.Make(go, sector, slideReelInfo, mod);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make slide reel for [{go.name}] : {ex.Message}, {ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,12 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
if(_prefab == null)
|
||||
{
|
||||
_prefab = GameObject.FindObjectOfType<RaftController>().gameObject.InstantiateInactive();
|
||||
_prefab = GameObject.FindObjectOfType<RaftController>()?.gameObject?.InstantiateInactive();
|
||||
if (_prefab == null)
|
||||
{
|
||||
Logger.LogWarning($"Tried to make a raft but couldn't. Do you have the DLC installed?");
|
||||
return;
|
||||
}
|
||||
_prefab.name = "Raft_Body_Prefab";
|
||||
}
|
||||
|
||||
|
||||
@ -1,12 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.Utility;
|
||||
using OWML.Common;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using Object = System.Object;
|
||||
|
||||
namespace NewHorizons.Builder.StarSystem
|
||||
{
|
||||
class SkyboxBuilder
|
||||
internal class SkyboxBuilder
|
||||
{
|
||||
public static Material LoadMaterial(string assetBundle, string path, string uniqueModName, IModBehaviour mod)
|
||||
{
|
||||
string key = uniqueModName + "." + assetBundle;
|
||||
AssetBundle bundle;
|
||||
Material cubemap;
|
||||
|
||||
try
|
||||
{
|
||||
if (Main.AssetBundles.ContainsKey(key)) bundle = Main.AssetBundles[key];
|
||||
else
|
||||
{
|
||||
bundle = mod.ModHelper.Assets.LoadBundle(assetBundle);
|
||||
Main.AssetBundles[key] = bundle;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError($"Couldn't load AssetBundle {assetBundle} : {e.Message}");
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
cubemap = bundle.LoadAsset<Material>(path);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Log($"Couldn't load asset {path} from AssetBundle {assetBundle} : {e.Message}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return cubemap;
|
||||
}
|
||||
|
||||
public static void Make(StarSystemConfig.SkyboxConfig info, IModBehaviour mod)
|
||||
{
|
||||
Logger.Log("Building Skybox");
|
||||
Material skyBoxMaterial = LoadMaterial(info.assetBundle, info.path, mod.ModHelper.Manifest.UniqueName, mod);
|
||||
RenderSettings.skybox = skyBoxMaterial;
|
||||
DynamicGI.UpdateEnvironment();
|
||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() =>
|
||||
{
|
||||
foreach (var camera in Resources.FindObjectsOfTypeAll<OWCamera>())
|
||||
{
|
||||
camera.clearFlags = CameraClearFlags.Skybox;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ namespace NewHorizons.External.Configs
|
||||
public bool destroyStockPlanets = true;
|
||||
public string factRequiredForWarp;
|
||||
public NomaiCoordinates coords;
|
||||
public SkyboxConfig skybox;
|
||||
|
||||
public class NomaiCoordinates
|
||||
{
|
||||
@ -22,6 +23,14 @@ namespace NewHorizons.External.Configs
|
||||
public int[] z;
|
||||
}
|
||||
|
||||
public class SkyboxConfig
|
||||
{
|
||||
public string assetBundle = null;
|
||||
public string path = null;
|
||||
public bool destroyStarField = false;
|
||||
}
|
||||
|
||||
public StarSystemConfig(Dictionary<string, object> dict) : base(dict) { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
2
NewHorizons/External/PropModule.cs
vendored
2
NewHorizons/External/PropModule.cs
vendored
@ -59,7 +59,7 @@ namespace NewHorizons.External
|
||||
{
|
||||
public MVector3 position;
|
||||
public float elevation;
|
||||
public float height;
|
||||
public float height = 30;
|
||||
public MColor tint;
|
||||
public bool downwards;
|
||||
public float wanderRate;
|
||||
|
||||
@ -5,7 +5,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NewHorizons.Builder.StarSystem;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace NewHorizons.Handlers
|
||||
{
|
||||
@ -17,23 +20,15 @@ namespace NewHorizons.Handlers
|
||||
|
||||
var skybox = GameObject.Find("Skybox/Starfield");
|
||||
|
||||
/*
|
||||
skybox.GetComponent<MeshRenderer>().material.shader = Shader.Find("Standard");
|
||||
*/
|
||||
if (system.Config.skybox?.destroyStarField ?? false)
|
||||
{
|
||||
Object.Destroy(skybox);
|
||||
}
|
||||
|
||||
/*
|
||||
var sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
|
||||
GameObject.Destroy(sphere.GetComponent<SphereCollider>());
|
||||
|
||||
sphere.transform.parent = skybox.transform;
|
||||
sphere.transform.localPosition = Vector3.zero;
|
||||
|
||||
var meshFilter = sphere.GetComponent<MeshFilter>();
|
||||
meshFilter.mesh.triangles = meshFilter.mesh.triangles.Reverse().ToArray();
|
||||
|
||||
var meshRenderer = sphere.GetComponent<MeshRenderer>();
|
||||
meshRenderer.material.color = Color.green;
|
||||
*/
|
||||
if (system.Config.skybox?.assetBundle != null && system.Config.skybox?.path != null)
|
||||
{
|
||||
SkyboxBuilder.Make(system.Config.skybox, system.Mod);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,6 +69,8 @@ namespace NewHorizons
|
||||
// For warping to the eye system
|
||||
private GameObject _ship;
|
||||
|
||||
public static bool HasDLC { get => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned; }
|
||||
|
||||
public override object GetApi()
|
||||
{
|
||||
return new NewHorizonsApi();
|
||||
@ -95,6 +97,30 @@ namespace NewHorizons
|
||||
_wasConfigured = true;
|
||||
}
|
||||
|
||||
public static void ResetConfigs(bool resetTranslation = true)
|
||||
{
|
||||
BodyDict.Clear();
|
||||
SystemDict.Clear();
|
||||
|
||||
BodyDict["SolarSystem"] = new List<NewHorizonsBody>();
|
||||
BodyDict["EyeOfTheUniverse"] = new List<NewHorizonsBody>(); // Keep this empty tho fr
|
||||
SystemDict["SolarSystem"] = new NewHorizonsSystem("SolarSystem", new StarSystemConfig(null), Instance)
|
||||
{
|
||||
Config =
|
||||
{
|
||||
destroyStockPlanets = false
|
||||
}
|
||||
};
|
||||
foreach (AssetBundle bundle in AssetBundles.Values)
|
||||
{
|
||||
bundle.Unload(true);
|
||||
}
|
||||
AssetBundles.Clear();
|
||||
if (!resetTranslation) return;
|
||||
TranslationHandler.ClearTables();
|
||||
TextTranslation.Get().SetLanguage(TextTranslation.Get().GetLanguage());
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
// Patches
|
||||
@ -111,12 +137,8 @@ namespace NewHorizons
|
||||
GlobalMessenger.AddListener("WakeUp", new Callback(OnWakeUp));
|
||||
ShaderBundle = Main.Instance.ModHelper.Assets.LoadBundle("AssetBundle/shader");
|
||||
|
||||
BodyDict["SolarSystem"] = new List<NewHorizonsBody>();
|
||||
BodyDict["EyeOfTheUniverse"] = new List<NewHorizonsBody>(); // Keep this empty tho fr
|
||||
|
||||
SystemDict["SolarSystem"] = new NewHorizonsSystem("SolarSystem", new StarSystemConfig(null), this);
|
||||
SystemDict["SolarSystem"].Config.destroyStockPlanets = false;
|
||||
|
||||
ResetConfigs(resetTranslation: false);
|
||||
|
||||
Logger.Log("Begin load of config files...", Logger.LogType.Log);
|
||||
|
||||
try
|
||||
|
||||
@ -111,5 +111,14 @@ namespace NewHorizons.Patches
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For debugging
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(FluidDetector), nameof(FluidDetector.AddVolume), new Type[] { typeof(EffectVolume) })]
|
||||
public static void FluidDetector_AddVolume(FluidDetector __instance, EffectVolume eVol)
|
||||
{
|
||||
Logger.Log($"[{__instance}] : AddVolume [{eVol}]");
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,20 +31,9 @@ namespace NewHorizons.Utility
|
||||
|
||||
private static void ReloadConfigs()
|
||||
{
|
||||
Main.BodyDict.Clear();
|
||||
Main.SystemDict.Clear();
|
||||
|
||||
Main.BodyDict["SolarSystem"] = new List<NewHorizonsBody>();
|
||||
Main.SystemDict["SolarSystem"] = new NewHorizonsSystem("SolarSystem", new StarSystemConfig(null), Main.Instance);
|
||||
foreach (AssetBundle bundle in Main.AssetBundles.Values)
|
||||
{
|
||||
bundle.Unload(true);
|
||||
}
|
||||
Main.AssetBundles.Clear();
|
||||
TranslationHandler.ClearTables();
|
||||
TextTranslation.Get().SetLanguage(TextTranslation.Get().GetLanguage());
|
||||
|
||||
Logger.Log("Begin reload of config files...", Logger.LogType.Log);
|
||||
|
||||
Main.ResetConfigs();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"author": "xen, Bwc9876, & Book",
|
||||
"name": "New Horizons",
|
||||
"uniqueName": "xen.NewHorizons",
|
||||
"version": "0.13.0",
|
||||
"version": "0.13.1",
|
||||
"owmlVersion": "2.1.0",
|
||||
"dependencies": [ "PacificEngine.OW_CommonResources" ],
|
||||
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "Vesper.AutoResume" ],
|
||||
|
||||
@ -19,6 +19,25 @@
|
||||
"destroyStockPlanets": {
|
||||
"type": "bool",
|
||||
"description": "Do you want a clean slate for this star system? Or will it be a modified version of the original."
|
||||
},
|
||||
"skybox": {
|
||||
"type": "object",
|
||||
"description": "Options for the skybox of your system",
|
||||
"properties": {
|
||||
"destroyStarField": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to destroy the star field around the player (always set to true if `assetBundle` and `path` is set)",
|
||||
"default": false
|
||||
},
|
||||
"assetBundle": {
|
||||
"type": "string",
|
||||
"description": "Path to the Unity asset bundle to load the skybox material from"
|
||||
},
|
||||
"path": {
|
||||
"type": "string",
|
||||
"description": "Path to the material within the asset bundle specified by `assetBundle` to use for the skybox"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user