summaryrefslogtreecommitdiff
path: root/locks/shared_locked_xdoors2.lua
diff options
context:
space:
mode:
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2018-09-08 12:12:15 -0400
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2018-09-08 12:12:15 -0400
commitaaed0a2ea81a51f36a7eb35cb30c57ddf646fe1b (patch)
tree379775ce76eb855a3ea65906727d828d1696cece /locks/shared_locked_xdoors2.lua
parentba470a69750df16eac4278c30471d813c2581202 (diff)
downloaddreambuilder_modpack-aaed0a2ea81a51f36a7eb35cb30c57ddf646fe1b.tar
dreambuilder_modpack-aaed0a2ea81a51f36a7eb35cb30c57ddf646fe1b.tar.gz
dreambuilder_modpack-aaed0a2ea81a51f36a7eb35cb30c57ddf646fe1b.tar.bz2
dreambuilder_modpack-aaed0a2ea81a51f36a7eb35cb30c57ddf646fe1b.tar.xz
dreambuilder_modpack-aaed0a2ea81a51f36a7eb35cb30c57ddf646fe1b.zip
updated castles, coloredwood, digistuff, locks, mesecons,
pipeworks, steel, unified dyes, unified mesecons, and worldedit
Diffstat (limited to 'locks/shared_locked_xdoors2.lua')
-rw-r--r--locks/shared_locked_xdoors2.lua90
1 files changed, 50 insertions, 40 deletions
diff --git a/locks/shared_locked_xdoors2.lua b/locks/shared_locked_xdoors2.lua
index 1af36fc..eb96f5c 100644
--- a/locks/shared_locked_xdoors2.lua
+++ b/locks/shared_locked_xdoors2.lua
@@ -1,7 +1,8 @@
--- xDoors² mod by xyz
+-- xDoors² mod by xyz
-- modified by Sokomine to allow locked doors that can only be opened/closed/dig up by the player who placed them
-- a little bit modified by addi to allow someone with the priv "opendoors" to open/close/dig all locked doors.
-- Sokomine: modified again so that it uses the new locks-mod
+-- 25.02.16 Added new Locks config Buttons.
local door_bottom = {-0.5, -0.5, -0.5, 0.5, 0.5, -0.4}
local door_top = {
@@ -33,13 +34,15 @@ local xdoors2_transform = function(pos, node, puncher)
local p2 = 0
if t == 2 then
p2 = (node.param2 + 1) % 4
+ minetest.sound_play("doors_door_open", { pos = pos, gain = 0.3, max_hear_distance = 10})
else
p2 = (node.param2 + 3) % 4
+ minetest.sound_play("doors_door_close", { pos = pos, gain = 0.3, max_hear_distance = 10})
end
local olddata = locks:get_lockdata( pos );
- minetest.env:add_node(pos, {name = "locks:door_bottom_"..t, param2 = p2})
- minetest.env:add_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "locks:door_top_"..t, param2 = p2})
+ minetest.add_node(pos, {name = "locks:door_bottom_"..t, param2 = p2})
+ minetest.add_node({x = pos.x, y = pos.y + 1, z = pos.z}, {name = "locks:door_top_"..t, param2 = p2})
-- remember who owns the door, what passwords are set etc.
locks:set_lockdata( pos, olddata );
@@ -51,8 +54,8 @@ local xdoors2_destruct = function(pos, oldnode)
if is_top(oldnode.name) then
pos = {x = pos.x, y = pos.y - 1, z = pos.z}
end
- minetest.env:remove_node(pos)
- minetest.env:remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
+ minetest.remove_node(pos)
+ minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
end
for i = 1, 2 do
@@ -77,8 +80,8 @@ for i = 1, 2 do
on_construct = function(pos)
locks:lock_init( pos,
"size[8,2]"..
- "field[0.3,0.6;6,0.7;locks_sent_lock_command;Locked door. Type /help for help:;]"..
- "button_exit[6.3,1.2;1.7,0.7;locks_sent_input;Proceed]" );
+ locks.uniform_background..
+ "button_exit[6.3,1.2;1.7,1;locks_sent_input;Proceed]" );
end,
on_receive_fields = function(pos, formname, fields, sender)
@@ -110,8 +113,8 @@ for i = 1, 2 do
on_construct = function(pos)
locks:lock_init( pos,
"size[8,2]"..
- "field[0.3,0.6;6,0.7;locks_sent_lock_command;Locked door. Type /help for help:;]"..
- "button_exit[6.3,0.2;1.7,0.7;locks_sent_input;Proceed]" );
+ locks.uniform_background..
+ "button_exit[6.3,1.2;1.7,1;locks_sent_input;Proceed]" );
end,
on_receive_fields = function(pos, formname, fields, sender)
@@ -137,40 +140,47 @@ minetest.register_node("locks:door", {
inventory_image = 'locks_xdoors2_door.png',
wield_image = 'xdoors2_door.png',
stack_max = 1,
+ sunlight_propogates = true,
on_place = function(itemstack, placer, pointed_thing)
local above = pointed_thing.above
-
- -- there should be 2 empty nodes
- if minetest.env:get_node({x = above.x, y = above.y + 1, z = above.z}).name ~= "air" then
- return itemstack
- end
+ local above1 = {x = above.x, y = above.y + 1, z = above.z};
+ if (minetest.is_protected(above, placer:get_player_name())
+ or minetest.is_protected(above1, placer:get_player_name())) then
+ minetest.chat_send_player(placer:get_player_name(), "This area is protected!")
+ return itemstack
+ else
+ -- there should be 2 empty nodes
+ if minetest.get_node(above1).name ~= "air" then
+ return itemstack
+ end
- local fdir = 0
- local placer_pos = placer:getpos()
- if placer_pos then
- dir = {
- x = above.x - placer_pos.x,
- y = above.y - placer_pos.y,
- z = above.z - placer_pos.z
- }
- fdir = minetest.dir_to_facedir(dir)
- end
-
- local t = 1
- local another_door = minetest.env:get_node({x = above.x + delta[fdir + 1].x, y = above.y, z = above.z + delta[fdir + 1].z})
- if (another_door.name:sub(-1) == "1" and another_door.param2 == fdir)
- or (another_door.name:sub(-1) == "2" and another_door.param2 == (fdir + 1) % 4) then
- t = 2
- end
-
- minetest.env:add_node(above, {name = "locks:door_bottom_"..t, param2 = fdir})
- minetest.env:add_node({x = above.x, y = above.y + 1, z = above.z}, {name = "locks:door_top_"..t, param2 = fdir})
-
- -- store who owns the door; the other data can be default for now
- locks:lock_set_owner( above, placer:get_player_name() or "", "Shared locked door");
- locks:lock_set_owner( {x = above.x, y = above.y + 1, z = above.z}, placer:get_player_name() or "", "Shared locked door");
-
- return ItemStack("")
+ local fdir = 0
+ local placer_pos = placer:getpos()
+ if placer_pos then
+ dir = {
+ x = above.x - placer_pos.x,
+ y = above.y - placer_pos.y,
+ z = above.z - placer_pos.z
+ }
+ fdir = minetest.dir_to_facedir(dir)
+ end
+
+ local t = 1
+ local another_door = minetest.get_node({x = above.x + delta[fdir + 1].x, y = above.y, z = above.z + delta[fdir + 1].z})
+ if (another_door.name:sub(-1) == "1" and another_door.param2 == fdir)
+ or (another_door.name:sub(-1) == "2" and another_door.param2 == (fdir + 1) % 4) then
+ t = 2
+ end
+
+ minetest.add_node(above, {name = "locks:door_bottom_"..t, param2 = fdir})
+ minetest.add_node({x = above.x, y = above.y + 1, z = above.z}, {name = "locks:door_top_"..t, param2 = fdir})
+
+ -- store who owns the door; the other data can be default for now
+ locks:lock_set_owner( above, placer:get_player_name() or "", "Shared locked door");
+ locks:lock_set_owner( {x = above.x, y = above.y + 1, z = above.z}, placer:get_player_name() or "", "Shared locked door");
+
+ return ItemStack("")
+ end
end
})