Add tooltip to WorldEdit GUI button (#240)

This commit is contained in:
David Leal 2024-03-25 10:58:35 -06:00 committed by GitHub
parent 41efbaf210
commit eac05e3133
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -80,6 +80,7 @@ if minetest.global_exists("unified_inventory") then -- unified inventory install
unified_inventory.register_button("worldedit_gui", { unified_inventory.register_button("worldedit_gui", {
type = "image", type = "image",
image = "inventory_plus_worldedit_gui.png", image = "inventory_plus_worldedit_gui.png",
tooltip = "Edit your World!",
condition = function(player) condition = function(player)
return minetest.check_player_privs(player:get_player_name(), {worldedit=true}) return minetest.check_player_privs(player:get_player_name(), {worldedit=true})
end, end,
@ -193,7 +194,8 @@ elseif minetest.global_exists("sfinv") then -- sfinv installed
get = function(self, player, context) get = function(self, player, context)
local can_worldedit = minetest.check_player_privs(player, {worldedit=true}) local can_worldedit = minetest.check_player_privs(player, {worldedit=true})
local fs = orig_get(self, player, context) local fs = orig_get(self, player, context)
return fs .. (can_worldedit and "image_button[0,0;1,1;inventory_plus_worldedit_gui.png;worldedit_gui;]" or "") return fs .. (can_worldedit and "image_button[0,0;1,1;inventory_plus_worldedit_gui.png;worldedit_gui;]" ..
"tooltip[worldedit_gui;Edit your World!]" or "")
end end
}) })