forked from mtcontrib/minetest-mod-snow
add snow biome flowers
This commit is contained in:
parent
47a8691b82
commit
ccc1b5154d
|
@ -1,2 +1,3 @@
|
||||||
default
|
default
|
||||||
|
flowers?
|
||||||
moreblocks?
|
moreblocks?
|
||||||
|
|
|
@ -78,7 +78,7 @@ local function is_plantlike(id)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local c
|
local c, known_plants
|
||||||
local function define_contents()
|
local function define_contents()
|
||||||
c = {
|
c = {
|
||||||
dirt_with_grass = minetest.get_content_id("default:dirt_with_grass"),
|
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"),
|
papyrus = minetest.get_content_id("default:papyrus"),
|
||||||
sand = minetest.get_content_id("default:sand"),
|
sand = minetest.get_content_id("default:sand"),
|
||||||
}
|
}
|
||||||
|
known_plants = snow.known_plants or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
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
|
if data[vi] == c.dirt_with_grass then
|
||||||
-- replace other plants with dry shrubs
|
-- replace other plants with dry shrubs
|
||||||
data[vi] = c.dirt_with_snow
|
data[vi] = c.dirt_with_snow
|
||||||
data[node] = c.dry_shrub
|
data[node] = known_plants[c_ground] or c.dry_shrub
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -361,7 +362,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
local wsz, wsx
|
local wsz, wsx
|
||||||
for _,i in pairs(snow_tab) do
|
for _,i in pairs(snow_tab) do
|
||||||
local y,z,x,test = unpack(i)
|
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
|
if test > 0 then
|
||||||
local maxh = math.floor(test*10)%10+1
|
local maxh = math.floor(test*10)%10+1
|
||||||
if maxh ~= 1 then
|
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
|
for _,cord in pairs({{x+i,z}, {x,z+i}}) do
|
||||||
local nd = data[area:index(cord[1], y, cord[2])]
|
local nd = data[area:index(cord[1], y, cord[2])]
|
||||||
if nd == c.air
|
if nd == c.air
|
||||||
or nd == c.dry_shrub then
|
or is_plantlike(nd) then
|
||||||
h = h/2
|
h = h/2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -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)
|
local function snow_onto_dirt(pos)
|
||||||
pos.y = pos.y - 1
|
pos.y = pos.y - 1
|
||||||
|
|
BIN
textures/snow_dandelion_white.png
Normal file
BIN
textures/snow_dandelion_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 122 B |
BIN
textures/snow_dandelion_yellow.png
Normal file
BIN
textures/snow_dandelion_yellow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 118 B |
BIN
textures/snow_geranium.png
Normal file
BIN
textures/snow_geranium.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 269 B |
BIN
textures/snow_rose.png
Normal file
BIN
textures/snow_rose.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 120 B |
BIN
textures/snow_tulip.png
Normal file
BIN
textures/snow_tulip.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 124 B |
BIN
textures/snow_viola.png
Normal file
BIN
textures/snow_viola.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 117 B |
Loading…
Reference in New Issue
Block a user