diff options
author | orwell96 <mono96.mml@gmail.com> | 2017-03-30 21:21:03 +0200 |
---|---|---|
committer | orwell96 <mono96.mml@gmail.com> | 2017-03-30 21:21:03 +0200 |
commit | b5a5d9035f83c47e64b3b0e3343c9de519391907 (patch) | |
tree | 6b0ef5c26eada3a04f811b798fbbcf0485762f35 /advtrains/advtrains/trackplacer.lua | |
parent | a091ac2e1da07b442c8f58237667287714adc838 (diff) | |
download | advtrains-b5a5d9035f83c47e64b3b0e3343c9de519391907.tar.gz advtrains-b5a5d9035f83c47e64b3b0e3343c9de519391907.tar.bz2 advtrains-b5a5d9035f83c47e64b3b0e3343c9de519391907.zip |
Respect protection_bypass privilege, fix crash with areas and properly record protection violations
Diffstat (limited to 'advtrains/advtrains/trackplacer.lua')
-rw-r--r-- | advtrains/advtrains/trackplacer.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/advtrains/advtrains/trackplacer.lua b/advtrains/advtrains/trackplacer.lua index df21608..e039800 100644 --- a/advtrains/advtrains/trackplacer.lua +++ b/advtrains/advtrains/trackplacer.lua @@ -194,8 +194,9 @@ function tp.register_track_placer(nnprefix, imgprefix, dispname) if pointed_thing.type=="node" then local pos=pointed_thing.above local upos=vector.subtract(pointed_thing.above, {x=0, y=1, z=0}) - if minetest.is_protected(pos,name) and minetest.is_protected(upos,name) then - return itemstack + if advtrains.is_protected(pos,name) then + minetest.record_protection_violation(pos, name) + return itemstack end if minetest.registered_nodes[minetest.get_node(pos).name] and minetest.registered_nodes[minetest.get_node(pos).name].buildable_to and minetest.registered_nodes[minetest.get_node(upos).name] and minetest.registered_nodes[minetest.get_node(upos).name].walkable then @@ -225,7 +226,8 @@ minetest.register_craftitem("advtrains:trackworker",{ end if pointed_thing.type=="node" then local pos=pointed_thing.under - if minetest.is_protected(pos, name) then + if advtrains.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) return end local node=minetest.get_node(pos) @@ -267,8 +269,9 @@ minetest.register_craftitem("advtrains:trackworker",{ if pointed_thing.type=="node" then local pos=pointed_thing.under local node=minetest.get_node(pos) - if minetest.is_protected(pos, name) then - return + if advtrains.is_protected(pos, name) then + minetest.record_protection_violation(pos, name) + return end --if not advtrains.is_track_and_drives_on(minetest.get_node(pos).name, advtrains.all_tracktypes) then return end |