forked from minetest-mods/unified_inventory
Compare commits
6 Commits
nalc-1.2.0
...
c6cc6ab83c
Author | SHA1 | Date | |
---|---|---|---|
c6cc6ab83c | |||
1fd87f5c51 | |||
e5dc9ed53a | |||
4bf5f22696 | |||
4f666f93d0 | |||
264833ed41 |
2
init.lua
2
init.lua
@ -82,3 +82,5 @@ dofile(modpath.."/item_names.lua")
|
|||||||
if minetest.get_modpath("datastorage") then
|
if minetest.get_modpath("datastorage") then
|
||||||
dofile(modpath.."/waypoints.lua")
|
dofile(modpath.."/waypoints.lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.log("action", "[unified_inventory] loaded.")
|
||||||
|
@ -99,17 +99,21 @@ function unified_inventory.get_formspec(player, page)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local j = 1 --Modif NALC (sys4 20/11/2018) 12 buttons max by row
|
||||||
for i, def in pairs(filtered_inv_buttons) do
|
for i, def in pairs(filtered_inv_buttons) do
|
||||||
|
|
||||||
if draw_lite_mode and i > 4 then
|
if draw_lite_mode and i > 4 then
|
||||||
button_row = 1
|
button_row = 1
|
||||||
button_col = 1
|
button_col = 1
|
||||||
|
elseif not draw_lite_mode and j > 12 then
|
||||||
|
button_row = 1
|
||||||
|
j = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if def.type == "image" then
|
if def.type == "image" then
|
||||||
if (def.condition == nil or def.condition(player) == true) then
|
if (def.condition == nil or def.condition(player) == true) then
|
||||||
formspec[n] = "image_button["
|
formspec[n] = "image_button["
|
||||||
formspec[n+1] = ( ui_peruser.main_button_x + 0.65 * (i - 1) - button_col * 0.65 * 4)
|
formspec[n+1] = ( ui_peruser.main_button_x + 0.65 * (j - 1) - button_col * 0.65 * 4) -- Modif NALC
|
||||||
formspec[n+2] = ","..(ui_peruser.main_button_y + button_row * 0.7)..";0.8,0.8;"
|
formspec[n+2] = ","..(ui_peruser.main_button_y + button_row * 0.7)..";0.8,0.8;"
|
||||||
formspec[n+3] = F(def.image)..";"
|
formspec[n+3] = F(def.image)..";"
|
||||||
formspec[n+4] = F(def.name)..";]"
|
formspec[n+4] = F(def.name)..";]"
|
||||||
@ -118,13 +122,14 @@ function unified_inventory.get_formspec(player, page)
|
|||||||
n = n+7
|
n = n+7
|
||||||
else
|
else
|
||||||
formspec[n] = "image["
|
formspec[n] = "image["
|
||||||
formspec[n+1] = ( ui_peruser.main_button_x + 0.65 * (i - 1) - button_col * 0.65 * 4)
|
formspec[n+1] = ( ui_peruser.main_button_x + 0.65 * (j - 1) - button_col * 0.65 * 4) -- Modif NALC
|
||||||
formspec[n+2] = ","..(ui_peruser.main_button_y + button_row * 0.7)..";0.8,0.8;"
|
formspec[n+2] = ","..(ui_peruser.main_button_y + button_row * 0.7)..";0.8,0.8;"
|
||||||
formspec[n+3] = F(def.image).."^[colorize:#808080:alpha]"
|
formspec[n+3] = F(def.image).."^[colorize:#808080:alpha]"
|
||||||
n = n+4
|
n = n+4
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
j = j + 1 -- Modif NALC
|
||||||
end
|
end
|
||||||
|
|
||||||
if fsdata.draw_inventory ~= false then
|
if fsdata.draw_inventory ~= false then
|
||||||
|
49
register.lua
49
register.lua
@ -40,55 +40,6 @@ unified_inventory.register_button("craftguide", {
|
|||||||
tooltip = S("Crafting Guide")
|
tooltip = S("Crafting Guide")
|
||||||
})
|
})
|
||||||
|
|
||||||
unified_inventory.register_button("home_gui_set", {
|
|
||||||
type = "image",
|
|
||||||
image = "ui_sethome_icon.png",
|
|
||||||
tooltip = S("Set home position"),
|
|
||||||
hide_lite=true,
|
|
||||||
action = function(player)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if minetest.check_player_privs(player_name, {home=true}) then
|
|
||||||
unified_inventory.set_home(player, player:get_pos())
|
|
||||||
local home = unified_inventory.home_pos[player_name]
|
|
||||||
if home ~= nil then
|
|
||||||
minetest.sound_play("dingdong",
|
|
||||||
{to_player=player_name, gain = 1.0})
|
|
||||||
minetest.chat_send_player(player_name,
|
|
||||||
S("Home position set to: %s"):format(minetest.pos_to_string(home)))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(player_name,
|
|
||||||
S("You don't have the \"home\" privilege!"))
|
|
||||||
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
condition = function(player)
|
|
||||||
return minetest.check_player_privs(player:get_player_name(), {home=true})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
unified_inventory.register_button("home_gui_go", {
|
|
||||||
type = "image",
|
|
||||||
image = "ui_gohome_icon.png",
|
|
||||||
tooltip = S("Go home"),
|
|
||||||
hide_lite=true,
|
|
||||||
action = function(player)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if minetest.check_player_privs(player_name, {home=true}) then
|
|
||||||
minetest.sound_play("teleport",
|
|
||||||
{to_player=player:get_player_name(), gain = 1.0})
|
|
||||||
unified_inventory.go_home(player)
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(player_name,
|
|
||||||
S("You don't have the \"home\" privilege!"))
|
|
||||||
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
condition = function(player)
|
|
||||||
return minetest.check_player_privs(player:get_player_name(), {home=true})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
unified_inventory.register_button("misc_set_day", {
|
unified_inventory.register_button("misc_set_day", {
|
||||||
type = "image",
|
type = "image",
|
||||||
image = "ui_sun_icon.png",
|
image = "ui_sun_icon.png",
|
||||||
|
Reference in New Issue
Block a user