Skip to content

Commit

Permalink
add priv for unrestricted spacecannon use
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Mar 4, 2021
1 parent 2e17eea commit 863fd6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions privs/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ minetest.register_privilege("staff", {
description = "pandorabox staff",
give_to_singleplayer = false
})

minetest.register_privilege("spacecannon_unrestricted", {
description = "can use the spacecannon everywhere",
give_to_singleplayer = false
})
7 changes: 4 additions & 3 deletions spacecannon.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

spacecannon.can_shoot = function(pos)
-- only allow shooting in space
return pos.y > 1000
spacecannon.can_shoot = function(pos, playername)
local has_unrestricted_priv = playername and minetest.check_player_priv(playername, "spacecannon_unrestricted")
-- only allow shooting in space or with priv
return has_unrestricted_priv or pos.y > 1000
end

0 comments on commit 863fd6e

Please sign in to comment.