merged dev

This commit is contained in:
FreezeDriedMangoes 2022-06-13 22:27:45 -04:00
commit 43b29e7775
22 changed files with 212 additions and 107 deletions

View File

@ -1,5 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/xen-42/outer-wilds-new-horizons/master/NewHorizons/translation_schema.json",
"$schema": "https://raw.githubusercontent.com/xen-42/outer-wilds-new-horizons/main/NewHorizons/Schemas/translation_schema.json",
"DialogueDictionary":
{
"NEW_HORIZONS_WARP_DRIVE_DIALOGUE_1" : "Your ship is now equiped with a warp drive!",
@ -11,6 +11,8 @@
"INTERSTELLAR_MODE" : "Interstellar Mode",
"FREQ_STATUE" : "Nomai Statue",
"FREQ_WARP_CORE" : "Anti-Graviton Flux",
"FREQ_UNKNOWN" : "???"
"FREQ_UNKNOWN" : "???",
"ENGAGE_WARP_PROMPT" : "Engage Warp To {0}",
"WARP_LOCKED" : "AUTOPILOT LOCKED TO:\n{0}"
}
}

View File

@ -11,6 +11,8 @@
"INTERSTELLAR_MODE" : "Режим Interstellar",
"FREQ_STATUE" : "Статуя Номаи",
"FREQ_WARP_CORE" : "Гиперядро",
"FREQ_UNKNOWN" : "???"
"FREQ_UNKNOWN" : "???",
"ENGAGE_WARP_PROMPT" : "Телепортироваться к {0}",
"WARP_LOCKED" : "АВТОПИЛОТ ЗАКРЕПЛЁН НА:\n{0}"
}
}
}

View File

@ -14,18 +14,33 @@ namespace NewHorizons.Builder.Body
public static void Make(GameObject planetGO, Sector sector, HeightMapModule module, IModBehaviour mod, int resolution = 51)
{
var deleteHeightmapFlag = false;
Texture2D heightMap, textureMap;
try
{
if (module.heightMap == null) heightMap = Texture2D.whiteTexture;
if (module.heightMap == null)
{
heightMap = Texture2D.whiteTexture;
}
else
{
// If we've loaded a new heightmap we'll delete the texture after
heightMap = ImageUtilities.GetTexture(mod, module.heightMap);
// defer remove texture to next frame
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => Object.Destroy(heightMap));
deleteHeightmapFlag = true;
}
if (module.textureMap == null) textureMap = Texture2D.whiteTexture;
else textureMap = ImageUtilities.GetTexture(mod, module.textureMap);
if (module.textureMap == null)
{
textureMap = Texture2D.whiteTexture;
}
else
{
textureMap = ImageUtilities.GetTexture(mod, module.textureMap);
}
// If the texturemap is the same as the heightmap don't delete it #176
if (textureMap == heightMap) deleteHeightmapFlag = false;
}
catch (Exception e)
{
@ -45,11 +60,9 @@ namespace NewHorizons.Builder.Body
cubeSphere.GetComponent<MeshFilter>().mesh = mesh;
if (PlanetShader == null) PlanetShader = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/SphereTextureWrapper.shader");
//if (PlanetShader == null) PlanetShader = Shader.Find("Standard");
var cubeSphereMR = cubeSphere.AddComponent<MeshRenderer>();
var material = cubeSphereMR.material;
material = new Material(PlanetShader);
var material = new Material(PlanetShader);
cubeSphereMR.material = material;
material.name = textureMap.name;
material.mainTexture = textureMap;
@ -65,6 +78,9 @@ namespace NewHorizons.Builder.Body
cubeSphere.transform.position = planetGO.transform.position;
cubeSphere.SetActive(true);
// Now that we've made the mesh we can delete the heightmap texture
if (deleteHeightmapFlag) ImageUtilities.DeleteTexture(mod, module.heightMap, heightMap);
}
}
}

View File

