From ccc1b5154dc26520a42328fa90c73f007b97b83e Mon Sep 17 00:00:00 2001 From: HybridDog Date: Sat, 13 Jun 2015 16:51:14 +0200 Subject: [PATCH] add snow biome flowers --- depends.txt | 1 + src/mapgen_v6.lua | 9 +++++---- src/nodes.lua | 23 +++++++++++++++++++++++ textures/snow_dandelion_white.png | Bin 0 -> 122 bytes textures/snow_dandelion_yellow.png | Bin 0 -> 118 bytes textures/snow_geranium.png | Bin 0 -> 269 bytes textures/snow_rose.png | Bin 0 -> 120 bytes textures/snow_tulip.png | Bin 0 -> 124 bytes textures/snow_viola.png | Bin 0 -> 117 bytes 9 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 textures/snow_dandelion_white.png create mode 100644 textures/snow_dandelion_yellow.png create mode 100644 textures/snow_geranium.png create mode 100644 textures/snow_rose.png create mode 100644 textures/snow_tulip.png create mode 100644 textures/snow_viola.png diff --git a/depends.txt b/depends.txt index 41bb35a..9d0cab1 100644 --- a/depends.txt +++ b/depends.txt @@ -1,2 +1,3 @@ default +flowers? moreblocks? diff --git a/src/mapgen_v6.lua b/src/mapgen_v6.lua index 0ee6ee1..c33e2f3 100644 --- a/src/mapgen_v6.lua +++ b/src/mapgen_v6.lua @@ -78,7 +78,7 @@ local function is_plantlike(id) return true end -local c +local c, known_plants local function define_contents() c = { dirt_with_grass = minetest.get_content_id("default:dirt_with_grass"), @@ -100,6 +100,7 @@ local function define_contents() papyrus = minetest.get_content_id("default:papyrus"), sand = minetest.get_content_id("default:sand"), } + known_plants = snow.known_plants or {} end minetest.register_on_generated(function(minp, maxp, seed) @@ -343,7 +344,7 @@ minetest.register_on_generated(function(minp, maxp, seed) if data[vi] == c.dirt_with_grass then -- replace other plants with dry shrubs data[vi] = c.dirt_with_snow - data[node] = c.dry_shrub + data[node] = known_plants[c_ground] or c.dry_shrub end end end @@ -361,7 +362,7 @@ minetest.register_on_generated(function(minp, maxp, seed) local wsz, wsx for _,i in pairs(snow_tab) do local y,z,x,test = unpack(i) - test = (test-0.73)/0.27 -- /(1-0.73) + test = (test-0.53)/0.47 -- /(1-0.53) if test > 0 then local maxh = math.floor(test*10)%10+1 if maxh ~= 1 then @@ -377,7 +378,7 @@ minetest.register_on_generated(function(minp, maxp, seed) for _,cord in pairs({{x+i,z}, {x,z+i}}) do local nd = data[area:index(cord[1], y, cord[2])] if nd == c.air - or nd == c.dry_shrub then + or is_plantlike(nd) then h = h/2 end end diff --git a/src/nodes.lua b/src/nodes.lua index 082d0e4..75d22fe 100644 --- a/src/nodes.lua +++ b/src/nodes.lua @@ -158,6 +158,29 @@ minetest.register_node("snow:moss", { }) +if rawget(_G, "flowers") then + -- broken flowers + snow.known_plants = {} + for _,name in pairs({"dandelion_yellow", "geranium", "rose", "tulip", "dandelion_white", "viola"}) do + local flowername = "flowers:"..name + local newname = "snow:flower_"..name + local flower = minetest.registered_nodes[flowername] + minetest.register_node(newname, { + drawtype = "plantlike", + tiles = { "snow_" .. name .. ".png" }, + sunlight_propagates = true, + paramtype = "light", + walkable = false, + drop = "", + groups = {snappy=3, attached_node = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = flower.selection_box + }) + snow.known_plants[minetest.get_content_id(flowername)] = minetest.get_content_id(newname) + end +end + + local function snow_onto_dirt(pos) pos.y = pos.y - 1 diff --git a/textures/snow_dandelion_white.png b/textures/snow_dandelion_white.png new file mode 100644 index 0000000000000000000000000000000000000000..336e893992f492ecec5821aadb42996fca811a3a GIT binary patch literal 122 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`j-D=#Ar*|t3k)S#r>~#ip2%gQ zY*5Me=GN|BCFT{+c{eqBN^z$eJ~Z#{HDZ3|bLyx6Mn(mnZO3+S?EZhnfMt0a1N)(X V(%9oC`hkWqc)I$ztaD0e0s!Z1CtCmj literal 0 HcmV?d00001 diff --git a/textures/snow_dandelion_yellow.png b/textures/snow_dandelion_yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..3ebb9e62bb4681d4a82fc319523f053bbcfb9672 GIT binary patch literal 118 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`ww^AIAr*|t3k)S#^Vc6RV4Wp6 z!-u&~XTb@ESC!2*36qXFMf#k{JNw`M1KW?YNy`4p9LIlIH}EdFArOzopr0A3X(DF6Tf literal 0 HcmV?d00001 diff --git a/textures/snow_geranium.png b/textures/snow_geranium.png new file mode 100644 index 0000000000000000000000000000000000000000..33b809d1900d51174a5e3d1f86d6add40645b248 GIT binary patch literal 269 zcmV+o0rLKdP)Ned^i*&c>M>v z#`_S1fzv6{V`BZCXa5(UzWjgT=}Z5~j?VtNH1af8XNUZU836J>*@nOjpqUo{Pz6`W TC|=kC00000NkvXXu0mjf4WDm1 literal 0 HcmV?d00001 diff --git a/textures/snow_rose.png b/textures/snow_rose.png new file mode 100644 index 0000000000000000000000000000000000000000..7e32736663c914747fb67cc7105c92a7c75c4947 GIT binary patch literal 120 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`_MR?|Ar*|t5^oYj<}^N1eUcT| z)N|6TK_~oxN$@M)md~0DYMDAuGT*HG{7?STV%B3RxA`vnOk`BxDdBw^!^jZ6U#?wu S9&0$zCVcy-##4ONufOo~Iu3!G^7zNIzFrDK4u*vw?YDos; Xf07?>TV?(M8pq)2>gTe~DWM4fn*}ND literal 0 HcmV?d00001 diff --git a/textures/snow_viola.png b/textures/snow_viola.png new file mode 100644 index 0000000000000000000000000000000000000000..95d2871a98c023f38e017fa40680a859f6500256 GIT binary patch literal 117 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Hl8kyAr*|t3T!=1fdNthzT4bN zeC8?UzO4O!@+!}<+soen;y;v9z0|_zrM+w8j@9RX+PltjoS_shaEXWE)Eni+i>{}| Q1I=OZboFyt=akR{0KEh#X8-^I literal 0 HcmV?d00001