do some stuff

This commit is contained in:
2022-07-15 20:47:50 +02:00
parent 1e6271579d
commit ddf946f58a
7 changed files with 877 additions and 824 deletions

View File

@@ -431,24 +431,6 @@ minetest.register_craftitem(
--if pointing at turret then start breaking it
if pointed_thing.type == "node" then
local node = minetest.get_node(pointed_thing.under)
if node.name == "portalgun:turretgun" or node.name == "portalgun:turretgun2" then
--if 4 blocks or closer to player
local pos = user:getpos()
local pos2 = pointed_thing.under
local dist = math.sqrt(
(pos.x - pos2.x) * (pos.x - pos2.x) +
(pos.y - pos2.y) * (pos.y - pos2.y) +
(pos.z - pos2.z) * (pos.z - pos2.z)
)
if dist < 4 then
--set the node to air
minetest.set_node(pointed_thing.under, {name = "air"})
--create entity
local pos_tmp = pointed_thing.under
local obj = minetest.add_entity(pos_tmp, "portalgun:turret_held")
--set the turret to the user
end
end
end
portalgun_onuse(itemstack, user, pointed_thing, 1)
return itemstack