Skip to content

Commit

Permalink
allow removal of self protected public travelnet boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
NatureFreshMilk committed Dec 16, 2019
1 parent 775ff54 commit ca01095
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions travel/travelnet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,29 @@ local public_networks = {}
public_networks["korlen"] = true

-- who can dig the box
travelnet.allow_dig = function(player_name, owner_name, network_name)
travelnet.allow_dig = function(player_name, owner_name, network_name, pos)

if not pos then
-- no position available, skip additional checks
return false
end

if minetest.is_protected(pos, player_name) then
-- protected travelnet, no removal possible
return false
end

local is_moderator = minetest.check_player_privs(player_name, { ban=true })
if is_moderator then
-- allow moderators to remove the travelnet
-- allow moderators to remove travelnets
return true
end

if public_networks[owner_name] then
-- allow removal of public travelnet boxes if they aren't protected or under your protection
return true
end

end

-- who can attach to which network
Expand Down

0 comments on commit ca01095

Please sign in to comment.