aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2021-02-19 22:46:21 +0100
committerorwell96 <orwell@bleipb.de>2021-02-19 22:46:21 +0100
commitdb9e4429d789b5217a969de34ecd429c385c380b (patch)
tree6fe2861fc3883dee0eab31ff6808e144d06db0c8 /advtrains_interlocking
parent30076f5ce33610c4c809500e1aa57efb066e6a8e (diff)
downloadadvtrains-db9e4429d789b5217a969de34ecd429c385c380b.tar.gz
advtrains-db9e4429d789b5217a969de34ecd429c385c380b.tar.bz2
advtrains-db9e4429d789b5217a969de34ecd429c385c380b.zip
Fix protection of TSR rail
Diffstat (limited to 'advtrains_interlocking')
-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