From: Maciej Kasatkin Date: Thu, 11 Oct 2012 15:44:25 +0000 (+0200) Subject: Added Water can + bug fixes X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=d5a7ade0d554dd9270552b86a3976dc48a63d8e9;p=zefram%2Fminetest%2Ftechnic.git Added Water can + bug fixes --- diff --git a/alloy_furnace.lua b/alloy_furnace.lua index ff805ab..3f02d9a 100644 --- a/alloy_furnace.lua +++ b/alloy_furnace.lua @@ -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) diff --git a/init.lua b/init.lua index f149b53..95a519f 100644 --- 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) diff --git a/iron_chest.lua b/iron_chest.lua index b6685b2..f0e0fcb 100644 --- a/iron_chest.lua +++ b/iron_chest.lua @@ -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 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 index 0000000..9c6ffa0 --- /dev/null +++ b/water_can.lua @@ -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, +})