@ -73,10 +73,18 @@ namespace NewHorizons.Builder.Body
deathVolume.transform.localPosition = Vector3.zero;
deathVolume.transform.localScale = Vector3.one;
deathVolume.GetComponent<SphereCollider>().radius = 1f;
deathVolume.GetComponent<DestructionVolume>()._onlyAffectsPlayerAndShip = false;
deathVolume.GetComponent<DestructionVolume>()._onlyAffectsPlayerAndShip = true;
deathVolume.GetComponent<DestructionVolume>()._shrinkBodies = true;
deathVolume.name = "DestructionVolume";
var planetDestructionVolume = Object.Instantiate(deathVolume, starGO.transform);
planetDestructionVolume.transform.localPosition = Vector3.zero;
planetDestructionVolume.transform.localScale = Vector3.one;
planetDestructionVolume.GetComponent<SphereCollider>().radius = 0.75f;
planetDestructionVolume.GetComponent<DestructionVolume>()._onlyAffectsPlayerAndShip = false;
planetDestructionVolume.GetComponent<DestructionVolume>()._shrinkBodies = true;
planetDestructionVolume.name = "PlanetDestructionVolume";
Light ambientLight = ambientLightGO.GetComponent<Light>();
var sunLight = new GameObject("StarLight");

View File

@ -45,15 +45,7 @@ namespace NewHorizons.Builder.Orbital
{
orbitLine = orbitGO.AddComponent<NHOrbitLine>();
var a = astroObject.semiMajorAxis;
var e = astroObject.eccentricity;
var b = a * Mathf.Sqrt(1f - (e * e));
var l = astroObject.longitudeOfAscendingNode;
var p = astroObject.argumentOfPeriapsis;
var i = astroObject.inclination;
(orbitLine as NHOrbitLine).SemiMajorAxis = a * OrbitalParameters.Rotate(Vector3.left, l, i, p);
(orbitLine as NHOrbitLine).SemiMinorAxis = b * OrbitalParameters.Rotate(Vector3.forward, l, i, p);
(orbitLine as NHOrbitLine).SetFromParameters(astroObject);
}
var color = Color.white;

View File

@ -19,6 +19,7 @@ namespace NewHorizons.Builder.Props
private static GameObject _computerPrefab;
private static GameObject _cairnPrefab;
private static GameObject _recorderPrefab;
private static GameObject _preCrashRecorderPrefab;
private static Dictionary<PropModule.NomaiTextArcInfo, GameObject> arcInfoToCorrespondingSpawnedGameObject = new Dictionary<PropModule.NomaiTextArcInfo, GameObject>();
public static GameObject GetSpawnedGameObjectByNomaiTextArcInfo(PropModule.NomaiTextArcInfo arc)
@ -81,6 +82,10 @@ namespace NewHorizons.Builder.Props
_recorderPrefab = SearchUtilities.Find("Comet_Body/Prefab_NOM_Shuttle/Sector_NomaiShuttleInterior/Interactibles_NomaiShuttleInterior/Prefab_NOM_Recorder").InstantiateInactive();
_recorderPrefab.name = "Prefab_NOM_Recorder";
_recorderPrefab.transform.rotation = Quaternion.identity;
_preCrashRecorderPrefab = SearchUtilities.Find("BrittleHollow_Body/Sector_BH/Sector_EscapePodCrashSite/Sector_CrashFragment/Interactables_CrashFragment/Prefab_NOM_Recorder").InstantiateInactive();
_preCrashRecorderPrefab.name = "Prefab_NOM_Recorder_Vessel";
_preCrashRecorderPrefab.transform.rotation = Quaternion.identity;
}
public static void Make(GameObject planetGO, Sector sector, PropModule.NomaiTextInfo info, IModBehaviour mod)
@ -242,9 +247,10 @@ namespace NewHorizons.Builder.Props
conversationInfoToCorrespondingSpawnedGameObject[info] = cairnObject;
break;
}
case PropModule.NomaiTextInfo.NomaiTextType.PreCrashRecorder:
case PropModule.NomaiTextInfo.NomaiTextType.Recorder:
{
var recorderObject = _recorderPrefab.InstantiateInactive();
var recorderObject = (info.type == PropModule.NomaiTextInfo.NomaiTextType.PreCrashRecorder? _preCrashRecorderPrefab : _recorderPrefab).InstantiateInactive();
recorderObject.transform.parent = sector?.transform ?? planetGO.transform;
recorderObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);

