Added treetap

This commit is contained in:
Maciej Kasatkin 2012-09-22 05:34:33 +02:00
parent f47f9a6105
commit d1715c47f8
3 changed files with 53 additions and 2 deletions

@ -1,4 +1,4 @@
-- Minetest 0.4.2 rc1: technic -- Minetest 0.4.3 : technic
minetest.register_alias("rebar", "technic:rebar") minetest.register_alias("rebar", "technic:rebar")
minetest.register_alias("concrete", "technic:concrete") minetest.register_alias("concrete", "technic:concrete")
@ -31,7 +31,7 @@ dofile(minetest.get_modpath("technic").."/music_player.lua")
dofile(minetest.get_modpath("technic").."/grinder.lua") dofile(minetest.get_modpath("technic").."/grinder.lua")
dofile(minetest.get_modpath("technic").."/mining_laser_mk1.lua") dofile(minetest.get_modpath("technic").."/mining_laser_mk1.lua")
--dofile(minetest.get_modpath("technic").."/project_table.lua") --dofile(minetest.get_modpath("technic").."/project_table.lua")
--dofile(minetest.get_modpath("technic").."/injector.lua") dofile(minetest.get_modpath("technic").."/injector.lua")
dofile(minetest.get_modpath("technic").."/generator.lua") dofile(minetest.get_modpath("technic").."/generator.lua")
dofile(minetest.get_modpath("technic").."/solar_panel.lua") dofile(minetest.get_modpath("technic").."/solar_panel.lua")
dofile(minetest.get_modpath("technic").."/geothermal.lua") dofile(minetest.get_modpath("technic").."/geothermal.lua")
@ -41,6 +41,8 @@ dofile(minetest.get_modpath("technic").."/items.lua")
dofile(minetest.get_modpath("technic").."/mining_drill.lua") dofile(minetest.get_modpath("technic").."/mining_drill.lua")
dofile(minetest.get_modpath("technic").."/screwdriver.lua") dofile(minetest.get_modpath("technic").."/screwdriver.lua")
dofile(minetest.get_modpath("technic").."/sonic_screwdriver.lua") dofile(minetest.get_modpath("technic").."/sonic_screwdriver.lua")
dofile(minetest.get_modpath("technic").."/node_breaker.lua")
dofile(minetest.get_modpath("technic").."/tree_tap.lua")
function has_locked_chest_privilege(meta, player) function has_locked_chest_privilege(meta, player)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

49
tree_tap.lua Normal file

@ -0,0 +1,49 @@
minetest.register_tool("technic:treetap", {
description = "Tree Tap",
inventory_image = "technic_tree_tap.png",
on_use = function(itemstack,user,pointed_thing)
if pointed_thing.type~="node" then return end
if user:get_inventory():room_for_item("main",ItemStack("technic:raw_rubber")) then
local pos=minetest.get_pointed_thing_position(pointed_thing,above)
local node=minetest.env:get_node(pos)
local node_name=node.name
if node_name == "farming:rubber_tree_full" then
user:get_inventory():add_item("main",ItemStack("technic:raw_rubber"))
minetest.env:set_node(pos,node)
local item=itemstack:to_table()
local item_wear=tonumber((item["wear"]))
item_wear=item_wear+819
if item_wear>65535 then itemstack:clear() return itemstack end
item["wear"]=tostring(item_wear)
itemstack:replace(item)
return itemstack
else
return itemstack
end
else return end
end,
})
minetest.register_craft({
output = "technic:treetap",
recipe = {
{"pipeworks:tube", "default:wood", "default:stick"},
{"", "default:stick", "default:stick"}
},
})
minetest.register_craftitem("technic:raw_rubber", {
description = "Raw Rubber",
inventory_image = "technic_raw_rubber.png",
})
minetest.register_craft({
type = "cooking",
output = "technic:rubber",
recipe = "technic:raw_rubber",
})
minetest.register_craftitem("technic:rubber", {
description = "Rubber Fiber",
inventory_image = "technic_rubber.png",
})