Merge branch 'dev' into scene-load-fixes

This commit is contained in:
JohnCorby 2024-04-25 00:03:36 -07:00
commit 62ee681cb8
12 changed files with 64 additions and 10 deletions

View File

@ -10,7 +10,7 @@
"Trifid#Tester\n#Programmer", "Trifid#Tester\n#Programmer",
"Nageld#Programmer", "Nageld#Programmer",
"Ernesto#Fish", "Ernesto#Fish",
"With help from#Raicuparta\n#dgarroDC\n#jtsalomo\n#and the modding community", "With help from#Raicuparta\n#dgarroDC\n#jtsalomo\n#coderCleric\n#TRSasasusu\n#and the modding community",
" ", " ",
"Based off Marshmallow made by#_nebula", "Based off Marshmallow made by#_nebula",
"With help from#AmazingAlek\n#Raicuparta\n#and the Outer Wilds discord server", "With help from#AmazingAlek\n#Raicuparta\n#and the Outer Wilds discord server",

View File

@ -1,6 +1,6 @@
using NewHorizons.Components; using NewHorizons.Components;
using NewHorizons.Components.Orbital; using NewHorizons.Components.Orbital;
using NewHorizons.External.Configs; using NewHorizons.External;
using NewHorizons.Utility.OWML; using NewHorizons.Utility.OWML;
using UnityEngine; using UnityEngine;
@ -8,9 +8,13 @@ namespace NewHorizons.Builder.General
{ {
public static class AstroObjectBuilder public static class AstroObjectBuilder
{ {
public static NHAstroObject Make(GameObject body, AstroObject primaryBody, PlanetConfig config, bool isVanilla) public static NHAstroObject Make(GameObject body, AstroObject primaryBody, NewHorizonsBody nhBody, bool isVanilla)
{ {
NHAstroObject astroObject = body.AddComponent<NHAstroObject>(); NHAstroObject astroObject = body.AddComponent<NHAstroObject>();
astroObject.modUniqueName = nhBody.Mod.ModHelper.Manifest.UniqueName;
var config = nhBody.Config;
astroObject.isVanilla = isVanilla; astroObject.isVanilla = isVanilla;
astroObject.HideDisplayName = !config.Base.hasMapMarker; astroObject.HideDisplayName = !config.Base.hasMapMarker;
astroObject.invulnerableToSun = config.Base.invulnerableToSun; astroObject.invulnerableToSun = config.Base.invulnerableToSun;

View File

@ -102,10 +102,12 @@ namespace NewHorizons.Builder.Props
// We just have to merge the dialogue options // We just have to merge the dialogue options
var dialogueOptions = newDialogueNode.GetChildNode("DialogueOptionsList").GetChildNodes("DialogueOption"); var dialogueOptions = newDialogueNode.GetChildNode("DialogueOptionsList").GetChildNodes("DialogueOption");
var existingDialogueOptionsList = existingNode.GetChildNode("DialogueOptionsList"); var existingDialogueOptionsList = existingNode.GetChildNode("DialogueOptionsList");
var firstNode = existingDialogueOptionsList.ChildNodes[0];
foreach (XmlNode node in dialogueOptions) foreach (XmlNode node in dialogueOptions)
{ {
var importedNode = existingDialogueOptionsList.OwnerDocument.ImportNode(node, true); var importedNode = existingDialogueOptionsList.OwnerDocument.ImportNode(node, true);
existingDialogueOptionsList.AppendChild(importedNode); // We add them to the start because normally the last option is to return to menu or exit
existingDialogueOptionsList.PrependChild(importedNode);
} }
} }
else else

View File

@ -51,6 +51,10 @@ namespace NewHorizons.Builder.Props
item.DisplayName = itemName; item.DisplayName = itemName;
item.ItemType = itemType; item.ItemType = itemType;
item.Droppable = info.droppable; item.Droppable = info.droppable;
item.HoldOffset = info.holdOffset ?? Vector3.zero;
item.HoldRotation = info.holdRotation ?? Vector3.zero;
item.SocketOffset = info.socketOffset ?? Vector3.zero;
item.SocketRotation = info.socketRotation ?? Vector3.zero;
if (!string.IsNullOrEmpty(info.pickupAudio)) if (!string.IsNullOrEmpty(info.pickupAudio))
{ {
item.PickupAudio = AudioTypeHandler.GetAudioType(info.pickupAudio, mod); item.PickupAudio = AudioTypeHandler.GetAudioType(info.pickupAudio, mod);

View File

@ -476,7 +476,7 @@ namespace NewHorizons.Builder.Props.TranslatorText
} }
ArcCacheData[] cachedData = null; ArcCacheData[] cachedData = null;
if (nhBody.Cache?.ContainsKey(cacheKey) ?? false) if (nhBody?.Cache?.ContainsKey(cacheKey) ?? false)
cachedData = nhBody.Cache.Get<ArcCacheData[]>(cacheKey); cachedData = nhBody.Cache.Get<ArcCacheData[]>(cacheKey);
var arranger = nomaiWallText.gameObject.AddComponent<NomaiTextArcArranger>(); var arranger = nomaiWallText.gameObject.AddComponent<NomaiTextArcArranger>();

View File

@ -14,6 +14,11 @@ namespace NewHorizons.Components.Orbital
public bool invulnerableToSun; public bool invulnerableToSun;
public bool isVanilla; public bool isVanilla;
/// <summary>
/// The unique name of the mod that created this body or, if it is an existing body being edited, the last mod to edit it
/// </summary>
public string modUniqueName;
public void SetOrbitalParametersFromConfig(OrbitModule orbit) public void SetOrbitalParametersFromConfig(OrbitModule orbit)
{ {
SetOrbitalParametersFromTrueAnomaly(orbit.eccentricity, orbit.semiMajorAxis, orbit.inclination, orbit.argumentOfPeriapsis, orbit.longitudeOfAscendingNode, orbit.trueAnomaly); SetOrbitalParametersFromTrueAnomaly(orbit.eccentricity, orbit.semiMajorAxis, orbit.inclination, orbit.argumentOfPeriapsis, orbit.longitudeOfAscendingNode, orbit.trueAnomaly);

View File

@ -19,6 +19,10 @@ namespace NewHorizons.Components.Props
public AudioType DropAudio; public AudioType DropAudio;
public AudioType SocketAudio; public AudioType SocketAudio;
public AudioType UnsocketAudio; public AudioType UnsocketAudio;
public Vector3 HoldOffset;
public Vector3 HoldRotation;
public Vector3 SocketOffset;
public Vector3 SocketRotation;
public string PickupCondition; public string PickupCondition;
public bool ClearPickupConditionOnDrop; public bool ClearPickupConditionOnDrop;
public string PickupFact; public string PickupFact;
@ -42,6 +46,8 @@ namespace NewHorizons.Components.Props
public override void PickUpItem(Transform holdTranform) public override void PickUpItem(Transform holdTranform)
{ {
base.PickUpItem(holdTranform); base.PickUpItem(holdTranform);
transform.localPosition = HoldOffset;
transform.localEulerAngles = HoldRotation;
TriggerPickupConditions(); TriggerPickupConditions();
PlayCustomSound(PickupAudio); PlayCustomSound(PickupAudio);
} }
@ -56,6 +62,8 @@ namespace NewHorizons.Components.Props
public override void SocketItem(Transform socketTransform, Sector sector) public override void SocketItem(Transform socketTransform, Sector sector)
{ {
base.SocketItem(socketTransform, sector); base.SocketItem(socketTransform, sector);
transform.localPosition = SocketOffset;
transform.localEulerAngles = SocketRotation;
TriggerDropConditions(); TriggerDropConditions();
PlayCustomSound(SocketAudio); PlayCustomSound(SocketAudio);
} }

View File

@ -44,6 +44,22 @@ namespace NewHorizons.External.Modules.Props.Item
/// </summary> /// </summary>
public MVector3 dropNormal; public MVector3 dropNormal;
/// <summary> /// <summary>
/// A relative offset to apply to the item's position when holding it. The initial position varies for vanilla item types.
/// </summary>
public MVector3 holdOffset;
/// <summary>
/// A relative offset to apply to the item's rotation when holding it.
/// </summary>
public MVector3 holdRotation;
/// <summary>
/// A relative offset to apply to the item's position when placing it into a socket.
/// </summary>
public MVector3 socketOffset;
/// <summary>
/// A relative offset to apply to the item's rotation when placing it into a socket.
/// </summary>
public MVector3 socketRotation;
/// <summary>
/// The audio to play when this item is picked up. Only applies to custom/non-vanilla item types. /// The audio to play when this item is picked up. Only applies to custom/non-vanilla item types.
/// Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list. /// Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list.
/// </summary> /// </summary>

View File

@ -371,7 +371,7 @@ namespace NewHorizons.Handlers
const float sphereOfInfluence = 2000f; const float sphereOfInfluence = 2000f;
var owRigidBody = RigidBodyBuilder.Make(go, sphereOfInfluence, body.Config); var owRigidBody = RigidBodyBuilder.Make(go, sphereOfInfluence, body.Config);
var ao = AstroObjectBuilder.Make(go, null, body.Config, false); var ao = AstroObjectBuilder.Make(go, null, body, false);
var sector = SectorBuilder.Make(go, owRigidBody, sphereOfInfluence); var sector = SectorBuilder.Make(go, owRigidBody, sphereOfInfluence);
ao._rootSector = sector; ao._rootSector = sector;
@ -447,7 +447,7 @@ namespace NewHorizons.Handlers
var sphereOfInfluence = GetSphereOfInfluence(body); var sphereOfInfluence = GetSphereOfInfluence(body);
var owRigidBody = RigidBodyBuilder.Make(go, sphereOfInfluence, body.Config); var owRigidBody = RigidBodyBuilder.Make(go, sphereOfInfluence, body.Config);
var ao = AstroObjectBuilder.Make(go, primaryBody, body.Config, false); var ao = AstroObjectBuilder.Make(go, primaryBody, body, false);
var sector = SectorBuilder.Make(go, owRigidBody, sphereOfInfluence * 2f); var sector = SectorBuilder.Make(go, owRigidBody, sphereOfInfluence * 2f);
ao._rootSector = sector; ao._rootSector = sector;
@ -788,7 +788,7 @@ namespace NewHorizons.Handlers
} }
// Just destroy the existing AO after copying everything over // Just destroy the existing AO after copying everything over
var newAO = AstroObjectBuilder.Make(go, primary, body.Config, true); var newAO = AstroObjectBuilder.Make(go, primary, body, true);
newAO._gravityVolume = ao._gravityVolume; newAO._gravityVolume = ao._gravityVolume;
newAO._moon = ao._moon; newAO._moon = ao._moon;
newAO._name = ao._name; newAO._name = ao._name;

View File

@ -1,4 +1,3 @@
using NewHorizons.Handlers;
using OWML.Common; using OWML.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@ -1429,6 +1429,22 @@
"description": "The direction the item will be oriented when dropping it on the ground. Defaults to up (0, 1, 0).", "description": "The direction the item will be oriented when dropping it on the ground. Defaults to up (0, 1, 0).",
"$ref": "#/definitions/MVector3" "$ref": "#/definitions/MVector3"
}, },
"holdOffset": {
"description": "A relative offset to apply to the item's position when holding it. The initial position varies for vanilla item types.",
"$ref": "#/definitions/MVector3"
},
"holdRotation": {
"description": "A relative offset to apply to the item's rotation when holding it.",
"$ref": "#/definitions/MVector3"
},
"socketOffset": {
"description": "A relative offset to apply to the item's position when placing it into a socket.",
"$ref": "#/definitions/MVector3"
},
"socketRotation": {
"description": "A relative offset to apply to the item's rotation when placing it into a socket.",
"$ref": "#/definitions/MVector3"
},
"pickupAudio": { "pickupAudio": {
"type": "string", "type": "string",
"description": "The audio to play when this item is picked up. Only applies to custom/non-vanilla item types.\nCan be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list." "description": "The audio to play when this item is picked up. Only applies to custom/non-vanilla item types.\nCan be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list."

View File

@ -4,7 +4,7 @@
"author": "xen, Bwc9876, JohnCorby, MegaPiggy, Clay, Trifid, and friends", "author": "xen, Bwc9876, JohnCorby, MegaPiggy, Clay, Trifid, and friends",
"name": "New Horizons", "name": "New Horizons",
"uniqueName": "xen.NewHorizons", "uniqueName": "xen.NewHorizons",
"version": "1.19.8", "version": "1.19.9",
"owmlVersion": "2.10.3", "owmlVersion": "2.10.3",
"dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "PacificEngine.OW_CommonResources" ], "conflicts": [ "PacificEngine.OW_CommonResources" ],