1
0
Fork 0

Add tab keybind

master
mckaygerhard 2024-06-02 06:40:02 -04:00
parent fd02603860
commit 9a733f881b
11 changed files with 27 additions and 2 deletions

View File

@ -408,6 +408,10 @@ keymap_slot31 (Hotbar slot 31 key) key
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
keymap_slot32 (Hotbar slot 32 key) key
# Key for use by mods.
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
keymap_tabb (Tab key) key KEY_TAB
# Key for toggling the display of the HUD.
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
keymap_toggle_hud (HUD toggle key) key KEY_F1

View File

@ -6547,7 +6547,7 @@ object you are working with still exists.
* `get_player_control()`: returns table with player pressed keys
* The table consists of fields with the following boolean values
representing the pressed keys: `up`, `down`, `left`, `right`, `jump`,
`aux1`, `sneak`, `dig`, `place`, `LMB`, `RMB`, and `zoom`.
`aux1`, `sneak`, `dig`, `place`, `LMB`, `RMB`, `zoom`, and `tabb`.
* The fields `LMB` and `RMB` are equal to `dig` and `place` respectively,
and exist only to preserve backwards compatibility.
* `get_player_control_bits()`: returns integer with bit packed player pressed
@ -6562,6 +6562,7 @@ object you are working with still exists.
* 7 - dig
* 8 - place
* 9 - zoom
* 10 - tabb
* `set_physics_override(override_table)`
* `override_table` is a table with the following fields:
* `speed`: multiplier to default walking speed value (default: `1`)

View File

@ -449,6 +449,11 @@
# type: key
# keymap_slot32 =
# Key for use by mods.
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
# type: key
# keymap_tabb = KEY_TAB
# Key for toggling the display of the HUD.
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
# type: key

View File

@ -2530,6 +2530,7 @@ void Game::updatePlayerControl(const CameraOrientation &cam)
isKeyDown(KeyType::SPECIAL1),
isKeyDown(KeyType::SNEAK),
isKeyDown(KeyType::ZOOM),
isKeyDown(KeyType::TABB),
isKeyDown(KeyType::DIG),
isKeyDown(KeyType::PLACE),
cam.camera_pitch,
@ -2553,7 +2554,8 @@ void Game::updatePlayerControl(const CameraOrientation &cam)
( (u32)(isKeyDown(KeyType::SNEAK) & 0x1) << 6) |
( (u32)(isKeyDown(KeyType::DIG) & 0x1) << 7) |
( (u32)(isKeyDown(KeyType::PLACE) & 0x1) << 8) |
( (u32)(isKeyDown(KeyType::ZOOM) & 0x1) << 9)
( (u32)(isKeyDown(KeyType::ZOOM) & 0x1) << 9) |
( (u32)(isKeyDown(KeyType::TABB) & 0x1) << 10)
);
LocalPlayer *player = client->getEnv().getLocalPlayer();

View File

@ -90,6 +90,8 @@ void KeyCache::populate()
key[KeyType::QUICKTUNE_INC] = getKeySetting("keymap_quicktune_inc");
key[KeyType::QUICKTUNE_DEC] = getKeySetting("keymap_quicktune_dec");
key[KeyType::TABB] = getKeySetting("keymap_tabb");
for (int i = 0; i < HUD_HOTBAR_ITEMCOUNT_MAX; i++) {
std::string slot_key_name = "keymap_slot" + std::to_string(i + 1);
key[KeyType::SLOT_1 + i] = getKeySetting(slot_key_name.c_str());

View File

@ -76,6 +76,8 @@ public:
QUICKTUNE_INC,
QUICKTUNE_DEC,
TABB,
// hotbar
SLOT_1,
SLOT_2,

View File

@ -159,6 +159,8 @@ void set_default_settings()
settings->setDefault("keymap_quicktune_dec", "KEY_NEXT");
settings->setDefault("keymap_quicktune_inc", "KEY_PRIOR");
settings->setDefault("keymap_tabb", "KEY_TAB");
// Visuals
#ifdef NDEBUG
settings->setDefault("show_debug", "false");

View File

@ -525,6 +525,7 @@ void Server::process_PlayerPos(RemotePlayer *player, PlayerSAO *playersao,
player->control.dig = (keyPressed & (0x1 << 7));
player->control.place = (keyPressed & (0x1 << 8));
player->control.zoom = (keyPressed & (0x1 << 9));
player->control.tabb = (keyPressed & (0x1 << 10));
if (playersao->checkMovementCheat()) {
// Call callbacks

View File

@ -57,6 +57,7 @@ struct PlayerControl
bool a_aux1,
bool a_sneak,
bool a_zoom,
bool a_tabb,
bool a_dig,
bool a_place,
float a_pitch,
@ -73,6 +74,7 @@ struct PlayerControl
aux1 = a_aux1;
sneak = a_sneak;
zoom = a_zoom;
tabb = a_tabb;
dig = a_dig;
place = a_place;
pitch = a_pitch;
@ -88,6 +90,7 @@ struct PlayerControl
bool aux1 = false;
bool sneak = false;
bool zoom = false;
bool tabb = false;
bool dig = false;
bool place = false;
float pitch = 0.0f;

View File

@ -231,6 +231,7 @@ int LuaLocalPlayer::l_get_control(lua_State *L)
set("aux1", c.aux1);
set("sneak", c.sneak);
set("zoom", c.zoom);
set("tabb", c.tabb);
set("dig", c.dig);
set("place", c.place);

View File

@ -1417,6 +1417,8 @@ int ObjectRef::l_get_player_control(lua_State *L)
lua_setfield(L, -2, "RMB");
lua_pushboolean(L, control.zoom);
lua_setfield(L, -2, "zoom");
lua_pushboolean(L, control.tabb);
lua_setfield(L, -2, "tabb");
return 1;
}