Skip to content
Snippets Groups Projects
Commit f9ab8cd0 authored by Perttu Ahola's avatar Perttu Ahola
Browse files

Add initial content

parent 52c95134
Branches
No related tags found
No related merge requests found
Showing
with 1607 additions and 0 deletions
default
-- bucket (Minetest 0.4 mod)
-- A bucket, which can pick up water and lava
minetest.register_alias("bucket", "bucket:bucket_empty")
minetest.register_alias("bucket_water", "bucket:bucket_water")
minetest.register_alias("bucket_lava", "bucket:bucket_lava")
minetest.register_craft({
output = 'bucket:bucket_empty 1',
recipe = {
{'default:steel_ingot', '', 'default:steel_ingot'},
{'', 'default:steel_ingot', ''},
}
})
bucket = {}
bucket.liquids = {}
-- Register a new liquid
-- source = name of the source node
-- flowing = name of the flowing node
-- 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)
-- This function can be called from any mod (that depends on bucket).
function bucket.register_liquid(source, flowing, itemname, inventory_image)
bucket.liquids[source] = {
source = source,
flowing = flowing,
itemname = itemname,
}
bucket.liquids[flowing] = bucket.liquids[source]
if itemname ~= nil then
minetest.register_craftitem(itemname, {
inventory_image = inventory_image,
stack_max = 1,
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
-- Check if pointing to a liquid
n = minetest.env:get_node(pointed_thing.under)
if bucket.liquids[n.name] == nil then
-- Not a liquid
minetest.env:add_node(pointed_thing.above, {name=source})
elseif n.name ~= source then
-- It's a liquid
minetest.env:add_node(pointed_thing.under, {name=source})
end
return {name="bucket:bucket_empty"}
end
})
end
end
minetest.register_craftitem("bucket:bucket_empty", {
inventory_image = "bucket.png",
stack_max = 1,
liquids_pointable = true,
on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to node
if pointed_thing.type ~= "node" then
return
end
-- Check if pointing to a liquid source
n = minetest.env:get_node(pointed_thing.under)
liquiddef = bucket.liquids[n.name]
if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then
minetest.env:add_node(pointed_thing.under, {name="air"})
return {name=liquiddef.itemname}
end
end,
})
bucket.register_liquid(
"default:water_source",
"default:water_flowing",
"bucket:bucket_water",
"bucket_water.png"
)
bucket.register_liquid(
"default:lava_source",
"default:lava_flowing",
"bucket:bucket_lava",
"bucket_lava.png"
)
minetest.register_craft({
type = "fuel",
recipe = "default:bucket_lava",
burntime = 60,
})
mods/bucket/textures/bucket.png

329 B

mods/bucket/textures/bucket_lava.png

363 B

mods/bucket/textures/bucket_water.png

369 B

This diff is collapsed.
mods/default/textures/crack.png

1.05 KiB

mods/default/textures/default_apple.png

203 B

mods/default/textures/default_book.png

292 B

mods/default/textures/default_bookshelf.png

597 B

mods/default/textures/default_brick.png

604 B

mods/default/textures/default_cactus_side.png

279 B

mods/default/textures/default_cactus_top.png

236 B

mods/default/textures/default_chest_front.png

167 B

mods/default/textures/default_chest_lock.png

224 B

mods/default/textures/default_chest_side.png

151 B

mods/default/textures/default_chest_top.png

142 B

mods/default/textures/default_clay.png

613 B

mods/default/textures/default_clay_brick.png

249 B

mods/default/textures/default_clay_lump.png

210 B

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment