From 66ddd2571c4e921ff10e7a77fcc6ce54cc8ec23f Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Fri, 12 Jan 2024 21:09:09 -0600 Subject: [PATCH] =?UTF-8?q?Only=20display=20=E2=80=9Chome=E2=80=9D=20butto?= =?UTF-8?q?n=20with=20home=20privilege?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i4/src/api.lua | 3 +++ i4/src/gui.lua | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/i4/src/api.lua b/i4/src/api.lua index 8b932a5..cbf80d8 100644 --- a/i4/src/api.lua +++ b/i4/src/api.lua @@ -338,6 +338,9 @@ i4.new_footer_button("home", { description = S"Go home", image = "i3_home.png", fields = home_footer_fields, + access = function(player, data) + return minetest.check_player_privs(player:get_player_name(), {home = true}) + end }) i4.register_craft_type("digging", { diff --git a/i4/src/gui.lua b/i4/src/gui.lua index dd7cdab..b48dc68 100644 --- a/i4/src/gui.lua +++ b/i4/src/gui.lua @@ -615,7 +615,9 @@ local function settings_footer_fs(player, data, fs) -- i4 stores home coordinates with one decimal of precision, as the blow fmt() statement -- assumes. So we need to trim sethome’s coordinates to one decimal, likewise. local home_pos = sethome.get(player:get_player_name()) - home = string.format("(%.1f,%.1f,%.1f)", home_pos.x, home_pos.y, home_pos.z) + if home_pos then + home = string.format("(%.1f,%.1f,%.1f)", home_pos.x, home_pos.y, home_pos.z) + end end if home then