From 9c157df9e11324555f3d1ce5a408891a65cad388 Mon Sep 17 00:00:00 2001 From: Shepel Pavel Date: Sun, 22 Dec 2024 11:29:39 +0300 Subject: [PATCH] fix: fix dupe airblock --- airblock.lua | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/airblock.lua b/airblock.lua index 2003399..d8f38a9 100644 --- a/airblock.lua +++ b/airblock.lua @@ -2,21 +2,23 @@ local S = minetest.get_translator("tech_additions") local placeairblock = function () return function(itemstack, user, pointed_thing) - local pos = user:getpos() - local dir = user:get_look_dir() - local distancefromplayer = 3 - local new_pos = { - x = pos.x + (dir.x * distancefromplayer), - y = pos.y + 1 + (dir.y * distancefromplayer), - z = pos.z + (dir.z * distancefromplayer), - } - 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 - minetest.set_node(new_pos, {name="tech_additions:air_block"}) + if minetest.is_creative_enabled(user:get_player_name()) then + local pos = user:getpos() + local dir = user:get_look_dir() + local distancefromplayer = 3 + local new_pos = { + x = pos.x + (dir.x * distancefromplayer), + y = pos.y + 1 + (dir.y * distancefromplayer), + z = pos.z + (dir.z * distancefromplayer), + } + 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 + minetest.set_node(new_pos, {name="tech_additions:air_block"}) + end end end end