1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 08:35:20 +02:00

Add keybinding for world close key (#16250)

Fix according to Lua code style guidelines (grorp)

Fix order in defaultsettings.cpp (grorp)

remove unrequired comment, and whitespace

Co-authored-by: y5nw <y5nw@users.noreply.github.com>
Co-authored-by: grorp <grorp@users.noreply.github.com>
This commit is contained in:
DragonWrangler1
2025-07-01 07:31:26 -05:00
committed by GitHub
parent 43aad3711b
commit 80be9bf76e
5 changed files with 41 additions and 8 deletions

View File

@@ -137,6 +137,7 @@ bool MyEventReceiver::OnEvent(const SEvent &event)
// This is separate from other keyboard handling so that it also works in menus.
if (event.EventType == EET_KEY_INPUT_EVENT) {
KeyPress keyCode(event.KeyInput);
if (keyCode == getKeySetting("keymap_fullscreen")) {
if (event.KeyInput.PressedDown && !fullscreen_is_down) {
IrrlichtDevice *device = RenderingEngine::get_raw_device();
@@ -150,8 +151,15 @@ bool MyEventReceiver::OnEvent(const SEvent &event)
}
fullscreen_is_down = event.KeyInput.PressedDown;
return true;
} else if (keyCode == EscapeKey &&
event.KeyInput.PressedDown && event.KeyInput.Shift) {
} else if (keyCode == getKeySetting("keymap_close_world")) {
close_world_down = event.KeyInput.PressedDown;
} else if (keyCode == EscapeKey) {
esc_down = event.KeyInput.PressedDown;
}
if (esc_down && close_world_down) {
g_gamecallback->disconnect();
return true;
}