merged rubber tree
authorMaciej Kasatkin <mk@realbadangel.pl>
Fri, 5 Oct 2012 23:36:41 +0000 (01:36 +0200)
committerMaciej Kasatkin <mk@realbadangel.pl>
Fri, 5 Oct 2012 23:36:41 +0000 (01:36 +0200)
init.lua
iron_chest.lua
rubber.lua [new file with mode: 0644]
textures/technic_rubber_sapling.png [new file with mode: 0644]
textures/technic_rubber_tree_empty.png [new file with mode: 0644]
textures/technic_rubber_tree_full.png [new file with mode: 0644]
tree_tap.lua

index 875f0643c06e87a7d5822445a7fd22c13d0fb354..619f9e168732ffd1549f32891df7ec85173c3768 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -43,6 +43,7 @@ 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")
 
 
index d6a4cc239c36cbe1221ecdb16d14e1abac7e8515..1a89ed371c5029ee64afc56c081822fc7e6abaf7 100644 (file)
@@ -32,6 +32,7 @@ minetest.register_node("technic:iron_chest", {
        groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
        legacy_facedir_simple = true,
        sounds = default.node_sound_wood_defaults(),
+       
        on_construct = function(pos)
                local meta = minetest.env:get_meta(pos)
                meta:set_string("formspec",
diff --git a/rubber.lua b/rubber.lua
new file mode 100644 (file)
index 0000000..38153ce
--- /dev/null
@@ -0,0 +1,93 @@
+minetest.register_node("technic:rubber_sapling", {
+       description = "Rubber Tree Sapling",
+       drawtype = "plantlike",
+       tiles = {"technic_rubber_sapling.png"},
+       inventory_image = "technic_rubber_sapling.png",
+       wield_image = "technic_rubber_sapling.png",
+       paramtype = "light",
+       walkable = false,
+       groups = {dig_immediate=3,flammable=2},
+       sounds = default.node_sound_defaults(),
+})
+
+minetest.register_node("technic:rubber_tree_full", {
+       description = "Rubber Tree",
+       tiles = {"default_tree_top.png", "default_tree_top.png", "farming_rubber_tree_full.png"},
+       groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
+       drop = "default:tree",
+       sounds = default.node_sound_wood_defaults(),
+       
+       on_dig = function(pos, node, digger)
+               minetest.node_dig(pos, node, digger)
+               minetest.env:remove_node(pos)
+       end,
+       
+       after_destruct = function(pos, oldnode)
+               oldnode.name = "technic:rubber_tree_empty"
+               minetest.env:set_node(pos, oldnode)
+       end
+})
+
+
+minetest.register_node("technic:rubber_tree_empty", {
+       tiles = {"default_tree_top.png", "default_tree_top.png", "farming_rubber_tree_empty.png"},
+       groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2, not_in_creative_inventory=1},
+       drop = "default:tree",
+       sounds = default.node_sound_wood_defaults(),
+})
+
+minetest.register_abm({
+       nodenames = {"technic:rubber_tree_empty"},
+       interval = 60,
+       chance = 15,
+       action = function(pos, node)
+               node.name = "technic:rubber_tree_full"
+               minetest.env:set_node(pos, node)
+       end
+})
+
+minetest.register_node("technic:rubber_leaves", {
+       drawtype = "allfaces_optional",
+       visual_scale = 1.3,
+       tiles = {"default_leaves.png"},
+       paramtype = "light",
+       groups = {snappy=3, leafdecay=3, flammable=2, not_in_creative_inventory=1},
+       drop = {
+               max_items = 1,
+               items = {
+                       {
+                               items = {'technic:rubber_sapling'},
+                               rarity = 20,
+                       },
+               }
+       },
+       sounds = default.node_sound_leaves_defaults(),
+})
+
+minetest.register_abm({
+       nodenames = {"technic:rubber_sapling"},
+       interval = 60,
+       chance = 20,
+       action = function(pos, node)
+               farming:generate_tree(pos, "technic:rubber_tree_full", "technic:rubber_leaves", {"default:dirt", "default:dirt_with_grass"})
+       end
+})
+
+minetest.register_on_generated(function(minp, maxp, blockseed)
+       if math.random(1, 100) > 5 then
+               return
+       end
+       local tmp = {x=(maxp.x-minp.x)/2+minp.x, y=(maxp.y-minp.y)/2+minp.y, z=(maxp.z-minp.z)/2+minp.z}
+       local pos = minetest.env:find_node_near(tmp, maxp.x-minp.x, {"default:dirt_with_grass"})
+       if pos ~= nil then
+               farming:generate_tree({x=pos.x, y=pos.y+1, z=pos.z}, "technic:rubber_tree_full", "technic:rubber_leaves", {"default:dirt", "default:dirt_with_grass"})
+       end
+end)
+
+
+-- ========= FUEL =========
+minetest.register_craft({
+       type = "fuel",
+       recipe = "technic:rubber_sapling",
+       burntime = 10
+})
diff --git a/textures/technic_rubber_sapling.png b/textures/technic_rubber_sapling.png
new file mode 100644 (file)
index 0000000..e5c9f5d
Binary files /dev/null and b/textures/technic_rubber_sapling.png differ
diff --git a/textures/technic_rubber_tree_empty.png b/textures/technic_rubber_tree_empty.png
new file mode 100644 (file)
index 0000000..1792951
Binary files /dev/null and b/textures/technic_rubber_tree_empty.png differ
diff --git a/textures/technic_rubber_tree_full.png b/textures/technic_rubber_tree_full.png
new file mode 100644 (file)
index 0000000..08067ef
Binary files /dev/null and b/textures/technic_rubber_tree_full.png differ
index 92c56b0511b95d597273546e845ed93454b9c1ef..1973f2a44d385f669a14ad78dd8c831ebb6f6a0f 100644 (file)
@@ -7,7 +7,7 @@
                             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
+                            if node_name == "technic:rubber_tree_full" then
                                     user:get_inventory():add_item("main",ItemStack("technic:caouthouc"))
                                     minetest.env:set_node(pos,node)
                                     local item=itemstack:to_table()