From e2033025b0af877cad11ff55dae1349013265c4a Mon Sep 17 00:00:00 2001 From: paramat <mat.gregory@virginmedia.com> Date: Mon, 20 Jul 2015 02:33:30 +0100 Subject: [PATCH] Default: Add biome API tree schematics and enable growing by sapling ABMs --- mods/default/schematics/acacia_tree.mts | Bin 0 -> 178 bytes mods/default/schematics/apple_tree.mts | Bin 0 -> 180 bytes mods/default/schematics/jungle_tree.mts | Bin 0 -> 221 bytes mods/default/schematics/large_cactus.mts | Bin 0 -> 94 bytes mods/default/schematics/pine_tree.mts | Bin 0 -> 186 bytes mods/default/trees.lua | 70 +++++++++++++++++++++-- 6 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 mods/default/schematics/acacia_tree.mts create mode 100644 mods/default/schematics/apple_tree.mts create mode 100644 mods/default/schematics/jungle_tree.mts create mode 100644 mods/default/schematics/large_cactus.mts create mode 100644 mods/default/schematics/pine_tree.mts diff --git a/mods/default/schematics/acacia_tree.mts b/mods/default/schematics/acacia_tree.mts new file mode 100644 index 0000000000000000000000000000000000000000..c9bd2d868e4697e78204aef6e23510baa22aa5ad GIT binary patch literal 178 zcmeYb3HD`RVc=xoVBoB`uLlDLW(MZO%pwNSl+?7u(wq{j#N@=}%*6Pd)WovXVg_L} z;gX`%)QUN8CmiHrP~>nqE&uMn|7E!-jk`=2O*`g^o65Eaaj9&-uy5|`_GRXszW*M# z$4l;>^?#yQ+}yht7FC_pS)@4a?YG00cl;}7gf6stVZQMC!5MYG8)w9+geiRSI=qBq Tci(jR{JE!(_Hvos(&PgGL)=V4 literal 0 HcmV?d00001 diff --git a/mods/default/schematics/apple_tree.mts b/mods/default/schematics/apple_tree.mts new file mode 100644 index 0000000000000000000000000000000000000000..07c3e7aac088c6d0e6b7fd612333c04a197aa4a5 GIT binary patch literal 180 zcmeYb3HD`RVPIuoXJD<juLl7jmpL)Bh=DI9H7&6;r^G5JHL)zUn1L6@Pb?_NNoC-H zaZ8F)Q!D1Io#4%NK!L|4IrfID_};`m1NRw=pJ{|?im)!-Skfea=(C_mp&Cz?t)p3I z>ep%4#N^BBxSy^m-QUf8+J5s7o$mjO6hatZh&XOynb0D#&Lm>@&bt{mIig%S=0Clx Uv+m9MBbvwgr`d_So|b0?0L_C%2><{9 literal 0 HcmV?d00001 diff --git a/mods/default/schematics/jungle_tree.mts b/mods/default/schematics/jungle_tree.mts new file mode 100644 index 0000000000000000000000000000000000000000..39cbcbf2686865b1002a11a7b68b26a4bf6eb2b8 GIT binary patch literal 221 zcmeYb3HD`RVPIttWMHkYueY}c5^#!vnSnVmvxq??B{eOvG^fNWt28e?Cp9NEu`IQi zK?qf}q$oADV$Rh`2RRQY@VH(L=C>_5+%rMYXx3s2udcAD?x?LoUhxVncJ_6yOOIS= zomD#Hc&6G)NxxavddoROXGeWs;cu09(X+|C?@M2OWw55ozfApx7KRQE-Ny52(cTkf z5*KI)2(D5vD$beq_HECeiOKoT9-L;~|1&~sQc24{^S|>_BQiFxEDd<!sFbO0ZM(_W F7XV)<S!w_P literal 0 HcmV?d00001 diff --git a/mods/default/schematics/large_cactus.mts b/mods/default/schematics/large_cactus.mts new file mode 100644 index 0000000000000000000000000000000000000000..b71077b3c5a0f397aade8d76cbe2f0a081d80b9f GIT binary patch literal 94 zcmeYb3HD`RVPIuoXJD*{00t%o=ETe*2ELTkw8YY!6079I<dV|jiaE&%3`}lp5)SEx uN{(zAZW|_){9zaT8n8%?r(sQ1wL&8QQ~^gdmjetZngkLI85VkStOWq<G91kS literal 0 HcmV?d00001 diff --git a/mods/default/schematics/pine_tree.mts b/mods/default/schematics/pine_tree.mts new file mode 100644 index 0000000000000000000000000000000000000000..0266875032da7ad5a4e2c158fd1b1acd6a4c9fdf GIT binary patch literal 186 zcmeYb3HD`RVPIw8V_>bfx332RAOWHom>HN8Gm98RQc}|rOLI!B3NrIj<MUEeQ*u&^ z83d3;ONvrcE9UGCa^yOoz~fzhE3y6W7XK5$wOz#uab}ULOEtIgHVSk#NMF*5l0C_k zQ)*Y69ujhOpXbbS&%3G)vU@Mz+Fh~v&)@ivm03$`#g}~Yh|-vFUpm;2#n?Wxc-Hw# a#hg36MauZ!K0K1RynAy+0pnr@t2h9La!PLi literal 0 HcmV?d00001 diff --git a/mods/default/trees.lua b/mods/default/trees.lua index 8e503556..b5b20ec5 100644 --- a/mods/default/trees.lua +++ b/mods/default/trees.lua @@ -29,8 +29,12 @@ minetest.register_abm({ end minetest.log("action", "A sapling grows into a tree at ".. - minetest.pos_to_string(pos)) - default.grow_tree(pos, random(1, 4) == 1) + minetest.pos_to_string(pos)) + if minetest.get_mapgen_params().mgname == "v6" then + default.grow_tree(pos, random(1, 4) == 1) + else + default.grow_new_apple_tree(pos) + end end }) @@ -44,8 +48,12 @@ minetest.register_abm({ end minetest.log("action", "A jungle sapling grows into a tree at ".. - minetest.pos_to_string(pos)) - default.grow_jungle_tree(pos) + minetest.pos_to_string(pos)) + if minetest.get_mapgen_params().mgname == "v6" then + default.grow_jungle_tree(pos) + else + default.grow_new_jungle_tree(pos) + end end }) @@ -59,8 +67,27 @@ minetest.register_abm({ end minetest.log("action", "A pine sapling grows into a tree at ".. - minetest.pos_to_string(pos)) - default.grow_pine_tree(pos) + minetest.pos_to_string(pos)) + if minetest.get_mapgen_params().mgname == "v6" then + default.grow_pine_tree(pos) + else + default.grow_new_pine_tree(pos) + end + end +}) + +minetest.register_abm({ + nodenames = {"default:acacia_sapling"}, + interval = 13, + chance = 50, + action = function(pos, node) + if not can_grow(pos) then + return + end + + minetest.log("action", "An acacia sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + default.grow_new_acacia_tree(pos) end }) @@ -346,3 +373,34 @@ function default.grow_pine_tree(pos) vm:update_map() end +-- New tree + +function default.grow_new_apple_tree(pos) + local path = minetest.get_modpath("default") .. "/schematics/apple_tree.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, 0, nil, false) +end + +-- New jungle tree + +function default.grow_new_jungle_tree(pos) + local path = minetest.get_modpath("default") .. "/schematics/jungle_tree.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, 0, nil, false) +end + +-- New pine tree + +function default.grow_new_pine_tree(pos) + local path = minetest.get_modpath("default") .. "/schematics/pine_tree.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, 0, nil, false) +end + +-- New acacia tree + +function default.grow_new_acacia_tree(pos) + local path = minetest.get_modpath("default") .. "/schematics/acacia_tree.mts" + minetest.place_schematic({x = pos.x - 4, y = pos.y - 1, z = pos.z - 4}, + path, random, nil, false) +end -- GitLab