mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
* Add Bootstrap Extension * Rename main.yml * Artifact Upload * Fix Bootstrap Reference Error * BootstrapTreeProcessor * getiterator removed * keys function * Style Images * Update docs_build.yml * Added Meta Files * Template Get * Fix Page Ref * Update BASE_URL * Sort Schemas * Add Sitemaps * Add favicons, open-graph, and setup guide * Update Setup.md * Update .gitignore * Update Setup.md * Use _blank on external links * Restructured Docs * Fix Links * Added XML Schemas * Name XML Schemas * Improved Best Practices * Add Logs For Static Files * Make docs build happen on PR * Responsive Footer * Started On Table OF Contents * Added Table Of Contents * Fix <code> bg colors * Remove unused CSS * Add canonical link * Fix OGP Image * Try ScrollSpy on TOC * Added ScrollSpy * Improve TOC Spacing * Custom Scroll Bars * Fix Formatting in ship_log.md
31 lines
869 B
Markdown
31 lines
869 B
Markdown
Title: API
|
|
Sort-Priority: 40
|
|
|
|
## How to use the API
|
|
|
|
First create the following interface in your mod:
|
|
|
|
```cs
|
|
public interface INewHorizons
|
|
{
|
|
void Create(Dictionary<string, object> config, IModBehaviour mod);
|
|
|
|
void LoadConfigs(IModBehaviour mod);
|
|
|
|
GameObject GetPlanet(string name);
|
|
}
|
|
```
|
|
|
|
In your main `ModBehaviour` class you can get the NewHorizons API like so:
|
|
```cs
|
|
public class MyMod : ModBehaviour
|
|
{
|
|
void Start()
|
|
{
|
|
INewHorizons NewHorizonsAPI = ModHelper.Interaction.GetModApi<INewHorizons>("xen.NewHorizons");
|
|
}
|
|
}
|
|
```
|
|
|
|
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.
|