From 634fc05f4e4863b15e737f77b2f89a8b3ec43be3 Mon Sep 17 00:00:00 2001 From: Maciej Kasatkin Date: Sat, 6 Oct 2012 01:36:41 +0200 Subject: [PATCH] merged rubber tree --- init.lua | 1 + iron_chest.lua | 1 + rubber.lua | 93 +++++++++++++++++++++++++ textures/technic_rubber_sapling.png | Bin 0 -> 333 bytes textures/technic_rubber_tree_empty.png | Bin 0 -> 835 bytes textures/technic_rubber_tree_full.png | Bin 0 -> 808 bytes tree_tap.lua | 2 +- 7 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 rubber.lua create mode 100644 textures/technic_rubber_sapling.png create mode 100644 textures/technic_rubber_tree_empty.png create mode 100644 textures/technic_rubber_tree_full.png diff --git a/init.lua b/init.lua index 875f064..619f9e1 100644 --- 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") diff --git a/iron_chest.lua b/iron_chest.lua index d6a4cc2..1a89ed3 100644 --- a/iron_chest.lua +++ b/iron_chest.lua @@ -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 index 0000000..38153ce --- /dev/null +++ b/rubber.lua @@ -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 index 0000000000000000000000000000000000000000..e5c9f5de0c191c2fb3c9e113a113ed69138bff8d GIT binary patch literal 333 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^JsM z;N)AjnLrWF0*}aI1_o|n5N2eUHAey{$X?><>&kwIgHJ$?^Mp+vFHq>Lr;B5V#p$g< z2f3OYL~61hX)Wn)ymZfq<$bNw{EPixrq((-z0v*jXz3c&8G2$$%T_!K%CI}PN1uVgq>(Mx+ekjBKx1jbBbMLh9IxaUnTDVm=wso0n|R zT%5b~qx==U4)bC!=~>TRm%6J@>^OCG(&eAuDtZ^~>pbejcFwRwGUdSnzXi9yeq;99 W5#n{Q?w1qLV+@|IelF{r5}E)?uYE%R literal 0 HcmV?d00001 diff --git a/textures/technic_rubber_tree_empty.png b/textures/technic_rubber_tree_empty.png new file mode 100644 index 0000000000000000000000000000000000000000..1792951edd5e5783c39432d545a82be85c54fbaf GIT binary patch literal 835 zcmV-J1HAl+P)Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyn_ z5CR+B@r3A6mdXN25~mJai_QxT^b`9rl-2QKJUG+i;m|HoR8<2 zCub9NE@3>%`Rw2a0It9EEItO3Y{30{_t|>v4D-_!!#pPu!@OL9QRd|ei9nhqG)>R` z)4Kp%eg0)2k~v{sF3Ho3)H$4UsIhe3W353$M8rUvS;Ps(7;av_#)X|dX4~h98i}gZ zb<4QOiNUj|Rsi&U00V*%oU>RfBx3pN&p!Zo`_}vP3aLw|>W0pH+NL9F1R#V+R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