aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/tsr_rail.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains_interlocking/tsr_rail.lua')
-rw-r--r--advtrains_interlocking/tsr_rail.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/advtrains_interlocking/tsr_rail.lua b/advtrains_interlocking/tsr_rail.lua
index a500c8f..f302540 100644
--- a/advtrains_interlocking/tsr_rail.lua
+++ b/advtrains_interlocking/tsr_rail.lua
@@ -23,6 +23,16 @@ local adefunc = function(def, preset, suffix, rotation)
advtrains.interlocking.npr_rails[pe] = nil
end,
on_receive_fields = function(pos, formname, fields, player)
+ local pname = player:get_player_name()
+ if not minetest.check_player_privs(pname, {interlocking=true}) then
+ minetest.chat_send_player(pname, "Interlocking privilege required!")
+ return
+ end
+ if minetest.is_protected(pos, pname) then
+ minetest.chat_send_player(pname, "This rail is protected!")
+ minetest.record_protection_violation(pos, pname)
+ return
+ end
if fields.npr then
local pe = advtrains.encode_pos(pos)
advtrains.interlocking.npr_rails[pe] = tonumber(fields.npr)
@@ -53,4 +63,4 @@ if minetest.get_modpath("advtrains_train_track") ~= nil then
formats={},
get_additional_definiton = adefunc,
}, advtrains.trackpresets.t_30deg_straightonly)
-end \ No newline at end of file
+end