16 Commits

Author SHA1 Message Date
829b38c6fc Merge remote-tracking branch 'upstream/master' 2021-04-04 21:05:40 +02:00
860371ecf8 more consistent formspec size decision 2021-03-31 00:52:30 -04:00
70fdb8556b Merge remote-tracking branch 'upstream/master' 2021-03-12 12:01:23 +01:00
c044f5e3b0 use the trash slot icon's alpha instead of [combine
also it's supposed to be 128px, not 256px.  fixed that.
2021-03-10 21:20:31 -05:00
608cdfb887 fix refill slot list[] offset also 2021-03-10 12:32:55 -05:00
afb295ec22 fix trash slot list[] offset
(only noticable when listcolors[] allows slots to be visible,
i.e. on mouseover)
2021-03-10 12:26:28 -05:00
a84ce24067 use the ui.list_img_offset variable for offsetting the std inv list[]
so that it'll match every other list that uses it.
2021-03-09 18:31:16 -05:00
497c632b24 Merge remote-tracking branch 'upstream/master' 2020-12-18 12:20:14 +01:00
46eeb36784 Merge remote-tracking branch 'upstream/master' 2020-07-18 11:28:21 +02:00
9a31609cfd Merge remote-tracking branch 'upstream/master' into nalc-1.2-dev 2020-06-14 22:55:56 +02:00
8e6a3740ae Merge branch 'master' of yunohost.local:minetest-mods/unified_inventory into nalc-1.2-dev 2019-12-22 15:57:28 +01:00
1fd87f5c51 Suppression des icônes set_home et home_go 2019-05-01 17:28:36 +02:00
e5dc9ed53a Merge branch 'master' into nalc-1.1 2019-05-01 17:15:35 +02:00
4bf5f22696 Merge branch 'master' into nalc 2019-01-19 19:43:32 +01:00
4f666f93d0 Ajoute message de chargement du mod dans le journal "action" 2019-01-19 19:43:04 +01:00
264833ed41 Place les boutons d'inventaires sur 2 lignes 2018-11-20 22:04:24 +01:00
5 changed files with 22 additions and 63 deletions

View File

@ -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)

View File

@ -49,6 +49,8 @@ local ui = unified_inventory
ui.style_full = {
formspec_x = 1,
formspec_y = 1,
formw = 17.75,
formh = 12.25,
pagecols = 8,
pagerows = 10,
page_x = 10.75,
@ -80,6 +82,8 @@ ui.style_full = {
ui.style_lite = {
formspec_x = 0.6,
formspec_y = 0.6,
formw = 14,
formh = 9.75,
pagecols = 4,
pagerows = 6,
page_x = 10.5,
@ -113,7 +117,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 +163,5 @@ dofile(modpath.."/item_names.lua")
if minetest.get_modpath("datastorage") then
dofile(modpath.."/waypoints.lua")
end
minetest.log("action", "[unified_inventory] loaded.")

View File

@ -40,18 +40,15 @@ function ui.get_formspec(player, page)
if not pagedef then
return "" -- Invalid page name
end
local formspec = {
"formspec_version[4]size[17.75,12.25]",
"formspec_version[4]",
"size["..ui_peruser.formw..","..ui_peruser.formh.."]",
pagedef.formspec_prepend and "" or "no_prepend[]",
ui.standard_background -- Background
ui.standard_background
}
local n = 4
if draw_lite_mode then
formspec[1] = "formspec_version[4]size[14,9.75]"
formspec[3] = ui.standard_background
end
local n = 5
local perplayer_formspec = ui.get_per_player_formspec(player_name)
local fsdata = pagedef.get_formspec(player, perplayer_formspec)
@ -72,17 +69,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 +92,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

View File

@ -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