Small bug fixes + json schema for configs

This commit is contained in:
Nick J. Connors 2022-01-05 12:45:19 -05:00
parent 60eb707390
commit d4c6a5e315
6 changed files with 890 additions and 7 deletions

View File

@ -11,7 +11,6 @@ namespace NewHorizons.External
public string StarSystem { get; set; } = "SolarSystem";
public bool Destroy { get; set; }
public int BuildPriority { get; set; } = -1;
public MVector3 SpawnPoint { get; set; }
public BaseModule Base { get; set; }
public AtmosphereModule Atmosphere { get; set; }
public OrbitModule Orbit { get; set; }

View File

@ -216,16 +216,19 @@ namespace NewHorizons
if (selectionCount > 1)
{
body1.transform.localScale = Vector3.one * (body1.transform.localScale.x) * 0.3f;
body1.transform.localPosition = new Vector3(0, -20, 0);
body1.transform.localPosition = new Vector3(0, -15, 0);
body1.transform.localRotation = Quaternion.Euler(10f, 0f, 0f);
body2 = LoadTitleScreenBody(eligible[indices[1]]);
body2.transform.localScale = Vector3.one * (body2.transform.localScale.x) * 0.3f;
body2.transform.localPosition = new Vector3(7, 40, 0);
body2.transform.localPosition = new Vector3(7, 30, 0);
body2.transform.localRotation = Quaternion.Euler(10f, 0f, 0f);
}
if (selectionCount > 2)
{
body3 = LoadTitleScreenBody(eligible[indices[2]]);
body3.transform.localScale = Vector3.one * (body3.transform.localScale.x) * 0.3f;
body3.transform.localPosition = new Vector3(-5, 10, 0);
body3.transform.localRotation = Quaternion.Euler(10f, 0f, 0f);
}
GameObject.Find("Scene/Background/PlanetPivot/Prefab_HEA_Campfire").SetActive(false);
@ -282,7 +285,6 @@ namespace NewHorizons
newRing.Texture = body.Config.Ring.Texture;
var ring = RingBuilder.Make(titleScreenGO, newRing, body.Assets);
titleScreenGO.transform.localScale = Vector3.one * 0.8f;
pivot.GetComponent<RotateTransform>()._degreesPerSecond = 0f;
}
titleScreenGO.transform.parent = pivot.transform;

View File

@ -47,6 +47,7 @@ namespace NewHorizons.Utility
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<BlackHoleVolume>("Start", typeof(Patches), nameof(Patches.OnBlackHoleVolumeStart));
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<WhiteHoleVolume>("Awake", typeof(Patches), nameof(Patches.OnWhiteHoleVolumeAwake));
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ProbeLauncher>("UpdateOrbitalLaunchValues", typeof(Patches), nameof(Patches.OnProbeLauncherUpdateOrbitalLaunchValues));
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<SurveyorProbe>("IsLaunched", typeof(Patches), nameof(Patches.OnSurveyorProbeIsLaunched));
Main.Instance.ModHelper.HarmonyHelper.AddPrefix<ShipLogController>("Update", typeof(Patches), nameof(Patches.OnShipLogControllerUpdate));
@ -369,5 +370,18 @@ namespace NewHorizons.Utility
}
return false;
}
public static bool OnSurveyorProbeIsLaunched(SurveyorProbe __instance, ref bool __result)
{
try
{
__result = __instance.gameObject.activeSelf;
}
catch(Exception)
{
__result = true;
}
return false;
}
}
}

View File

@ -34,10 +34,18 @@ namespace NewHorizons.Utility
public void RemoveStar(StarController star)
{
Logger.Log($"Removing star from list: {star?.gameObject?.name}");
if (_stars.Contains(star))
{
if (_activeStar.Equals(star)) _activeStar = null;
_stars.Remove(star);
if (_activeStar.Equals(star))
{
_stars.Remove(star);
if(_stars.Count > 0) ChangeActiveStar(_stars[0]);
}
else
{
_stars.Remove(star);
}
}
}

View File

