From 0010d400e08df4f6e1bc06e7400059b83d02bd50 Mon Sep 17 00:00:00 2001 From: Andrey Stepanov Date: Sun, 22 Dec 2024 17:27:05 +0500 Subject: [PATCH] [air_block] refactor old nodes check --- airblock.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/airblock.lua b/airblock.lua index 5a8109d..81a00a0 100644 --- a/airblock.lua +++ b/airblock.lua @@ -1,5 +1,12 @@ local S = minetest.get_translator("tech_additions") +local replace_allowed = {} +replace_allowed["air"] = true +replace_allowed["default:water_source"] = true +replace_allowed["default:water_flowing"] = true +replace_allowed["default:river_water_source"] = true +replace_allowed["default:river_water_flowing"] = true + local placeairblock = function () return function(itemstack, user, pointed_thing) local name = user:get_player_name() @@ -22,11 +29,7 @@ local placeairblock = function () end local getPos = minetest.get_node(new_pos) - if getPos.name == "air" or - getPos.name == "default:water_source" or - getPos.name == "default:water_flowing" or - getPos.name == "default:river_water_source" or - getPos.name == "default:river_water_flowing" then + if replace_allowed[getPos.name] then minetest.set_node(new_pos, {name="tech_additions:air_block"}) end end