From 4d417ddcb2be62e568ae3f11c58bcb156d5d6a35 Mon Sep 17 00:00:00 2001 From: cheapie Date: Thu, 25 Oct 2018 18:44:11 -0500 Subject: Require "firealarm" priv to pull fire alarms in areas owned by other players --- firealarm_pullstation/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'firealarm_pullstation/init.lua') diff --git a/firealarm_pullstation/init.lua b/firealarm_pullstation/init.lua index 1d0756b..88ad7ac 100644 --- a/firealarm_pullstation/init.lua +++ b/firealarm_pullstation/init.lua @@ -1,3 +1,8 @@ +minetest.register_privilege("firealarm",{ + description = "Can bypass area protection when pulling fire alarms", + give_to_singleplayer = true, +}) + minetest.register_node(":firealarm:pullstation_off",{ description = "Fire Alarm Pull Station", groups = { oddly_breakable_by_hand = 1 }, @@ -23,6 +28,10 @@ minetest.register_node(":firealarm:pullstation_off",{ minetest.chat_send_player(name,string.format("Position: %d,%d,%d",pos.x,pos.y,pos.z)) end, on_rightclick = function(pos,node,clicker) + if minetest.is_protected(pos,clicker:get_player_name()) and not minetest.check_player_privs(clicker,"protection_bypass") and not minetest.check_player_privs(clicker,"firealarm") then + minetest.record_protection_violation(pos,clicker:get_player_name()) + return + end local devInfo = firealarm.getDevInfo("signaling",pos) if devInfo then devInfo.active = true -- cgit v1.2.3