1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-22 23:10:17 +01:00

Add a description to buckets and use rightclick to place the liquids

This commit is contained in:
PilzAdam 2013-03-19 20:06:53 +01:00
parent 79856c914d
commit 4e20ed6153

View File

@ -24,7 +24,7 @@ bucket.liquids = {}
-- itemname = name of the new bucket item (or nil if liquid is not takeable) -- itemname = name of the new bucket item (or nil if liquid is not takeable)
-- inventory_image = texture of the new bucket item (ignored if itemname == nil) -- inventory_image = texture of the new bucket item (ignored if itemname == nil)
-- This function can be called from any mod (that depends on bucket). -- This function can be called from any mod (that depends on bucket).
function bucket.register_liquid(source, flowing, itemname, inventory_image) function bucket.register_liquid(source, flowing, itemname, inventory_image, name)
bucket.liquids[source] = { bucket.liquids[source] = {
source = source, source = source,
flowing = flowing, flowing = flowing,
@ -34,10 +34,12 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image)
if itemname ~= nil then if itemname ~= nil then
minetest.register_craftitem(itemname, { minetest.register_craftitem(itemname, {
description = name,
inventory_image = inventory_image, inventory_image = inventory_image,
stack_max = 1, stack_max = 1,
liquids_pointable = true, liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing) groups = {not_in_creative_inventory=1},
on_place = function(itemstack, user, pointed_thing)
-- Must be pointing to node -- Must be pointing to node
if pointed_thing.type ~= "node" then if pointed_thing.type ~= "node" then
return return
@ -113,14 +115,16 @@ bucket.register_liquid(
"default:water_source", "default:water_source",
"default:water_flowing", "default:water_flowing",
"bucket:bucket_water", "bucket:bucket_water",
"bucket_water.png" "bucket_water.png",
"Water Bucket"
) )
bucket.register_liquid( bucket.register_liquid(
"default:lava_source", "default:lava_source",
"default:lava_flowing", "default:lava_flowing",
"bucket:bucket_lava", "bucket:bucket_lava",
"bucket_lava.png" "bucket_lava.png",
"Lava Bucket"
) )
minetest.register_craft({ minetest.register_craft({