2013-05-18 16:05:16 +02:00
|
|
|
-- Minetest 0.4 mod: vessels
|
|
|
|
-- See README.txt for licensing and other information.
|
|
|
|
|
2015-03-02 10:29:02 +01:00
|
|
|
local vessels_shelf_formspec =
|
2016-05-21 04:49:28 +02:00
|
|
|
"size[8,7;]" ..
|
|
|
|
default.gui_bg ..
|
|
|
|
default.gui_bg_img ..
|
|
|
|
default.gui_slots ..
|
|
|
|
"list[context;vessels;0,0.3;8,2;]" ..
|
|
|
|
"list[current_player;main;0,2.85;8,1;]" ..
|
|
|
|
"list[current_player;main;0,4.08;8,3;8]" ..
|
|
|
|
"listring[context;vessels]" ..
|
|
|
|
"listring[current_player;main]" ..
|
|
|
|
default.get_hotbar_bg(0, 2.85)
|
2015-03-02 10:29:02 +01:00
|
|
|
|
2016-11-06 21:36:36 +01:00
|
|
|
local function get_vessels_shelf_formspec(inv)
|
|
|
|
local formspec = vessels_shelf_formspec
|
|
|
|
local invlist = inv and inv:get_list("vessels")
|
|
|
|
-- Inventory slots overlay
|
|
|
|
local vx, vy = 0, 0.3
|
|
|
|
for i = 1, 16 do
|
|
|
|
if i == 9 then
|
|
|
|
vx = 0
|
|
|
|
vy = vy + 1
|
|
|
|
end
|
|
|
|
if not invlist or invlist[i]:is_empty() then
|
|
|
|
formspec = formspec ..
|
|
|
|
"image[" .. vx .. "," .. vy .. ";1,1;vessels_shelf_slot.png]"
|
|
|
|
end
|
|
|
|
vx = vx + 1
|
2016-10-27 19:42:47 +02:00
|
|
|
end
|
2016-11-06 21:36:36 +01:00
|
|
|
return formspec
|
2016-10-27 19:42:47 +02:00
|
|
|
end
|
|
|
|
|
2015-03-02 10:29:02 +01:00
|
|
|
minetest.register_node("vessels:shelf", {
|
2016-05-21 04:49:28 +02:00
|
|
|
description = "Vessels Shelf",
|
2016-05-21 04:32:50 +02:00
|
|
|
tiles = {"default_wood.png", "default_wood.png", "default_wood.png",
|
|
|
|
"default_wood.png", "vessels_shelf.png", "vessels_shelf.png"},
|
|
|
|
paramtype2 = "facedir",
|
2015-03-02 10:29:02 +01:00
|
|
|
is_ground_content = false,
|
2016-05-21 04:49:28 +02:00
|
|
|
groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
|
2015-03-02 10:29:02 +01:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
|
|
|
|
on_construct = function(pos)
|
|
|
|
local meta = minetest.get_meta(pos)
|
2016-11-06 21:36:36 +01:00
|
|
|
meta:set_string("formspec", get_vessels_shelf_formspec(nil))
|
2015-03-02 10:29:02 +01:00
|
|
|
local inv = meta:get_inventory()
|
2016-03-23 19:48:22 +01:00
|
|
|
inv:set_size("vessels", 8 * 2)
|
2015-03-02 10:29:02 +01:00
|
|
|
end,
|
|
|
|
can_dig = function(pos,player)
|
2016-03-23 19:48:22 +01:00
|
|
|
local inv = minetest.get_meta(pos):get_inventory()
|
2015-03-02 10:29:02 +01:00
|
|
|
return inv:is_empty("vessels")
|
|
|
|
end,
|
|
|
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
2016-03-23 19:48:22 +01:00
|
|
|
if minetest.get_item_group(stack:get_name(), "vessel") ~= 0 then
|
|
|
|
return stack:get_count()
|
2015-03-02 10:29:02 +01:00
|
|
|
end
|
2016-03-23 19:48:22 +01:00
|
|
|
return 0
|
2015-03-02 10:29:02 +01:00
|
|
|
end,
|
|
|
|
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
2016-03-23 19:48:22 +01:00
|
|
|
minetest.log("action", player:get_player_name() ..
|
|
|
|
" moves stuff in vessels shelf at ".. minetest.pos_to_string(pos))
|
2016-11-06 21:36:36 +01:00
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory()))
|
2015-03-02 10:29:02 +01:00
|
|
|
end,
|
|
|
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
2016-03-23 19:48:22 +01:00
|
|
|
minetest.log("action", player:get_player_name() ..
|
|
|
|
" moves stuff to vessels shelf at ".. minetest.pos_to_string(pos))
|
2016-11-06 21:36:36 +01:00
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory()))
|
2015-03-02 10:29:02 +01:00
|
|
|
end,
|
|
|
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
2016-03-23 19:48:22 +01:00
|
|
|
minetest.log("action", player:get_player_name() ..
|
|
|
|
" takes stuff from vessels shelf at ".. minetest.pos_to_string(pos))
|
2016-11-06 21:36:36 +01:00
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory()))
|
2015-03-02 10:29:02 +01:00
|
|
|
end,
|
2016-04-16 04:21:45 +02:00
|
|
|
on_blast = function(pos)
|
|
|
|
local drops = {}
|
|
|
|
default.get_inventory_drops(pos, "vessels", drops)
|
2016-05-21 04:49:28 +02:00
|
|
|
drops[#drops + 1] = "vessels:shelf"
|
2016-04-16 04:21:45 +02:00
|
|
|
minetest.remove_node(pos)
|
|
|
|
return drops
|
|
|
|
end,
|
2015-03-02 10:29:02 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
2016-05-21 04:49:28 +02:00
|
|
|
output = "vessels:shelf",
|
2015-03-02 10:29:02 +01:00
|
|
|
recipe = {
|
2016-05-21 04:49:28 +02:00
|
|
|
{"group:wood", "group:wood", "group:wood"},
|
|
|
|
{"group:vessel", "group:vessel", "group:vessel"},
|
|
|
|
{"group:wood", "group:wood", "group:wood"},
|
2015-03-02 10:29:02 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2013-05-18 16:05:16 +02:00
|
|
|
minetest.register_node("vessels:glass_bottle", {
|
|
|
|
description = "Glass Bottle (empty)",
|
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"vessels_glass_bottle.png"},
|
2016-05-19 20:43:46 +02:00
|
|
|
inventory_image = "vessels_glass_bottle.png",
|
2013-05-18 16:05:16 +02:00
|
|
|
wield_image = "vessels_glass_bottle.png",
|
|
|
|
paramtype = "light",
|
2015-06-14 05:58:54 +02:00
|
|
|
is_ground_content = false,
|
2013-05-18 16:05:16 +02:00
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
2016-05-19 20:43:46 +02:00
|
|
|
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
|
2013-05-18 16:05:16 +02:00
|
|
|
},
|
2016-05-21 04:49:28 +02:00
|
|
|
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
|
2013-05-18 16:05:16 +02:00
|
|
|
sounds = default.node_sound_glass_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "vessels:glass_bottle 10",
|
|
|
|
recipe = {
|
2016-05-21 04:49:28 +02:00
|
|
|
{"default:glass", "", "default:glass"},
|
|
|
|
{"default:glass", "", "default:glass"},
|
|
|
|
{"", "default:glass", ""}
|
2013-05-18 16:05:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("vessels:drinking_glass", {
|
|
|
|
description = "Drinking Glass (empty)",
|
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"vessels_drinking_glass.png"},
|
|
|
|
inventory_image = "vessels_drinking_glass_inv.png",
|
|
|
|
wield_image = "vessels_drinking_glass.png",
|
|
|
|
paramtype = "light",
|
2015-06-14 05:58:54 +02:00
|
|
|
is_ground_content = false,
|
2013-05-18 16:05:16 +02:00
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
2016-05-19 20:43:46 +02:00
|
|
|
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
|
2013-05-18 16:05:16 +02:00
|
|
|
},
|
2016-05-21 04:49:28 +02:00
|
|
|
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
|
2013-05-18 16:05:16 +02:00
|
|
|
sounds = default.node_sound_glass_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "vessels:drinking_glass 14",
|
|
|
|
recipe = {
|
2016-05-21 04:49:28 +02:00
|
|
|
{"default:glass", "", "default:glass"},
|
|
|
|
{"default:glass", "", "default:glass"},
|
|
|
|
{"default:glass", "default:glass", "default:glass"}
|
2013-05-18 16:05:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("vessels:steel_bottle", {
|
|
|
|
description = "Heavy Steel Bottle (empty)",
|
|
|
|
drawtype = "plantlike",
|
|
|
|
tiles = {"vessels_steel_bottle.png"},
|
2016-05-19 20:43:46 +02:00
|
|
|
inventory_image = "vessels_steel_bottle.png",
|
2013-05-18 16:05:16 +02:00
|
|
|
wield_image = "vessels_steel_bottle.png",
|
|
|
|
paramtype = "light",
|
2015-06-14 05:58:54 +02:00
|
|
|
is_ground_content = false,
|
2013-05-18 16:05:16 +02:00
|
|
|
walkable = false,
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
2016-05-19 20:43:46 +02:00
|
|
|
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
|
2013-05-18 16:05:16 +02:00
|
|
|
},
|
2016-05-21 04:49:28 +02:00
|
|
|
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
|
2013-05-18 16:05:16 +02:00
|
|
|
sounds = default.node_sound_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = "vessels:steel_bottle 5",
|
|
|
|
recipe = {
|
2016-05-21 04:49:28 +02:00
|
|
|
{"default:steel_ingot", "", "default:steel_ingot"},
|
|
|
|
{"default:steel_ingot", "", "default:steel_ingot"},
|
|
|
|
{"", "default:steel_ingot", ""}
|
2013-05-18 16:05:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2016-05-21 04:49:28 +02:00
|
|
|
-- Glass and steel recycling
|
2013-05-18 16:05:16 +02:00
|
|
|
|
|
|
|
minetest.register_craftitem("vessels:glass_fragments", {
|
|
|
|
description = "Pile of Glass Fragments",
|
|
|
|
inventory_image = "vessels_glass_fragments.png",
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
type = "shapeless",
|
|
|
|
output = "vessels:glass_fragments",
|
|
|
|
recipe = {
|
|
|
|
"vessels:glass_bottle",
|
|
|
|
"vessels:glass_bottle",
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
type = "shapeless",
|
|
|
|
output = "vessels:glass_fragments",
|
|
|
|
recipe = {
|
|
|
|
"vessels:drinking_glass",
|
|
|
|
"vessels:drinking_glass",
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "cooking",
|
|
|
|
output = "default:glass",
|
|
|
|
recipe = "vessels:glass_fragments",
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
type = "cooking",
|
|
|
|
output = "default:steel_ingot",
|
|
|
|
recipe = "vessels:steel_bottle",
|
|
|
|
})
|
Add and edit fuel registrations
Edited fuels: fences, wooden ladder.
New fuels:
boat, paper, book, dry shrub, stick, vessels shelf, wooden tools,
wooden door, trapdoor, fence gates, farming crops, stairs, slabs, beds.
2016-10-30 11:29:58 +01:00
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "vessels:shelf",
|
|
|
|
burntime = 30,
|
|
|
|
})
|