From 5c3cbe89c1c85fac7371642614507a1ae0e1bcfe Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Thu, 27 Jul 2023 15:50:45 +0200 Subject: [PATCH] Last argument notificationpopup forces accept Also you can't move or turn the camera when a notificationpopup is forced And you can't pitch the camera up and down anymore while in a script --- P3D/Overworld/NotificationPopup.vb | 7 ++++-- P3D/Overworld/OverworldCamera.vb | 25 +++++++++++++------ .../ActionScript/V2/ScriptCommands/DoText.vb | 4 ++- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/P3D/Overworld/NotificationPopup.vb b/P3D/Overworld/NotificationPopup.vb index 6e3a8a398..68a47a34c 100644 --- a/P3D/Overworld/NotificationPopup.vb +++ b/P3D/Overworld/NotificationPopup.vb @@ -22,13 +22,14 @@ Public Class NotificationPopup Public _waitForInput As Boolean = False Public _interacted As Boolean = False Public _scriptFile As String = "" + Public _forceAccept As Boolean = False Public IsReady As Boolean = False ''' ''' Sets the values of the NotificationPopup and displays it on the screen. ''' - Public Sub Setup(Text As String, Optional Delay As Integer = 500, Optional BackgroundIndex As Integer = 0, Optional IconIndex As Integer = 0, Optional SoundEffect As String = "", Optional ScriptFile As String = "") + Public Sub Setup(Text As String, Optional Delay As Integer = 500, Optional BackgroundIndex As Integer = 0, Optional IconIndex As Integer = 0, Optional SoundEffect As String = "", Optional ScriptFile As String = "", Optional ForceAccept As Boolean = False) _text = Text If Delay <> -1 Then @@ -81,6 +82,8 @@ Public Class NotificationPopup _scriptFile = ScriptFile _soundEffect = SoundEffect + + _forceAccept = ForceAccept End Sub ''' @@ -122,7 +125,7 @@ Public Class NotificationPopup End If Else Dim BackY As Integer = CInt(0 - _size.Height * (FrameSizeBack / 3) * _scale - (FrameSizeBack / 3 * _scale) - 5) - If Me._interacted = True Then + If Me._interacted = True OrElse _forceAccept = True Then If Me._positionY > BackY Then Me._positionY -= CInt(1.5 * (FrameSizeBack / 3 * _scale) / _size.Height) If Me._positionY <= BackY Then diff --git a/P3D/Overworld/OverworldCamera.vb b/P3D/Overworld/OverworldCamera.vb index fac1f93f0..7d55da0a0 100644 --- a/P3D/Overworld/OverworldCamera.vb +++ b/P3D/Overworld/OverworldCamera.vb @@ -229,14 +229,17 @@ Public Class OverworldCamera If CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then Dim OS As OverworldScreen = CType(CurrentScreen, OverworldScreen) - If _freeCameraMode = True And OS.ActionScript.IsReady = True Then - If YawLocked = False Then - Yaw += -RotationSpeed * 0.75F * dx + If OS.NotificationPopupList.Count = 0 OrElse OS.NotificationPopupList(0)._forceAccept = False Then + If _freeCameraMode = True And OS.ActionScript.IsReady = True Then + If YawLocked = False Then + Yaw += -RotationSpeed * 0.75F * dx + End If + End If + If OS.ActionScript.IsReady = True Then + Pitch += -RotationSpeed * dy End If End If End If - - Pitch += -RotationSpeed * dy 'text = " (Moving)" End If 'Dim interval As TimeSpan @@ -334,10 +337,14 @@ Public Class OverworldCamera If _isFixed = False Then If PreventMovement = False AndAlso KeyBoardHandler.KeyPressed(KeyBindings.PerspectiveSwitchKey) = True Or ControllerHandler.ButtonPressed(Buttons.LeftShoulder) = True Then Dim actionscriptReady As Boolean = True + Dim forcedNotification As Boolean = False If CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then actionscriptReady = CType(CurrentScreen, OverworldScreen).ActionScript.IsReady + If CType(CurrentScreen, OverworldScreen).NotificationPopupList.Count > 0 AndAlso CType(CurrentScreen, OverworldScreen).NotificationPopupList(0)._forceAccept = True Then + forcedNotification = True + End If End If - If actionscriptReady = True And _canToggleThirdPerson Then + If actionscriptReady = True And _canToggleThirdPerson AndAlso forcedNotification = False Then SetThirdPerson(Not _thirdPerson, True) End If End If @@ -656,13 +663,17 @@ Public Class OverworldCamera End If Dim isActionscriptReady As Boolean = False + Dim forcedNotification As Boolean = False Dim OS As OverworldScreen = Nothing If CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then OS = CType(CurrentScreen, OverworldScreen) isActionscriptReady = OS.ActionScript.IsReady + If OS.NotificationPopupList.Count > 0 AndAlso OS.NotificationPopupList(0)._forceAccept = True Then + forcedNotification = True + End If End If - If isActionscriptReady = True AndAlso ScriptBlock.TriggeredScriptBlock = False AndAlso Screen.Level.CanMove() = True AndAlso PreventMovement = False Then + If isActionscriptReady = True AndAlso ScriptBlock.TriggeredScriptBlock = False AndAlso Screen.Level.CanMove() = True AndAlso PreventMovement = False AndAlso forcedNotification = False Then If _thirdPerson = False And _cameraFocusType = CameraFocusTypes.Player Then FirstPersonMovement() Else diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoText.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoText.vb index a46aa05a9..1dd8d3a66 100644 --- a/P3D/World/ActionScript/V2/ScriptCommands/DoText.vb +++ b/P3D/World/ActionScript/V2/ScriptCommands/DoText.vb @@ -26,8 +26,10 @@ _NotificationPopup.Setup(args(0), int(args(1)), int(args(2)), int(args(3))) Case 5 _NotificationPopup.Setup(args(0), int(args(1)), int(args(2)), int(args(3)), args(4)) - Case 6, 7 + Case 6 _NotificationPopup.Setup(args(0), int(args(1)), int(args(2)), int(args(3)), args(4), args(5)) + Case 7 + _NotificationPopup.Setup(args(0), int(args(1)), int(args(2)), int(args(3)), args(4), args(5), CBool(args(6))) End Select If args.Length = 7 AndAlso CBool(args(6)) = True Then CType(CurrentScreen, OverworldScreen).NotificationPopupList.Insert(0, _NotificationPopup)