Merge pull request #24 from xen-42/dev

Dev
This commit is contained in:
Nick 2022-02-08 10:49:50 -05:00 committed by GitHub
commit b2113b7358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 53 additions and 96 deletions

View File

@ -8,7 +8,8 @@
"position":{"x": -0.3071011, "y": 2.741472, "z": -4.005298}, "position":{"x": -0.3071011, "y": 2.741472, "z": -4.005298},
"radius":1, "radius":1,
"xmlFile":"AssetBundle/WarpDriveDialogue.xml", "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"
} }
] ]
} }

View File

@ -6,33 +6,7 @@
<EntryCondition>DEFAULT</EntryCondition> <EntryCondition>DEFAULT</EntryCondition>
<Dialogue> <Dialogue>
<Page>Your ship is now equiped with a warp drive! </Page> <Page>Your ship is now equiped with a warp drive! </Page>
</Dialogue>
<DialogueOptionsList>
<DialogueOption>
<Text>...</Text>
<DialogueTarget>1</DialogueTarget>
</DialogueOption>
</DialogueOptionsList>
</DialogueNode>
<DialogueNode>
<Name>1</Name>
<Dialogue>
<Page>You can use the new "Interstellar Mode" page in the ship log to lock-on your autopilot to another star system.</Page> <Page>You can use the new "Interstellar Mode" page in the ship log to lock-on your autopilot to another star system.</Page>
</Dialogue>
<DialogueOptionsList>
<DialogueOption>
<Text>...</Text>
<DialogueTarget>2</DialogueTarget>
</DialogueOption>
</DialogueOptionsList>
</DialogueNode>
<DialogueNode>
<Name>2</Name>
<Dialogue>
<Page>Then just buckle up and engage the autopilot to warp there!</Page> <Page>Then just buckle up and engage the autopilot to warp there!</Page>
</Dialogue> </Dialogue>
<SetPersistentCondition>KnowsAboutWarpDrive</SetPersistentCondition> <SetPersistentCondition>KnowsAboutWarpDrive</SetPersistentCondition>

View File

@ -26,7 +26,12 @@ namespace NewHorizons.Atmosphere
rainGO.transform.localPosition = Vector3.zero; rainGO.transform.localPosition = Vector3.zero;
var pvc = rainGO.GetComponent<PlanetaryVectionController>(); var pvc = rainGO.GetComponent<PlanetaryVectionController>();
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<PlanetaryVectionController>().SetValue("_activeInSector", sector); rainGO.GetComponent<PlanetaryVectionController>().SetValue("_activeInSector", sector);
rainGO.GetComponent<PlanetaryVectionController>().SetValue("_exclusionSectors", new Sector[] { }); rainGO.GetComponent<PlanetaryVectionController>().SetValue("_exclusionSectors", new Sector[] { });
@ -45,7 +50,12 @@ namespace NewHorizons.Atmosphere
snowEmitter.transform.localPosition = Vector3.zero; snowEmitter.transform.localPosition = Vector3.zero;
var pvc = snowEmitter.GetComponent<PlanetaryVectionController>(); var pvc = snowEmitter.GetComponent<PlanetaryVectionController>();
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<PlanetaryVectionController>().SetValue("_activeInSector", sector); snowEmitter.GetComponent<PlanetaryVectionController>().SetValue("_activeInSector", sector);
snowEmitter.GetComponent<PlanetaryVectionController>().SetValue("_exclusionSectors", new Sector[] { }); snowEmitter.GetComponent<PlanetaryVectionController>().SetValue("_exclusionSectors", new Sector[] { });

View File