View File

@ -96,7 +96,7 @@ namespace NewHorizons.Builder.Props
imageLoader.imageLoadedEvent.AddListener(
(Texture2D tex, int index) =>
{
slideCollection.slides[index].textureOverride = ImageUtilities.Invert(tex);
slideCollection.slides[index]._image = ImageUtilities.Invert(tex);
// Track the first 15 to put on the slide reel object
if (index < 15)
@ -176,7 +176,7 @@ namespace NewHorizons.Builder.Props
slideCollection.slides[i] = slide;
}
imageLoader.imageLoadedEvent.AddListener((Texture2D tex, int index) => { slideCollection.slides[index].textureOverride = ImageUtilities.Invert(tex); });
imageLoader.imageLoadedEvent.AddListener((Texture2D tex, int index) => { slideCollection.slides[index]._image = ImageUtilities.Invert(tex); });
slideCollectionContainer.slideCollection = slideCollection;
@ -185,8 +185,8 @@ namespace NewHorizons.Builder.Props
// Change the picture on the lens
var lens = projectorObj.transform.Find("Spotlight/Prop_IP_SingleSlideProjector/Projector_Lens").GetComponent<MeshRenderer>();
lens.materials[1].mainTexture = slideCollection.slides[0]._textureOverride;
lens.materials[1].SetTexture(EmissionMap, slideCollection.slides[0]._textureOverride);
lens.materials[1].mainTexture = slideCollection.slides[0]._image;
lens.materials[1].SetTexture(EmissionMap, slideCollection.slides[0]._image);
projectorObj.SetActive(true);
}
@ -224,7 +224,7 @@ namespace NewHorizons.Builder.Props
slideCollection.slides[i] = slide;
}
imageLoader.imageLoadedEvent.AddListener((Texture2D tex, int index) => { slideCollection.slides[index].textureOverride = tex; });
imageLoader.imageLoadedEvent.AddListener((Texture2D tex, int index) => { slideCollection.slides[index]._image = tex; });
// attatch a component to store all the data for the slides that play when a vision torch scans this target
@ -298,7 +298,7 @@ namespace NewHorizons.Builder.Props
imageLoader.imageLoadedEvent.AddListener(
(Texture2D tex, int index) =>
{
slideCollection.slides[index].textureOverride = tex;
slideCollection.slides[index]._image = tex;
displaySlidesLoaded++; // threading moment
if (displaySlidesLoaded >= slides.Length)
@ -380,7 +380,7 @@ namespace NewHorizons.Builder.Props
public class VisionTorchTarget : MonoBehaviour
{
public MindSlideCollection slideCollection;
public SlideCollectionContainer slideCollectionContainer;
public SlideCollectionContainer slideCollectionContainer;
public OWEvent.OWCallback onSlidesComplete;
}
}

View File

@ -116,7 +116,9 @@ namespace NewHorizons.Builder.Props
tornadoGO.transform.localScale = Vector3.one * scale;
// Resize the distance it can be heard from to match roughly with the size
audioSource.maxDistance = 100 * scale;
var maxDistance = info.audioDistance == 0 ? 10 * scale : info.audioDistance;
audioSource.maxDistance = maxDistance;
audioSource.minDistance = maxDistance / 10f;
var controller = tornadoGO.GetComponent<TornadoController>();
controller.SetSector(sector);

View File

@ -12,9 +12,9 @@ namespace NewHorizons.Components
private List<Renderer> _renderers = null;
internal static bool isPlayerInside = false;
internal static bool isProbeInside = false;
internal static bool isShipInside = false;
public static bool isPlayerInside = false;
public static bool isProbeInside = false;
public static bool isShipInside = false;
public void Init(CloakFieldController cloak, GameObject root)
{

View File

@ -1,20 +1,17 @@
using System;
using System;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Components.Orbital
{
public class NHOrbitLine : OrbitLine
{
public Vector3 SemiMajorAxis { get; set; }
public Vector3 SemiMinorAxis { get; set; }
private Vector3 _semiMajorAxis;
private Vector3 _semiMinorAxis;
private Vector3 _upAxis;
private float _fociDistance;
private Vector3[] _verts;
private float semiMajorAxis;
private float semiMinorAxis;
public override void InitializeLineRenderer()
{
base.GetComponent<LineRenderer>().positionCount = this._numVerts;
@ -36,10 +33,10 @@ namespace NewHorizons.Components.Orbital
{
base.Start();
var a = SemiMajorAxis.magnitude;
var b = SemiMinorAxis.magnitude;
var a = _semiMajorAxis.magnitude;
var b = _semiMinorAxis.magnitude;
_upAxis = Vector3.Cross(SemiMajorAxis.normalized, SemiMinorAxis.normalized);
_upAxis = Vector3.Cross(_semiMajorAxis.normalized, _semiMinorAxis.normalized);
_fociDistance = Mathf.Sqrt(a * a - b * b);
if (float.IsNaN(_fociDistance)) _fociDistance = 0f;
@ -48,9 +45,6 @@ namespace NewHorizons.Components.Orbital
transform.localRotation = Quaternion.Euler(270, 90, 0);
semiMajorAxis = SemiMajorAxis.magnitude;
semiMinorAxis = SemiMinorAxis.magnitude;
base.enabled = false;
}
@ -67,22 +61,22 @@ namespace NewHorizons.Components.Orbital
return;
}
Vector3 origin = primary.transform.position + SemiMajorAxis.normalized * _fociDistance;
Vector3 origin = primary.transform.position + _semiMajorAxis.normalized * _fociDistance;
float num = CalcProjectedAngleToCenter(origin, SemiMajorAxis, SemiMinorAxis, _astroObject.transform.position);
float num = CalcProjectedAngleToCenter(origin, _semiMajorAxis, _semiMinorAxis, _astroObject.transform.position);
for (int i = 0; i < _numVerts; i++)
{
var stepSize = 2f * Mathf.PI / (float)(_numVerts - 1);
float f = num + stepSize * i;
_verts[i] = SemiMajorAxis * Mathf.Cos(f) + SemiMinorAxis * Mathf.Sin(f);
_verts[i] = _semiMajorAxis * Mathf.Cos(f) + _semiMinorAxis * Mathf.Sin(f);
}
_lineRenderer.SetPositions(_verts);
transform.position = origin;
transform.rotation = Quaternion.Euler(0, 0, 0); //Quaternion.LookRotation(-SemiMajorAxis, _upAxis);
float num2 = DistanceToEllipticalOrbitLine(origin, SemiMajorAxis, SemiMinorAxis, _upAxis, Locator.GetActiveCamera().transform.position);
float num2 = DistanceToEllipticalOrbitLine(origin, _semiMajorAxis, _semiMinorAxis, _upAxis, Locator.GetActiveCamera().transform.position);
float widthMultiplier = Mathf.Min(num2 * (_lineWidth / 1000f), _maxLineWidth);
float num3 = _fade ? (1f - Mathf.Clamp01((num2 - _fadeStartDist) / (_fadeEndDist - _fadeStartDist))) : 1f;
@ -96,6 +90,19 @@ namespace NewHorizons.Components.Orbital
}
}
public void SetFromParameters(IOrbitalParameters parameters)
{
var a = parameters.semiMajorAxis;
var e = parameters.eccentricity;
var b = a * Mathf.Sqrt(1f - (e * e));
var l = parameters.longitudeOfAscendingNode;
var p = parameters.argumentOfPeriapsis;
var i = parameters.inclination;
_semiMajorAxis = a * OrbitalParameters.Rotate(Vector3.left, l, i, p);
_semiMinorAxis = b * OrbitalParameters.Rotate(Vector3.forward, l, i, p);
}
private float CalcProjectedAngleToCenter(Vector3 foci, Vector3 semiMajorAxis, Vector3 semiMinorAxis, Vector3 point)
{
Vector3 lhs = point - foci;
@ -107,7 +114,7 @@ namespace NewHorizons.Components.Orbital
private float DistanceToEllipticalOrbitLine(Vector3 foci, Vector3 semiMajorAxis, Vector3 semiMinorAxis, Vector3 upAxis, Vector3 point)
{
float f = CalcProjectedAngleToCenter(foci, semiMajorAxis, semiMinorAxis, point);
Vector3 b = foci + SemiMajorAxis * Mathf.Cos(f) + SemiMinorAxis * Mathf.Sin(f);
Vector3 b = foci + _semiMajorAxis * Mathf.Cos(f) + _semiMinorAxis * Mathf.Sin(f);
return Vector3.Distance(point, b);
}
}

View File

@ -1,4 +1,4 @@
using NewHorizons.Builder.General;
using NewHorizons.Builder.General;
using NewHorizons.Builder.Orbital;
using NewHorizons.Components.Orbital;
using NewHorizons.External.Modules;
@ -20,6 +20,9 @@ namespace NewHorizons.Components
private ConstantForceDetector _detector;
private AlignWithTargetBody _alignment;
private OWRigidbody _rb;
private OrbitLine _orbitLine;
public int CurrentIndex { get { return _currentIndex; } }
public override void Awake()
{
@ -29,6 +32,7 @@ namespace NewHorizons.Components
_detector = GetComponentInChildren<ConstantForceDetector>();
_alignment = GetComponent<AlignWithTargetBody>();
_rb = GetComponent<OWRigidbody>();
_orbitLine = GetComponent<OrbitLine>();
GlobalMessenger.AddListener("PlayerBlink", new Callback(OnPlayerBlink));
@ -141,6 +145,16 @@ namespace NewHorizons.Components
}
_rb.SetVelocity(orbitalParameters.InitialVelocity + primaryBody.GetAttachedOWRigidbody().GetVelocity());
if (_orbitLine is NHOrbitLine nhOrbitLine)
{
nhOrbitLine.SetFromParameters(orbitalParameters);
}
if (_orbitLine is TrackingOrbitLine trackingOrbitLine)
{
trackingOrbitLine.Reset();
}
}
private void OnPlayerBlink()

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Components
{
@ -105,12 +106,15 @@ namespace NewHorizons.Components
}
var newCard = GameObject.Instantiate(_cardTemplate, parent);
var textComponent = newCard.transform.Find("EntryCardRoot/NameBackground/Name").GetComponent<UnityEngine.UI.Text>();
var textComponent = newCard.transform.Find("EntryCardRoot/NameBackground/Name").GetComponent<Text>();
var name = UniqueIDToName(uniqueID);
textComponent.text = name;
if (name.Length > 17) textComponent.fontSize = 10;
// Do it next frame
var fontPath = "Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/ScaleRoot/PanRoot/TH_VILLAGE/EntryCardRoot/NameBackground/Name";
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => textComponent.font = SearchUtilities.Find(fontPath).GetComponent<Text>().font);
newCard.SetActive(true);
newCard.transform.name = uniqueID;
@ -273,16 +277,20 @@ namespace NewHorizons.Components
private void SetWarpTarget(ShipLogEntryCard shipLogEntryCard)
{
RemoveWarpTarget(false);
_oneShotSource.PlayOneShot(global::AudioType.ShipLogUnmarkLocation, 1f);
_oneShotSource.PlayOneShot(AudioType.ShipLogUnmarkLocation, 1f);
_target = shipLogEntryCard;
_target.SetMarkedOnHUD(true);
Locator._rfTracker.UntargetReferenceFrame();
GlobalMessenger.FireEvent("UntargetReferenceFrame");
_warpNotificationData = new NotificationData($"AUTOPILOT LOCKED TO:\n{UniqueIDToName(shipLogEntryCard.name).ToUpper()}");
var name = UniqueIDToName(shipLogEntryCard.name);
var warpNotificationDataText = TranslationHandler.GetTranslation("WARP_LOCKED", TranslationHandler.TextType.UI).Replace("{0}", name.ToUpper());
_warpNotificationData = new NotificationData(warpNotificationDataText);
NotificationManager.SharedInstance.PostNotification(_warpNotificationData, true);
_warpPrompt.SetText($"<CMD> Engage Warp To {UniqueIDToName(shipLogEntryCard.name)}");
var warpPromptText = "<CMD> " + TranslationHandler.GetTranslation("ENGAGE_WARP_PROMPT", TranslationHandler.TextType.UI).Replace("{0}", name);
_warpPrompt.SetText(warpPromptText);
}
private void RemoveWarpTarget(bool playSound = false)

View File

@ -14,11 +14,6 @@ namespace NewHorizons.External.Configs
/// </summary>
public bool canEnterViaWarpDrive = true;
/// <summary>
/// [DEPRECATED] Not implemented
/// </summary>
public NomaiCoordinates coords;
/// <summary>
/// Do you want a clean slate for this star system? Or will it be a modified version of the original.
/// </summary>

View File

@ -5,6 +5,7 @@ using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
namespace NewHorizons.External.Modules
{
@ -205,10 +206,7 @@ namespace NewHorizons.External.Modules
[EnumMember(Value = @"hurricane")] Hurricane = 2
}
/// <summary>
/// [DEPRECATED] Should this tornado shoot you down instead of up?
/// </summary>
public bool downwards;
[Obsolete("Downwards is deprecated. Use Type instead.")] public bool downwards;
/// <summary>
/// Alternative to setting the position. Will choose a random place at this elevation.
@ -250,6 +248,11 @@ namespace NewHorizons.External.Modules
/// 0.1.
/// </summary>
public float wanderRate;
/// <summary>
/// The maximum distance at which you'll hear the sounds of the cyclone. If not set it will scale relative to the size of the cyclone.
/// </summary>
public float audioDistance;
}
[JsonObject]
@ -421,7 +424,9 @@ namespace NewHorizons.External.Modules
[EnumMember(Value = @"cairn")] Cairn = 3,
[EnumMember(Value = @"recorder")] Recorder = 4
[EnumMember(Value = @"recorder")] Recorder = 4,
[EnumMember(Value = @"preCrashRecorder")] PreCrashRecorder = 5
}
/// <summary>

