From 1315e2cc5f8630cdffb2f5e9c2139ca8ef756447 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 8 Jul 2022 09:21:32 +0100 Subject: [PATCH] add df_primordial_items and tweak surface detection for decorations --- init.lua | 23 +++++++---------------- mods.lua | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/init.lua b/init.lua index 9e6e673..af2a5c3 100644 --- a/init.lua +++ b/init.lua @@ -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 diff --git a/mods.lua b/mods.lua index bd4f69e..54de673 100644 --- a/mods.lua +++ b/mods.lua @@ -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