mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix update from dev
This commit is contained in:
parent
3bfabadda8
commit
ed66cb0665
@ -1,11 +1,11 @@
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.Components.Volumes;
|
||||
using NewHorizons.External.Modules;
|
||||
using NewHorizons.Builder.Props.TranslatorText;
|
||||
using NewHorizons.External.Modules.Props;
|
||||
using NewHorizons.External.Modules.Props.Shuttle;
|
||||
using NewHorizons.Handlers;
|
||||
using NewHorizons.Utility;
|
||||
using NewHorizons.Utility.OWML;
|
||||
using OWML.Common;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
|
||||
namespace NewHorizons.Builder.Props
|
||||
{
|
||||
@ -32,20 +32,13 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
|
||||
public static GameObject Make(GameObject planetGO, Sector sector, PropModule.GravityCannonInfo info, IModBehaviour mod)
|
||||
public static GameObject Make(GameObject planetGO, Sector sector, GravityCannonInfo info, IModBehaviour mod)
|
||||
{
|
||||
InitPrefab();
|
||||
|
||||
if (_prefab == null || planetGO == null || sector == null) return null;
|
||||
|
||||
var detailInfo = new PropModule.DetailInfo()
|
||||
{
|
||||
position = info.position,
|
||||
rotation = info.rotation,
|
||||
parentPath = info.parentPath,
|
||||
isRelativeToParent = info.isRelativeToParent,
|
||||
rename = info.rename
|
||||
};
|
||||
var detailInfo = new DetailInfo(info);
|
||||
var gravityCannonObject = DetailBuilder.Make(planetGO, sector, _prefab, detailInfo);
|
||||
gravityCannonObject.SetActive(false);
|
||||
|
||||
@ -55,38 +48,40 @@ namespace NewHorizons.Builder.Props
|
||||
gravityCannonController._shuttleID = ShuttleHandler.GetShuttleID(info.shuttleID);
|
||||
gravityCannonController._retrieveShipLogFact = info.retrieveReveal;
|
||||
gravityCannonController._launchShipLogFact = info.launchReveal;
|
||||
|
||||
if (info.computer != null)
|
||||
{
|
||||
gravityCannonController._nomaiComputer = NomaiTextBuilder.Make(planetGO, sector, new PropModule.NomaiTextInfo
|
||||
{
|
||||
type = PropModule.NomaiTextInfo.NomaiTextType.Computer,
|
||||
position = info.computer.position,
|
||||
rotation = info.computer.rotation,
|
||||
normal = info.computer.normal,
|
||||
isRelativeToParent = info.computer.isRelativeToParent,
|
||||
rename = info.computer.rename,
|
||||
location = info.computer.location,
|
||||
xmlFile = info.computer.xmlFile,
|
||||
parentPath = info.computer.parentPath
|
||||
}, mod).GetComponent<NomaiComputer>();
|
||||
gravityCannonController._nomaiComputer = CreateComputer(planetGO, sector, info.computer);
|
||||
}
|
||||
else
|
||||
{
|
||||
gravityCannonController._nomaiComputer = NomaiTextBuilder.Make(planetGO, sector, new PropModule.NomaiTextInfo
|
||||
{
|
||||
type = PropModule.NomaiTextInfo.NomaiTextType.Computer,
|
||||
position = new MVector3(-2.556838f, -0.8018004f, 10.01348f),
|
||||
rotation = new MVector3(8.293f, 2.403f, 0.9f),
|
||||
isRelativeToParent = true,
|
||||
rename = "Computer",
|
||||
xmlFile = "Assets/GravityCannonComputer.xml",
|
||||
parentPath = gravityCannonObject.transform.GetPath().Remove(0, planetGO.name.Length + 1)
|
||||
}, Main.Instance).GetComponent<NomaiComputer>();
|
||||
gravityCannonController._nomaiComputer = null;
|
||||
}
|
||||
|
||||
gravityCannonObject.SetActive(true);
|
||||
|
||||
return gravityCannonObject;
|
||||
}
|
||||
|
||||
private static NomaiComputer CreateComputer(GameObject planetGO, Sector sector, NomaiComputerInfo computerInfo)
|
||||
{
|
||||
var prefab = computerInfo.type switch
|
||||
{
|
||||
NomaiComputerType.NORMAL => TranslatorTextBuilder.ComputerPrefab,
|
||||
NomaiComputerType.PRECRASH => TranslatorTextBuilder.PreCrashComputerPrefab,
|
||||
_ => throw new System.NotImplementedException()
|
||||
};
|
||||
|
||||
var computerObject = DetailBuilder.Make(planetGO, sector, prefab, new DetailInfo(computerInfo));
|
||||
|
||||
var computer = computerObject.GetComponentInChildren<NomaiComputer>();
|
||||
computer.SetSector(sector);
|
||||
|
||||
Delay.FireOnNextUpdate(computer.ClearAllEntries);
|
||||
|
||||
computerObject.SetActive(true);
|
||||
|
||||
return computer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -747,7 +747,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
if (rootNode == null)
|
||||
{
|
||||
Logger.LogError($"Couldn't find NomaiObject in [{xmlPath}]");
|
||||
NHLogger.LogError($"Couldn't find NomaiObject in [{xmlPath}]");
|
||||
return dict;
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make gravity cannon [{gravityCannonInfo.shuttleID}] for [{go.name}]:\n{ex}");
|
||||
NHLogger.LogError($"Couldn't make gravity cannon [{gravityCannonInfo.shuttleID}] for [{go.name}]:\n{ex}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -43,7 +43,7 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"Couldn't make shuttle [{shuttleInfo.id}] for [{go.name}]:\n{ex}");
|
||||
NHLogger.LogError($"Couldn't make shuttle [{shuttleInfo.id}] for [{go.name}]:\n{ex}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.Components.Volumes;
|
||||
using NewHorizons.External.Modules;
|
||||
using NewHorizons.External.Modules.Props;
|
||||
using NewHorizons.External.Modules.Props.Shuttle;
|
||||
using NewHorizons.Handlers;
|
||||
using NewHorizons.Utility;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
|
||||
namespace NewHorizons.Builder.Props
|
||||
{
|
||||
@ -66,20 +65,13 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
|
||||
public static GameObject Make(GameObject planetGO, Sector sector, PropModule.ShuttleInfo info)
|
||||
public static GameObject Make(GameObject planetGO, Sector sector, ShuttleInfo info)
|
||||
{
|
||||
InitPrefab();
|
||||
|
||||
if (_prefab == null || planetGO == null || sector == null) return null;
|
||||
|
||||
var detailInfo = new PropModule.DetailInfo()
|
||||
{
|
||||
position = info.position,
|
||||
rotation = info.rotation,
|
||||
parentPath = info.parentPath,
|
||||
isRelativeToParent = info.isRelativeToParent,
|
||||
rename = info.rename
|
||||
};
|
||||
var detailInfo = new DetailInfo(info);
|
||||
var shuttleObject = DetailBuilder.Make(planetGO, sector, _prefab, detailInfo);
|
||||
shuttleObject.SetActive(false);
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ namespace NewHorizons.Builder.Props.TranslatorText
|
||||
private static Material _childArcMaterial;
|
||||
private static GameObject _scrollPrefab;
|
||||
public static GameObject ComputerPrefab { get; private set; }
|
||||
private static GameObject _preCrashComputerPrefab;
|
||||
public static GameObject PreCrashComputerPrefab { get; private set; }
|
||||
private static GameObject _cairnBHPrefab;
|
||||
private static GameObject _cairnTHPrefab;
|
||||
private static GameObject _cairnCTPrefab;
|
||||
@ -89,9 +89,9 @@ namespace NewHorizons.Builder.Props.TranslatorText
|
||||
ComputerPrefab = SearchUtilities.Find("VolcanicMoon_Body/Sector_VM/Interactables_VM/Prefab_NOM_Computer").InstantiateInactive().Rename("Prefab_NOM_Computer").DontDestroyOnLoad();
|
||||
}
|
||||
|
||||
if (_preCrashComputerPrefab == null)
|
||||
if (PreCrashComputerPrefab == null)
|
||||
{
|
||||
_preCrashComputerPrefab = SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_EscapePodCrashSite/Sector_CrashFragment/EscapePod_Socket/Interactibles_EscapePod/Prefab_NOM_Vessel_Computer").InstantiateInactive().Rename("Prefab_NOM_Vessel_Computer").DontDestroyOnLoad();
|
||||
PreCrashComputerPrefab = SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_EscapePodCrashSite/Sector_CrashFragment/EscapePod_Socket/Interactibles_EscapePod/Prefab_NOM_Vessel_Computer").InstantiateInactive().Rename("Prefab_NOM_Vessel_Computer").DontDestroyOnLoad();
|
||||
}
|
||||
|
||||
if (_cairnBHPrefab == null)
|
||||
@ -238,7 +238,7 @@ namespace NewHorizons.Builder.Props.TranslatorText
|
||||
}
|
||||
case NomaiTextType.PreCrashComputer:
|
||||
{
|
||||
var computerObject = DetailBuilder.Make(planetGO, sector, _preCrashComputerPrefab, new DetailInfo(info));
|
||||
var computerObject = DetailBuilder.Make(planetGO, sector, PreCrashComputerPrefab, new DetailInfo(info));
|
||||
computerObject.SetActive(false);
|
||||
|
||||
var computer = computerObject.GetComponent<NomaiVesselComputer>();
|
||||
|
||||
@ -144,9 +144,16 @@ namespace NewHorizons.Builder.Props
|
||||
transmitterObject.SetActive(true);
|
||||
}
|
||||
|
||||
private static void CreateComputer(GameObject planetGO, Sector sector, NomaiWarpComputerLoggerInfo computerInfo, NomaiWarpReceiver receiver)
|
||||
private static void CreateComputer(GameObject planetGO, Sector sector, NomaiComputerInfo computerInfo, NomaiWarpReceiver receiver)
|
||||
{
|
||||
var computerObject = DetailBuilder.Make(planetGO, sector, TranslatorTextBuilder.ComputerPrefab, new DetailInfo(computerInfo));
|
||||
var prefab = computerInfo.type switch
|
||||
{
|
||||
NomaiComputerType.NORMAL => TranslatorTextBuilder.ComputerPrefab,
|
||||
NomaiComputerType.PRECRASH => TranslatorTextBuilder.PreCrashComputerPrefab,
|
||||
_ => throw new System.NotImplementedException()
|
||||
};
|
||||
|
||||
var computerObject = DetailBuilder.Make(planetGO, sector, prefab, new DetailInfo(computerInfo));
|
||||
|
||||
var computer = computerObject.GetComponentInChildren<NomaiComputer>();
|
||||
computer.SetSector(sector);
|
||||
|
||||
11
NewHorizons/External/Modules/PropModule.cs
vendored
11
NewHorizons/External/Modules/PropModule.cs
vendored
@ -4,6 +4,7 @@ using NewHorizons.External.Modules.Props.Dialogue;
|
||||
using NewHorizons.External.Modules.Props.EchoesOfTheEye;
|
||||
using NewHorizons.External.Modules.Props.Quantum;
|
||||
using NewHorizons.External.Modules.Props.Remote;
|
||||
using NewHorizons.External.Modules.Props.Shuttle;
|
||||
using NewHorizons.External.Modules.TranslatorText;
|
||||
using NewHorizons.External.Modules.VariableSize;
|
||||
using NewHorizons.External.Modules.Volumes.VolumeInfos;
|
||||
@ -112,6 +113,16 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public AudioSourceInfo[] audioSources;
|
||||
|
||||
/// <summary>
|
||||
/// Add a gravity cannon to this planet. Must be paired to a new shuttle, which can be placed on this planet or elsewhere.
|
||||
/// </summary>
|
||||
public GravityCannonInfo[] gravityCannons;
|
||||
|
||||
/// <summary>
|
||||
/// Add a Nomai shuttle to this planet. Can be paired to a gravity cannon on this planet or elsewhere.
|
||||
/// </summary>
|
||||
public ShuttleInfo[] shuttles;
|
||||
|
||||
[Obsolete("reveal is deprecated. Use Volumes->revealVolumes instead.")] public RevealVolumeInfo[] reveal;
|
||||
|
||||
[Obsolete("audioVolumes is deprecated. Use Volumes->audioVolumes instead.")] public AudioVolumeInfo[] audioVolumes;
|
||||
|
||||
23
NewHorizons/External/Modules/Props/NomaiComputerInfo.cs
vendored
Normal file
23
NewHorizons/External/Modules/Props/NomaiComputerInfo.cs
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace NewHorizons.External.Modules.Props
|
||||
{
|
||||
[JsonObject]
|
||||
public class NomaiComputerInfo : GeneralPropInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// What design the computer will use.
|
||||
/// </summary>
|
||||
[DefaultValue(NomaiComputerType.NORMAL)] public NomaiComputerType type = NomaiComputerType.NORMAL;
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum NomaiComputerType
|
||||
{
|
||||
[EnumMember(Value = @"normal")] NORMAL = 0,
|
||||
[EnumMember(Value = @"precrash")] PRECRASH = 1
|
||||
}
|
||||
}
|
||||
33
NewHorizons/External/Modules/Props/Shuttle/GravityCannonInfo.cs
vendored
Normal file
33
NewHorizons/External/Modules/Props/Shuttle/GravityCannonInfo.cs
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NewHorizons.External.Modules.Props.Shuttle
|
||||
{
|
||||
[JsonObject]
|
||||
public class GravityCannonInfo : GeneralPropInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique ID for the shuttle that pairs with this gravity cannon
|
||||
/// </summary>
|
||||
public string shuttleID;
|
||||
|
||||
/// <summary>
|
||||
/// Ship log fact revealed when retrieving the shuttle to this pad. Optional.
|
||||
/// </summary>
|
||||
public string retrieveReveal;
|
||||
|
||||
/// <summary>
|
||||
/// Ship log fact revealed when launching from this pad. Optional.
|
||||
/// </summary>
|
||||
public string launchReveal;
|
||||
|
||||
/// <summary>
|
||||
/// Will create a modern Nomai computer linked to this gravity cannon.
|
||||
/// </summary>
|
||||
public NomaiComputerInfo computer;
|
||||
}
|
||||
}
|
||||
18
NewHorizons/External/Modules/Props/Shuttle/ShuttleInfo.cs
vendored
Normal file
18
NewHorizons/External/Modules/Props/Shuttle/ShuttleInfo.cs
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NewHorizons.External.Modules.Props.Shuttle
|
||||
{
|
||||
[JsonObject]
|
||||
public class ShuttleInfo : GeneralPropInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique ID for this shuttle
|
||||
/// </summary>
|
||||
public string id;
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NewHorizons.External.Modules.WarpPad
|
||||
{
|
||||
[JsonObject]
|
||||
public class NomaiWarpComputerLoggerInfo : GeneralPropInfo
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
using NewHorizons.External.Modules.Props;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NewHorizons.External.Modules.WarpPad
|
||||
@ -14,7 +15,7 @@ namespace NewHorizons.External.Modules.WarpPad
|
||||
/// <summary>
|
||||
/// Will create a modern Nomai computer linked to this receiver.
|
||||
/// </summary>
|
||||
public NomaiWarpComputerLoggerInfo computer;
|
||||
public NomaiComputerInfo computer;
|
||||
|
||||
/// <summary>
|
||||
/// Set to true if you want to include Nomai ruin details around the warp pad.
|
||||
|
||||
@ -1,11 +1,6 @@
|
||||
using NewHorizons.Utility;
|
||||
using OWML.Common;
|
||||
using NewHorizons.Utility.OWML;
|
||||
using OWML.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
|
||||
namespace NewHorizons.Handlers
|
||||
{
|
||||
@ -15,8 +10,7 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
try
|
||||
{
|
||||
NomaiShuttleController.ShuttleID shuttleID;
|
||||
if (EnumUtils.TryParse<NomaiShuttleController.ShuttleID>(id, out shuttleID))
|
||||
if (EnumUtils.TryParse(id, out NomaiShuttleController.ShuttleID shuttleID))
|
||||
{
|
||||
return shuttleID;
|
||||
}
|
||||
@ -27,14 +21,14 @@ namespace NewHorizons.Handlers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError($"Couldn't load shuttle id [{id}]:\n{e}");
|
||||
NHLogger.LogError($"Couldn't load shuttle id [{id}]:\n{e}");
|
||||
return EnumUtils.FromObject<NomaiShuttleController.ShuttleID>(-1);
|
||||
}
|
||||
}
|
||||
|
||||
public static NomaiShuttleController.ShuttleID AddCustomShuttleID(string id)
|
||||
{
|
||||
Logger.LogVerbose($"Registering new shuttle id [{id}]");
|
||||
NHLogger.LogVerbose($"Registering new shuttle id [{id}]");
|
||||
|
||||
return EnumUtilities.Create<NomaiShuttleController.ShuttleID>(id);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user