View File

@ -1,4 +1,4 @@
using NewHorizons.External.Configs;
using NewHorizons.External.Configs;
using System;
using System.Collections.Generic;
using System.Linq;
@ -18,6 +18,11 @@ namespace NewHorizons.Handlers
}
public static string GetTranslation(string text, TextType type)
{
return GetTranslation(text, type, out var _);
}
public static string GetTranslation(string text, TextType type, out TextTranslation.Language translatedLanguage)
{
Dictionary<TextTranslation.Language, Dictionary<string, string>> dictionary;
var language = TextTranslation.Get().m_language;
@ -34,6 +39,7 @@ namespace NewHorizons.Handlers
dictionary = _uiTranslationDictionary;
break;
default:
translatedLanguage = TextTranslation.Language.UNKNOWN;
return text;
}
@ -41,6 +47,7 @@ namespace NewHorizons.Handlers
{
if (table.TryGetValue(text, out var translatedText))
{
translatedLanguage = language;
return translatedText;
}
}
@ -51,11 +58,13 @@ namespace NewHorizons.Handlers
if (englishTable.TryGetValue(text, out var englishText))
{
translatedLanguage = TextTranslation.Language.ENGLISH;
return englishText;
}
}
// Default to the key
translatedLanguage = TextTranslation.Language.UNKNOWN;
return text;
}

