Fix protection of TSR rail
parent
30076f5ce3
commit
db9e4429d7
|
@ -23,6 +23,16 @@ local adefunc = function(def, preset, suffix, rotation)
|
||||||
advtrains.interlocking.npr_rails[pe] = nil
|
advtrains.interlocking.npr_rails[pe] = nil
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos, formname, fields, player)
|
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
|
if fields.npr then
|
||||||
local pe = advtrains.encode_pos(pos)
|
local pe = advtrains.encode_pos(pos)
|
||||||
advtrains.interlocking.npr_rails[pe] = tonumber(fields.npr)
|
advtrains.interlocking.npr_rails[pe] = tonumber(fields.npr)
|
||||||
|
@ -53,4 +63,4 @@ if minetest.get_modpath("advtrains_train_track") ~= nil then
|
||||||
formats={},
|
formats={},
|
||||||
get_additional_definiton = adefunc,
|
get_additional_definiton = adefunc,
|
||||||
}, advtrains.trackpresets.t_30deg_straightonly)
|
}, advtrains.trackpresets.t_30deg_straightonly)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue