diff --git a/NewHorizons/AssetBundle/WarpDriveConfig.json b/NewHorizons/AssetBundle/WarpDriveConfig.json
index eb685c70..cc45a642 100644
--- a/NewHorizons/AssetBundle/WarpDriveConfig.json
+++ b/NewHorizons/AssetBundle/WarpDriveConfig.json
@@ -8,7 +8,8 @@
"position":{"x": -0.3071011, "y": 2.741472, "z": -4.005298},
"radius":1,
"xmlFile":"AssetBundle/WarpDriveDialogue.xml",
- "remoteTriggerPosition": {"x": -0.05656214, "y": 0.5362684, "z": 0.5467669}
+ "remoteTriggerPosition": {"x": -0.05656214, "y": 0.5362684, "z": 0.5467669},
+ "blockAfterPersistentCondition" : "KnowsAboutWarpDrive"
}
]
}
diff --git a/NewHorizons/AssetBundle/WarpDriveDialogue.xml b/NewHorizons/AssetBundle/WarpDriveDialogue.xml
index 37c2c43a..1f9ea63f 100644
--- a/NewHorizons/AssetBundle/WarpDriveDialogue.xml
+++ b/NewHorizons/AssetBundle/WarpDriveDialogue.xml
@@ -6,33 +6,7 @@
DEFAULT
Your ship is now equiped with a warp drive!
-
-
-
-
- ...
- 1
-
-
-
-
-
- 1
-
You can use the new "Interstellar Mode" page in the ship log to lock-on your autopilot to another star system.
-
-
-
-
- ...
- 2
-
-
-
-
-
- 2
-
Then just buckle up and engage the autopilot to warp there!
KnowsAboutWarpDrive
diff --git a/NewHorizons/Builder/Atmosphere/EffectsBuilder.cs b/NewHorizons/Builder/Atmosphere/EffectsBuilder.cs
index f53b9a18..501148c6 100644
--- a/NewHorizons/Builder/Atmosphere/EffectsBuilder.cs
+++ b/NewHorizons/Builder/Atmosphere/EffectsBuilder.cs
@@ -26,7 +26,12 @@ namespace NewHorizons.Atmosphere
rainGO.transform.localPosition = Vector3.zero;
var pvc = rainGO.GetComponent();
- pvc.SetValue("_densityByHeight", new AnimationCurve(new Keyframe[] { new Keyframe(surfaceSize, 10f), new Keyframe(atmoSize / 2f, 0f) }));
+ pvc._densityByHeight = new AnimationCurve(new Keyframe[]
+ {
+ new Keyframe(surfaceSize - 0.5f, 0),
+ new Keyframe(surfaceSize, 10f),
+ new Keyframe(atmoSize, 0f)
+ });
rainGO.GetComponent().SetValue("_activeInSector", sector);
rainGO.GetComponent().SetValue("_exclusionSectors", new Sector[] { });
@@ -45,7 +50,12 @@ namespace NewHorizons.Atmosphere
snowEmitter.transform.localPosition = Vector3.zero;
var pvc = snowEmitter.GetComponent();
- pvc.SetValue("_densityByHeight", new AnimationCurve(new Keyframe[] { new Keyframe(surfaceSize, 10f), new Keyframe(atmoSize / 2f, 0f) }));
+ pvc._densityByHeight = new AnimationCurve(new Keyframe[]
+ {
+ new Keyframe(surfaceSize - 0.5f, 0),
+ new Keyframe(surfaceSize, 10f),
+ new Keyframe(atmoSize, 0f)
+ });
snowEmitter.GetComponent().SetValue("_activeInSector", sector);
snowEmitter.GetComponent().SetValue("_exclusionSectors", new Sector[] { });
diff --git a/NewHorizons/Builder/Body/WaterBuilder.cs b/NewHorizons/Builder/Body/WaterBuilder.cs
index c6cc0711..59bbc6ae 100644
--- a/NewHorizons/Builder/Body/WaterBuilder.cs
+++ b/NewHorizons/Builder/Body/WaterBuilder.cs
@@ -40,6 +40,8 @@ namespace NewHorizons.Builder.Body
if (module.Tint != null)
{
tempArray[i].color = module.Tint.ToColor32();
+ tempArray[i].color = module.Tint.ToColor();
+ tempArray[i].SetColor("_FogColor", module.Tint.ToColor());
}
}
@@ -80,6 +82,13 @@ namespace NewHorizons.Builder.Body
fogGO.name = "OceanFog";
fogGO.transform.localPosition = Vector3.zero;
fogGO.transform.localScale = Vector3.one;
+ if (module.Tint != null)
+ {
+ var adjustedColour = module.Tint.ToColor() / 4f;
+ adjustedColour.a = 1f;
+
+ fogGO.GetComponent().material.color = adjustedColour;
+ }
if (module.Curve != null)
{
diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs
index 3b1a786a..3cc77e70 100644
--- a/NewHorizons/Builder/Props/DialogueBuilder.cs
+++ b/NewHorizons/Builder/Props/DialogueBuilder.cs
@@ -15,6 +15,8 @@ namespace NewHorizons.Builder.Props
{
public static void Make(GameObject go, Sector sector, PropModule.DialogueInfo info, IModHelper mod)
{
+ if (info.blockAfterPersistentCondition != null && PlayerData._currentGameSave.GetPersistentCondition(info.blockAfterPersistentCondition)) return;
+
var dialogue = MakeConversationZone(go, sector, info, mod);
if (info.remoteTriggerPosition != null) MakeRemoteDialogueTrigger(go, sector, info, dialogue);
}
diff --git a/NewHorizons/External/PropModule.cs b/NewHorizons/External/PropModule.cs
index 02f66142..dfe7455c 100644
--- a/NewHorizons/External/PropModule.cs
+++ b/NewHorizons/External/PropModule.cs
@@ -66,7 +66,7 @@ namespace NewHorizons.External
public float radius = 1f;
public string xmlFile;
public MVector3 remoteTriggerPosition;
- public string persistentCondition;
+ public string blockAfterPersistentCondition;
}
}
}
diff --git a/NewHorizons/Builder/General/ShipLogBuilder.cs b/NewHorizons/Handlers/StarChartHandler.cs
similarity index 92%
rename from NewHorizons/Builder/General/ShipLogBuilder.cs
rename to NewHorizons/Handlers/StarChartHandler.cs
index 8d38d135..6fafab15 100644
--- a/NewHorizons/Builder/General/ShipLogBuilder.cs
+++ b/NewHorizons/Handlers/StarChartHandler.cs
@@ -5,29 +5,28 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
-using Logger = NewHorizons.Utility.Logger;
-namespace NewHorizons.Builder.General
+namespace NewHorizons.Handlers
{
- public static class ShipLogBuilder
+ public static class StarChartHandler
{
public static ShipLogStarChartMode ShipLogStarChartMode;
public static void Init()
{
var shipLogRoot = GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas");
-
+
var starChartLog = new GameObject("StarChartMode");
starChartLog.SetActive(false);
starChartLog.transform.parent = shipLogRoot.transform;
starChartLog.transform.localScale = Vector3.one * 1f;
starChartLog.transform.localPosition = Vector3.zero;
starChartLog.transform.localRotation = Quaternion.Euler(0, 0, 0);
-
+
ShipLogStarChartMode = starChartLog.AddComponent();
-
+
var reticleImage = GameObject.Instantiate(GameObject.Find("Ship_Body/Module_Cabin/Systems_Cabin/ShipLogPivot/ShipLog/ShipLogPivot/ShipLogCanvas/DetectiveMode/ReticleImage (1)/"), starChartLog.transform);
-
+
var scaleRoot = new GameObject("ScaleRoot");
scaleRoot.transform.parent = starChartLog.transform;
scaleRoot.transform.localScale = Vector3.one;
@@ -38,7 +37,7 @@ namespace NewHorizons.Builder.General
panRoot.transform.parent = scaleRoot.transform;
panRoot.transform.localScale = Vector3.one;
panRoot.transform.localPosition = Vector3.zero;
- panRoot.transform.localRotation = Quaternion.Euler(0,0,0);
+ panRoot.transform.localRotation = Quaternion.Euler(0, 0, 0);
var centerPromptList = shipLogRoot.transform.Find("ScreenPromptListScaleRoot/ScreenPromptList_Center")?.GetComponent();
var upperRightPromptList = shipLogRoot.transform.Find("ScreenPromptListScaleRoot/ScreenPromptList_UpperRight")?.GetComponent();
@@ -50,4 +49,4 @@ namespace NewHorizons.Builder.General
oneShotSource);
}
}
-}
+}
\ No newline at end of file
diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs
index 967b4466..4d81d809 100644
--- a/NewHorizons/Main.cs
+++ b/NewHorizons/Main.cs
@@ -7,6 +7,7 @@ using NewHorizons.Builder.Props;
using NewHorizons.Components;
using NewHorizons.External;
using NewHorizons.External.VariableSize;
+using NewHorizons.Handlers;
using NewHorizons.OrbitalPhysics;
using NewHorizons.Utility;
using OWML.Common;
@@ -113,12 +114,9 @@ namespace NewHorizons
HasWarpDrive = true;
_shipWarpController = GameObject.Find("Ship_Body").AddComponent();
- Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => ShipLogBuilder.Init());
+ Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => StarChartHandler.Init());
- if (!PlayerData._currentGameSave.GetPersistentCondition("KnowsAboutWarpDrive"))
- {
- LoadBody(LoadConfig(this, "AssetBundle/WarpDriveConfig.json"));
- }
+ LoadBody(LoadConfig(this, "AssetBundle/WarpDriveConfig.json"));
}
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => AstroObjectLocator.GetAstroObject("MapSatellite").gameObject.AddComponent());
@@ -582,7 +580,7 @@ namespace NewHorizons
}
if (body.Config.Atmosphere.HasRain || body.Config.Atmosphere.HasSnow)
- EffectsBuilder.Make(go, sector, body.Config.Base.SurfaceSize, body.Config.Atmosphere.Size / 2f, body.Config.Atmosphere.HasRain, body.Config.Atmosphere.HasSnow);
+ EffectsBuilder.Make(go, sector, body.Config.Base.SurfaceSize, body.Config.Atmosphere.Size, body.Config.Atmosphere.HasRain, body.Config.Atmosphere.HasSnow);
if (body.Config.Atmosphere.FogSize != 0)
FogBuilder.Make(go, sector, body.Config.Atmosphere);
diff --git a/NewHorizons/Tools/Patches.cs b/NewHorizons/Tools/Patches.cs
index cc02fc79..4e32af97 100644
--- a/NewHorizons/Tools/Patches.cs
+++ b/NewHorizons/Tools/Patches.cs
@@ -52,6 +52,7 @@ namespace NewHorizons.Tools
// Postfixes
Main.Instance.ModHelper.HarmonyHelper.AddPostfix("Awake", typeof(Patches), nameof(Patches.OnMapControllerAwake));
+ Main.Instance.ModHelper.HarmonyHelper.AddPostfix("OnTargetReferenceFrame", typeof(Patches), nameof(Patches.OnMapControllerOnTargetReferenceFrame));
}
public static bool GetHUDDisplayName(ReferenceFrame __instance, ref string __result)
@@ -67,9 +68,12 @@ namespace NewHorizons.Tools
public static bool CheckShipOutersideSolarSystem(PlayerState __instance, ref bool __result)
{
+ if (PlayerState._inBrambleDimension) return false;
+
Transform sunTransform = Locator.GetSunTransform();
OWRigidbody shipBody = Locator.GetShipBody();
- __result = sunTransform != null && shipBody != null && (sunTransform.position - shipBody.transform.position).sqrMagnitude > Main.FurthestOrbit * Main.FurthestOrbit * 4f;
+ var maxDist2 = Mathf.Max(900000000f, Main.FurthestOrbit * Main.FurthestOrbit * 2f);
+ __result = sunTransform != null && shipBody != null && (sunTransform.position - shipBody.transform.position).sqrMagnitude > maxDist2;
return false;
}
@@ -347,5 +351,10 @@ namespace NewHorizons.Tools
}
return false;
}
+
+ public static void OnMapControllerOnTargetReferenceFrame(MapController __instance, ReferenceFrame __0)
+ {
+ __instance._isLockedOntoMapSatellite = true;
+ }
}
}
diff --git a/NewHorizons/Tools/WarpDrivePatches.cs b/NewHorizons/Tools/WarpDrivePatches.cs
index e84d0d71..e06ce4c0 100644
--- a/NewHorizons/Tools/WarpDrivePatches.cs
+++ b/NewHorizons/Tools/WarpDrivePatches.cs
@@ -1,4 +1,5 @@
using NewHorizons.Builder.General;
+using NewHorizons.Handlers;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -35,7 +36,7 @@ namespace NewHorizons.Tools
if (__instance._playerAtFlightConsole && OWInput.IsNewlyPressed(InputLibrary.autopilot, InputMode.ShipCockpit))
{
- var targetSystem = ShipLogBuilder.ShipLogStarChartMode.GetTargetStarSystem();
+ var targetSystem = StarChartHandler.ShipLogStarChartMode.GetTargetStarSystem();
if (targetSystem != null)
{
Main.Instance.ChangeCurrentStarSystem(targetSystem, true);
@@ -52,7 +53,7 @@ namespace NewHorizons.Tools
if (__instance._exiting
|| OWInput.GetInputMode() != InputMode.ShipComputer
|| __instance._currentMode.AllowCancelInput() && OWInput.IsNewlyPressed(InputLibrary.cancel, InputMode.All)
- || ShipLogBuilder.ShipLogStarChartMode == null)
+ || StarChartHandler.ShipLogStarChartMode == null)
return true;
__instance._exitPrompt.SetVisibility(__instance._currentMode.AllowCancelInput());
@@ -66,8 +67,8 @@ namespace NewHorizons.Tools
__instance._currentMode = (flag ? __instance._detectiveMode : __instance._mapMode);
if (currentMode.Equals(__instance._mapMode))
- __instance._currentMode = ShipLogBuilder.ShipLogStarChartMode;
- else if (currentMode.Equals(ShipLogBuilder.ShipLogStarChartMode))
+ __instance._currentMode = StarChartHandler.ShipLogStarChartMode;
+ else if (currentMode.Equals(StarChartHandler.ShipLogStarChartMode))
__instance._currentMode = __instance._detectiveMode;
else
__instance._currentMode = __instance._mapMode;
diff --git a/NewHorizons/Utility/DebugRaycaster.cs b/NewHorizons/Utility/DebugRaycaster.cs
index 39537d07..6dd56a44 100644
--- a/NewHorizons/Utility/DebugRaycaster.cs
+++ b/NewHorizons/Utility/DebugRaycaster.cs
@@ -13,10 +13,6 @@ namespace NewHorizons.Utility
public class DebugRaycaster : MonoBehaviour
{
private OWRigidbody _rb;
-
- private GameObject blackHole;
- private GameObject whiteHole;
-
private void Awake()
{
_rb = this.GetRequiredComponent();
@@ -38,48 +34,6 @@ namespace NewHorizons.Utility
}
_rb.EnableCollisionDetection();
}
-
- /*
- // Portal Gun:
- if (Keyboard.current == null) return;
- var fireBlackHole = Keyboard.current[Key.B].wasReleasedThisFrame;
- var fireWhiteHole = Keyboard.current[Key.N].wasReleasedThisFrame;
- if (fireBlackHole || fireWhiteHole)
- {
- // Raycast
- _rb.DisableCollisionDetection();
- int layerMask = OWLayerMask.physicalMask;
- var origin = Locator.GetActiveCamera().transform.position;
- var direction = Locator.GetActiveCamera().transform.TransformDirection(Vector3.forward);
- if (Physics.Raycast(origin, direction, out RaycastHit hitInfo, Mathf.Infinity, OWLayerMask.physicalMask))
- {
- var pos = hitInfo.transform.InverseTransformPoint(hitInfo.point + hitInfo.normal);
- var hitBody = hitInfo.transform.gameObject;
- var sector = hitBody.GetComponent()?.GetRootSector();
-
- if (hitBody == null || sector == null) return;
- Logger.Log($"{hitBody}");
- if (fireBlackHole)
- {
- if (blackHole != null) GameObject.Destroy(blackHole);
- blackHole = SingularityBuilder.MakeBlackHole(hitBody, sector, pos, 2, false, null, false);
- Logger.Log("Make black hole");
- }
- else
- {
- if (whiteHole != null) GameObject.Destroy(whiteHole);
- whiteHole = SingularityBuilder.MakeWhiteHole(hitBody, sector, hitBody.GetAttachedOWRigidbody(), pos, 2, false);
- Logger.Log("Make white hole");
- }
-
- if(blackHole && whiteHole)
- {
- SingularityBuilder.PairSingularities(blackHole, whiteHole);
- }
- }
- _rb.EnableCollisionDetection();
- }
- */
}
}
}