From 7eb7805dcfb211b165b74098d848d6637fa49ef9 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Sat, 11 Jun 2022 15:01:16 +0200 Subject: [PATCH] Added constructs for checking player movement Also fixed the "" construct and reset the player's movement speed in the teacher script in violet city --- P3D/Content/Data/Scripts/violet/teacher.dat | Bin 6102 -> 6142 bytes P3D/Overworld/OverworldCamera.vb | 2 +- .../V2/ScriptConstructs/DoPlayer.vb | 6 +++++- P3D/World/ActionScript/V2/ScriptLibrary.vb | 4 +++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/P3D/Content/Data/Scripts/violet/teacher.dat b/P3D/Content/Data/Scripts/violet/teacher.dat index 474a4e60ce4f1c34ffa45230a8908829712e7dab..d44c19931ee09097ba2bec2ecabcc345f9f54398 100644 GIT binary patch delta 36 pcmcbn|4)BI1;^wS0(`lh0O;z?DzpU@dfJu diff --git a/P3D/Overworld/OverworldCamera.vb b/P3D/Overworld/OverworldCamera.vb index b5b8162de..af1c2a7e1 100644 --- a/P3D/Overworld/OverworldCamera.vb +++ b/P3D/Overworld/OverworldCamera.vb @@ -25,7 +25,7 @@ Public Class OverworldCamera Private _scrollSpeed As Single = 0F Private _scrollDirection As Integer = 1 - Private _moved As Single = 0F + Public _moved As Single = 0F Public LastStepPosition As Vector3 = New Vector3(0, -2, 0) Public YawLocked As Boolean = False diff --git a/P3D/World/ActionScript/V2/ScriptConstructs/DoPlayer.vb b/P3D/World/ActionScript/V2/ScriptConstructs/DoPlayer.vb index 41530d209..cc916ad18 100644 --- a/P3D/World/ActionScript/V2/ScriptConstructs/DoPlayer.vb +++ b/P3D/World/ActionScript/V2/ScriptConstructs/DoPlayer.vb @@ -47,7 +47,11 @@ Case "skin" Return Core.Player.Skin Case "velocity" - Return 0F + Return CInt(CType(Screen.Camera, OverworldCamera)._moved) + Case "speed" + Return Screen.Camera.Speed / 0.04F + Case "isrunning" + Return ReturnBoolean(Core.Player.IsRunning) Case "ismoving" Return ReturnBoolean(Screen.Camera.IsMoving()) Case "facing" diff --git a/P3D/World/ActionScript/V2/ScriptLibrary.vb b/P3D/World/ActionScript/V2/ScriptLibrary.vb index b7b986319..6d6b41f7e 100644 --- a/P3D/World/ActionScript/V2/ScriptLibrary.vb +++ b/P3D/World/ActionScript/V2/ScriptLibrary.vb @@ -489,7 +489,9 @@ Namespace ScriptVersion2 r(New ScriptCommand("player", "hasbadge", "bool", {New ScriptArgument("badgeID", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Returns if the player owns a specific Badge.", ",", True)) r(New ScriptCommand("player", "skin", "str", "Returns the current skin the player wears.", ",", True)) r(New ScriptCommand("player", "velocity", "sng", "Returns the player's velocity (steps until the player movement ends).", ",", True)) - r(New ScriptCommand("player", "ismoving", "bool", "Returns if the player moves.", ",", True)) + r(New ScriptCommand("player", "speed", "sng", "Returns the player's movement speed (divided by 0.04F).", ",", True)) + r(New ScriptCommand("player", "isrunning", "bool", "Returns if the player is currently running.", ",", True)) + r(New ScriptCommand("player", "ismoving", "bool", "Returns if the player is currently moving.", ",", True)) r(New ScriptCommand("player", "facing", "int", "Returns the direction the player is facing.", ",", True)) r(New ScriptCommand("player", "compass", "str", "Returns ""north"", ""east"", ""south"" or ""east"" depending on the direction the player is facing.", ",", True)) r(New ScriptCommand("player", "money", "int", "Returns the player's money.", ",", True))