using OWML.Common; using System; using System.Collections.Generic; using System.Xml.Linq; using UnityEngine; using UnityEngine.Events; namespace NewHorizons { public interface INewHorizons { #region Obsolete [Obsolete("Create(Dictionary config) is deprecated, please use LoadConfigs(IModBehaviour mod) instead")] void Create(Dictionary config); [Obsolete("Create(Dictionary config) is deprecated, please use LoadConfigs(IModBehaviour mod) instead")] void Create(Dictionary config, IModBehaviour mod); #endregion /// /// 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. /// void LoadConfigs(IModBehaviour mod); /// /// Retrieve the root GameObject of a custom planet made by creating configs. /// Will only work if the planet has been created (see GetStarSystemLoadedEvent) /// GameObject GetPlanet(string name); /// /// Returns the uniqueIDs of each installed NH addon. /// string[] GetInstalledAddons(); #region Get/set/change star system /// /// The name of the current star system loaded. /// string GetCurrentStarSystem(); /// /// Allows you to overwrite the default system. This is where the player is respawned after dying. /// bool SetDefaultSystem(string name); /// /// 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). /// bool ChangeCurrentStarSystem(string name); #endregion #region events /// /// 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. /// UnityEvent GetChangeStarSystemEvent(); /// /// 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. /// UnityEvent GetStarSystemLoadedEvent(); /// /// An event invoked when NH has finished a planet for a star system. /// Gives the name of the planet that was just loaded. /// UnityEvent GetBodyLoadedEvent(); #endregion #region Querying configs /// /// Uses JSONPath to query a body /// object QueryBody(Type outType, string bodyName, string path); /// /// Uses JSONPath to query a body /// T QueryBody(string bodyName, string path); /// /// Uses JSONPath to query the current star system /// object QuerySystem(Type outType, string path); /// /// Uses JSONPath to query the current star system /// T QuerySystem(string path); #endregion #region Spawn props /// /// 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. /// GameObject SpawnObject(GameObject planet, Sector sector, string propToCopyPath, Vector3 position, Vector3 eulerAngles, float scale, bool alignWithNormal); /// /// 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. /// 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 = ""); /// /// 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. /// (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); #endregion #region Load json/xml directly /// /// Allows creation of a planet by directly passing the json contents as a string. /// /// /// void CreatePlanet(string config, IModBehaviour mod); /// /// Allows defining details of a star system by directly passing the json contents as a string. /// /// /// /// void DefineStarSystem(string name, string config, IModBehaviour mod); /// /// Allows creation of dialogue by directly passing the xml and dialogueInfo json contents as strings /// /// TextAsset name used for compatibility with voice mod. Just has to be a unique identifier. /// The contents of the dialogue xml file as a string /// The json dialogue info as a string. See the documentation/schema for what this can contain. /// The root planet rigidbody that this dialogue is attached to. Any paths in the dialogueInfo are relative to this body. /// (CharacterDialogueTree, RemoteDialogueTrigger) CreateDialogueFromXML(string textAssetID, string xml, string dialogueInfo, GameObject planetGO); /// /// Directly add ship logs from XML. Call this method right before ShipLogManager awake. /// /// The mod this method is being called from. This is required for loading files. /// The ship log xml contents /// The planet that these ship logs correspond to in the map mode /// The relative path from your mod manifest.json where the ship log images are located. The filename must be the same as the fact id. Optional. /// A dictionary of each fact id to its 2D position in the ship log. Optional. /// A dictionary of each curiousity ID to its colour and highlight colour in the ship log. Optional. void AddShipLogXML(IModBehaviour mod, XElement xml, string planetName, string imageFolder = null, Dictionary entryPositions = null, Dictionary curiousityColours = null); #endregion } }