mirror of
https://github.com/minetest-mods/unified_inventory.git
synced 2025-07-17 15:50:41 +02:00
Compare commits
14 Commits
version-2
...
70fdb8556b
Author | SHA1 | Date | |
---|---|---|---|
70fdb8556b | |||
c044f5e3b0 | |||
608cdfb887 | |||
afb295ec22 | |||
a84ce24067 | |||
497c632b24 | |||
46eeb36784 | |||
9a31609cfd | |||
8e6a3740ae | |||
1fd87f5c51 | |||
e5dc9ed53a | |||
4bf5f22696 | |||
4f666f93d0 | |||
264833ed41 |
4
api.lua
4
api.lua
@ -316,8 +316,8 @@ end
|
||||
function ui.make_trash_slot(xpos, ypos)
|
||||
return
|
||||
ui.single_slot(xpos, ypos)..
|
||||
"image["..xpos..","..ypos..";1.25,1.25;ui_trash_slot_icon.png^[opacity:95]"..
|
||||
"list[detached:trash;main;"..xpos..","..ypos..";1,1;]"
|
||||
"image["..xpos..","..ypos..";1.25,1.25;ui_trash_slot_icon.png]"..
|
||||
"list[detached:trash;main;"..(xpos + ui.list_img_offset)..","..(ypos + ui.list_img_offset)..";1,1;]"
|
||||
end
|
||||
|
||||
function ui.make_inv_img_grid(xpos, ypos, width, height, bright)
|
||||
|
4
init.lua
4
init.lua
@ -113,7 +113,7 @@ dofile(modpath.."/api.lua")
|
||||
for _, style in ipairs({ui.style_full, ui.style_lite}) do
|
||||
style.items_per_page = style.pagecols * style.pagerows
|
||||
style.standard_inv = string.format("list[current_player;main;%f,%f;8,4;]",
|
||||
style.std_inv_x+0.13, style.std_inv_y+0.13)
|
||||
style.std_inv_x + ui.list_img_offset, style.std_inv_y + ui.list_img_offset)
|
||||
|
||||
style.standard_inv_bg = ui.make_inv_img_grid(style.std_inv_x, style.std_inv_y, 8, 1, true)..
|
||||
ui.make_inv_img_grid(style.std_inv_x, style.std_inv_y + ui.imgscale, 8, 3)
|
||||
@ -159,3 +159,5 @@ dofile(modpath.."/item_names.lua")
|
||||
if minetest.get_modpath("datastorage") then
|
||||
dofile(modpath.."/waypoints.lua")
|
||||
end
|
||||
|
||||
minetest.log("action", "[unified_inventory] loaded.")
|
||||
|
@ -72,17 +72,21 @@ function ui.get_formspec(player, page)
|
||||
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
|
||||
|
||||
if draw_lite_mode and i > 4 then
|
||||
button_row = 1
|
||||
button_col = 1
|
||||
elseif not draw_lite_mode and j > 12 then
|
||||
button_row = 1
|
||||
j = 1
|
||||
end
|
||||
|
||||
if def.type == "image" then
|
||||
if (def.condition == nil or def.condition(player) == true) then
|
||||
formspec[n] = string.format("image_button[%f,%f;%f,%f;%s;%s;]",
|
||||
ui_peruser.main_button_x + ui_peruser.btn_spc * (i - 1) - button_col * ui_peruser.btn_spc * 4,
|
||||
ui_peruser.main_button_x + ui_peruser.btn_spc * (j - 1) - button_col * ui_peruser.btn_spc * 4, -- Modif NALC
|
||||
ui_peruser.main_button_y + button_row * ui_peruser.btn_spc,
|
||||
ui_peruser.btn_size,ui_peruser.btn_size,
|
||||
F(def.image),
|
||||
@ -91,12 +95,13 @@ function ui.get_formspec(player, page)
|
||||
n = n+2
|
||||
else
|
||||
formspec[n] = string.format("image[%f,%f;%f,%f;%s^[colorize:#808080:alpha]",
|
||||
ui_peruser.main_button_x + ui_peruser.btn_spc * (i - 1) - button_col * ui_peruser.btn_spc * 4,
|
||||
ui_peruser.main_button_x + ui_peruser.btn_spc * (j - 1) - button_col * ui_peruser.btn_spc * 4, -- Modif NALC
|
||||
ui_peruser.main_button_y + button_row * ui_peruser.btn_spc,
|
||||
ui_peruser.btn_size,ui_peruser.btn_size,def.image)
|
||||
n = n+1
|
||||
end
|
||||
end
|
||||
j = j + 1 -- Modif NALC
|
||||
end
|
||||
|
||||
if fsdata.draw_inventory ~= false then
|
||||
|
51
register.lua
51
register.lua
@ -41,55 +41,6 @@ ui.register_button("craftguide", {
|
||||
tooltip = S("Crafting Guide")
|
||||
})
|
||||
|
||||
ui.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
|
||||
ui.set_home(player, player:get_pos())
|
||||
local home = ui.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: @1", minetest.pos_to_string(home)))
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(player_name,
|
||||
S("You don't have the \"home\" privilege!"))
|
||||
ui.set_inventory_formspec(player, ui.current_page[player_name])
|
||||
end
|
||||
end,
|
||||
condition = function(player)
|
||||
return minetest.check_player_privs(player:get_player_name(), {home=true})
|
||||
end,
|
||||
})
|
||||
|
||||
ui.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
|
||||
if ui.go_home(player) then
|
||||
minetest.sound_play("teleport", {to_player = player_name})
|
||||
end
|
||||
else
|
||||
minetest.chat_send_player(player_name,
|
||||
S("You don't have the \"home\" privilege!"))
|
||||
ui.set_inventory_formspec(player, ui.current_page[player_name])
|
||||
end
|
||||
end,
|
||||
condition = function(player)
|
||||
return minetest.check_player_privs(player:get_player_name(), {home=true})
|
||||
end,
|
||||
})
|
||||
|
||||
ui.register_button("misc_set_day", {
|
||||
type = "image",
|
||||
image = "ui_sun_icon.png",
|
||||
@ -192,7 +143,7 @@ ui.register_page("craft", {
|
||||
formspec[n] = ui.single_slot(craftx - 2.5, crafty + 2.5)
|
||||
formspec[n+1] = string.format("label[%f,%f;%s]", craftx - 2.3, crafty + 2.4,F(S("Refill:")))
|
||||
formspec[n+2] = string.format("list[detached:%srefill;main;%f,%f;1,1;]",
|
||||
F(player_name), craftx - 2.2 - ui.list_img_offset, crafty + 2.5 + ui.list_img_offset)
|
||||
F(player_name), craftx - 2.5 + ui.list_img_offset, crafty + 2.5 + ui.list_img_offset)
|
||||
end
|
||||
return {formspec=table.concat(formspec)}
|
||||
end,
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 697 B |
Reference in New Issue
Block a user