mirror of
https://github.com/D00Med/scifi_nodes.git
synced 2024-12-22 16:10:18 +01:00
fix protection and infinite stack of doors
This commit is contained in:
parent
bd7150df49
commit
4bbb5071ff
10
doors.lua
10
doors.lua
@ -43,11 +43,14 @@ function onplace(itemstack, placer, pointed_thing)
|
|||||||
local pos2 = {x=pos1.x, y=pos1.y, z=pos1.z}
|
local pos2 = {x=pos1.x, y=pos1.y, z=pos1.z}
|
||||||
pos2.y = pos2.y+1
|
pos2.y = pos2.y+1
|
||||||
if
|
if
|
||||||
|
|
||||||
not minetest.registered_nodes[minetest.get_node(pos1).name].buildable_to or
|
not minetest.registered_nodes[minetest.get_node(pos1).name].buildable_to or
|
||||||
not minetest.registered_nodes[minetest.get_node(pos2).name].buildable_to or
|
not minetest.registered_nodes[minetest.get_node(pos2).name].buildable_to or
|
||||||
not placer or
|
not placer or
|
||||||
not placer:is_player() then
|
not placer:is_player() or
|
||||||
return
|
minetest.is_protected(pos1, placer:get_player_name()) or
|
||||||
|
minetest.is_protected(pos2, placer:get_player_name()) then
|
||||||
|
return
|
||||||
end
|
end
|
||||||
local pt = pointed_thing.above
|
local pt = pointed_thing.above
|
||||||
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
|
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
|
||||||
@ -75,6 +78,9 @@ function onplace(itemstack, placer, pointed_thing)
|
|||||||
minetest.set_node(pt, {name=doora, param2=p2})
|
minetest.set_node(pt, {name=doora, param2=p2})
|
||||||
minetest.set_node(pt2, {name=doorb, param2=p2})
|
minetest.set_node(pt2, {name=doorb, param2=p2})
|
||||||
end
|
end
|
||||||
|
itemstack:take_item(1)
|
||||||
|
|
||||||
|
return itemstack;
|
||||||
end
|
end
|
||||||
|
|
||||||
function afterdestruct(pos, oldnode)
|
function afterdestruct(pos, oldnode)
|
||||||
|
Loading…
Reference in New Issue
Block a user