summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2018-10-25 18:44:11 -0500
committercheapie <no-email-for-you@example.com>2018-10-25 18:44:11 -0500
commit4d417ddcb2be62e568ae3f11c58bcb156d5d6a35 (patch)
tree3903097381bf39b15e5784bd337cc9f4b8c409bb
parentd0e6e6ef5937a71c0706d6ed57d097dda68e5aab (diff)
downloadfirealarm-4d417ddcb2be62e568ae3f11c58bcb156d5d6a35.tar
firealarm-4d417ddcb2be62e568ae3f11c58bcb156d5d6a35.tar.gz
firealarm-4d417ddcb2be62e568ae3f11c58bcb156d5d6a35.tar.bz2
firealarm-4d417ddcb2be62e568ae3f11c58bcb156d5d6a35.tar.xz
firealarm-4d417ddcb2be62e568ae3f11c58bcb156d5d6a35.zip
Require "firealarm" priv to pull fire alarms in areas owned by other players
-rw-r--r--firealarm_pullstation/init.lua9
1 files changed, 9 insertions, 0 deletions
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