Added Water can + bug fixes
authorMaciej Kasatkin <mk@realbadangel.pl>
Thu, 11 Oct 2012 15:44:25 +0000 (17:44 +0200)
committerMaciej Kasatkin <mk@realbadangel.pl>
Thu, 11 Oct 2012 15:44:25 +0000 (17:44 +0200)
alloy_furnace.lua
init.lua
iron_chest.lua
textures/technic_water_can.png [new file with mode: 0644]
water_can.lua [new file with mode: 0644]

index ff805ab7b5dc9142efcb85dd8cc082a5d435b0fc..3f02d9ac7981ab0b633cacc4efcce29ee0bc19a7 100644 (file)
@@ -24,7 +24,7 @@ end
 register_alloy_recipe ("technic:copper_dust",3, "technic:tin_dust",1, "technic:bronze_dust",4)
 register_alloy_recipe ("moreores:copper_ingot",3, "moreores:tin_ingot",1, "moreores:bronze_ingot",4)
 register_alloy_recipe ("technic:iron_dust",3, "technic:chromium_dust",1, "technic:stainless_steel_dust",4)
-register_alloy_recipe ("technic:steel_ingot",3, "technic:chromium_ingot",1, "technic:stainless_steel_ingot",4)
+register_alloy_recipe ("default:steel_ingot",3, "technic:chromium_ingot",1, "technic:stainless_steel_ingot",4)
 register_alloy_recipe ("technic:copper_dust",2, "technic:zinc_dust",1, "technic:brass_dust",3)
 register_alloy_recipe ("technic:copper_ingot",2, "technic:zinc_ingot",1, "technic:brass_ingot",3)
 register_alloy_recipe ("default:sand",2, "technic:coal_dust",2, "technic:silicon_wafer",1)
index f149b533a01fb9c9a59f054674a10b0ea4904887..95a519f0fd886d9588275d06751daeb853beb594 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -24,14 +24,13 @@ dofile(minetest.get_modpath("technic").."/electric_furnace.lua")
 dofile(minetest.get_modpath("technic").."/battery_box.lua")
 dofile(minetest.get_modpath("technic").."/wires.lua")
 dofile(minetest.get_modpath("technic").."/wires_mv.lua")
---dofile(minetest.get_modpath("technic").."/dyes.lua")
+dofile(minetest.get_modpath("technic").."/dyes.lua")
 dofile(minetest.get_modpath("technic").."/ores.lua")
 
 dofile(minetest.get_modpath("technic").."/tool_workshop.lua")
 dofile(minetest.get_modpath("technic").."/music_player.lua")
 dofile(minetest.get_modpath("technic").."/grinder.lua")
 dofile(minetest.get_modpath("technic").."/mining_laser_mk1.lua")
---dofile(minetest.get_modpath("technic").."/project_table.lua")
 dofile(minetest.get_modpath("technic").."/injector.lua")
 dofile(minetest.get_modpath("technic").."/generator.lua")
 dofile(minetest.get_modpath("technic").."/solar_panel.lua")
@@ -44,8 +43,9 @@ dofile(minetest.get_modpath("technic").."/screwdriver.lua")
 dofile(minetest.get_modpath("technic").."/sonic_screwdriver.lua")
 dofile(minetest.get_modpath("technic").."/node_breaker.lua")
 dofile(minetest.get_modpath("technic").."/deployer.lua")
---dofile(minetest.get_modpath("technic").."/rubber.lua")
 dofile(minetest.get_modpath("technic").."/tree_tap.lua")
+dofile(minetest.get_modpath("technic").."/torchlight.lua")
+dofile(minetest.get_modpath("technic").."/water_can.lua")
 
 
 function has_locked_chest_privilege(meta, player)
index b6685b2e9df6f397010d8d7c5701feb518badb94..f0e0fcb0c02e6b72736fe038585e337d2024cf89 100644 (file)
@@ -11,7 +11,7 @@ minetest.register_craft({
        output = 'technic:iron_locked_chest 1',
        recipe = {
                {'default:steel_ingot','default:steel_ingot','default:steel_ingot'},
-               {'default:steel_ingot','default:locked_chest','default:steel_ingot'},
+               {'default:steel_ingot','default:chest_locked','default:steel_ingot'},
                {'default:steel_ingot','default:steel_ingot','default:steel_ingot'},
        }
 })
diff --git a/textures/technic_water_can.png b/textures/technic_water_can.png
new file mode 100644 (file)
index 0000000..411e91f
Binary files /dev/null and b/textures/technic_water_can.png differ
diff --git a/water_can.lua b/water_can.lua
new file mode 100644 (file)
index 0000000..9c6ffa0
--- /dev/null
@@ -0,0 +1,62 @@
+water_can_max_load = 16
+
+minetest.register_craft({
+       output = 'technic:water_can 1',
+       recipe = {
+               {'technic:zinc_ingot', 'technic:rubber_fiber','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,
+})