Skip to content

Commit

Permalink
deprecate old input functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Dregu committed Nov 3, 2023
1 parent b47ff68 commit 661c867
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 41 deletions.
13 changes: 0 additions & 13 deletions docs/game_data/spel2.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 24 additions & 27 deletions docs/src/includes/_globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -3762,6 +3735,30 @@ This function never worked properly as too many places in the game individually
`nil testflag()`<br/>

### 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)`<br/>
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)`<br/>
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)`<br/>
Send input to entity, has to be previously stolen with [steal_input](#steal_input)

### read_input


Expand Down
5 changes: 4 additions & 1 deletion src/game_api/script/lua_vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,8 @@ end
lua["get_window_size"] = []() -> std::tuple<int, int>
{ 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");
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down

0 comments on commit 661c867

Please sign in to comment.