diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-11-29 17:44:07 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-11-29 19:13:58 +0200 |
commit | 9d35e4fa6ed339bb2f960c933db2247f1771fb98 (patch) | |
tree | 18058866e07036ca51a3c0e213f88c69031ce477 /data/mods/bucket | |
parent | bd1e5f4fc8aef281f7e4a09568e6c5ae7a62ff9d (diff) | |
download | minetest-9d35e4fa6ed339bb2f960c933db2247f1771fb98.tar.gz minetest-9d35e4fa6ed339bb2f960c933db2247f1771fb98.tar.bz2 minetest-9d35e4fa6ed339bb2f960c933db2247f1771fb98.zip |
Reorganize mods
Diffstat (limited to 'data/mods/bucket')
-rw-r--r-- | data/mods/bucket/depends.txt | 2 | ||||
-rw-r--r-- | data/mods/bucket/init.lua | 78 |
2 files changed, 80 insertions, 0 deletions
diff --git a/data/mods/bucket/depends.txt b/data/mods/bucket/depends.txt new file mode 100644 index 000000000..3a7daa1d7 --- /dev/null +++ b/data/mods/bucket/depends.txt @@ -0,0 +1,2 @@ +default + diff --git a/data/mods/bucket/init.lua b/data/mods/bucket/init.lua new file mode 100644 index 000000000..b2947274f --- /dev/null +++ b/data/mods/bucket/init.lua @@ -0,0 +1,78 @@ +local craftitem_place_item = function(item, player, pos) + minetest.env:add_item(pos, 'CraftItem "' .. item .. '" 1') + return true +end + +minetest.register_craft({ + output = 'CraftItem "bucket" 1', + recipe = { + {'CraftItem "steel_ingot"', '', 'CraftItem "steel_ingot"'}, + {'', 'CraftItem "steel_ingot"', ''}, + } +}) + +minetest.register_craftitem("bucket", { + image = "bucket.png", + stack_max = 1, + liquids_pointable = true, + on_place_on_ground = craftitem_place_item, + on_use = function(item, player, pointed_thing) + if pointed_thing.type == "node" then + n = minetest.env:get_node(pointed_thing.under) + if n.name == "water_source" then + minetest.env:add_node(pointed_thing.under, {name="air"}) + player:add_to_inventory_later('CraftItem "water_bucket" 1') + return true + elseif n.name == "lava_source" then + minetest.env:add_node(pointed_thing.under, {name="air"}) + player:add_to_inventory_later('CraftItem "lava_bucket" 1') + return true + end + end + return false + end, +}) + +minetest.register_craftitem("water_bucket", { + image = "bucket_water.png", + stack_max = 1, + liquids_pointable = true, + on_place_on_ground = craftitem_place_item, + on_use = function(item, player, pointed_thing) + if pointed_thing.type == "node" then + n = minetest.env:get_node(pointed_thing.under) + if n.name == "water_source" then + -- unchanged + elseif n.name == "water_flowing" or n.name == "lava_source" or n.name == "lava_flowing" then + minetest.env:add_node(pointed_thing.under, {name="water_source"}) + else + minetest.env:add_node(pointed_thing.above, {name="water_source"}) + end + player:add_to_inventory_later('CraftItem "bucket" 1') + return true + end + return false + end, +}) + +minetest.register_craftitem("lava_bucket", { + image = "bucket_lava.png", + stack_max = 1, + liquids_pointable = true, + on_place_on_ground = craftitem_place_item, + on_use = function(item, player, pointed_thing) + if pointed_thing.type == "node" then + n = minetest.env:get_node(pointed_thing.under) + if n.name == "lava_source" then + -- unchanged + elseif n.name == "water_source" or n.name == "water_flowing" or n.name == "lava_flowing" then + minetest.env:add_node(pointed_thing.under, {name="lava_source"}) + else + minetest.env:add_node(pointed_thing.above, {name="lava_source"}) + end + player:add_to_inventory_later('CraftItem "bucket" 1') + return true + end + return false + end, +}) |