Added Lava Can
authorMaciej Kasatkin <mk@realbadangel.pl>
Thu, 11 Oct 2012 16:23:30 +0000 (18:23 +0200)
committerMaciej Kasatkin <mk@realbadangel.pl>
Thu, 11 Oct 2012 16:23:30 +0000 (18:23 +0200)
cans.lua [new file with mode: 0644]
init.lua
textures/technic_lava_can.png [new file with mode: 0644]
textures/technic_water_can.png
water_can.lua [deleted file]

diff --git a/cans.lua b/cans.lua
new file mode 100644 (file)
index 0000000..e4a94c1
--- /dev/null
+++ b/cans.lua
@@ -0,0 +1,125 @@
+water_can_max_load = 16
+lava_can_max_load = 8
+
+minetest.register_craft({
+       output = 'technic:water_can 1',
+       recipe = {
+               {'technic:zinc_ingot', 'technic:rubber','technic:zinc_ingot'},
+               {'default:steel_ingot', '', 'default:steel_ingot'},
+               {'technic:zinc_ingot', 'default:steel_ingot', 'technic:zinc_ingot'},
+       }
+})
+
+minetest.register_craft({
+       output = 'technic:lava_can 1',
+       recipe = {
+               {'technic:zinc_ingot', 'technic:stainless_steel_ingot','technic:zinc_ingot'},
+               {'technic:stainless_steel_ingot', '', 'technic:stainless_steel_ingot'},
+               {'technic:zinc_ingot', 'technic:stainless_steel_ingot', 'technic:zinc_ingot'},
+       }
+})
+
+
+minetest.register_tool("technic:water_can", {
+       description = "Water Can",
+       inventory_image = "technic_water_can.png",
+       stack_max = 1,
+       liquids_pointable = true,
+       on_use = function(itemstack, user, pointed_thing)
+               
+               if pointed_thing.type ~= "node" then
+                                       return end
+               
+               n = minetest.env:get_node(pointed_thing.under)
+               if n.name == "default:water_source" then
+                       item=itemstack:to_table()
+                       local load=tonumber((item["wear"])) 
+                       if  load==0 then load =65535 end
+                       load=get_RE_item_load(load,water_can_max_load)
+                       if load+1<17 then
+                       minetest.env:add_node(pointed_thing.under, {name="air"})
+                        load=load+1;   
+                       load=set_RE_item_load(load,water_can_max_load)
+                       item["wear"]=tostring(load)
+                       itemstack:replace(item)
+                       end
+                       return itemstack
+               end
+               item=itemstack:to_table()
+                       load=tonumber((item["wear"])) 
+                       if  load==0 then load =65535 end
+                       load=get_RE_item_load(load,water_can_max_load)
+                       if load==0 then return end
+                       
+               if n.name == "default:water_flowing" then
+                       minetest.env:add_node(pointed_thing.under, {name="default:water_source"})
+                       load=load-1;    
+                       load=set_RE_item_load(load,water_can_max_load)
+                       item["wear"]=tostring(load)
+                       itemstack:replace(item)
+                       return itemstack
+                       end
+
+               n = minetest.env:get_node(pointed_thing.above)
+               if n.name == "air" then
+                       minetest.env:add_node(pointed_thing.above, {name="default:water_source"})
+                       load=load-1;    
+                       load=set_RE_item_load(load,water_can_max_load)
+                       item["wear"]=tostring(load)
+                       itemstack:replace(item)
+                       return itemstack
+                       end             
+       end,
+})
+
+minetest.register_tool("technic:lava_can", {
+       description = "Lava Can",
+       inventory_image = "technic_lava_can.png",
+       stack_max = 1,
+       liquids_pointable = true,
+       on_use = function(itemstack, user, pointed_thing)
+               
+               if pointed_thing.type ~= "node" then
+                                       return end
+               
+               n = minetest.env:get_node(pointed_thing.under)
+               if n.name == "default:lava_source" then
+                       item=itemstack:to_table()
+                       local load=tonumber((item["wear"])) 
+                       if  load==0 then load =65535 end
+                       load=get_RE_item_load(load,lava_can_max_load)
+                       if load+1<9 then
+                       minetest.env:add_node(pointed_thing.under, {name="air"})
+                        load=load+1;   
+                       load=set_RE_item_load(load,water_can_max_load)
+                       item["wear"]=tostring(load)
+                       itemstack:replace(item)
+                       end
+                       return itemstack
+               end
+               item=itemstack:to_table()
+                       load=tonumber((item["wear"])) 
+                       if  load==0 then load =65535 end
+                       load=get_RE_item_load(load,water_can_max_load)
+                       if load==0 then return end
+                       
+               if n.name == "default:lava_flowing" then
+                       minetest.env:add_node(pointed_thing.under, {name="default:lava_source"})
+                       load=load-1;    
+                       load=set_RE_item_load(load,water_can_max_load)
+                       item["wear"]=tostring(load)
+                       itemstack:replace(item)
+                       return itemstack
+                       end
+
+               n = minetest.env:get_node(pointed_thing.above)
+               if n.name == "air" then
+                       minetest.env:add_node(pointed_thing.above, {name="default:lava_source"})
+                       load=load-1;    
+                       load=set_RE_item_load(load,water_can_max_load)
+                       item["wear"]=tostring(load)
+                       itemstack:replace(item)
+                       return itemstack
+                       end             
+       end,
+})
index 5504b291f30c24dec608fb7946226f3f8eaf7752..e931bdfed99cea677a4d9e9cb85a831d5ef11306 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -45,7 +45,7 @@ dofile(minetest.get_modpath("technic").."/node_breaker.lua")
 dofile(minetest.get_modpath("technic").."/deployer.lua")
 dofile(minetest.get_modpath("technic").."/tree_tap.lua")
 dofile(minetest.get_modpath("technic").."/flashlight.lua")
