From 09a957dff37ffdf6a4282435b6548bace0d1f957 Mon Sep 17 00:00:00 2001 From: Niklp09 <89982526+Niklp09@users.noreply.github.com> Date: Sun, 16 Jul 2023 12:58:19 +0200 Subject: [PATCH] fixes --- bushes_classic/init.lua | 9 +++------ ferns/horsetail.lua | 3 +-- pl_seaweed/init.lua | 2 +- pl_waterlilies/init.lua | 2 +- poisonivy/init.lua | 5 ++--- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/bushes_classic/init.lua b/bushes_classic/init.lua index 5f022f8..2918a5d 100644 --- a/bushes_classic/init.lua +++ b/bushes_classic/init.lua @@ -54,21 +54,18 @@ minetest.register_abm({ chance = 100, label = "[bushes_classic] spawn bushes", min_y = -16, - max_y = 48, + max_y = 48, action = function(pos, node) local p_top = {x = pos.x, y = pos.y + 1, z = pos.z} local n_top = minetest.get_node_or_nil(p_top) - if not n_top then return end - if n_top.name ~= "air" then return end + if not n_top or n_top.name ~= "air" then return end local perlin_fertile_area = minetest.get_perlin(545342534, 3, 0.6, 100) local fertility, temperature, humidity = get_biome_data(pos, perlin_fertile_area) local pos_biome_ok = fertility > -0.1 and temperature <= 0.15 and temperature >= -0.15 and humidity <= 0 and humidity >= -1 - if not pos_biome_ok then - return -- Outside of biome - end + if not pos_biome_ok then return end if minetest.find_node_near(p_top, 10 + math.random(-1.5,2), {"group:bush"}) then return -- Nodes to avoid are nearby diff --git a/ferns/horsetail.lua b/ferns/horsetail.lua index 38b8a09..f190b8b 100644 --- a/ferns/horsetail.lua +++ b/ferns/horsetail.lua @@ -94,8 +94,7 @@ if abstract_ferns.config.enable_horsetails_spawning == true then action = function(pos, node) local p_top = {x = pos.x, y = pos.y + 1, z = pos.z} local n_top = minetest.get_node_or_nil(p_top) - if not n_top then return end - if n_top.name ~= "air" then return end + if not n_top or n_top.name ~= "air" then return end local NEAR_DST = 2 if #minetest.find_nodes_in_area( diff --git a/pl_seaweed/init.lua b/pl_seaweed/init.lua index b2bf6b4..b5456c7 100644 --- a/pl_seaweed/init.lua +++ b/pl_seaweed/init.lua @@ -7,7 +7,7 @@ local seaweed_max_count = tonumber(minetest.settings:get("pl_seaweed_max_count") local seaweed_rarity = tonumber(minetest.settings:get("pl_seaweed_rarity")) or 33 local function get_ndef(name) - return minetest.registered_noes[name] or {} + return minetest.registered_nodes[name] or {} end local algae_list = { {nil}, {2}, {3}, {4} } diff --git a/pl_waterlilies/init.lua b/pl_waterlilies/init.lua index c21c62d..491a39a 100644 --- a/pl_waterlilies/init.lua +++ b/pl_waterlilies/init.lua @@ -7,7 +7,7 @@ local lilies_max_count = tonumber(minetest.settings:get("pl_waterlilies_max_coun local lilies_rarity = tonumber(minetest.settings:get("pl_waterlilies_rarity")) or 33 local function get_ndef(name) - return minetest.registered_noes[name] or {} + return minetest.registered_nodes[name] or {} end local lilies_list = { diff --git a/poisonivy/init.lua b/poisonivy/init.lua index df3f49f..a1d33b3 100644 --- a/poisonivy/init.lua +++ b/poisonivy/init.lua @@ -81,12 +81,11 @@ minetest.register_abm({ chance = 20, label = "[poisoninvy] spawn plants", min_y = -16, - max_y = 48, + max_y = 48, action = function(pos, node) local p_top = {x = pos.x, y = pos.y + 1, z = pos.z} local n_top = minetest.get_node_or_nil(p_top) - if not n_top then return end - if n_top.name ~= "air" then return end + if not n_top or n_top.name ~= "air" then return end local n_light = minetest.get_node_light(p_top) if n_light < 7 then