1
0
mirror of https://github.com/Splizard/minetest-mod-snow.git synced 2024-12-27 15:10:20 +01:00

add snow biome flowers

This commit is contained in:
HybridDog 2015-06-13 16:51:14 +02:00
parent 47a8691b82
commit ccc1b5154d
9 changed files with 29 additions and 4 deletions

View File

@ -1,2 +1,3 @@
default
flowers?
moreblocks?

View File

@ -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

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

BIN
textures/snow_geranium.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

BIN
textures/snow_rose.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

BIN
textures/snow_tulip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

BIN
textures/snow_viola.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B