Added Water can + bug fixes

This commit is contained in:
Maciej Kasatkin 2012-10-11 17:44:25 +02:00
parent 845b0607eb
commit d5a7ade0d5
5 changed files with 67 additions and 5 deletions

View 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)

View File

@ -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)

View 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'},
}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

62
water_can.lua Normal file
View File

@ -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,
})