mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix xml dialogue loading and changed parameter name
This commit is contained in:
parent
0d915bcffc
commit
77131b9aca
@ -8,7 +8,7 @@
|
||||
"position":{"x": -0.3071011, "y": 2.741472, "z": -4.005298},
|
||||
"radius":1,
|
||||
"xmlFile":"AssetBundle/WarpDriveDialogue.xml",
|
||||
"remoteVolumePosition": {"x": -0.05656214, "y": 0.5362684, "z": 0.5467669}
|
||||
"remoteTriggerPosition": {"x": -0.05656214, "y": 0.5362684, "z": 0.5467669}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using NewHorizons.External;
|
||||
using OWML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -12,10 +13,10 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
public static class DialogueBuilder
|
||||
{
|
||||
public static void Make(GameObject go, Sector sector, PropModule.DialogueInfo info)
|
||||
public static void Make(GameObject go, Sector sector, PropModule.DialogueInfo info, IModHelper mod)
|
||||
{
|
||||
var dialogue = MakeConversationZone(go, sector, info);
|
||||
if (info.remoteVolumePosition != null) MakeRemoteDialogueTrigger(go, sector, info, dialogue);
|
||||
var dialogue = MakeConversationZone(go, sector, info, mod);
|
||||
if (info.remoteTriggerPosition != null) MakeRemoteDialogueTrigger(go, sector, info, dialogue);
|
||||
}
|
||||
|
||||
public static void MakeRemoteDialogueTrigger(GameObject go, Sector sector, PropModule.DialogueInfo info, CharacterDialogueTree dialogue)
|
||||
@ -44,11 +45,11 @@ namespace NewHorizons.Builder.Props
|
||||
boxCollider.size = Vector3.one * info.radius / 2f;
|
||||
|
||||
conversationTrigger.transform.parent = sector?.transform ?? go.transform;
|
||||
conversationTrigger.transform.localPosition = info.remoteVolumePosition;
|
||||
conversationTrigger.transform.localPosition = info.remoteTriggerPosition;
|
||||
conversationTrigger.SetActive(true);
|
||||
}
|
||||
|
||||
public static CharacterDialogueTree MakeConversationZone(GameObject go, Sector sector, PropModule.DialogueInfo info)
|
||||
public static CharacterDialogueTree MakeConversationZone(GameObject go, Sector sector, PropModule.DialogueInfo info, IModHelper mod)
|
||||
{
|
||||
GameObject conversationZone = new GameObject("ConversationZone");
|
||||
conversationZone.SetActive(false);
|
||||
@ -64,7 +65,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
var dialogueTree = conversationZone.AddComponent<CharacterDialogueTree>();
|
||||
|
||||
var xml = System.IO.File.ReadAllText(Main.Instance.ModHelper.Manifest.ModFolderPath + info.xmlFile);
|
||||
var xml = System.IO.File.ReadAllText(mod.Manifest.ModFolderPath + info.xmlFile);
|
||||
var text = new TextAsset(xml);
|
||||
|
||||
dialogueTree.SetTextXml(text);
|
||||
|
||||
@ -15,17 +15,17 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
public static class PropBuildManager
|
||||
{
|
||||
public static void Make(GameObject go, Sector sector, IPlanetConfig config, IModAssets assets, string uniqueModName)
|
||||
public static void Make(GameObject go, Sector sector, IPlanetConfig config, IModHelper mod, string uniqueModName)
|
||||
{
|
||||
if (config.Props.Scatter != null)
|
||||
{
|
||||
ScatterBuilder.Make(go, sector, config, assets, uniqueModName);
|
||||
ScatterBuilder.Make(go, sector, config, mod.Assets, uniqueModName);
|
||||
}
|
||||
if(config.Props.Details != null)
|
||||
{
|
||||
foreach (var detail in config.Props.Details)
|
||||
{
|
||||
DetailBuilder.Make(go, sector, config, assets, uniqueModName, detail);
|
||||
DetailBuilder.Make(go, sector, config, mod.Assets, uniqueModName, detail);
|
||||
}
|
||||
}
|
||||
if(config.Props.Geysers != null)
|
||||
@ -50,7 +50,7 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
foreach(var dialogueInfo in config.Props.Dialogue)
|
||||
{
|
||||
DialogueBuilder.Make(go, sector, dialogueInfo);
|
||||
DialogueBuilder.Make(go, sector, dialogueInfo, mod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
NewHorizons/External/PropModule.cs
vendored
4
NewHorizons/External/PropModule.cs
vendored
@ -62,9 +62,9 @@ namespace NewHorizons.External
|
||||
public class DialogueInfo
|
||||
{
|
||||
public MVector3 position;
|
||||
public float radius;
|
||||
public float radius = 1f;
|
||||
public string xmlFile;
|
||||
public MVector3 remoteVolumePosition;
|
||||
public MVector3 remoteTriggerPosition;
|
||||
public string persistentCondition;
|
||||
}
|
||||
}
|
||||
|
||||
@ -591,7 +591,7 @@ namespace NewHorizons
|
||||
}
|
||||
|
||||
if (body.Config.Props != null)
|
||||
PropBuildManager.Make(go, sector, body.Config, body.Mod.Assets, body.Mod.Manifest.UniqueName);
|
||||
PropBuildManager.Make(go, sector, body.Config, body.Mod, body.Mod.Manifest.UniqueName);
|
||||
|
||||
if (body.Config.Signal != null)
|
||||
SignalBuilder.Make(go, sector, body.Config.Signal, body.Mod);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user