From 292f77d7b2b3aae502c0bc28d0abe7b941f8bfa4 Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Tue, 9 Jun 2020 12:09:32 +0100 Subject: [PATCH] Update README.md --- README.md | 73 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 57f3fbdd..f03ac279 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Support for mods to create custom planets / moons is also coming soon! - [Creating a planet file](#creating-a-planet-file-) - [Submit bugs / Chat about life](#submit-bugs--chat-about-life-) +- [Using Marshmallow from other mods](#using-marshmallow-from-other-mods-) @@ -17,27 +18,39 @@ Support for mods to create custom planets / moons is also coming soon! This list will update as more options are added. Structure JSON file like so : ``` { - "settings": { "name" : "Test Planet", - "position" : [0, 0, 20000], + "position" : { + "x" : 0, + "y" : 0, + "z" : 5000 + }, "orbitAngle" : 0, + "primaryBody" : "SUN", "hasFog" : true, - "fogTint" : [0, 75, 15, 128], + "fogTint" : { + "r" : 255, + "g" : 100, + "b" : 0, + "a" : 128 + }, "fogDensity" : 0.5 - } } ``` Everything in "Required" is always needed, and so is every tabbed line in an option. ### Required : - name - The name of the planet. -- position - The Vector3 positon of the planet in world space. Write as \[x, y, z]. +- position - The Vector3 positon of the planet in world space. - orbitAngle - The angle of the orbit. +- primaryBody - The AstroObject ID of the body this planet orbits. ### Optional : +- hasGround - Set to "true" if you want to have a sphere as a ground. + - groundSize - The size of the ground sphere. - hasClouds - Set to "true" if you want Giant's Deep-type clouds. - topCloudSize - The size of the outer sphere of the clouds. - bottomCloudSize - The size of the bumpy clouds underneath the top. *(Check that the bottom clouds are not poking through the top!)* - - cloudTint - The color of the clouds. Write as \[r, g, b, a] in byte form. (0-255) + - topCloudTint - The color of the top clouds. + - bottomCloudTint - The color of the bottom clouds. - hasWater - Set to "true" if you want water. - waterSize - Size of the water sphere. - hasRain - Set to "true" if you want it to be raining. @@ -45,9 +58,55 @@ Everything in "Required" is always needed, and so is every tabbed line in an opt - surfaceAcceleration - Strength of gravity. - hasMapMarker - Set to "true" if you want the planet name on the map. - hasFog - Set to "true" if you want fog. - - fogTint - The color of the fog. Write as \[r, g, b, a] in byte form. (0-255) + - fogTint - The color of the fog. - fogDensity - The thickness of the fog. \[0-1] +## Using Marshmallow from other mods : +Marshmallow uses the fancy API system provided by OWML to allow other mods to communicate with it. As this system is currently still being worked on (by me :P), the way the Marshmallow API is used is slightly more annoying than when the system will be finished. + +To use the API, first define this interface in your mod. +``` +public interface IMarshmallow +{ + void Create(Dictionary config); +} +``` +Then, you need to find the Marshmallow API. This can be done using the interaction helpers of OWML. +``` +var marshmallowApi = ModHelper.Interaction.GetApi("misternebula.Marshmallow"); +``` +**Make sure that Marshmallow is defined as a dependency! This will prevent any load-order issues from occuring.** +Next, we need to generate the dictionary of config options. To save time, you can copy this definition and just change the values. +``` +var configDict = new Dictionary + { + { "name", "Test Planet" }, + { "position", new Vector3(0, 0, 3000) }, + { "orbitAngle", 0 }, + { "primaryBody", "SUN" }, + { "hasSpawnPoint", true }, + { "hasGround", true }, + { "groundSize", 400f }, + { "hasClouds", true }, + { "topCloudSize", 650f }, + { "bottomCloudSize", 600f }, + { "topCloudTint", new Color32(255, 0, 0, 128) }, + { "bottomCloudTint", new Color32(255, 0, 0, 128) }, + { "hasWater", true }, + { "waterSize", 401f }, + { "hasRain", true }, + { "hasGravity", true }, + { "surfaceAcceleration", 12f }, + { "hasMapMarker", true }, + { "hasFog", true }, + { "fogTint", new Color32(255, 0, 0, 128 }, + { "fogDensity", 0.5f }, + }; +``` +Then, you just call the `Create` method in the API! +``` +marshmallowApi.Create(configDict); +``` ## Submit bugs / Chat about life : Did you know we have a nice [Outer Wilds discord](https://discord.gg/Sftcc9Z)? Drop by to submit bugs, ask questions, and chat about whatever. Join us modding folk in the `#modding` channel!