View File

@ -81,6 +81,9 @@ namespace NewHorizons
_defaultSystemOverride = config.GetSettingsValue<string>("Default System Override");
// Else it doesn't get set idk
if (SceneManager.GetActiveScene().name == "TitleScreen") _currentStarSystem = _defaultSystemOverride;
var wasUsingCustomTitleScreen = _useCustomTitleScreen;
_useCustomTitleScreen = config.GetSettingsValue<bool>("Custom title screen");
// Reload the title screen if this was updated on it

View File

@ -0,0 +1,14 @@
using HarmonyLib;
namespace NewHorizons.Patches;
[HarmonyPatch]
public class AutoSlideProjectorPatches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(AutoSlideProjector), nameof(AutoSlideProjector.Play))]
public static void AutoSlideProjector_Play(ref SlideCollectionContainer ____slideCollectionItem)
{
____slideCollectionItem.enabled = true;
}
}

View File

@ -0,0 +1,35 @@
using HarmonyLib;
using NewHorizons.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.Patches
{
[HarmonyPatch]
public static class DestructionVolumePatches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(DestructionVolume), nameof(DestructionVolume.Vanish))]
public static bool DestructionVolume_Vanish(OWRigidbody __0)
{
var quantumPlanet = __0.gameObject.GetComponent<QuantumPlanet>();
if (quantumPlanet == null) return true;
// Allow it to vanish if this is the only state
if (quantumPlanet.states.Count <= 1) return true;
// Force it to change states but if it can't, remove it
var oldIndex = quantumPlanet.CurrentIndex;
quantumPlanet.ChangeQuantumState(true);
if (quantumPlanet.CurrentIndex == oldIndex) return true;
quantumPlanet.states.RemoveAt(oldIndex);
return false;
}
}
}

