mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Update API page with GetInstalledAddons
This commit is contained in:
parent
a7872aa892
commit
f991b46b9b
@ -2,6 +2,7 @@ Title: API
|
||||
Sort_Priority: 40
|
||||
|
||||
## How to use the API
|
||||
|
||||
___
|
||||
|
||||
First create the following interface in your mod:
|
||||
@ -14,16 +15,19 @@ public interface INewHorizons
|
||||
void LoadConfigs(IModBehaviour mod);
|
||||
|
||||
GameObject GetPlanet(string name);
|
||||
|
||||
string GetCurrentStarSystem();
|
||||
|
||||
string GetCurrentStarSystem();
|
||||
|
||||
UnityEvent<string> GetChangeStarSystemEvent();
|
||||
|
||||
UnityEvent<string> GetStarSystemLoadedEvent();
|
||||
|
||||
string[] GetInstalledAddons();
|
||||
}
|
||||
```
|
||||
|
||||
In your main `ModBehaviour` class you can get the NewHorizons API like so:
|
||||
|
||||
```cs
|
||||
public class MyMod : ModBehaviour
|
||||
{
|
||||
@ -37,3 +41,5 @@ public class MyMod : ModBehaviour
|
||||
You can then use the APIs `LoadConfigs()` method to load from a "planets" folder, or use the `Create()` and `GetPlanet()` methods to create planets and do whatever with them. Just make sure you create planets in the `Start()` method or at least before the SolarSystem scene loads, or they will not be created.
|
||||
|
||||
The `GetChangeStarSystemEvent` and `GetStarSystemLoadedEvent` events let you listen in for when the player starts changing to a new system (called when entering a black hole or using the warp drive) and when the system is fully loaded in, respectively.
|
||||
|
||||
You can also use the `GetInstalledAddons` method to get a list of addons that are installed and enabled.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user