mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
1395cf910b
@ -8,21 +8,26 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
public static class DialogueBuilder
|
public static class DialogueBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject go, Sector sector, PropModule.DialogueInfo info, IModBehaviour mod)
|
// Returns the character dialogue tree and remote dialogue trigger, if applicable.
|
||||||
|
public static (CharacterDialogueTree, RemoteDialogueTrigger) Make(GameObject go, Sector sector, PropModule.DialogueInfo info, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
// In stock I think they disable dialogue stuff with conditions
|
// In stock I think they disable dialogue stuff with conditions
|
||||||
// Here we just don't make it at all
|
// Here we just don't make it at all
|
||||||
if (info.blockAfterPersistentCondition != null && PlayerData._currentGameSave.GetPersistentCondition(info.blockAfterPersistentCondition)) return;
|
if (info.blockAfterPersistentCondition != null && PlayerData._currentGameSave.GetPersistentCondition(info.blockAfterPersistentCondition)) return (null, null);
|
||||||
|
|
||||||
var dialogue = MakeConversationZone(go, sector, info, mod.ModHelper);
|
var dialogue = MakeConversationZone(go, sector, info, mod.ModHelper);
|
||||||
if (info.remoteTriggerPosition != null || info.remoteTriggerRadius != 0) MakeRemoteDialogueTrigger(go, sector, info, dialogue);
|
|
||||||
|
RemoteDialogueTrigger remoteTrigger = null;
|
||||||
|
if (info.remoteTriggerPosition != null || info.remoteTriggerRadius != 0) remoteTrigger = MakeRemoteDialogueTrigger(go, sector, info, dialogue);
|
||||||
|
|
||||||
// Make the character look at the player
|
// Make the character look at the player
|
||||||
// Useful for dialogue replacement
|
// Useful for dialogue replacement
|
||||||
if (!string.IsNullOrEmpty(info.pathToAnimController)) MakePlayerTrackingZone(go, dialogue, info);
|
if (!string.IsNullOrEmpty(info.pathToAnimController)) MakePlayerTrackingZone(go, dialogue, info);
|
||||||
|
|
||||||
|
return (dialogue, remoteTrigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MakeRemoteDialogueTrigger(GameObject planetGO, Sector sector, PropModule.DialogueInfo info, CharacterDialogueTree dialogue)
|
private static RemoteDialogueTrigger MakeRemoteDialogueTrigger(GameObject planetGO, Sector sector, PropModule.DialogueInfo info, CharacterDialogueTree dialogue)
|
||||||
{
|
{
|
||||||
GameObject conversationTrigger = new GameObject("ConversationTrigger");
|
GameObject conversationTrigger = new GameObject("ConversationTrigger");
|
||||||
conversationTrigger.SetActive(false);
|
conversationTrigger.SetActive(false);
|
||||||
@ -50,9 +55,11 @@ namespace NewHorizons.Builder.Props
|
|||||||
conversationTrigger.transform.parent = sector?.transform ?? planetGO.transform;
|
conversationTrigger.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
conversationTrigger.transform.position = planetGO.transform.TransformPoint(info.remoteTriggerPosition ?? info.position);
|
conversationTrigger.transform.position = planetGO.transform.TransformPoint(info.remoteTriggerPosition ?? info.position);
|
||||||
conversationTrigger.SetActive(true);
|
conversationTrigger.SetActive(true);
|
||||||
|
|
||||||
|
return remoteDialogueTrigger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CharacterDialogueTree MakeConversationZone(GameObject planetGO, Sector sector, PropModule.DialogueInfo info, IModHelper mod)
|
private static CharacterDialogueTree MakeConversationZone(GameObject planetGO, Sector sector, PropModule.DialogueInfo info, IModHelper mod)
|
||||||
{
|
{
|
||||||
GameObject conversationZone = new GameObject("ConversationZone");
|
GameObject conversationZone = new GameObject("ConversationZone");
|
||||||
conversationZone.SetActive(false);
|
conversationZone.SetActive(false);
|
||||||
@ -99,7 +106,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
return dialogueTree;
|
return dialogueTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MakePlayerTrackingZone(GameObject go, CharacterDialogueTree dialogue, PropModule.DialogueInfo info)
|
private static void MakePlayerTrackingZone(GameObject go, CharacterDialogueTree dialogue, PropModule.DialogueInfo info)
|
||||||
{
|
{
|
||||||
var character = go.transform.Find(info.pathToAnimController);
|
var character = go.transform.Find(info.pathToAnimController);
|
||||||
|
|
||||||
|
|||||||
@ -14,22 +14,74 @@ namespace NewHorizons
|
|||||||
[Obsolete("Create(Dictionary<string, object> config) is deprecated, please use LoadConfigs(IModBehaviour mod) instead")]
|
[Obsolete("Create(Dictionary<string, object> config) is deprecated, please use LoadConfigs(IModBehaviour mod) instead")]
|
||||||
void Create(Dictionary<string, object> config, IModBehaviour mod);
|
void Create(Dictionary<string, object> config, IModBehaviour mod);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Will load all configs in the regular folders (planets, systems, translations, etc) for this mod.
|
||||||
|
/// The NH addon config template is just a single call to this API method.
|
||||||
|
/// </summary>
|
||||||
void LoadConfigs(IModBehaviour mod);
|
void LoadConfigs(IModBehaviour mod);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the root GameObject of a custom planet made by creating configs.
|
||||||
|
/// Will only work if the planet has been created (see GetStarSystemLoadedEvent)
|
||||||
|
/// </summary>
|
||||||
GameObject GetPlanet(string name);
|
GameObject GetPlanet(string name);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the current star system loaded.
|
||||||
|
/// </summary>
|
||||||
string GetCurrentStarSystem();
|
string GetCurrentStarSystem();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An event invoked when the player begins loading the new star system, before the scene starts to load.
|
||||||
|
/// Gives the name of the star system being switched to.
|
||||||
|
/// </summary>
|
||||||
UnityEvent<string> GetChangeStarSystemEvent();
|
UnityEvent<string> GetChangeStarSystemEvent();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An event invoked when NH has finished generating all planets for a new star system.
|
||||||
|
/// Gives the name of the star system that was just loaded.
|
||||||
|
/// </summary>
|
||||||
UnityEvent<string> GetStarSystemLoadedEvent();
|
UnityEvent<string> GetStarSystemLoadedEvent();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows you to overwrite the default system. This is where the player is respawned after dying.
|
||||||
|
/// </summary>
|
||||||
bool SetDefaultSystem(string name);
|
bool SetDefaultSystem(string name);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows you to instantly begin a warp to a new star system.
|
||||||
|
/// Will return false if that system does not exist (cannot be warped to).
|
||||||
|
/// </summary>
|
||||||
bool ChangeCurrentStarSystem(string name);
|
bool ChangeCurrentStarSystem(string name);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the uniqueIDs of each installed NH addon.
|
||||||
|
/// </summary>
|
||||||
string[] GetInstalledAddons();
|
string[] GetInstalledAddons();
|
||||||
|
|
||||||
GameObject SpawnObject(GameObject planet, Sector sector, string propToCopyPath, Vector3 position, Vector3 eulerAngles, float scale, bool alignWithNormal);
|
/// <summary>
|
||||||
|
/// Allows you to spawn a copy of a prop by specifying its path.
|
||||||
|
/// This is the same as using Props->details in a config, but also returns the spawned gameObject to you.
|
||||||
|
/// </summary>
|
||||||
|
GameObject SpawnObject(GameObject planet, Sector sector, string propToCopyPath, Vector3 position, Vector3 eulerAngles,
|
||||||
|
float scale, bool alignWithNormal);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows you to spawn an AudioSignal on a planet.
|
||||||
|
/// This is the same as using Props->signals in a config, but also returns the spawned AudioSignal to you.
|
||||||
|
/// This method will not set its position. You will have to do that with the returned object.
|
||||||
|
/// </summary>
|
||||||
|
AudioSignal SpawnSignal(IModBehaviour mod, GameObject root, string audio, string name, string frequency,
|
||||||
|
float sourceRadius = 1f, float detectionRadius = 20f, float identificationRadius = 10f, bool insideCloak = false,
|
||||||
|
bool onlyAudibleToScope = true, string reveals = "");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows you to spawn character dialogue on a planet. Also returns the RemoteDialogueTrigger if remoteTriggerRadius is specified.
|
||||||
|
/// This is the same as using Props->dialogue in a config, but also returns the spawned game objects to you.
|
||||||
|
/// This method will not set the position of the dialogue or remote trigger. You will have to do that with the returned objects.
|
||||||
|
/// </summary>
|
||||||
|
(CharacterDialogueTree, RemoteDialogueTrigger) SpawnDialogue(IModBehaviour mod, GameObject root, string xmlFile, float radius = 1f,
|
||||||
|
float range = 1f, string blockAfterPersistentCondition = null, float lookAtRadius = 1f, string pathToAnimController = null,
|
||||||
|
float remoteTriggerRadius = 0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using NewHorizons.Builder.Props;
|
using NewHorizons.Builder.Props;
|
||||||
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using OWML.Utils;
|
using OWML.Utils;
|
||||||
@ -107,9 +108,51 @@ namespace NewHorizons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameObject SpawnObject(GameObject planet, Sector sector, string propToCopyPath, Vector3 position, Vector3 eulerAngles, float scale, bool alignWithNormal)
|
public GameObject SpawnObject(GameObject planet, Sector sector, string propToCopyPath, Vector3 position, Vector3 eulerAngles,
|
||||||
|
float scale, bool alignWithNormal)
|
||||||
{
|
{
|
||||||
return DetailBuilder.MakeDetail(planet, sector, propToCopyPath, position, eulerAngles, scale, alignWithNormal);
|
return DetailBuilder.MakeDetail(planet, sector, propToCopyPath, position, eulerAngles, scale, alignWithNormal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AudioSignal SpawnSignal(IModBehaviour mod, GameObject root, string audio, string name, string frequency,
|
||||||
|
float sourceRadius = 1f, float detectionRadius = 20f, float identificationRadius = 10f, bool insideCloak = false,
|
||||||
|
bool onlyAudibleToScope = true, string reveals = "")
|
||||||
|
{
|
||||||
|
var info = new SignalModule.SignalInfo()
|
||||||
|
{
|
||||||
|
audio = audio,
|
||||||
|
detectionRadius = detectionRadius,
|
||||||
|
frequency = frequency,
|
||||||
|
identificationRadius = identificationRadius,
|
||||||
|
insideCloak = insideCloak,
|
||||||
|
name = name,
|
||||||
|
onlyAudibleToScope = onlyAudibleToScope,
|
||||||
|
position = MVector3.zero,
|
||||||
|
reveals = reveals,
|
||||||
|
sourceRadius = sourceRadius
|
||||||
|
};
|
||||||
|
|
||||||
|
return SignalBuilder.Make(root, null, info, mod).GetComponent<AudioSignal>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public (CharacterDialogueTree, RemoteDialogueTrigger) SpawnDialogue(IModBehaviour mod, GameObject root, string xmlFile, float radius = 1f,
|
||||||
|
float range = 1f, string blockAfterPersistentCondition = null, float lookAtRadius = 1f, string pathToAnimController = null,
|
||||||
|
float remoteTriggerRadius = 0f)
|
||||||
|
{
|
||||||
|
var info = new PropModule.DialogueInfo()
|
||||||
|
{
|
||||||
|
blockAfterPersistentCondition = blockAfterPersistentCondition,
|
||||||
|
lookAtRadius = lookAtRadius,
|
||||||
|
pathToAnimController = pathToAnimController,
|
||||||
|
position = Vector3.zero,
|
||||||
|
radius = radius,
|
||||||
|
remoteTriggerPosition = null,
|
||||||
|
range = range,
|
||||||
|
remoteTriggerRadius = remoteTriggerRadius,
|
||||||
|
xmlFile = xmlFile
|
||||||
|
};
|
||||||
|
|
||||||
|
return DialogueBuilder.Make(root, null, info, mod);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user