Bucket description

Buckets with liquid have description.
This commit is contained in:
Kotolegokot 2012-10-30 20:02:00 +06:00
parent 64a96a5197
commit 2ef6d71869

View File

@ -1,9 +1,10 @@
buckets = {} buckets = {}
buckets.liquids = {} buckets.liquids = {}
function buckets.register_liquid(source, flowing, itemname, inventory_image) function buckets.register_liquid(name, source, flowing, itemname, inventory_image)
buckets.liquids[source] = { buckets.liquids[source] = {
name = name,
source = source, source = source,
flowing = flowing, flowing = flowing,
itemname = itemname, itemname = itemname,
@ -13,6 +14,7 @@ function buckets.register_liquid(source, flowing, itemname, inventory_image)
if itemname ~= nil then if itemname ~= nil then
for i = 1,#metals.list do for i = 1,#metals.list do
minetest.register_craftitem(itemname.."_"..metals.list[i], { minetest.register_craftitem(itemname.."_"..metals.list[i], {
description = metals.desc_list[i] .. " Bucket with " .. name,
inventory_image = "metals_"..metals.list[i].."_bucket.png^"..inventory_image, inventory_image = "metals_"..metals.list[i].."_bucket.png^"..inventory_image,
stack_max = 1, stack_max = 1,
liquids_pointable = true, liquids_pointable = true,
@ -25,9 +27,11 @@ function buckets.register_liquid(source, flowing, itemname, inventory_image)
n = minetest.env:get_node(pointed_thing.under) n = minetest.env:get_node(pointed_thing.under)
if buckets.liquids[n.name] == nil then if buckets.liquids[n.name] == nil then
-- Not a liquid -- Not a liquid
--if minetest.env:get_node(pointed_thing.above) == "air" then if minetest.env:get_node(pointed_thing.above).name == "air" then
minetest.env:add_node(pointed_thing.above, {name=source}) minetest.env:add_node(pointed_thing.above, {name=source})
-- end else
return itemstack
end
elseif n.name ~= source then elseif n.name ~= source then
-- It's a liquid -- It's a liquid
minetest.env:add_node(pointed_thing.under, {name=source}) minetest.env:add_node(pointed_thing.under, {name=source})
@ -62,6 +66,7 @@ for i = 1,#metals.list do
end end
buckets.register_liquid( buckets.register_liquid(
"Water",
"default:water_source", "default:water_source",
"default:water_flowing", "default:water_flowing",
"metals:bucket_water", "metals:bucket_water",
@ -69,6 +74,7 @@ buckets.register_liquid(
) )
buckets.register_liquid( buckets.register_liquid(
"Lava",
"default:lava_source", "default:lava_source",
"default:lava_flowing", "default:lava_flowing",
"metals:bucket_lava", "metals:bucket_lava",