diff options
-rw-r--r-- | builtin/client/chatcommands.lua | 4 | ||||
-rw-r--r-- | builtin/client/cheats.lua | 2 | ||||
-rw-r--r-- | builtin/client/death_formspec.lua | 1 | ||||
-rw-r--r-- | builtin/client/register.lua | 2 | ||||
-rw-r--r-- | builtin/client/util.lua | 4 | ||||
-rw-r--r-- | builtin/common/misc_helpers.lua | 13 | ||||
-rw-r--r-- | builtin/mainmenu/tab_content.lua | 18 | ||||
-rw-r--r-- | src/client/game.cpp | 20 | ||||
-rw-r--r-- | src/client/game.h | 20 | ||||
-rw-r--r-- | src/script/cpp_api/s_client.h | 4 |
10 files changed, 50 insertions, 38 deletions
diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua index fc6ed5b2b..0da3dab1b 100644 --- a/builtin/client/chatcommands.lua +++ b/builtin/client/chatcommands.lua @@ -180,5 +180,5 @@ core.register_chatcommand("setpitch", { end }) -core.register_list_command("xray", "Configure X-Ray", "xray_nodes") -core.register_list_command("search", "Configure NodeESP", "node_esp_nodes") +core.register_list_command("xray", "Configure X-Ray", "xray_nodes") +core.register_list_command("search", "Configure NodeESP", "node_esp_nodes") diff --git a/builtin/client/cheats.lua b/builtin/client/cheats.lua index 42f7abbb3..1abc2c8ef 100644 --- a/builtin/client/cheats.lua +++ b/builtin/client/cheats.lua @@ -55,4 +55,4 @@ core.cheats = { function core.register_cheat(cheatname, category, func) core.cheats[category] = core.cheats[category] or {} core.cheats[category][cheatname] = func -end +end diff --git a/builtin/client/death_formspec.lua b/builtin/client/death_formspec.lua index 499ed47f3..7b8530440 100644 --- a/builtin/client/death_formspec.lua +++ b/builtin/client/death_formspec.lua @@ -36,4 +36,3 @@ core.register_chatcommand("respawn", { end end }) - diff --git a/builtin/client/register.lua b/builtin/client/register.lua index 669ef134e..de5d89909 100644 --- a/builtin/client/register.lua +++ b/builtin/client/register.lua @@ -60,7 +60,7 @@ function core.override_item(name, redefinition) end local nodedef = core.get_node_def(name) table.combine(itemdef, nodedef) - + for k, v in pairs(redefinition) do rawset(itemdef, k, v) end diff --git a/builtin/client/util.lua b/builtin/client/util.lua index 30f983af3..e85727436 100644 --- a/builtin/client/util.lua +++ b/builtin/client/util.lua @@ -13,13 +13,13 @@ function core.parse_pos(param) return true, vector.round(p) end return false, "Invalid position (" .. param .. ")" -end +end function core.parse_relative_pos(param) local success, pos = core.parse_pos(param:gsub("~", "0")) if success then pos = vector.round(vector.add(core.localplayer:get_pos(), pos)) end return success, pos -end +end function core.find_item(item, mini, maxi) for index, stack in ipairs(core.get_inventory("current_player").main) do diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index 64d67bc72..db94e7073 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -516,6 +516,7 @@ function table.shuffle(t, from, to, random) end end + function table.combine(t, other) other = other or {} for k, v in pairs(other) do @@ -603,7 +604,7 @@ local function rgb_to_hex(rgb) while(value > 0)do local index = math.fmod(value, 16) + 1 value = math.floor(value / 16) - hex = string.sub('0123456789ABCDEF', index, index) .. hex + hex = string.sub('0123456789ABCDEF', index, index) .. hex end if(string.len(hex) == 0)then @@ -624,12 +625,12 @@ local function color_from_hue(hue) local c = 255 local x = (1 - math.abs(h%2 - 1)) * 255 - local i = math.floor(h); + local i = math.floor(h); if (i == 0) then return rgb_to_hex({c, x, 0}) - elseif (i == 1) then + elseif (i == 1) then return rgb_to_hex({x, c, 0}) - elseif (i == 2) then + elseif (i == 2) then return rgb_to_hex({0, c, x}) elseif (i == 3) then return rgb_to_hex({0, x, c}); @@ -649,9 +650,9 @@ function core.rainbow(input) if char:match("%s") then output = output .. char else - output = output .. core.get_color_escape_sequence(color_from_hue(hue)) .. char + output = output .. core.get_color_escape_sequence(color_from_hue(hue)) .. char end - hue = hue + step + hue = hue + step end return output end diff --git a/builtin/mainmenu/tab_content.lua b/builtin/mainmenu/tab_content.lua index 623210597..a76fee864 100644 --- a/builtin/mainmenu/tab_content.lua +++ b/builtin/mainmenu/tab_content.lua @@ -50,12 +50,12 @@ local function get_formspec(tabview, name, tabdata) packages = filterlist.create(get_data, pkgmgr.compare_package, is_equal, nil, {}) - + local filename = core.get_clientmodpath() .. DIR_DELIM .. "mods.conf" local conffile = Settings(filename) local mods = conffile:to_table() - + for i = 1, #packages_raw do local mod = packages_raw[i] if mod.is_clientside and not mod.is_modpack then @@ -71,7 +71,7 @@ local function get_formspec(tabview, name, tabdata) mods["load_mod_" .. mod.name] = nil end end - + -- Remove mods that are not present anymore for key in pairs(mods) do if key:sub(1, 9) == "load_mod_" then @@ -211,24 +211,26 @@ local function handle_buttons(tabview, fields, tabname, tabdata) local event = core.explode_table_event(fields["pkglist"]) tabdata.selected_pkg = event.row local mod = packages:get_list()[tabdata.selected_pkg] - + if event.type == "DCL" and mod.is_clientside then pkgmgr.enable_mod({data = {list = packages, selected_mod = tabdata.selected_pkg}}) packages = nil end return true end - + if fields.btn_mod_mgr_mp_enable ~= nil or fields.btn_mod_mgr_mp_disable ~= nil then - pkgmgr.enable_mod({data = {list = packages, selected_mod = tabdata.selected_pkg}}, fields.btn_mod_mgr_mp_enable ~= nil) + pkgmgr.enable_mod({data = {list = packages, selected_mod = tabdata.selected_pkg}}, + fields.btn_mod_mgr_mp_enable ~= nil) packages = nil return true end - + if fields.btn_mod_mgr_enable_mod ~= nil or fields.btn_mod_mgr_disable_mod ~= nil then - pkgmgr.enable_mod({data = {list = packages, selected_mod = tabdata.selected_pkg}}, fields.btn_mod_mgr_enable_mod ~= nil) + pkgmgr.enable_mod({data = {list = packages, selected_mod = tabdata.selected_pkg}}, + fields.btn_mod_mgr_enable_mod ~= nil) packages = nil return true end diff --git a/src/client/game.cpp b/src/client/game.cpp index 69feeef97..5893e8ac9 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -3373,6 +3373,26 @@ void Game::readSettings() m_does_lost_focus_pause_game = g_settings->getBool("pause_on_lost_focus"); } +bool Game::isKeyDown(GameKeyType k) +{ + return input->isKeyDown(k); +} + +bool Game::wasKeyDown(GameKeyType k) +{ + return input->wasKeyDown(k); +} + +bool Game::wasKeyPressed(GameKeyType k) +{ + return input->wasKeyPressed(k); +} + +bool Game::wasKeyReleased(GameKeyType k) +{ + return input->wasKeyReleased(k); +} + /****************************************************************************/ /**************************************************************************** Shutdown / cleanup diff --git a/src/client/game.h b/src/client/game.h index 26117ab86..3e80b15e7 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -792,22 +792,10 @@ public: static void updateAllMapBlocksCallback(const std::string &setting_name, void *data); void readSettings(); - inline bool isKeyDown(GameKeyType k) - { - return input->isKeyDown(k); - } - inline bool wasKeyDown(GameKeyType k) - { - return input->wasKeyDown(k); - } - inline bool wasKeyPressed(GameKeyType k) - { - return input->wasKeyPressed(k); - } - inline bool wasKeyReleased(GameKeyType k) - { - return input->wasKeyReleased(k); - } + bool isKeyDown(GameKeyType k); + bool wasKeyDown(GameKeyType k); + bool wasKeyPressed(GameKeyType k); + bool wasKeyReleased(GameKeyType k); #ifdef __ANDROID__ void handleAndroidChatInput(); diff --git a/src/script/cpp_api/s_client.h b/src/script/cpp_api/s_client.h index ff1c473ae..26fa7abea 100644 --- a/src/script/cpp_api/s_client.h +++ b/src/script/cpp_api/s_client.h @@ -58,7 +58,9 @@ public: bool on_punchnode(v3s16 p, MapNode node); bool on_placenode(const PointedThing &pointed, const ItemDefinition &item); bool on_item_use(const ItemStack &item, const PointedThing &pointed); - bool on_recieve_physics_override(float override_speed, float override_jump, float override_gravity, bool sneak, bool sneak_glitch, bool new_move); + bool on_recieve_physics_override(float override_speed, float override_jump, + float override_gravity, bool sneak, bool sneak_glitch, + bool new_move); bool on_play_sound(SimpleSoundSpec spec); bool on_spawn_particle(struct ParticleParameters param); |