Add dry-colored grass/fern variants

This commit is contained in:
Wuzzy 2017-11-14 23:44:53 +01:00
parent 3bc9918370
commit 72f5591400
28 changed files with 256 additions and 127 deletions

View file

@ -137,7 +137,7 @@ mcl_dye.apply_bone_meal = function(pointed_thing)
-- Must be on a dirt-type block
local below = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
if below.name ~= "mcl_core:mycelium" and below.name ~= "mcl_core:dirt" and below.name ~= "mcl_core:dirt_with_grass" and below.name ~= "mcl_core:coarse_dirt" and below.name ~= "mcl_core:podzol" then
if below.name ~= "mcl_core:mycelium" and below.name ~= "mcl_core:dirt" and minetest.get_item_group(below.name, "grass_block") ~= 1 and below.name ~= "mcl_core:coarse_dirt" and below.name ~= "mcl_core:podzol" then
return false
end
@ -206,7 +206,7 @@ mcl_dye.apply_bone_meal = function(pointed_thing)
-- Cocoa: Advance by 1 stage
mcl_cocoas.grow(pos)
return true
elseif n.name == "mcl_core:dirt_with_grass" or n.name == "mcl_core:dirt_with_grass_snow" then
elseif minetest.get_item_group(n.name, "grass_block") == 1 then
-- Grass Block: Generate tall grass and random flowers all over the place
for i = -2, 2 do
for j = -2, 2 do
@ -215,12 +215,16 @@ mcl_dye.apply_bone_meal = function(pointed_thing)
n = minetest.get_node(pos)
local n2 = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
if n.name ~= "" and n.name == "air" and (n2.name == "mcl_core:dirt_with_grass" or n2.name == "mcl_core:dirt_with_grass_snow") then
if n.name ~= "" and n.name == "air" and (minetest.get_item_group(n2.name, "grass_block") == 1) and (minetest.get_item_group(n2.name, "snowed") == 0) then
-- Randomly generate flowers, tall grass or nothing
if math.random(1,100) <= 90 then
-- 90% tall grass, 10% flower
if math.random(1,100) <= 90 then
minetest.add_node(pos, {name="mcl_core:tallgrass"})
if n2.name == "mcl_core:dirt_with_dry_grass" then
minetest.add_node(pos, {name="mcl_flowers:tallgrass_dry"})
else
minetest.add_node(pos, {name="mcl_flowers:tallgrass"})
end
else
minetest.add_node(pos, {name=flowers_table[math.random(1, #flowers_table)]})
end
@ -253,6 +257,14 @@ mcl_dye.apply_bone_meal = function(pointed_thing)
minetest.set_node(toppos, { name = "mcl_flowers:double_grass_top" })
return true
end
elseif n.name == "mcl_flowers:tallgrass_dry" then
local toppos = { x=pos.x, y=pos.y+1, z=pos.z }
local topnode = minetest.get_node(toppos)
if minetest.registered_nodes[topnode.name].buildable_to then
minetest.set_node(pos, { name = "mcl_flowers:double_grass_dry" })
minetest.set_node(toppos, { name = "mcl_flowers:double_grass_dry_top" })
return true
end
elseif n.name == "mcl_flowers:fern" then
-- Fern: Grow into large fern
@ -263,6 +275,14 @@ mcl_dye.apply_bone_meal = function(pointed_thing)
minetest.set_node(toppos, { name = "mcl_flowers:double_fern_top" })
return true
end
elseif n.name == "mcl_flowers:fern_dry" then
local toppos = { x=pos.x, y=pos.y+1, z=pos.z }
local topnode = minetest.get_node(toppos)
if minetest.registered_nodes[topnode.name].buildable_to then
minetest.set_node(pos, { name = "mcl_flowers:double_fern_dry" })
minetest.set_node(toppos, { name = "mcl_flowers:double_fern_dry_top" })
return true
end
end
return false