-dofile(minetest.get_modpath("technic").."/water_can.lua")
+dofile(minetest.get_modpath("technic").."/cans.lua")
 
 
 function has_locked_chest_privilege(meta, player)
diff --git a/textures/technic_lava_can.png b/textures/technic_lava_can.png
new file mode 100644 (file)
index 0000000..80d15a6
Binary files /dev/null and b/textures/technic_lava_can.png differ
index 411e91fd24d572475cf4aeaeb09e379ad576f804..18e0225b4d3ddd2c78644b528f264d47096fa6f0 100644 (file)
Binary files a/textures/technic_water_can.png and b/textures/technic_water_can.png differ
diff --git a/water_can.lua b/water_can.lua
deleted file mode 100644 (file)
index fab2c28..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-water_can_max_load = 16
-
-minetest.register_craft({
-       output = 'technic:water_can 1',
-       recipe = {
-               {'technic:zinc_ingot', 'technic:rubber','technic:zinc_ingot'},
-               {'default:steel_ingot', '', 'default:steel_ingot'},
-               {'technic:zinc_ingot', 'default:steel_ingot', 'technic:zinc_ingot'},
-       }
-})
-
-minetest.register_tool("technic:water_can", {
-       description = "Water Can",
-       inventory_image = "technic_water_can.png",
-       stack_max = 1,
-       liquids_pointable = true,
-       on_use = function(itemstack, user, pointed_thing)
-               
-               if pointed_thing.type ~= "node" then
-                                       return end
-               
-               n = minetest.env:get_node(pointed_thing.under)
-               if n.name == "default:water_source" then
-                       item=itemstack:to_table()
-                       local load=tonumber((item["wear"])) 
-                       if  load==0 then load =65535 end
-                       load=get_RE_item_load(load,water_can_max_load)
-                       if load+1<17 then
-                       minetest.env:add_node(pointed_thing.under, {name="air"})
-                        load=load+1;   
-                       load=set_RE_item_load(load,water_can_max_load)
-                       item["wear"]=tostring(load)
-                       itemstack:replace(item)
-                       end
-                       return itemstack
-               end
-               item=itemstack:to_table()
-                       load=tonumber((item["wear"])) 
-                       if  load==0 then load =65535 end
-                       load=get_RE_item_load(load,water_can_max_load)
-                       if load==0 then return end
-                       
-               if n.name == "default:water_flowing" then
-                       minetest.env:add_node(pointed_thing.under, {name="default:water_source"})
-                       load=load-1;    
-                       load=set_RE_item_load(load,water_can_max_load)
-                       item["wear"]=tostring(load)
-                       itemstack:replace(item)
-                       return itemstack
-                       end
-
-               n = minetest.env:get_node(pointed_thing.above)
-               if n.name == "air" then
-                       minetest.env:add_node(pointed_thing.above, {name="default:water_source"})
-                       load=load-1;    
-                       load=set_RE_item_load(load,water_can_max_load)
-                       item["wear"]=tostring(load)
-                       itemstack:replace(item)
-                       return itemstack
-                       end             
-       end,
-})