Space Engineers

Space Engineers

Real Gas Giants
 This topic has been pinned, so it's probably important
Echthros  [developer] 15 May, 2024 @ 1:04pm
Real Gas Giants Mod API
Setup Steps:
1. Copy RealGasGiantsApiClient.cs file to your code project.
2. Instantiate the RealGasGiantsAPI class in the main MySessionComponentBase and store it in a property. (i.e. public RealGasGiantsApi RealGasGiantsApi = new RealGasGiantsApi();)
3. Add the RealGasGiantsAPI.Load() call to the LoadData() method and the RealGasGiantsAPI.Unload() call to the UnloadData() override methods in the main MySessionComponentBase.
4. Use the API methods as you please.

Methods:
MyPlanet SpawnGasGiant(Vector3D position, float radius, Vector3I planetColor, string planetSkin, float gravityStrength, float gravityFalloff, float dayLength)
Create a new gas giant with the input values. Returns the created planet.

bool SetGasGiantConfig_BasicInfo(MyPlanet planet, float radius, Vector3I planetColor, string planetSkin, float gravityStrength, float gravityFalloff, float dayLength)
Sets the Radius, PlanetColor, PlanetSkin, GravityStrength, GravityFalloff, and DayLengthSeconds (positive values spin counterclockwise) for an existing gas giant. Returns if the operation was successful.

bool SetGasGiantConfig_Name(MyPlanet planet, string name)
Sets the custom name of an existing gas giant. Returns if the operation was successful.

MyTuple<bool, float, Vector3I, string, float> GetGasGiantConfig_BasicInfo_Base(MyPlanet planet)
Gets the Radius, PlanetColor, PlanetSkin, and DayLengthSeconds (positive values spin counterclockwise) of an existing gas giant. The first element in the returned tuple is true if the operation was successful.

MyTuple<bool, float, float> GetGasGiantConfig_BasicInfo_Gravity(MyPlanet planet)
Gets the GravityStrength and GravityFalloff of an existing gas giant. The first element in the returned tuple is true if the operation was successful.

bool SetGasGiantConfig_AtmoInfo(MyPlanet planet, float airDensity, float oxygenDensity, float windSpeed)
Sets the atmo info of an existing gas giant. Returns if the operation was successful.

MyTuple<bool, float, float, float> GetGasGiantConfig_AtmoInfo(MyPlanet planet)
Gets the AirDensity, OxygenDensity, and WindSpeed of an existing gas giant. The first element in the returned tuple is true if the operation was successful.

bool SetGasGiantConfig_RingInfo(MyPlanet planet, bool hasRing, string ringSkin, Vector3D ringNormal, Vector3I ringColor, float ringLightMult, float ringShadowMult, float ringInnerScale, float ringOuterScale, float ringLayerSpacingScale, float ringRotationPeriod, bool constrainNearbyAsteroidsToRing)
Sets the ring info for an existing gas giant. Returns if the operation was successful.

MyTuple<bool, bool, float, bool> GetGasGiantConfig_RingInfo_Base(MyPlanet planet)
Gets the HasRing, RingRotationPeriodSeconds, and ConstrainNearbyAsteroidsToRing values of an existing gas giant's ring. The first element in the returned tuple is true if the operation was successful.

MyTuple<bool, string, Vector3I, float, float> GetGasGiantConfig_RingInfo_Visual(MyPlanet planet)
Gets the RingSkin, RingColor, RingLightMult, and RingShadowMult values of an existing gas giant's ring. The first element in the returned tuple is true if the operation was successful.

MyTuple<bool, Vector3D, float, float, float> GetGasGiantConfig_RingInfo_Size(MyPlanet planet)
Gets the RingNormal, RingInnerScale, RingOuterScale, and RingLayerSpacingScale values of an existing gas giant's ring. The first element in the returned tuple is true if the operation was successful.

bool SetGasGiantConfig_InteriorInfo(MyPlanet planet, bool asteroidRemoval, bool pressureDamagePlayers, bool pressureDamageGrids)
Sets the interior info for an existing gas giant. Returns if the operation was successful.

MyTuple<bool, bool, bool, bool> API_GetGasGiantConfig_InteriorInfo(MyPlanet planet)
Gets the AsteroidRemoval, PressureDamagePlayers, and PressureDamageGrids values of an existing gas giant. The first element in the returned tuple is true if the operation was successful.

bool SetGasGiantConfig_ResourceInfo(MyPlanet planet, bool collectPlanetResources, string collectResourceUpperSubtypeId, float collectResourceUpperAmount, string collectResourceLowerSubtypeId, float collectResourceLowerAmount, bool collectRingResources, string collectResourceRingSubtypeId, float collectResourceRingAmount)
Sets the resources collected from an existing gas giant and its ring. Returns if the operation was successful.

MyTuple<bool, bool, string, float, string, float> GetGasGiantConfig_ResourceInfo_Planet(MyPlanet planet)
Gets the CollectPlanetResources, CollectResourceUpperSubtypeId, CollectResourceUpperAmount, CollectResourceLowerSubtypeId, and CollectResourceLowerAmount values of an existing gas giant. The first element in the returned tuple is true if the operation was successful.

MyTuple<bool, bool, string, float> GetGasGiantConfig_ResourceInfo_Ring(MyPlanet planet)
Gets the CollectRingResources, CollectResourceRingSubtypeId, and CollectResourceRingAmount values of an existing gas giant's ring. The first element in the returned tuple is true if the operation was successful.

List<string> GetGasGiantSkinList()
Gets a list of all valid planet skin options for gas giants (includes any mods which add extras).

List<string> GetGasGiantRingSkinList()
Gets a list of all valid ring skin options for gas giants (includes any mods which add extras).

List<MyPlanet> GetOverlapGasGiantsAtPosition(Vector3D position)
Gets a list of all gas giants overlapping the input position (maximum atmo effect / inner sphere / inside of the planet).

List<MyPlanet> GetAtmoGasGiantsAtPosition(Vector3D position)
Gets a list of all gas giants overlapping the input position (minimum atmo effect / outer sphere / inside of the atmosphere).

float GetShadowFactor(Vector3D position)
Gets the shadow factor (how strongly the gas giant planets are blocking the sun) for a point in space. Value is between 0 (no shadow) and 1 (full shadow). Value will be 1 if point is inside a gas giant atmosphere.

float GetAtmoDensity(MyPlanet planet, Vector3D position)
Gets the density of the atmosphere for the input gas giant at the given position.

float GetAtmoDensityGlobal(Vector3D position)
Gets the density of the atmosphere from all gas giants at the given position.

float GetRingInfluenceAtPosition(MyPlanet planet, Vector3D position)
Gets the ring influence value at a position for a specific gas giant. A value of 1 means the position is completely inside the ring (i.e. resources can be collected, asteroids will spawn, etc.). A value of 0 means that the position is completely outside the ring.

float GetRingInfluenceAtPositionGlobal(Vector3D position)
Gets the ring influence at a position for all gas giants.
Last edited by Echthros; 3 Sep, 2024 @ 10:58pm