mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Add basic protection support to builtin
This commit is contained in:
parent
2636c92075
commit
06a5eceb81
4 changed files with 53 additions and 0 deletions
|
@ -218,6 +218,15 @@ function minetest.item_place_node(itemstack, placer, pointed_thing, param2)
|
|||
place_to = {x = under.x, y = under.y, z = under.z}
|
||||
end
|
||||
|
||||
if minetest.is_protected(place_to, placer:get_player_name()) then
|
||||
minetest.log("action", placer:get_player_name()
|
||||
.. " tried to place " .. def.name
|
||||
.. " at protected position "
|
||||
.. minetest.pos_to_string(place_to))
|
||||
minetest.record_protection_violation(place_to, placer:get_player_name())
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.log("action", placer:get_player_name() .. " places node "
|
||||
.. def.name .. " at " .. minetest.pos_to_string(place_to))
|
||||
|
||||
|
@ -377,6 +386,15 @@ function minetest.node_dig(pos, node, digger)
|
|||
return
|
||||
end
|
||||
|
||||
if minetest.is_protected(pos, digger:get_player_name()) then
|
||||
minetest.log("action", digger:get_player_name()
|
||||
.. " tried to dig " .. node.name
|
||||
.. " at protected position "
|
||||
.. minetest.pos_to_string(pos))
|
||||
minetest.record_protection_violation(pos, digger:get_player_name())
|
||||
return
|
||||
end
|
||||
|
||||
minetest.log('action', digger:get_player_name() .. " digs "
|
||||
.. node.name .. " at " .. minetest.pos_to_string(pos))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue