Merge branch 'inventory'
commit
a2378b85cf
|
@ -1 +1,2 @@
|
|||
default
|
||||
inventory
|
||||
|
|
|
@ -18,19 +18,38 @@ clothing.update_skin = function(player)
|
|||
)
|
||||
end
|
||||
|
||||
-- Save and restore data
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if (formname == "" or formname:sub(0,9) == "inventory") then
|
||||
clothing.update_skin(player)
|
||||
end
|
||||
print("For debug (from clothing mod) inv. fields:",dump(fields))
|
||||
end)
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
clothing.update_skin(player)
|
||||
end)
|
||||
|
||||
--{{{ Cloth
|
||||
-- Required values is:
|
||||
--{{{ Cloth -- Required values is:
|
||||
-- "wear_image" (this image is adding on player skin)
|
||||
minetest.register_craftitem("clothing:test", {
|
||||
decription = "Test cloth",
|
||||
minetest.register_craftitem("clothing:test1", {
|
||||
decription = "Test cloth 1",
|
||||
inventory_image = "clothing_test.png",
|
||||
wield_image = "clothing_test.png",
|
||||
wear_image = "clothing_test.png",
|
||||
stack_max = 1,
|
||||
})
|
||||
minetest.register_craftitem("clothing:test2", {
|
||||
decription = "Test cloth 2",
|
||||
inventory_image = "clothing_test2.png",
|
||||
wield_image = "clothing_test2.png",
|
||||
wear_image = "clothing_test2.png",
|
||||
stack_max = 1,
|
||||
})
|
||||
minetest.register_craftitem("clothing:test3", {
|
||||
decription = "Test cloth 3",
|
||||
inventory_image = "clothing_test3.png",
|
||||
wield_image = "clothing_test3.png",
|
||||
wear_image = "clothing_test3.png",
|
||||
stack_max = 1,
|
||||
})
|
||||
--}}}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 200 B |
Binary file not shown.
After Width: | Height: | Size: 189 B |
|
@ -1,2 +1 @@
|
|||
default
|
||||
clothing
|
||||
|
|
|
@ -20,27 +20,72 @@ minetest.register_on_newplayer(function(player)
|
|||
invref:set_size("wear", 36)
|
||||
|
||||
-- Left and right hand (is this needed?)
|
||||
invref:set_list("left_hand", {})
|
||||
invref:set_size("left_hand", 1)
|
||||
invref:set_list("right_hand", {})
|
||||
invref:set_size("right_hand", 1)
|
||||
--invref:set_list("left_hand", {})
|
||||
--invref:set_size("left_hand", 1)
|
||||
--invref:set_list("right_hand", {})
|
||||
--invref:set_size("right_hand", 1)
|
||||
end)
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
player:set_inventory_formspec(inventory.gui_survival_form)
|
||||
player:set_inventory_formspec(inventory.craft)
|
||||
end
|
||||
end)
|
||||
|
||||
inventory.gui_survival_form =
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if (formname == "" or formname:sub(0,9) == "inventory") then
|
||||
if fields.craft_inv then
|
||||
minetest.show_formspec(
|
||||
player:get_player_name(),
|
||||
"",
|
||||
inventory.craft
|
||||
)
|
||||
elseif fields.wear_inv then
|
||||
minetest.show_formspec(
|
||||
player:get_player_name(),
|
||||
"inventory:wear",
|
||||
inventory.wear
|
||||
)
|
||||
elseif fields.notes_inv then
|
||||
minetest.show_formspec(
|
||||
player:get_player_name(),
|
||||
"inventory:notes",
|
||||
inventory.notes
|
||||
)
|
||||
end
|
||||
end
|
||||
print("For debug (from inventory mod) inv. fields:",dump(fields))
|
||||
end)
|
||||
|
||||
|
||||
inventory.base =
|
||||
"size[9,5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"button[0.25,4.9;2.5,0.1;craft_inv;Inventory]"..
|
||||
"button[3.25,4.9;2.5,0.1;wear_inv;Clothes]"..
|
||||
"button[6.25,4.9;2.5,0.1;notes_inv;Notes]"
|
||||
|
||||
inventory.craft =
|
||||
inventory.base..
|
||||
|
||||
-- Craft
|
||||
"list[current_player;craft;2,0;3,3;]"..
|
||||
"image[5,1;1,1;gui_furnace_arrow_bg.png^[transformR270]"..
|
||||
"list[current_player;craftpreview;6,1;1,1;]"..
|
||||
"list[current_player;left_hand;0.25,1;1,1;]"..
|
||||
"list[current_player;right_hand;7.75,1;1,1;]"..
|
||||
"list[current_player;main;0,3.5;9,1;]"..
|
||||
default.get_hotbar_bg(0,3.5)
|
||||
|
||||
-- Left and right hand
|
||||
--"list[current_player;left_hand;0.25,1;1,1;]"..
|
||||
--"list[current_player;right_hand;7.75,1;1,1;]"..
|
||||
|
||||
-- Main inventory
|
||||
"list[current_player;main;0,3.5;9,1;]"
|
||||
|
||||
inventory.wear =
|
||||
inventory.base..
|
||||
"list[current_player;wear;0,0;9,4;]"
|
||||
|
||||
inventory.notes =
|
||||
inventory.base..
|
||||
"textarea[0.3,0;9,4.5;inv_notes;Quick notes;]"
|
||||
|
|
Loading…
Reference in New Issue