mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
commit
49e6f43e0d
@ -30,11 +30,19 @@ namespace NewHorizons.Components
|
||||
|
||||
private ScreenPrompt _detectiveModePrompt;
|
||||
private ScreenPrompt _targetSystemPrompt;
|
||||
private ScreenPrompt _warpPrompt = new ScreenPrompt(InputLibrary.autopilot, "<CMD> Warp to system");
|
||||
|
||||
private ShipLogEntryCard _target = null;
|
||||
private NotificationData _warpNotificationData = null;
|
||||
|
||||
private int _nextCardIndex;
|
||||
private bool _isAtFlightConsole;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// Prompts
|
||||
Locator.GetPromptManager().AddScreenPrompt(_warpPrompt, PromptPosition.UpperLeft, false);
|
||||
}
|
||||
|
||||
public override void Initialize(ScreenPromptList centerPromptList, ScreenPromptList upperRightPromptList, OWAudioSource oneShotSource)
|
||||
{
|
||||
@ -49,6 +57,9 @@ namespace NewHorizons.Components
|
||||
|
||||
GlobalMessenger<ReferenceFrame>.AddListener("TargetReferenceFrame", new Callback<ReferenceFrame>(OnTargetReferenceFrame));
|
||||
GlobalMessenger<OWRigidbody>.AddListener("EnterFlightConsole", new Callback<OWRigidbody>(OnEnterFlightConsole));
|
||||
GlobalMessenger.AddListener("ExitFlightConsole", new Callback(OnExitFlightConsole));
|
||||
GlobalMessenger.AddListener("GamePaused", new Callback(OnGamePaused));
|
||||
GlobalMessenger.AddListener("GameUnpaused", new Callback(OnGameUnpaused));
|
||||
|
||||
_nextCardIndex = 0;
|
||||
foreach (var starSystem in Main.SystemDict.Keys)
|
||||
@ -91,11 +102,39 @@ namespace NewHorizons.Components
|
||||
{
|
||||
GlobalMessenger<ReferenceFrame>.RemoveListener("TargetReferenceFrame", new Callback<ReferenceFrame>(OnTargetReferenceFrame));
|
||||
GlobalMessenger<OWRigidbody>.RemoveListener("EnterFlightConsole", new Callback<OWRigidbody>(OnEnterFlightConsole));
|
||||
GlobalMessenger.RemoveListener("ExitFlightConsole", new Callback(OnExitFlightConsole));
|
||||
GlobalMessenger.RemoveListener("GamePaused", new Callback(OnGamePaused));
|
||||
GlobalMessenger.RemoveListener("GameUnpaused", new Callback(OnGameUnpaused));
|
||||
|
||||
Locator.GetPromptManager().RemoveScreenPrompt(_warpPrompt, PromptPosition.UpperLeft);
|
||||
}
|
||||
|
||||
private void OnEnterFlightConsole(OWRigidbody _)
|
||||
{
|
||||
if (_target == null) GlobalMessenger.FireEvent("UntargetReferenceFrame");
|
||||
_isAtFlightConsole = true;
|
||||
if(_target != null)
|
||||
{
|
||||
_warpPrompt.SetVisibility(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnExitFlightConsole()
|
||||
{
|
||||
_isAtFlightConsole = false;
|
||||
_warpPrompt.SetVisibility(false);
|
||||
}
|
||||
|
||||
private void OnGamePaused()
|
||||
{
|
||||
_warpPrompt.SetVisibility(false);
|
||||
}
|
||||
|
||||
private void OnGameUnpaused()
|
||||
{
|
||||
if(_target != null && _isAtFlightConsole)
|
||||
{
|
||||
_warpPrompt.SetVisibility(true);
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject CreateCard(string uniqueName, Transform parent, Vector2 position)
|
||||
@ -271,9 +310,13 @@ namespace NewHorizons.Components
|
||||
_oneShotSource.PlayOneShot(global::AudioType.ShipLogUnmarkLocation, 1f);
|
||||
_target = shipLogEntryCard;
|
||||
_target.SetMarkedOnHUD(true);
|
||||
Locator._rfTracker.UntargetReferenceFrame();
|
||||
|
||||
GlobalMessenger.FireEvent("UntargetReferenceFrame");
|
||||
_warpNotificationData = new NotificationData($"AUTOPILOT LOCKED TO:\n{UniqueNameToString(shipLogEntryCard.name).ToUpper()}");
|
||||
NotificationManager.SharedInstance.PostNotification(_warpNotificationData, true);
|
||||
|
||||
_warpPrompt.SetText($"<CMD> Engage Warp To {UniqueNameToString(shipLogEntryCard.name)}");
|
||||
}
|
||||
|
||||
private void RemoveWarpTarget(bool playSound = false)
|
||||
@ -283,11 +326,24 @@ namespace NewHorizons.Components
|
||||
if(playSound) _oneShotSource.PlayOneShot(global::AudioType.ShipLogMarkLocation, 1f);
|
||||
_target.SetMarkedOnHUD(false);
|
||||
_target = null;
|
||||
|
||||
_warpPrompt.SetVisibility(false);
|
||||
}
|
||||
|
||||
public string GetTargetStarSystem()
|
||||
{
|
||||
return _target?.name;
|
||||
}
|
||||
|
||||
private bool IsWarpDriveAvailable()
|
||||
{
|
||||
return OWInput.IsInputMode(InputMode.ShipCockpit) && _target != null;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Logger.Log("???");
|
||||
_warpPrompt.SetVisibility(IsWarpDriveAvailable());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"author": "xen, Idiot, & Book",
|
||||
"name": "New Horizons",
|
||||
"uniqueName": "xen.NewHorizons",
|
||||
"version": "0.10.1",
|
||||
"version": "0.10.2",
|
||||
"owmlVersion": "2.1.0",
|
||||
"dependencies": [ "PacificEngine.OW_CommonResources" ],
|
||||
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "Vesper.OuterWildsMMO", "Vesper.AutoResume" ],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user