mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-15 17:35:37 +02:00
Expose analog joystick input to the Lua API (#14348)
This commit is contained in:
@@ -1622,6 +1622,13 @@ int ObjectRef::l_get_player_control(lua_State *L)
|
||||
lua_setfield(L, -2, "dig");
|
||||
lua_pushboolean(L, control.place);
|
||||
lua_setfield(L, -2, "place");
|
||||
|
||||
v2f movement = control.getMovement();
|
||||
lua_pushnumber(L, movement.X);
|
||||
lua_setfield(L, -2, "movement_x");
|
||||
lua_pushnumber(L, movement.Y);
|
||||
lua_setfield(L, -2, "movement_y");
|
||||
|
||||
// Legacy fields to ensure mod compatibility
|
||||
lua_pushboolean(L, control.dig);
|
||||
lua_setfield(L, -2, "LMB");
|
||||
|
Reference in New Issue
Block a user