[u_inv] Apply our modifications again
0
mods/unified_inventory/.gitignore
vendored
Normal file → Executable file
0
mods/unified_inventory/README.md
Normal file → Executable file
19
mods/unified_inventory/api.lua
Normal file → Executable file
@ -24,9 +24,22 @@ minetest.after(0.01, function()
|
|||||||
|
|
||||||
for _,chk in pairs(recipe.items) do
|
for _,chk in pairs(recipe.items) do
|
||||||
local groupchk = string.find(chk, "group:")
|
local groupchk = string.find(chk, "group:")
|
||||||
if (not groupchk and not minetest.registered_items[chk])
|
if groupchk then
|
||||||
or (groupchk and not unified_inventory.get_group_item(string.gsub(chk, "group:", "")).item) then
|
for _,groupname in pairs(string.gsub(chk, "group:", ""):split(",")) do
|
||||||
|
if not unified_inventory.get_group_item(groupname).item then
|
||||||
|
unknowns = true
|
||||||
|
if minetest.setting_getbool("show_unknown_craftrecipes") then
|
||||||
|
minetest.log("error", "Recipe for item " .. recipe.output .. " contains unknown group " .. groupname)
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif not minetest.registered_items[chk] then
|
||||||
unknowns = true
|
unknowns = true
|
||||||
|
if minetest.setting_getbool("show_unknown_craftrecipes") then
|
||||||
|
minetest.log("error", "Recipe for item " .. recipe.output .. " contains unknown item " .. chk)
|
||||||
|
end
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -40,7 +53,7 @@ minetest.after(0.01, function()
|
|||||||
end
|
end
|
||||||
table.sort(unified_inventory.items_list)
|
table.sort(unified_inventory.items_list)
|
||||||
unified_inventory.items_list_size = #unified_inventory.items_list
|
unified_inventory.items_list_size = #unified_inventory.items_list
|
||||||
print("Unified Inventory. inventory size: "..unified_inventory.items_list_size)
|
minetest.log("Unified Inventory. inventory size: "..unified_inventory.items_list_size)
|
||||||
for _, name in ipairs(unified_inventory.items_list) do
|
for _, name in ipairs(unified_inventory.items_list) do
|
||||||
local def = minetest.registered_items[name]
|
local def = minetest.registered_items[name]
|
||||||
if type(def.drop) == "string" then
|
if type(def.drop) == "string" then
|
||||||
|
79
mods/unified_inventory/bags.lua
Normal file → Executable file
@ -10,10 +10,10 @@ unified_inventory.register_page("bags", {
|
|||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local formspec = "background[0.06,0.99;7.92,7.52;ui_bags_main_form.png]"
|
local formspec = "background[0.06,0.99;7.92,7.52;ui_bags_main_form.png]"
|
||||||
formspec = formspec.."label[0,0;"..S("Bags").."]"
|
formspec = formspec.."label[0,0;"..S("Bags").."]"
|
||||||
formspec = formspec.."button[0,2;2,0.5;bag1;Bag 1]"
|
formspec = formspec.."button[0,2;2,0.5;bag1;Bag 1]" .. "button[0,3;2,0.5;unequip_bag1;Unequip]"
|
||||||
formspec = formspec.."button[2,2;2,0.5;bag2;Bag 2]"
|
formspec = formspec.."button[2,2;2,0.5;bag2;Bag 2]" .. "button[2,3;2,0.5;unequip_bag2;Unequip]"
|
||||||
formspec = formspec.."button[4,2;2,0.5;bag3;Bag 3]"
|
formspec = formspec.."button[4,2;2,0.5;bag3;Bag 3]" .. "button[4,3;2,0.5;unequip_bag3;Unequip]"
|
||||||
formspec = formspec.."button[6,2;2,0.5;bag4;Bag 4]"
|
formspec = formspec.."button[6,2;2,0.5;bag4;Bag 4]" .. "button[6,3;2,0.5;unequip_bag4;Unequip]"
|
||||||
formspec = formspec.."listcolors[#00000000;#00000000]"
|
formspec = formspec.."listcolors[#00000000;#00000000]"
|
||||||
formspec = formspec.."list[detached:"..minetest.formspec_escape(player_name).."_bags;bag1;0.5,1;1,1;]"
|
formspec = formspec.."list[detached:"..minetest.formspec_escape(player_name).."_bags;bag1;0.5,1;1,1;]"
|
||||||
formspec = formspec.."list[detached:"..minetest.formspec_escape(player_name).."_bags;bag2;2.5,1;1,1;]"
|
formspec = formspec.."list[detached:"..minetest.formspec_escape(player_name).."_bags;bag2;2.5,1;1,1;]"
|
||||||
@ -27,7 +27,8 @@ unified_inventory.register_button("bags", {
|
|||||||
type = "image",
|
type = "image",
|
||||||
image = "ui_bags_icon.png",
|
image = "ui_bags_icon.png",
|
||||||
tooltip = S("Bags"),
|
tooltip = S("Bags"),
|
||||||
hide_lite=true
|
hide_lite=true,
|
||||||
|
show_with = false, --Modif MFF (Crabman 30/06/2015)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -128,6 +129,15 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
end
|
end
|
||||||
unified_inventory.set_inventory_formspec(player, "bag"..i)
|
unified_inventory.set_inventory_formspec(player, "bag"..i)
|
||||||
return
|
return
|
||||||
|
elseif fields["unequip_bag" .. i] then
|
||||||
|
local stack = unified_inventory.extract_bag(player, i)
|
||||||
|
if not stack then
|
||||||
|
return
|
||||||
|
elseif not player:get_inventory():room_for_item("main", stack) then
|
||||||
|
minetest.chat_send_player(player:get_player_name(), "You need one free slot in your main inventory")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
player:get_inventory():add_item("main", stack)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@ -136,12 +146,20 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
local player_inv = player:get_inventory()
|
local player_inv = player:get_inventory()
|
||||||
local bags_inv = minetest.create_detached_inventory(player:get_player_name().."_bags",{
|
local bags_inv = minetest.create_detached_inventory(player:get_player_name().."_bags",{
|
||||||
on_put = function(inv, listname, index, stack, player)
|
on_put = function(inv, listname, index, stack, player)
|
||||||
player:get_inventory():set_stack(listname, index, stack)
|
local pinv = player:get_inventory()
|
||||||
player:get_inventory():set_size(listname.."contents",
|
pinv:set_stack(listname, index, stack)
|
||||||
|
pinv:set_size(listname.."contents",
|
||||||
stack:get_definition().groups.bagslots)
|
stack:get_definition().groups.bagslots)
|
||||||
|
|
||||||
|
-- Retrieve the serialized inventory if any
|
||||||
|
if stack:get_metadata() ~= "" then
|
||||||
|
for i, item in pairs(minetest.deserialize(stack:get_metadata())) do
|
||||||
|
pinv:set_stack(listname .. "contents", i, ItemStack(item))
|
||||||
|
end
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
on_take = function(inv, listname, index, stack, player)
|
allow_take = function()
|
||||||
player:get_inventory():set_stack(listname, index, nil)
|
return 0
|
||||||
end,
|
end,
|
||||||
allow_put = function(inv, listname, index, stack, player)
|
allow_put = function(inv, listname, index, stack, player)
|
||||||
if stack:get_definition().groups.bagslots then
|
if stack:get_definition().groups.bagslots then
|
||||||
@ -150,13 +168,6 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
allow_take = function(inv, listname, index, stack, player)
|
|
||||||
if player:get_inventory():is_empty(listname.."contents") then
|
|
||||||
return stack:get_count()
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||||
return 0
|
return 0
|
||||||
end,
|
end,
|
||||||
@ -193,15 +204,15 @@ minetest.register_craft({
|
|||||||
output = "unified_inventory:bag_small",
|
output = "unified_inventory:bag_small",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"", "farming:cotton", ""},
|
{"", "farming:cotton", ""},
|
||||||
{"group:wool", "group:wool", "group:wool"},
|
{"group:wool", "group:wool", "group:wool"},
|
||||||
{"group:wool", "group:wool", "group:wool"},
|
{"group:wool", "group:wool", "group:wool"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "unified_inventory:bag_medium",
|
output = "unified_inventory:bag_medium",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"", "", ""},
|
{"", "", ""},
|
||||||
{"farming:cotton", "unified_inventory:bag_small", "farming:cotton"},
|
{"farming:cotton", "unified_inventory:bag_small", "farming:cotton"},
|
||||||
{"farming:cotton", "unified_inventory:bag_small", "farming:cotton"},
|
{"farming:cotton", "unified_inventory:bag_small", "farming:cotton"},
|
||||||
},
|
},
|
||||||
@ -210,9 +221,37 @@ minetest.register_craft({
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "unified_inventory:bag_large",
|
output = "unified_inventory:bag_large",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"", "", ""},
|
{"", "", ""},
|
||||||
{"farming:cotton", "unified_inventory:bag_medium", "farming:cotton"},
|
{"farming:cotton", "unified_inventory:bag_medium", "farming:cotton"},
|
||||||
{"farming:cotton", "unified_inventory:bag_medium", "farming:cotton"},
|
{"farming:cotton", "unified_inventory:bag_medium", "farming:cotton"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function unified_inventory.extract_bag(player, id)
|
||||||
|
if not player then
|
||||||
|
minetest.log("error", "[u_inv] Invalid player for bag extraction : nil")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if tonumber(id) == nil or id > 4 or id < 0 then
|
||||||
|
minetest.log("error", "Invalid id: " .. (id or 'nil'))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local stack = player:get_inventory():get_stack("bag"..id, 1)
|
||||||
|
if not stack:get_definition().groups.bagslots then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local pinv = player:get_inventory()
|
||||||
|
local inv = pinv:get_list("bag" .. id .. "contents")
|
||||||
|
local list = {}
|
||||||
|
for i, item in pairs(inv) do
|
||||||
|
list[i] = item:to_table()
|
||||||
|
end
|
||||||
|
|
||||||
|
pinv:remove_item("bag" .. id, stack)
|
||||||
|
minetest.get_inventory({type = "detached", name = minetest.formspec_escape(player:get_player_name()) .. "_bags"}):set_stack("bag" .. id, 1, nil)
|
||||||
|
pinv:set_list("bag" .. id .. "contents", {})
|
||||||
|
|
||||||
|
stack:set_metadata(minetest.serialize(list))
|
||||||
|
return stack
|
||||||
|
end
|
||||||
|
10
mods/unified_inventory/callbacks.lua
Normal file → Executable file
@ -56,6 +56,16 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if fields.hidebutton then --MFF crabman(29/11/2015) hide guide, textfield bug
|
||||||
|
if not unified_inventory.hidden_guide[player_name] then
|
||||||
|
unified_inventory.hidden_guide[player_name] = true
|
||||||
|
else
|
||||||
|
unified_inventory.hidden_guide[player_name] = false
|
||||||
|
end
|
||||||
|
unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name])
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- always take new search text, even if not searching on it yet
|
-- always take new search text, even if not searching on it yet
|
||||||
if fields.searchbox
|
if fields.searchbox
|
||||||
and fields.searchbox ~= unified_inventory.current_searchbox[player_name] then
|
and fields.searchbox ~= unified_inventory.current_searchbox[player_name] then
|
||||||
|
1
mods/unified_inventory/depends.txt
Normal file → Executable file
@ -1,3 +1,4 @@
|
|||||||
|
sethome
|
||||||
creative?
|
creative?
|
||||||
intllib?
|
intllib?
|
||||||
datastorage?
|
datastorage?
|
||||||
|
0
mods/unified_inventory/group.lua
Normal file → Executable file
0
mods/unified_inventory/image_credits.txt
Normal file → Executable file
6
mods/unified_inventory/init.lua
Normal file → Executable file
@ -22,6 +22,7 @@ unified_inventory = {
|
|||||||
filtered_items_list = {},
|
filtered_items_list = {},
|
||||||
pages = {},
|
pages = {},
|
||||||
buttons = {},
|
buttons = {},
|
||||||
|
hidden_guide = {}, --MFF crabman(29/11/2015) hide guide, textfield bug
|
||||||
|
|
||||||
-- Homepos stuff
|
-- Homepos stuff
|
||||||
home_pos = {},
|
home_pos = {},
|
||||||
@ -48,9 +49,8 @@ unified_inventory = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Disable default creative inventory
|
-- Disable default creative inventory
|
||||||
local creative = rawget(_G, "creative") or rawget(_G, "creative_inventory")
|
if rawget(_G, "creative_inventory") then
|
||||||
if creative then
|
function creative_inventory.set_creative_formspec(player, start_i, pagenum)
|
||||||
function creative.set_creative_formspec(player, start_i, pagenum)
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
20
mods/unified_inventory/internal.lua
Normal file → Executable file
@ -85,6 +85,7 @@ function unified_inventory.get_formspec(player, page)
|
|||||||
formspec[n] = fsdata.formspec
|
formspec[n] = fsdata.formspec
|
||||||
n = n+1
|
n = n+1
|
||||||
|
|
||||||
|
local privs = minetest.get_player_privs(player_name) --Modif MFF (Crabman 13/10/2015) not show if player has not privs requiered
|
||||||
local button_row = 0
|
local button_row = 0
|
||||||
local button_col = 0
|
local button_col = 0
|
||||||
|
|
||||||
@ -93,16 +94,20 @@ 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) and (not def.show_with or (privs[def.show_with] and privs[def.show_with] == true)) then --Modif MFF (Crabman 13/10/2015) not show if player has not privs requiered
|
||||||
table.insert(filtered_inv_buttons, def)
|
table.insert(filtered_inv_buttons, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, def in pairs(filtered_inv_buttons) do
|
local i = 1 --Modif MFF (Crabman 13/10/2015) 12 buttons max by row
|
||||||
|
for _, def in pairs(filtered_inv_buttons) do --Modif MFF (Crabman 13/10/2015)
|
||||||
|
|
||||||
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 i > 12 then --Modif MFF (Crabman 13/10/2015)
|
||||||
|
button_row = 1
|
||||||
|
i = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if def.type == "image" then
|
if def.type == "image" then
|
||||||
@ -115,6 +120,7 @@ function unified_inventory.get_formspec(player, page)
|
|||||||
formspec[n+6] = ";"..(def.tooltip or "").."]"
|
formspec[n+6] = ";"..(def.tooltip or "").."]"
|
||||||
n = n+7
|
n = n+7
|
||||||
end
|
end
|
||||||
|
i = i + 1 --Modif MFF (Crabman 13/10/2015)
|
||||||
end
|
end
|
||||||
|
|
||||||
if fsdata.draw_inventory ~= false then
|
if fsdata.draw_inventory ~= false then
|
||||||
@ -128,6 +134,16 @@ function unified_inventory.get_formspec(player, page)
|
|||||||
return table.concat(formspec, "")
|
return table.concat(formspec, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not unified_inventory.hidden_guide[player_name] then --MFF crabman(29/11/2015) hide guide, textfield bug
|
||||||
|
formspec[n] = "image_button[13.2,0.1;.8,.8;ui_on_icon.png;hidebutton;]"
|
||||||
|
.. "tooltip[hidebutton;" ..S("Hide guide") .. "]"
|
||||||
|
n = n+1
|
||||||
|
else
|
||||||
|
formspec[n] = "image_button[13.2,0.1;.8,.8;ui_off_icon.png;hidebutton;]"
|
||||||
|
.. "tooltip[hidebutton;" ..S("Show guide") .. "]"
|
||||||
|
return table.concat(formspec, "")
|
||||||
|
end
|
||||||
|
|
||||||
-- Controls to flip items pages
|
-- Controls to flip items pages
|
||||||
local start_x = 9.2
|
local start_x = 9.2
|
||||||
|
|
||||||
|
7
mods/unified_inventory/item_names.lua
Normal file → Executable file
@ -6,15 +6,12 @@ local dtimes = {}
|
|||||||
local dlimit = 3 -- HUD element will be hidden after this many seconds
|
local dlimit = 3 -- HUD element will be hidden after this many seconds
|
||||||
local air_hud_mod = minetest.get_modpath("4air")
|
local air_hud_mod = minetest.get_modpath("4air")
|
||||||
local hud_mod = minetest.get_modpath("hud")
|
local hud_mod = minetest.get_modpath("hud")
|
||||||
local hudbars_mod = minetest.get_modpath("hudbars")
|
|
||||||
|
|
||||||
local function set_hud(player)
|
local function set_hud(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local off = {x=0, y=-70}
|
local off = {x=0, y=-70}
|
||||||
if air_hud_mod or hud_mod then
|
if air_hud_mod or hud_mod then
|
||||||
off.y = off.y - 20
|
off.y = off.y - 20
|
||||||
elseif hudbars_mod then
|
|
||||||
off.y = off.y + 13
|
|
||||||
end
|
end
|
||||||
huds[player_name] = player:hud_add({
|
huds[player_name] = player:hud_add({
|
||||||
hud_elem_type = "text",
|
hud_elem_type = "text",
|
||||||
@ -45,7 +42,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
if wstack ~= wield[player_name] then
|
if wstack ~= wield[player_name] then
|
||||||
wield[player_name] = wstack
|
wield[player_name] = wstack
|
||||||
dtimes[player_name] = 0
|
dtimes[player_name] = 0
|
||||||
if huds[player_name] then
|
if huds[player_name] then
|
||||||
local def = minetest.registered_items[wstack]
|
local def = minetest.registered_items[wstack]
|
||||||
local desc = def and def.description or ""
|
local desc = def and def.description or ""
|
||||||
player:hud_change(huds[player_name], 'text', desc)
|
player:hud_change(huds[player_name], 'text', desc)
|
||||||
|
0
mods/unified_inventory/locale/de.txt
Normal file → Executable file
0
mods/unified_inventory/locale/es.txt
Normal file → Executable file
0
mods/unified_inventory/locale/fr.txt
Normal file → Executable file
0
mods/unified_inventory/locale/pl.txt
Normal file → Executable file
0
mods/unified_inventory/locale/ru.txt
Normal file → Executable file
0
mods/unified_inventory/locale/template.txt
Normal file → Executable file
0
mods/unified_inventory/locale/tr.txt
Normal file → Executable file
47
mods/unified_inventory/register.lua
Normal file → Executable file
@ -30,13 +30,15 @@ trash:set_size("main", 1)
|
|||||||
unified_inventory.register_button("craft", {
|
unified_inventory.register_button("craft", {
|
||||||
type = "image",
|
type = "image",
|
||||||
image = "ui_craft_icon.png",
|
image = "ui_craft_icon.png",
|
||||||
tooltip = S("Crafting Grid")
|
tooltip = S("Crafting Grid"),
|
||||||
|
show_with = false, --Modif MFF (Crabman 30/06/2015)
|
||||||
})
|
})
|
||||||
|
|
||||||
unified_inventory.register_button("craftguide", {
|
unified_inventory.register_button("craftguide", {
|
||||||
type = "image",
|
type = "image",
|
||||||
image = "ui_craftguide_icon.png",
|
image = "ui_craftguide_icon.png",
|
||||||
tooltip = S("Crafting Guide")
|
tooltip = S("Crafting Guide"),
|
||||||
|
show_with = false, --Modif MFF (Crabman 30/06/2015)
|
||||||
})
|
})
|
||||||
|
|
||||||
unified_inventory.register_button("home_gui_set", {
|
unified_inventory.register_button("home_gui_set", {
|
||||||
@ -44,38 +46,28 @@ unified_inventory.register_button("home_gui_set", {
|
|||||||
image = "ui_sethome_icon.png",
|
image = "ui_sethome_icon.png",
|
||||||
tooltip = S("Set home position"),
|
tooltip = S("Set home position"),
|
||||||
hide_lite=true,
|
hide_lite=true,
|
||||||
|
show_with = "interact", --Modif MFF (Crabman 30/06/2015)
|
||||||
action = function(player)
|
action = function(player)
|
||||||
local player_name = player:get_player_name()
|
if home.sethome(player:get_player_name()) == true then --modif MFF
|
||||||
if minetest.check_player_privs(player_name, {home=true}) then
|
|
||||||
unified_inventory.set_home(player, player:getpos())
|
|
||||||
local home = unified_inventory.home_pos[player_name]
|
|
||||||
if home ~= nil then
|
|
||||||
minetest.sound_play("dingdong",
|
minetest.sound_play("dingdong",
|
||||||
{to_player=player_name, gain = 1.0})
|
{to_player=player:get_player_name(), gain = 1.0})
|
||||||
minetest.chat_send_player(player_name,
|
|
||||||
S("Home position set to: %s"):format(minetest.pos_to_string(home)))
|
|
||||||
end
|
end
|
||||||
else
|
end,
|
||||||
minetest.chat_send_player(player_name,
|
|
||||||
S("You don't have the \"home\" privilege!"))
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unified_inventory.register_button("home_gui_go", {
|
unified_inventory.register_button("home_gui_go", {
|
||||||
type = "image",
|
type = "image",
|
||||||
image = "ui_gohome_icon.png",
|
image = "ui_gohome_icon.png",
|
||||||
tooltip = S("Go home"),
|
tooltip = S("Go home"),
|
||||||
hide_lite=true,
|
hide_lite=true,
|
||||||
|
show_with = "interact", --Modif MFF (Crabman 30/06/2015)
|
||||||
action = function(player)
|
action = function(player)
|
||||||
local player_name = player:get_player_name()
|
if home.tohome(player:get_player_name()) == true then --modif MFF
|
||||||
if minetest.check_player_privs(player_name, {home=true}) then
|
|
||||||
minetest.sound_play("teleport",
|
minetest.sound_play("teleport",
|
||||||
{to_player=player:get_player_name(), gain = 1.0})
|
{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!"))
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -85,6 +77,7 @@ unified_inventory.register_button("misc_set_day", {
|
|||||||
image = "ui_sun_icon.png",
|
image = "ui_sun_icon.png",
|
||||||
tooltip = S("Set time to day"),
|
tooltip = S("Set time to day"),
|
||||||
hide_lite=true,
|
hide_lite=true,
|
||||||
|
show_with = "settime", --Modif MFF (Crabman 30/06/2015)
|
||||||
action = function(player)
|
action = function(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
if minetest.check_player_privs(player_name, {settime=true}) then
|
if minetest.check_player_privs(player_name, {settime=true}) then
|
||||||
@ -105,6 +98,7 @@ unified_inventory.register_button("misc_set_night", {
|
|||||||
image = "ui_moon_icon.png",
|
image = "ui_moon_icon.png",
|
||||||
tooltip = S("Set time to night"),
|
tooltip = S("Set time to night"),
|
||||||
hide_lite=true,
|
hide_lite=true,
|
||||||
|
show_with = "settime", --Modif MFF (Crabman 30/06/2015)
|
||||||
action = function(player)
|
action = function(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
if minetest.check_player_privs(player_name, {settime=true}) then
|
if minetest.check_player_privs(player_name, {settime=true}) then
|
||||||
@ -124,6 +118,7 @@ unified_inventory.register_button("clear_inv", {
|
|||||||
type = "image",
|
type = "image",
|
||||||
image = "ui_trash_icon.png",
|
image = "ui_trash_icon.png",
|
||||||
tooltip = S("Clear inventory"),
|
tooltip = S("Clear inventory"),
|
||||||
|
show_with = "creative", --Modif MFF (Crabman 30/06/2015)
|
||||||
action = function(player)
|
action = function(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
if not unified_inventory.is_creative(player_name) then
|
if not unified_inventory.is_creative(player_name) then
|
||||||
@ -168,6 +163,11 @@ unified_inventory.register_page("craft", {
|
|||||||
|
|
||||||
-- stack_image_button(): generate a form button displaying a stack of items
|
-- stack_image_button(): generate a form button displaying a stack of items
|
||||||
--
|
--
|
||||||
|
-- Normally a simple item_image_button[] is used. If the stack contains
|
||||||
|
-- more than one item, item_image_button[] doesn't have an option to
|
||||||
|
-- display an item count in the way that an inventory slot does, so
|
||||||
|
-- we have to fake it using the label facility.
|
||||||
|
--
|
||||||
-- The specified item may be a group. In that case, the group will be
|
-- The specified item may be a group. In that case, the group will be
|
||||||
-- represented by some item in the group, along with a flag indicating
|
-- represented by some item in the group, along with a flag indicating
|
||||||
-- that it's a group. If the group contains only one item, it will be
|
-- that it's a group. If the group contains only one item, it will be
|
||||||
@ -177,7 +177,7 @@ local function stack_image_button(x, y, w, h, buttonname_prefix, item)
|
|||||||
local name = item:get_name()
|
local name = item:get_name()
|
||||||
local count = item:get_count()
|
local count = item:get_count()
|
||||||
local show_is_group = false
|
local show_is_group = false
|
||||||
local displayitem = name.." "..count
|
local displayitem = name
|
||||||
local selectitem = name
|
local selectitem = name
|
||||||
if name:sub(1, 6) == "group:" then
|
if name:sub(1, 6) == "group:" then
|
||||||
local group_name = name:sub(7)
|
local group_name = name:sub(7)
|
||||||
@ -186,7 +186,8 @@ local function stack_image_button(x, y, w, h, buttonname_prefix, item)
|
|||||||
displayitem = group_item.item or "unknown"
|
displayitem = group_item.item or "unknown"
|
||||||
selectitem = group_item.sole and displayitem or name
|
selectitem = group_item.sole and displayitem or name
|
||||||
end
|
end
|
||||||
local label = show_is_group and "G" or ""
|
local label = string.format("\n\n%s%7d", show_is_group and " G\n" or " ", count):gsub(" 1$", " .")
|
||||||
|
if label == "\n\n ." then label = "" end
|
||||||
return string.format("item_image_button[%f,%f;%u,%u;%s;%s;%s]",
|
return string.format("item_image_button[%f,%f;%u,%u;%s;%s;%s]",
|
||||||
x, y, w, h,
|
x, y, w, h,
|
||||||
minetest.formspec_escape(displayitem),
|
minetest.formspec_escape(displayitem),
|
||||||
|
BIN
mods/unified_inventory/sounds/birds.ogg
Normal file → Executable file
BIN
mods/unified_inventory/sounds/click.ogg
Normal file → Executable file
BIN
mods/unified_inventory/sounds/dingdong.ogg
Normal file → Executable file
BIN
mods/unified_inventory/sounds/electricity.ogg
Normal file → Executable file
BIN
mods/unified_inventory/sounds/owl.ogg
Normal file → Executable file
BIN
mods/unified_inventory/sounds/paperflip1.ogg
Normal file → Executable file
BIN
mods/unified_inventory/sounds/paperflip2.ogg
Normal file → Executable file
BIN
mods/unified_inventory/sounds/teleport.ogg
Normal file → Executable file
BIN
mods/unified_inventory/sounds/trash.ogg
Normal file → Executable file
BIN
mods/unified_inventory/sounds/trash_all.ogg
Normal file → Executable file
BIN
mods/unified_inventory/textures/bags_large.png
Normal file → Executable file
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
BIN
mods/unified_inventory/textures/bags_medium.png
Normal file → Executable file
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 12 KiB |
BIN
mods/unified_inventory/textures/bags_small.png
Normal file → Executable file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 10 KiB |
BIN
mods/unified_inventory/textures/ui_1_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 688 B After Width: | Height: | Size: 570 B |
0
mods/unified_inventory/textures/ui_2_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
mods/unified_inventory/textures/ui_3_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
mods/unified_inventory/textures/ui_4_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 846 B |
BIN
mods/unified_inventory/textures/ui_5_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
mods/unified_inventory/textures/ui_bags_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
BIN
mods/unified_inventory/textures/ui_bags_lg_form.png
Normal file → Executable file
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
BIN
mods/unified_inventory/textures/ui_bags_main_form.png
Normal file → Executable file
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 6.4 KiB |
BIN
mods/unified_inventory/textures/ui_bags_med_form.png
Normal file → Executable file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 11 KiB |
BIN
mods/unified_inventory/textures/ui_bags_sm_form.png
Normal file → Executable file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 10 KiB |
BIN
mods/unified_inventory/textures/ui_blank_image.png
Normal file → Executable file
Before Width: | Height: | Size: 143 B After Width: | Height: | Size: 96 B |
BIN
mods/unified_inventory/textures/ui_blue_icon_background.png
Normal file → Executable file
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 3.8 KiB |
BIN
mods/unified_inventory/textures/ui_circular_arrows_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
BIN
mods/unified_inventory/textures/ui_craft_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
BIN
mods/unified_inventory/textures/ui_craftgrid_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 680 B After Width: | Height: | Size: 485 B |
BIN
mods/unified_inventory/textures/ui_craftguide_form.png
Normal file → Executable file
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 12 KiB |
BIN
mods/unified_inventory/textures/ui_craftguide_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
0
mods/unified_inventory/textures/ui_crafting_form.png
Normal file → Executable file
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
BIN
mods/unified_inventory/textures/ui_doubleleft_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 10 KiB |
BIN
mods/unified_inventory/textures/ui_doubleright_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 10 KiB |
BIN
mods/unified_inventory/textures/ui_form_bg.png
Normal file → Executable file
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 1.7 KiB |
BIN
mods/unified_inventory/textures/ui_gohome_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
BIN
mods/unified_inventory/textures/ui_green_icon_background.png
Normal file → Executable file
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
mods/unified_inventory/textures/ui_group.png
Normal file → Executable file
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
BIN
mods/unified_inventory/textures/ui_home_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 14 KiB |
BIN
mods/unified_inventory/textures/ui_left_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.0 KiB |
BIN
mods/unified_inventory/textures/ui_main_inventory.png
Normal file → Executable file
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 4.6 KiB |
BIN
mods/unified_inventory/textures/ui_misc_form.png
Normal file → Executable file
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 5.7 KiB |
BIN
mods/unified_inventory/textures/ui_moon_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
BIN
mods/unified_inventory/textures/ui_no.png
Normal file → Executable file
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 6.2 KiB |
BIN
mods/unified_inventory/textures/ui_off_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 5.8 KiB |
BIN
mods/unified_inventory/textures/ui_ok_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 3.8 KiB |
BIN
mods/unified_inventory/textures/ui_on_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 5.9 KiB |
BIN
mods/unified_inventory/textures/ui_pencil_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 6.3 KiB |
BIN
mods/unified_inventory/textures/ui_red_icon_background.png
Normal file → Executable file
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 3.8 KiB |
BIN
mods/unified_inventory/textures/ui_right_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.1 KiB |
BIN
mods/unified_inventory/textures/ui_search_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 11 KiB |
BIN
mods/unified_inventory/textures/ui_sethome_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
0
mods/unified_inventory/textures/ui_single_slot.png
Normal file → Executable file
Before Width: | Height: | Size: 988 B After Width: | Height: | Size: 988 B |
BIN
mods/unified_inventory/textures/ui_skip_backward_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.3 KiB |
BIN
mods/unified_inventory/textures/ui_skip_forward_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.2 KiB |
BIN
mods/unified_inventory/textures/ui_sun_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
BIN
mods/unified_inventory/textures/ui_trash_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
BIN
mods/unified_inventory/textures/ui_waypoint_set_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.5 KiB |
BIN
mods/unified_inventory/textures/ui_waypoints_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 15 KiB |
BIN
mods/unified_inventory/textures/ui_xyz_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.4 KiB |
BIN
mods/unified_inventory/textures/ui_xyz_off_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 8.4 KiB |
BIN
mods/unified_inventory/textures/ui_xyz_on_icon.png
Normal file → Executable file
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.4 KiB |
3
mods/unified_inventory/waypoints.lua
Normal file → Executable file
@ -112,7 +112,8 @@ unified_inventory.register_button("waypoints", {
|
|||||||
type = "image",
|
type = "image",
|
||||||
image = "ui_waypoints_icon.png",
|
image = "ui_waypoints_icon.png",
|
||||||
tooltip = S("Waypoints"),
|
tooltip = S("Waypoints"),
|
||||||
hide_lite=true
|
hide_lite=true,
|
||||||
|
show_with = false, --Modif MFF (Crabman 30/06/2015)
|
||||||
})
|
})
|
||||||
|
|
||||||
local function update_hud(player, waypoints, temp, i)
|
local function update_hud(player, waypoints, temp, i)
|
||||||
|