add df_primordial_items and tweak surface detection for decorations

This commit is contained in:
tenplus1 2022-07-08 09:21:32 +01:00
parent 4a0eddef02
commit 1315e2cc5f
2 changed files with 29 additions and 16 deletions

View File

@ -86,7 +86,8 @@ minetest.after(0.1, function()
if def.groups
and def.groups.flower
and not node:find("waterlily")
and not node:find("xdecor:potted_") then
and not node:find("xdecor:potted_")
and not node:find("df_farming:") then
flowers[#flowers + 1] = node
end
end
@ -95,6 +96,8 @@ end)
-- default biomes deco
local deco = {
{"default:dirt", green_grass, flowers},
{"default:dirt_with_grass", green_grass, flowers},
{"default:dry_dirt", dry_grass, {}},
{"default:dry_dirt_with_dry_grass", dry_grass, {}},
{"default:dirt_with_dry_grass", dry_grass, flowers},
@ -259,33 +262,21 @@ local function check_soil(pos, nodename, strength)
-- set radius according to strength
local side = strength - 1
local tall = max(strength - 2, 0)
local floor
local groups = minetest.registered_items[nodename]
and minetest.registered_items[nodename].groups or {}
-- only place decoration on one type of surface
if groups.soil then
floor = {"group:soil"}
elseif groups.sand then
floor = {"group:sand"}
else
floor = {nodename}
end
-- get area of land with free space above
local dirt = minetest.find_nodes_in_area_under_air(
{x = pos.x - side, y = pos.y - tall, z = pos.z - side},
{x = pos.x + side, y = pos.y + tall, z = pos.z + side}, floor)
{x = pos.x + side, y = pos.y + tall, z = pos.z + side}, {nodename})
-- set default grass and decoration
local grass = green_grass
local decor = flowers
local grass, decor
-- choose grass and decoration to use on dirt patch
for n = 1, #deco do
-- do we have a grass match?
if nodename == deco[n][1] then
grass = deco[n][2] or {}
decor = deco[n][3] or {}
end

View File

@ -253,4 +253,26 @@ if minetest.get_modpath("df_primordial_items") then
{"df_primordial_items:mush_sapling", mush_fix, "soil", true},
{"df_primordial_items:fern_sapling", fern_fix, "soil", true}
})
local jgrass = {
"df_primordial_items:jungle_grass_1",
"df_primordial_items:jungle_grass_2",
"df_primordial_items:jungle_grass_3",
"df_primordial_items:fern_1",
"df_primordial_items:fern_2",
"", "", "", ""
}
local jdeco = {
"df_primordial_items:jungle_mushroom_1",
"df_primordial_items:jungle_mushroom_2",
"df_primordial_items:glow_plant_1",
"df_primordial_items:glow_plant_2",
"df_primordial_items:glow_plant_3",
"", "", ""
}
bonemeal:add_deco({
{"df_primordial_items:dirt_with_jungle_grass", jgrass, jdeco}
})
end