From 32f117783b6fd5c450288210c38cb49dbce4092d Mon Sep 17 00:00:00 2001 From: superEVILFACE <94980017+superEVILFACE@users.noreply.github.com> Date: Tue, 14 Jan 2025 21:29:51 -0500 Subject: [PATCH] simple change --- source/Engine/Bytecode/StandardLibrary.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/Engine/Bytecode/StandardLibrary.cpp b/source/Engine/Bytecode/StandardLibrary.cpp index 1bfeaeb..00935d2 100644 --- a/source/Engine/Bytecode/StandardLibrary.cpp +++ b/source/Engine/Bytecode/StandardLibrary.cpp @@ -6497,6 +6497,23 @@ VMValue Input_IsAnyActionPressed(int argCount, VMValue* args, Uint32 threadID) { else return INTEGER_VAL(!!InputManager::IsAnyActionPressed(playerID)); } +/*** + * Input.IsActionPressedByAny + * \desc Gets whether any input action is currently pressed + * \param actionName (String): Name of the action to check. + * \return Returns a Boolean value. + * \ns Input + */ +VMValue Input_IsActionPressedByAny(int argCount, VMValue* args, Uint32 threadID) { + CHECK_AT_LEAST_ARGCOUNT(1); + char* actionName = GET_ARG(0, GetString); + int actionID = InputManager::GetActionID(actionName); + if (actionID == -1) { + THROW_ERROR("Invalid input action \"%s\"!", actionName); + return NULL_VAL; + } + return INTEGER_VAL(!!InputManager::IsActionPressedByAny(actionID)); +} /*** * Input.IsAnyActionReleased * \desc Gets whether any input action was released for the specified player. @@ -17860,6 +17877,7 @@ void StandardLibrary::Link() { DEF_NATIVE(Input, ActionExists); DEF_NATIVE(Input, IsActionHeld); DEF_NATIVE(Input, IsActionPressed); + DEF_NATIVE(Input, IsActionPressedByAny); DEF_NATIVE(Input, IsActionReleased); DEF_NATIVE(Input, IsAnyActionHeld); DEF_NATIVE(Input, IsAnyActionPressed);