@ -3,7 +3,7 @@
"author": "xen",
"name": "New Horizons",
"uniqueName": "xen.NewHorizons",
"version": "0.5.2",
"version": "0.5.3",
"owmlVersion": "2.1.0",
"dependencies": [ "PacificEngine.OW_CommonResources" ]
}

860
NewHorizons/schema.json Normal file
View File

@ -0,0 +1,860 @@
{
"title": "Planet",
"type": "object",
"required": [
"name",
"Base",
"Orbit"
],
"properties": {
"name": {
"type": "string",
"description": "Unique name of your planet",
"default": "New planet"
},
"starSystem": {
"type": "string",
"description": "Unique star system containing your planet",
"default": "SolarSystem"
},
"destroy": {
"type": "boolean",
"description": "True if you want to delete this planet",
"default": false
},
"Base": {
"type": "object",
"properties": {
"hasMapMarker": {
"type": "boolean",
"default": false
},
"hasAmbientLight": {
"type": "boolean",
"default": false
},
"surfaceGravity": {
"type": "number",
"default": 12,
"description": "The acceleration due to gravity felt as the surfaceSize. Timber Hearth has 12 for reference"
},
"gravityFallOff": {
"type": "string",
"enum": [
"linear",
"inverseSquared"
],
"default": "linear"
},
"surfaceSize": {
"type": "number",
"default": 100,
"description": "A scale height used for a number of things."
},
"sphereOfInfluence": {
"type": "number",
"default": 0,
"description": "An override for the radius of the planet's gravitational sphere of influence. Optional"
},
"waterSize": {
"type": "number",
"default": 0,
"description": "Sea level for the planet. Optional"
},
"groundSize": {
"type": "number",
"default": 0,
"description": "Radius of the a simple sphere used as the ground for the planet. If you want to use more complex terrain, leave this as 0."
},
"lavaSize": {
"type": "number",
"default": 0,
"description": "Radius of a sphere of lava. Optional."
},
"hasCometTail": {
"type": "boolean",
"default": false
},
"hasReferenceFrame": {
"type": "boolean",
"default": true,
"description": "Allows the object to be targetable from the map."
},
"centerOfSolarSystem": {
"type": "boolean",
"default": false,
"description": "Set this to true if you are replacing the sun with a different body. Only one object in a star system should ever have this set to true."
},
"isSatellite": {
"type": "boolean",
"default": false,
"description": "Is this body an artificial satellite of a planet/moon/star?"
}
}
},
"atmosphere": {
"type": "object",
"properties": {
"size": {
"type": "number",
"default": 0,
"description": "Scale height of the atmosphere"
},
"cloudTint": {
"type": "object",
"properties": {
"R": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"G": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"B": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"A": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
}
}
},
"cloud": {
"type": "string",
"description": "Relative filepath to the cloud texture, if the planet has clouds. Optional."
},
"cloudCap": {
"type": "string",
"description": "Relative filepath to the cloud cap texture, if the planet has clouds. Optional."
},
"cloudRamp": {
"type": "string",
"description": "Relative filepath to the cloud ramp texture, if the planet has clouds. Optional."
},
"fogTint": {
"type": "object",
"description": "Colour of fog on the planet.",
"properties": {
"R": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"G": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"B": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"A": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
}
}
},
"fogDensity": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"fogSize": {
"type": "number",
"description": "Radius of fog sphere, independant of the atmosphere",
"minimum": 0
},
"hasRain": {
"type": "boolean",
"default": false
},
"hasSnow": {
"type": "boolean",
"default": false
},
"hasOxygen": {
"type": "boolean",
"default": false
},
"atmosphereTint": {
"type": "object",
"description": "Colour of atmospheric shader on the planet.",
"properties": {
"R": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"G": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"B": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"A": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
}
}
}
}
},
"Orbit": {
"type": "object",
"properties": {
"semiMajorAxis": {
"type": "integer",
"default": 5000,
"minimum": 0,
"description": "The average distance between the planet and its primary body."
},
"inclination": {
"type": "integer",
"default": 0,
"description": "The angle (in degrees) between the body's orbit and the plane of the star system"
},
"primaryBody": {
"type": "string",
"default": "Sun",
"description": "The name of the body this one will orbit around"
},
"isMoon": {
"type": "boolean",
"description": "Is this the moon of a planet?"
},
"longitudeOfAscendingNode": {
"type": "number",
"default": 0
},
"eccentricity": {
"type": "number",
"default": 0,
"minimum": 0,
"maximum": 0.99
},
"argumentOfPeriapsis": {
"type": "number",
"default": 0,
"minimum": 0,
"maximum": 360
},
"trueAnomaly": {
"type": "number",
"default": 0,
"minimum": 0,
"maximum": 360
},
"axialTilt": {
"type": "number",
"default": 0
},
"siderealPeriod": {
"type": "number",
"default": 0
},
"isTidallyLocked": {
"type": "boolean",
"default": false
},
"showOrbitLine": {
"type": "boolean",
"default": false
},
"isStatic": {
"type": "boolean",
"default": false,
"description": "Is the body meant to stay in one place without moving?"
},
"tint": {
"type": "object",
"description": "Colour of the orbitline in the map view.",
"properties": {
"R": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"G": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"B": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"A": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
}
}
}
}
},
"Ring": {
"type": "object",
"properties": {
"innerRadius": {
"type": "number",
"default": 0,
"minimum": 0
},
"outerRadius": {
"type": "number",
"default": 0,
"minimum": 0
},
"inclination": {
"type": "number",
"default": 0
},
"longitudeOfAscendingNode": {
"type": "number",
"default": 0,
"minimum": 0,
"maximum": 360
},
"texture": {
"type": "string",
"description": "Relative filepath to the texture used for the rings."
}
}
},
"HeightMap": {
"type": "object",
"properties": {
"heightMap": {
"type": "string",
"description": "Relative filepath to the texture used for the terrain height"
},
"textureMap": {
"type": "string",
"description": "Relative filepath to the texture used for the terrain."
},
"minHeight": {
"type": "number",
"minimum": 0
},
"maxHeight": {
"type": "number",
"minimum": 0
}
}
},
"ProcGen": {
"type": "object",
"properties": {
"scale": {
"type": "number",
"minimum": 0,
"description": "Average surface size"
},
"colour": {
"type": "object",
"description": "Colour of the terrain.",
"properties": {
"R": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"G": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"B": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"A": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
}
}
}
}
},
"AsteroidBelt": {
"type": "object",
"properties": {
"innerRadius": {
"type": "number",
"default": 0,
"minimum": 0
},
"outerRadius": {
"type": "number",
"default": 0,
"minimum": 0
},
"inclination": {
"type": "number",
"default": 0
},
"longitudeOfAscendingNode": {
"type": "number",
"default": 0,
"minimum": 0,
"maximum": 360
},
"randomSeed": {
"type": "integer",
"default": 0,
"description": "Number used to randomize asteroid positions"
},
"procGen": {
"type": "object"
}
}
},
"Star": {
"type": "object",
"properties": {
"size": {
"type": "number",
"default": 2000,
"minimum": 0
},
"tint": {
"type": "object",
"description": "Colour of the star.",
"properties": {
"R": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"G": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"B": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"A": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
}
}
},
"solarFlareTint": {
"type": "object",
"description": "Colour of the solar flares.",
"properties": {
"R": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"G": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"B": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"A": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
}
}
},
"lightTint": {
"type": "object",
"description": "Colour of the light given off.",
"properties": {
"R": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"G": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"B": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
},
"A": {
"type": "integer",
"default": 0,
"minimum": 0,
"maximum": 255
}
}
},
"solarLuminosity": {
"type": "number",
"minimum": 0,
"description": "Relative strenght of the light compared to the sun",
"default": 1
}
}
},
"FocalPoint": {
"type": "object",
"description": "Use this to create the focal point that two objects can orbit in a binary system",
"properties": {
"primary": {
"type": "string",
"description": "The larger of the two bodies in the binary pair."
},
"secondary": {
"type": "string",
"description": "The smaller of the two bodies in the binary pair."
}
}
},
"Props": {
"type": "object",
"properties": {
"scatter": {
"type": "array",
"items": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"path": {
"type": "string",
"description": "Either the path in the scene hierarchy of the item to copy or the path to the object in the supplied asset bundle"
},
"assetBundle": {
"type": "string",
"description": "Relative filepath to an assetbundle"
},
"offset": {
"type": "object",
"properties": {
"x": {
"type": "number",
"default": 0
},
"y": {
"type": "number",
"default": 0
},
"z": {
"type": "number",
"default": 0
}
},
"rotation": {
"type": "object",
"description": "Euler angle degrees",
"properties": {
"x": {
"type": "number",
"default": 0
},
"y": {
"type": "number",
"default": 0
},
"z": {
"type": "number",
"default": 0
}
}
},
"scale": {
"type": "number",
"default": 1
}
}
}
}
},
"details": {
"type": "array",
"items": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"path": {
"type": "string",
"description": "Either the path in the scene hierarchy of the item to copy or the path to the object in the supplied asset bundle"
},
"assetBundle": {
"type": "string",
"description": "Relative filepath to an assetbundle"
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"default": 0
},
"y": {
"type": "number",
"default": 0
},
"z": {
"type": "number",
"default": 0
}
},
"rotation": {
"type": "object",
"description": "Euler angle degrees",
"properties": {
"x": {
"type": "number",
"default": 0
},
"y": {
"type": "number",
"default": 0
},
"z": {
"type": "number",
"default": 0
}
}
},
"scale": {
"type": "number",
"default": 1
},
"alignToNormal": {
"type": "boolean",
"description": "Do we override rotation and try to automatically align this object to stand upright on the body's surface?",
"default": false
}
}
}
}
}
}
},
"Spawn": {
"type": "object",
"properties": {
"playerSpawnPoint": {
"type": "object",
"properties": {
"x": {
"type": "number",
"default": 0
},
"y": {
"type": "number",
"default": 0
},
"z": {
"type": "number",
"default": 0
}
}
},
"shipSpawnPoint": {
"type": "object",
"properties": {
"x": {
"type": "number",
"default": 0
},
"y": {
"type": "number",
"default": 0
},
"z": {
"type": "number",
"default": 0
}
}
},
"starWithSuit": {
"type": "boolean",
"default": false
}
}
},
"Signal": {
"type": "object",
"properties": {
"signals": {
"type": "array",
"items": {
"type": "object",
"properties": {
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"default": 0
},
"y": {
"type": "number",
"default": 0
},
"z": {
"type": "number",
"default": 0
}
}
},
"frequency": {
"type": "string",
"enum": [
"Default",
"Traveler",
"Quantum",
"EscapePod",
"Statue",
"WarpCore",
"HideAndSeek",
"Radio"
]
},
"name": {
"type": "string"
},
"audioClip": {
"type": "string",
"description": "Name of an existing AudioClip in the game"
},
"audioFilePath": {
"type": "string",
"description": "Relative filepath to the .wav file to use as the audio. Mutually exclusive with audioClip"
},
"sourceRadius": {
"type": "number",
"default": 1,
"description": "Radius of the sphere giving off the signal"
},
"detectionRadius": {
"type": "number",
"minimum": 0,
"description": "How close the player must get to the signal to detect it"
},
"identificationRadius": {
"type": "number",
"minimum": 0,
"description": "How close the player must get to the signal to identify it"
},
"onlyAudibleToScope": {
"type": "boolean",
"default": true,
"description": "False if the player can hear the signal without equiping the signalscope"
},
"insideCloak": {
"type": "boolean",
"default": false,
"description": "Only set to true if you are putting this signal inside a cloaking field"
}
}
}
}
}
},
"Singularity": {
"type": "object",
"properties": {
"size": {
"type": "number",
"default": 0,
"minimum": 0
},
"pairedSingularity": {
"type": "string",
"description": "The name of the whitehole/blackhole that is paired to this one. If you don't set a value, entering will kill the player"
},
"targetStarSystem": {
"type": "string",
"description": "If you want a black hole to load a new star system scene, put it's name here. Optional."
},
"type": {
"type": "string",
"enum": [
"BlackHole",
"WhiteHole"
]
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"default": 0
},
"y": {
"type": "number",
"default": 0
},
"z": {
"type": "number",
"default": 0
}
}
}
}
}
}
}