fix: fix dupe airblock

This commit is contained in:
Shepel Pavel 2024-12-22 11:29:39 +03:00 committed by Koldun
parent 833a9549c8
commit 9c157df9e1

View File

@ -2,21 +2,23 @@ local S = minetest.get_translator("tech_additions")
local placeairblock = function () local placeairblock = function ()
return function(itemstack, user, pointed_thing) return function(itemstack, user, pointed_thing)
local pos = user:getpos() if minetest.is_creative_enabled(user:get_player_name()) then
local dir = user:get_look_dir() local pos = user:getpos()
local distancefromplayer = 3 local dir = user:get_look_dir()
local new_pos = { local distancefromplayer = 3
x = pos.x + (dir.x * distancefromplayer), local new_pos = {
y = pos.y + 1 + (dir.y * distancefromplayer), x = pos.x + (dir.x * distancefromplayer),
z = pos.z + (dir.z * 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 local getPos = minetest.get_node(new_pos)
getPos.name == "default:water_source" or if getPos.name == "air" or
getPos.name == "default:water_flowing" or getPos.name == "default:water_source" or
getPos.name == "default:river_water_source" or getPos.name == "default:water_flowing" or
getPos.name == "default:river_water_flowing" then getPos.name == "default:river_water_source" or
minetest.set_node(new_pos, {name="tech_additions:air_block"}) getPos.name == "default:river_water_flowing" then
minetest.set_node(new_pos, {name="tech_additions:air_block"})
end
end end
end end
end end