Only display “home” button with home privilege

This commit is contained in:
Jaidyn Ann 2024-01-12 21:09:09 -06:00
parent 73627499da
commit 66ddd2571c
2 changed files with 6 additions and 1 deletions

View File

@ -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", {

View File

@ -615,8 +615,10 @@ 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 sethomes coordinates to one decimal, likewise.
local home_pos = sethome.get(player:get_player_name())
if home_pos then
home = string.format("(%.1f,%.1f,%.1f)", home_pos.x, home_pos.y, home_pos.z)
end
end
if home then
str = home:gsub(",", " "):sub(2,-2):gsub("%.%d", ""):gsub(