No longer need server priv to change flag, check protection instead

master
Wuzzy 2022-07-04 18:33:06 +02:00
parent 889744fc7a
commit 7698ceebd0
2 changed files with 22 additions and 18 deletions

View File

@ -10,8 +10,7 @@ conspicuous location, such as atop a building or along a promenade.
/giveme pride_flags:mast_upper
Initially, the rainbow pride flag will appear when the upper mast is placed.
Right-click or punch the node to select a different flag
(this requires the "server" privilege).
Right-click or punch the node to select a different flag.
Repository

View File

@ -256,9 +256,15 @@ local function spawn_flag_and_set_texture( pos )
end
local function cycle_flag( pos, player, cycle_backwards )
local pname = player:get_player_name( )
if minetest.is_protected( pos, pname ) and not
minetest.check_player_privs( pname, "protection_bypass") then
minetest.register_protection_violation( pos, pname )
return
end
local node_idx = minetest.hash_node_position( pos )
if minetest.check_player_privs( player:get_player_name( ), "server" ) then
local aflag = active_flags[ node_idx ]
local flag
if aflag then
@ -277,7 +283,6 @@ local function cycle_flag( pos, player, cycle_backwards )
spawn_flag_and_set_texture( pos )
end
end
end
minetest.register_node( "pride_flags:upper_mast", {
description = S("Flag Pole with Flag"),