From 489af57626dec0e091a7ac21194a4f477138ae93 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Thu, 20 Apr 2023 15:54:53 +0200 Subject: [PATCH] Hopefully fix waterfalls this time --- P3D/Entites/Enviroment/SlideBlock.vb | 6 ++++++ P3D/Entites/Enviroment/Waterfall.vb | 14 ++++++++++---- P3D/World/ActionScript/ActionScript.vb | 5 ----- .../ActionScript/V2/ScriptCommands/DoPlayer.vb | 6 ++++-- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/P3D/Entites/Enviroment/SlideBlock.vb b/P3D/Entites/Enviroment/SlideBlock.vb index 131cbb2bc..e7a5d7155 100644 --- a/P3D/Entites/Enviroment/SlideBlock.vb +++ b/P3D/Entites/Enviroment/SlideBlock.vb @@ -71,6 +71,9 @@ s &= ":end" CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2, False) + If CType(Core.CurrentScreen, OverworldScreen).ActionScript.IsReady = True And CType(Screen.Camera, OverworldCamera).PreventMovement = True Then + CType(Screen.Camera, OverworldCamera).PreventMovement = False + End If Return True Else CType(Screen.Camera, OverworldCamera).PreventMovement = False @@ -169,6 +172,9 @@ s &= ":end" CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2, False) + If CType(Core.CurrentScreen, OverworldScreen).ActionScript.IsReady = True And CType(Screen.Camera, OverworldCamera).PreventMovement = True Then + CType(Screen.Camera, OverworldCamera).PreventMovement = False + End If Else CType(Screen.Camera, OverworldCamera).PreventMovement = False End If diff --git a/P3D/Entites/Enviroment/Waterfall.vb b/P3D/Entites/Enviroment/Waterfall.vb index 46ddada7e..c0f28e72e 100644 --- a/P3D/Entites/Enviroment/Waterfall.vb +++ b/P3D/Entites/Enviroment/Waterfall.vb @@ -199,7 +199,7 @@ If Me.ActionValue = 1 Then Exit Sub End If - CType(Screen.Camera, OverworldCamera).PreventMovement = True + Dim isOnTop As Boolean = True Dim OnTopcheckPosition As Vector3 = New Vector3(Me.Position.X, Me.Position.Y + 1, Me.Position.Z) Dim Oe As Entity = GetEntity(Screen.Level.Entities, OnTopcheckPosition, True, {GetType(Waterfall)}) @@ -234,6 +234,7 @@ End While s = "version=2" & Environment.NewLine & + "@player.preventmovement" & Environment.NewLine & "@player.stopmovement" & Environment.NewLine & "@player.move(2)" & Environment.NewLine & "@player.setmovement(0,-1,0)" & Environment.NewLine & @@ -243,6 +244,9 @@ ":end" CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2) + If CType(Core.CurrentScreen, OverworldScreen).ActionScript.IsReady = True And CType(Screen.Camera, OverworldCamera).PreventMovement = True Then + CType(Screen.Camera, OverworldCamera).PreventMovement = False + End If End If End Sub @@ -253,7 +257,6 @@ Dim p As Pokemon = ReturnWaterFallPokemonName() If GameController.IS_DEBUG_ACTIVE = True OrElse Core.Player.SandBoxMode = True OrElse Badge.CanUseHMMove(Badge.HMMoves.Waterfall) = True AndAlso Not p Is Nothing Then - CType(Screen.Camera, OverworldCamera).PreventMovement = True Dim s As String = "" Dim pName As String = "" @@ -284,6 +287,7 @@ End If End While s = "version=2" & Environment.NewLine & + "@player.preventmovement" & Environment.NewLine & "@player.stopmovement" & Environment.NewLine & "@pokemon.cry(" & pNumber & ")" & Environment.NewLine & "@sound.play(select)" & Environment.NewLine & @@ -297,10 +301,12 @@ PlayerStatistics.Track("Waterfall used", 1) CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2) - + If CType(Core.CurrentScreen, OverworldScreen).ActionScript.IsReady = True And CType(Screen.Camera, OverworldCamera).PreventMovement = True Then + CType(Screen.Camera, OverworldCamera).PreventMovement = False + End If Return False Else - CType(Screen.Camera, OverworldCamera).PreventMovement = False + CType(Screen.Camera, OverworldCamera).PreventMovement = False End If If Me.Collision = True Then diff --git a/P3D/World/ActionScript/ActionScript.vb b/P3D/World/ActionScript/ActionScript.vb index fa44e7e83..0e6cf25ba 100644 --- a/P3D/World/ActionScript/ActionScript.vb +++ b/P3D/World/ActionScript/ActionScript.vb @@ -3,7 +3,6 @@ Public Class ActionScript Public Scripts As New List(Of Script) - Public AllowMovementAfterEnd As Boolean = False Public Class ScriptLevel Public WaitingEndWhen As New List(Of Boolean) Public Switched As New List(Of Boolean) @@ -80,10 +79,6 @@ nextScript: reDelay = 0.0F End If End If - If AllowMovementAfterEnd = True Then - CType(Screen.Camera, OverworldCamera).PreventMovement = False - AllowMovementAfterEnd = False - End If End If End Sub diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoPlayer.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoPlayer.vb index 21641110f..4b4d7ec43 100644 --- a/P3D/World/ActionScript/V2/ScriptCommands/DoPlayer.vb +++ b/P3D/World/ActionScript/V2/ScriptCommands/DoPlayer.vb @@ -228,9 +228,11 @@ IsReady = True Case "allowmovement" - CType(CurrentScreen, OverworldScreen).ActionScript.AllowMovementAfterEnd = True + If CType(Screen.Camera, OverworldCamera)._moved = 0.0F Then + CType(Screen.Camera, OverworldCamera).PreventMovement = False - IsReady = True + IsReady = True + End If Case "money", "addmoney" Core.Player.Money += int(argument)