@ -40,6 +40,8 @@ namespace NewHorizons.Builder.Body
if (module.Tint != null) if (module.Tint != null)
{ {
tempArray[i].color = module.Tint.ToColor32(); 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.name = "OceanFog";
fogGO.transform.localPosition = Vector3.zero; fogGO.transform.localPosition = Vector3.zero;
fogGO.transform.localScale = Vector3.one; fogGO.transform.localScale = Vector3.one;
if (module.Tint != null)
{
var adjustedColour = module.Tint.ToColor() / 4f;
adjustedColour.a = 1f;
fogGO.GetComponent<MeshRenderer>().material.color = adjustedColour;
}
if (module.Curve != null) if (module.Curve != null)
{ {

View File

@ -15,6 +15,8 @@ namespace NewHorizons.Builder.Props
{ {
public static void Make(GameObject go, Sector sector, PropModule.DialogueInfo info, IModHelper mod) 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); var dialogue = MakeConversationZone(go, sector, info, mod);
if (info.remoteTriggerPosition != null) MakeRemoteDialogueTrigger(go, sector, info, dialogue); if (info.remoteTriggerPosition != null) MakeRemoteDialogueTrigger(go, sector, info, dialogue);
} }

View File

@ -66,7 +66,7 @@ namespace NewHorizons.External
public float radius = 1f; public float radius = 1f;
public string xmlFile; public string xmlFile;
public MVector3 remoteTriggerPosition; public MVector3 remoteTriggerPosition;
public string persistentCondition; public string blockAfterPersistentCondition;
} }
} }
} }

View File

@ -5,11 +5,10 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using UnityEngine; 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 ShipLogStarChartMode ShipLogStarChartMode;
@ -38,7 +37,7 @@ namespace NewHorizons.Builder.General
panRoot.transform.parent = scaleRoot.transform; panRoot.transform.parent = scaleRoot.transform;
panRoot.transform.localScale = Vector3.one; panRoot.transform.localScale = Vector3.one;
panRoot.transform.localPosition = Vector3.zero; 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<ScreenPromptList>(); var centerPromptList = shipLogRoot.transform.Find("ScreenPromptListScaleRoot/ScreenPromptList_Center")?.GetComponent<ScreenPromptList>();
var upperRightPromptList = shipLogRoot.transform.Find("ScreenPromptListScaleRoot/ScreenPromptList_UpperRight")?.GetComponent<ScreenPromptList>(); var upperRightPromptList = shipLogRoot.transform.Find("ScreenPromptListScaleRoot/ScreenPromptList_UpperRight")?.GetComponent<ScreenPromptList>();

View File

@ -7,6 +7,7 @@ using NewHorizons.Builder.Props;
using NewHorizons.Components; using NewHorizons.Components;
using NewHorizons.External; using NewHorizons.External;
using NewHorizons.External.VariableSize; using NewHorizons.External.VariableSize;
using NewHorizons.Handlers;
using NewHorizons.OrbitalPhysics; using NewHorizons.OrbitalPhysics;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
@ -113,12 +114,9 @@ namespace NewHorizons
HasWarpDrive = true; HasWarpDrive = true;
_shipWarpController = GameObject.Find("Ship_Body").AddComponent<ShipWarpController>(); _shipWarpController = GameObject.Find("Ship_Body").AddComponent<ShipWarpController>();
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<MapSatelliteOrbitFix>()); Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => AstroObjectLocator.GetAstroObject("MapSatellite").gameObject.AddComponent<MapSatelliteOrbitFix>());
@ -582,7 +580,7 @@ namespace NewHorizons
} }
if (body.Config.Atmosphere.HasRain || body.Config.Atmosphere.HasSnow) 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) if (body.Config.Atmosphere.FogSize != 0)
FogBuilder.Make(go, sector, body.Config.Atmosphere); FogBuilder.Make(go, sector, body.Config.Atmosphere);

View File

