From 300aa877382d50905af5bbe921c2454a35044c41 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Sun, 12 Feb 2023 18:57:20 +0100 Subject: [PATCH] Fixed slideblock and waterfall --- P3D/Entites/Enviroment/SlideBlock.vb | 13 +++++++++++-- P3D/Entites/Enviroment/Waterfall.vb | 5 ++--- P3D/World/ActionScript/ActionScript.vb | 5 +++++ .../ActionScript/V2/ScriptCommands/DoPlayer.vb | 2 +- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/P3D/Entites/Enviroment/SlideBlock.vb b/P3D/Entites/Enviroment/SlideBlock.vb index 864d8128e..131cbb2bc 100644 --- a/P3D/Entites/Enviroment/SlideBlock.vb +++ b/P3D/Entites/Enviroment/SlideBlock.vb @@ -5,6 +5,7 @@ Dim TempScriptEntity As ScriptBlock = Nothing Public Overrides Function WalkAgainstFunction() As Boolean + CType(Screen.Camera, OverworldCamera).PreventMovement = True Dim facing As Integer = CInt(Me.Rotation.Y / MathHelper.PiOver2) facing -= 2 If facing < 0 Then @@ -59,7 +60,8 @@ "@player.setmovement(" & Screen.Camera.GetMoveDirection().X & ",0," & Screen.Camera.GetMoveDirection().Z & ")" & Environment.NewLine & "@overworldpokemon.hide" & Environment.NewLine & "@player.move(1)" & Environment.NewLine & - "@overworldpokemon.hide" & Environment.NewLine + "@overworldpokemon.hide" & Environment.NewLine & + "@player.allowmovement" & Environment.NewLine If Not Me.TempScriptEntity Is Nothing Then s &= GetScriptStartLine(Me.TempScriptEntity) & Environment.NewLine @@ -71,6 +73,7 @@ CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2, False) Return True Else + CType(Screen.Camera, OverworldCamera).PreventMovement = False Return True End If @@ -79,9 +82,11 @@ facing += 4 End If If Screen.Camera.GetPlayerFacingDirection() = facing Then + CType(Screen.Camera, OverworldCamera).PreventMovement = False Return False End If + CType(Screen.Camera, OverworldCamera).PreventMovement = False Return True End Function @@ -103,6 +108,7 @@ End Function Public Overrides Sub WalkOntoFunction() + CType(Screen.Camera, OverworldCamera).PreventMovement = True Dim facing As Integer = CInt(Me.Rotation.Y / MathHelper.PiOver2) Screen.Camera.PlannedMovement = Vector3.Zero @@ -152,7 +158,8 @@ "@player.move(1)" & Environment.NewLine & "@player.setmovement(" & Screen.Camera.GetMoveDirection().X & ",-1," & Screen.Camera.GetMoveDirection().Z & ")" & Environment.NewLine & "@player.move(" & Steps & ")" & Environment.NewLine & - "@overworldpokemon.hide" & Environment.NewLine + "@overworldpokemon.hide" & Environment.NewLine & + "@player.allowmovement" & Environment.NewLine If Not Me.TempScriptEntity Is Nothing Then s &= GetScriptStartLine(Me.TempScriptEntity) & Environment.NewLine @@ -162,6 +169,8 @@ s &= ":end" CType(Core.CurrentScreen, OverworldScreen).ActionScript.StartScript(s, 2, False) + Else + CType(Screen.Camera, OverworldCamera).PreventMovement = False End If End Sub diff --git a/P3D/Entites/Enviroment/Waterfall.vb b/P3D/Entites/Enviroment/Waterfall.vb index 07586057f..4d886cc44 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,7 +234,6 @@ 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 & @@ -254,6 +253,7 @@ Dim p As Pokemon = ReturnWaterFallPokemonName() If Badge.CanUseHMMove(Badge.HMMoves.Waterfall) = True And Not p Is Nothing Or GameController.IS_DEBUG_ACTIVE = True Or Core.Player.SandBoxMode = True Then + CType(Screen.Camera, OverworldCamera).PreventMovement = True Dim s As String = "" Dim pName As String = "" @@ -284,7 +284,6 @@ 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 & diff --git a/P3D/World/ActionScript/ActionScript.vb b/P3D/World/ActionScript/ActionScript.vb index 0e6cf25ba..fa44e7e83 100644 --- a/P3D/World/ActionScript/ActionScript.vb +++ b/P3D/World/ActionScript/ActionScript.vb @@ -3,6 +3,7 @@ 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) @@ -79,6 +80,10 @@ 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 68077349c..21641110f 100644 --- a/P3D/World/ActionScript/V2/ScriptCommands/DoPlayer.vb +++ b/P3D/World/ActionScript/V2/ScriptCommands/DoPlayer.vb @@ -228,7 +228,7 @@ IsReady = True Case "allowmovement" - CType(Screen.Camera, OverworldCamera).PreventMovement = False + CType(CurrentScreen, OverworldScreen).ActionScript.AllowMovementAfterEnd = True IsReady = True Case "money", "addmoney"