Merge f48b62afa9
into fc36b3ff3b
This commit is contained in:
commit
1c79638e5a
|
@ -168,6 +168,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
unified_inventory.current_page[player_name])
|
unified_inventory.current_page[player_name])
|
||||||
minetest.sound_play("click",
|
minetest.sound_play("click",
|
||||||
{to_player=player_name, gain = 0.1})
|
{to_player=player_name, gain = 0.1})
|
||||||
|
elseif fields.ui_ring_dst then
|
||||||
|
local possible = {craft = 1, trash = 2, refill = 3}
|
||||||
|
local invs = {"current_name;craft", "detached:trash;main", "detached:"..minetest.formspec_escape(player_name).."refill;main"}
|
||||||
|
local ring_dest = possible[fields.ui_ring_dst] or 1
|
||||||
|
unified_inventory.ring_dst[player:get_player_name()] = ring_dest
|
||||||
|
local f = player:get_inventory_formspec()
|
||||||
|
local bla = f:find("listring[", 1, true)
|
||||||
|
f = f:sub(1, bla+8)..invs[ring_dest]..f:sub(f:find("]", bla), -1)
|
||||||
|
bla = f:find(";ui_ring_dst;") + 32
|
||||||
|
f = f:sub(1, bla-1)..ring_dest..f:sub(bla+1)
|
||||||
|
player:set_inventory_formspec(f)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- alternate buttons
|
-- alternate buttons
|
||||||
|
|
4
init.lua
4
init.lua
|
@ -32,6 +32,8 @@ unified_inventory = {
|
||||||
pages = {},
|
pages = {},
|
||||||
buttons = {},
|
buttons = {},
|
||||||
|
|
||||||
|
ring_dst = {},
|
||||||
|
|
||||||
-- Homepos stuff
|
-- Homepos stuff
|
||||||
home_pos = {},
|
home_pos = {},
|
||||||
home_filename = worldpath.."/unified_inventory_home.home",
|
home_filename = worldpath.."/unified_inventory_home.home",
|
||||||
|
@ -45,7 +47,7 @@ unified_inventory = {
|
||||||
|
|
||||||
-- "Lite" mode
|
-- "Lite" mode
|
||||||
lite_mode = minetest.setting_getbool("unified_inventory_lite"),
|
lite_mode = minetest.setting_getbool("unified_inventory_lite"),
|
||||||
|
|
||||||
-- Trash enabled
|
-- Trash enabled
|
||||||
trash_enabled = (minetest.setting_getbool("unified_inventory_trash") ~= false),
|
trash_enabled = (minetest.setting_getbool("unified_inventory_trash") ~= false),
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ function unified_inventory.get_per_player_formspec(player_name)
|
||||||
ui.craft_result_x = unified_inventory.craft_result_x
|
ui.craft_result_x = unified_inventory.craft_result_x
|
||||||
ui.craft_result_y = unified_inventory.craft_result_y
|
ui.craft_result_y = unified_inventory.craft_result_y
|
||||||
ui.form_header_y = unified_inventory.form_header_y
|
ui.form_header_y = unified_inventory.form_header_y
|
||||||
|
ui.ring_dst = unified_inventory.ring_dst[player_name] or 1
|
||||||
|
|
||||||
if lite then
|
if lite then
|
||||||
ui.pagecols = 4
|
ui.pagecols = 4
|
||||||
|
@ -94,7 +95,7 @@ function unified_inventory.get_formspec(player, page)
|
||||||
local filtered_inv_buttons = {}
|
local filtered_inv_buttons = {}
|
||||||
|
|
||||||
for i, def in pairs(unified_inventory.buttons) do
|
for i, def in pairs(unified_inventory.buttons) do
|
||||||
if not (draw_lite_mode and def.hide_lite) then
|
if not (draw_lite_mode and def.hide_lite) then
|
||||||
table.insert(filtered_inv_buttons, def)
|
table.insert(filtered_inv_buttons, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -167,6 +167,7 @@ unified_inventory.register_page("craft", {
|
||||||
|
|
||||||
local formspecy = perplayer_formspec.formspec_y
|
local formspecy = perplayer_formspec.formspec_y
|
||||||
local formheadery = perplayer_formspec.form_header_y
|
local formheadery = perplayer_formspec.form_header_y
|
||||||
|
local ring_dst = perplayer_formspec.ring_dst
|
||||||
|
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local formspec = "background[2,"..formspecy..";6,3;ui_crafting_form.png]"
|
local formspec = "background[2,"..formspecy..";6,3;ui_crafting_form.png]"
|
||||||
|
@ -183,8 +184,10 @@ unified_inventory.register_page("craft", {
|
||||||
formspec = formspec.."listring[current_name;craft]"
|
formspec = formspec.."listring[current_name;craft]"
|
||||||
formspec = formspec.."listring[current_player;main]"
|
formspec = formspec.."listring[current_player;main]"
|
||||||
if unified_inventory.is_creative(player_name) then
|
if unified_inventory.is_creative(player_name) then
|
||||||
|
formspec = formspec.."label[0,"..(formspecy)..";Shift-click to:]"
|
||||||
|
formspec = formspec.."dropdown[0,"..(formspecy + 0.5)..";1;ui_ring_dst;craft,trash,refill;"..ring_dst.."]"
|
||||||
formspec = formspec.."label[0,"..(formspecy + 1.5)..";" .. F("Refill:") .. "]"
|
formspec = formspec.."label[0,"..(formspecy + 1.5)..";" .. F("Refill:") .. "]"
|
||||||
formspec = formspec.."list[detached:"..minetest.formspec_escape(player_name).."refill;main;0,"..(formspecy +2)..";1,1;]"
|
formspec = formspec.."list[detached:"..minetest.formspec_escape(player_name).."refill;main;0,"..(formspecy + 2)..";1,1;]"
|
||||||
end
|
end
|
||||||
return {formspec=formspec}
|
return {formspec=formspec}
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in New Issue