@ -52,6 +52,7 @@ namespace NewHorizons.Tools
// Postfixes // Postfixes
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<MapController>("Awake", typeof(Patches), nameof(Patches.OnMapControllerAwake)); Main.Instance.ModHelper.HarmonyHelper.AddPostfix<MapController>("Awake", typeof(Patches), nameof(Patches.OnMapControllerAwake));
Main.Instance.ModHelper.HarmonyHelper.AddPostfix<MapController>("OnTargetReferenceFrame", typeof(Patches), nameof(Patches.OnMapControllerOnTargetReferenceFrame));
} }
public static bool GetHUDDisplayName(ReferenceFrame __instance, ref string __result) 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) public static bool CheckShipOutersideSolarSystem(PlayerState __instance, ref bool __result)
{ {
if (PlayerState._inBrambleDimension) return false;
Transform sunTransform = Locator.GetSunTransform(); Transform sunTransform = Locator.GetSunTransform();
OWRigidbody shipBody = Locator.GetShipBody(); 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; return false;
} }
@ -347,5 +351,10 @@ namespace NewHorizons.Tools
} }
return false; return false;
} }
public static void OnMapControllerOnTargetReferenceFrame(MapController __instance, ReferenceFrame __0)
{
__instance._isLockedOntoMapSatellite = true;
}
} }
} }

View File

@ -1,4 +1,5 @@
using NewHorizons.Builder.General; using NewHorizons.Builder.General;
using NewHorizons.Handlers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -35,7 +36,7 @@ namespace NewHorizons.Tools
if (__instance._playerAtFlightConsole && OWInput.IsNewlyPressed(InputLibrary.autopilot, InputMode.ShipCockpit)) if (__instance._playerAtFlightConsole && OWInput.IsNewlyPressed(InputLibrary.autopilot, InputMode.ShipCockpit))
{ {
var targetSystem = ShipLogBuilder.ShipLogStarChartMode.GetTargetStarSystem(); var targetSystem = StarChartHandler.ShipLogStarChartMode.GetTargetStarSystem();
if (targetSystem != null) if (targetSystem != null)
{ {
Main.Instance.ChangeCurrentStarSystem(targetSystem, true); Main.Instance.ChangeCurrentStarSystem(targetSystem, true);
@ -52,7 +53,7 @@ namespace NewHorizons.Tools
if (__instance._exiting if (__instance._exiting
|| OWInput.GetInputMode() != InputMode.ShipComputer || OWInput.GetInputMode() != InputMode.ShipComputer
|| __instance._currentMode.AllowCancelInput() && OWInput.IsNewlyPressed(InputLibrary.cancel, InputMode.All) || __instance._currentMode.AllowCancelInput() && OWInput.IsNewlyPressed(InputLibrary.cancel, InputMode.All)
|| ShipLogBuilder.ShipLogStarChartMode == null) || StarChartHandler.ShipLogStarChartMode == null)
return true; return true;
__instance._exitPrompt.SetVisibility(__instance._currentMode.AllowCancelInput()); __instance._exitPrompt.SetVisibility(__instance._currentMode.AllowCancelInput());
@ -66,8 +67,8 @@ namespace NewHorizons.Tools
__instance._currentMode = (flag ? __instance._detectiveMode : __instance._mapMode); __instance._currentMode = (flag ? __instance._detectiveMode : __instance._mapMode);
if (currentMode.Equals(__instance._mapMode)) if (currentMode.Equals(__instance._mapMode))
__instance._currentMode = ShipLogBuilder.ShipLogStarChartMode; __instance._currentMode = StarChartHandler.ShipLogStarChartMode;
else if (currentMode.Equals(ShipLogBuilder.ShipLogStarChartMode)) else if (currentMode.Equals(StarChartHandler.ShipLogStarChartMode))
__instance._currentMode = __instance._detectiveMode; __instance._currentMode = __instance._detectiveMode;
else else
__instance._currentMode = __instance._mapMode; __instance._currentMode = __instance._mapMode;

View File

@ -13,10 +13,6 @@ namespace NewHorizons.Utility
public class DebugRaycaster : MonoBehaviour public class DebugRaycaster : MonoBehaviour
{ {
private OWRigidbody _rb; private OWRigidbody _rb;
private GameObject blackHole;
private GameObject whiteHole;
private void Awake() private void Awake()
{ {
_rb = this.GetRequiredComponent<OWRigidbody>(); _rb = this.GetRequiredComponent<OWRigidbody>();
@ -38,48 +34,6 @@ namespace NewHorizons.Utility
} }
_rb.EnableCollisionDetection(); _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<AstroObject>()?.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();
}
*/
} }
} }
} }