diff --git a/docs/game_data/spel2.lua b/docs/game_data/spel2.lua index 13d50a8ed..fab4efbe6 100644 --- a/docs/game_data/spel2.lua +++ b/docs/game_data/spel2.lua @@ -932,19 +932,6 @@ function test_mask(flags, mask) end ---Gets the resolution (width and height) of the screen ---@return integer, integer function get_window_size() end ----Steal input from a Player, HiredHand or PlayerGhost ----@param uid integer ----@return nil -function steal_input(uid) end ----Return input previously stolen with [steal_input](https://spelunky-fyi.github.io/overlunky/#steal_input) ----@param uid integer ----@return nil -function return_input(uid) end ----Send input to entity, has to be previously stolen with [steal_input](https://spelunky-fyi.github.io/overlunky/#steal_input) ----@param uid integer ----@param buttons INPUTS ----@return nil -function send_input(uid, buttons) end ---Clears a callback that is specific to a screen. ---@param screen_id integer ---@param cb_id CallbackId diff --git a/docs/src/includes/_globals.md b/docs/src/includes/_globals.md index b8b4bea88..e26bf8c08 100644 --- a/docs/src/includes/_globals.md +++ b/docs/src/includes/_globals.md @@ -2073,33 +2073,6 @@ Returns: [ImGuiIO](#ImGuiIO) for raw keyboard, mouse and xinput gamepad stuff. Current mouse cursor position in screen coordinates. -### return_input - - -> Search script examples for [return_input](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=return_input) - -#### nil return_input(int uid) - -Return input previously stolen with [steal_input](#steal_input) - -### send_input - - -> Search script examples for [send_input](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=send_input) - -#### nil send_input(int uid, [INPUTS](#INPUTS) buttons) - -Send input to entity, has to be previously stolen with [steal_input](#steal_input) - -### steal_input - - -> Search script examples for [steal_input](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=steal_input) - -#### nil steal_input(int uid) - -Steal input from a [Player](#Player), HiredHand or [PlayerGhost](#PlayerGhost) - ## Lighting functions @@ -3762,6 +3735,30 @@ This function never worked properly as too many places in the game individually `nil testflag()`
+### steal_input + + +> Search script examples for [steal_input](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=steal_input) + +`nil steal_input(int uid)`
+Deprecated because it's a weird old hack that crashes the game. You can modify inputs in many other ways, like editing `state.player_inputs.player_slot_1.buttons_gameplay` in PRE_UPDATE or a `set_pre_process_input` hook. Steal input from a Player, HiredHand or PlayerGhost. + +### return_input + + +> Search script examples for [return_input](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=return_input) + +`nil return_input(int uid)`
+Return input previously stolen with [steal_input](#steal_input) + +### send_input + + +> Search script examples for [send_input](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=send_input) + +`nil send_input(int uid, INPUTS buttons)`
+Send input to entity, has to be previously stolen with [steal_input](#steal_input) + ### read_input diff --git a/src/game_api/script/lua_vm.cpp b/src/game_api/script/lua_vm.cpp index 6007c209a..6d03569f2 100644 --- a/src/game_api/script/lua_vm.cpp +++ b/src/game_api/script/lua_vm.cpp @@ -1320,7 +1320,8 @@ end lua["get_window_size"] = []() -> std::tuple { return {(int)ImGui::GetIO().DisplaySize.x, (int)ImGui::GetIO().DisplaySize.y}; }; - /// Steal input from a Player, HiredHand or PlayerGhost + /// Deprecated + /// Deprecated because it's a weird old hack that crashes the game. You can modify inputs in many other ways, like editing `state.player_inputs.player_slot_1.buttons_gameplay` in PRE_UPDATE or a `set_pre_process_input` hook. Steal input from a Player, HiredHand or PlayerGhost. lua["steal_input"] = [](int uid) { static const auto player_ghost = to_id("ENT_TYPE_ITEM_PLAYERGHOST"); @@ -1359,6 +1360,7 @@ end backend->script_input[uid] = newinput; } }; + /// Deprecated /// Return input previously stolen with [steal_input](#steal_input) lua["return_input"] = [](int uid) { @@ -1383,6 +1385,7 @@ end } backend->script_input.erase(uid); }; + /// Deprecated /// Send input to entity, has to be previously stolen with [steal_input](#steal_input) lua["send_input"] = [](int uid, INPUTS buttons) {