View File

@ -1018,14 +1018,16 @@
"Scroll",
"Computer",
"Cairn",
"Recorder"
"Recorder",
"PreCrashRecorder"
],
"enum": [
"wall",
"scroll",
"computer",
"cairn",
"recorder"
"recorder",
"preCrashRecorder"
]
},
"RaftInfo": {
@ -1238,10 +1240,6 @@
"type": "object",
"additionalProperties": false,
"properties": {
"downwards": {
"type": "boolean",
"description": "[DEPRECATED] Should this tornado shoot you down instead of up?"
},
"elevation": {
"type": "number",
"description": "Alternative to setting the position. Will choose a random place at this elevation.",
@ -1281,6 +1279,11 @@
"type": "number",
"description": "The rate at which the tornado will wander around the planet. Set to 0 for it to be stationary. Should be around\n0.1.",
"format": "float"
},
"audioDistance": {
"type": "number",
"description": "The maximum distance at which you'll hear the sounds of the cyclone. If not set it will scale relative to the size of the cyclone.",
"format": "float"
}
}
},

View File

@ -9,10 +9,6 @@
"type": "boolean",
"description": "Whether this system can be warped to via the warp drive"
},
"coords": {
"description": "[DEPRECATED] Not implemented",
"$ref": "#/definitions/NomaiCoordinates"
},
"destroyStockPlanets": {
"type": "boolean",
"description": "Do you want a clean slate for this star system? Or will it be a modified version of the original."
@ -52,33 +48,6 @@
}
},
"definitions": {
"NomaiCoordinates": {
"type": "object",
"additionalProperties": false,
"properties": {
"x": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
}
},
"y": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
}
},
"z": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
}
}
}
},
"SkyboxConfig": {
"type": "object",
"additionalProperties": false,

View File

@ -42,9 +42,24 @@ namespace NewHorizons.Utility
}
}
public static void DeleteTexture(IModBehaviour mod, string filename, Texture2D texture)
{
var path = mod.ModHelper.Manifest.ModFolderPath + filename;
if (_loadedTextures.ContainsKey(path))
{
if (_loadedTextures[path] == texture)
{
_loadedTextures.Remove(path);
UnityEngine.Object.Destroy(texture);
}
}
UnityEngine.Object.Destroy(texture);
}
public static void ClearCache()
{
Logger.Log("Cleaing image cache");
Logger.Log("Clearing image cache");
foreach (var texture in _loadedTextures.Values)
{

View File

@ -3,7 +3,7 @@
"author": "xen, Bwc9876, & Book",
"name": "New Horizons",
"uniqueName": "xen.NewHorizons",
"version": "1.2.4",
"version": "1.2.5",
"owmlVersion": "2.3.3",
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "Vesper.AutoResume", "PacificEngine.OW_Randomizer" ],
"pathsToPreserve": [ "planets", "systems", "translations" ]