Brought over changes from ship log branch

This commit is contained in:
Nick J. Connors 2022-02-07 23:27:35 -05:00
parent df7b6ab1aa
commit 701f908798
11 changed files with 49 additions and 95 deletions

View File

@ -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"
}
]
}

View File

@ -6,33 +6,7 @@
<EntryCondition>DEFAULT</EntryCondition>
<Dialogue>
<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>
</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>
</Dialogue>
<SetPersistentCondition>KnowsAboutWarpDrive</SetPersistentCondition>

View File

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

View File

@ -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<MeshRenderer>().material.color = adjustedColour;
}
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)
{
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);
}

View File

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

View File

@ -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<ShipLogStarChartMode>();
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<ScreenPromptList>();
var upperRightPromptList = shipLogRoot.transform.Find("ScreenPromptListScaleRoot/ScreenPromptList_UpperRight")?.GetComponent<ScreenPromptList>();
@ -50,4 +49,4 @@ namespace NewHorizons.Builder.General
oneShotSource);
}
}
}
}

View File

@ -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<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>());
@ -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);

View File

@ -52,6 +52,7 @@ namespace NewHorizons.Tools
// Postfixes
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)
@ -347,5 +348,10 @@ namespace NewHorizons.Tools
}
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.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;

View File

@ -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<OWRigidbody>();
@ -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<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();
}
*/
}
}
}