protection_bypass allows to dig chessboard always
This commit is contained in:
parent
24ef28e0a5
commit
086a4e8f41
@ -430,6 +430,9 @@ can’t be stopped by other players. But to prevent two players blocking a
|
|||||||
chessboard forever, there is a 5-minute timer. If no player makes a move
|
chessboard forever, there is a 5-minute timer. If no player makes a move
|
||||||
for 5 minutes, then the chessboard can be reset and dug by anyone.
|
for 5 minutes, then the chessboard can be reset and dug by anyone.
|
||||||
|
|
||||||
|
Exception: Players with the `protection_bypass` privilege can always
|
||||||
|
dig the chessboard.
|
||||||
|
|
||||||
|
|
||||||
## Appendix
|
## Appendix
|
||||||
|
|
||||||
|
@ -3052,10 +3052,14 @@ function realchess.fields(pos, _, fields, sender)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function realchess.dig(pos, player)
|
function realchess.can_dig(pos, player)
|
||||||
if not player then
|
if not player or not player:is_player() then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
-- Protection_bypass priv guarantees digging rights
|
||||||
|
if minetest.check_player_privs(player, "protection_bypass") then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local playerName = player:get_player_name()
|
local playerName = player:get_player_name()
|
||||||
@ -3242,7 +3246,7 @@ if ENABLE_CHESS_GAMES then
|
|||||||
-- Extend chess board node definition if chess games are enabled
|
-- Extend chess board node definition if chess games are enabled
|
||||||
chessboarddef._tt_help = S("Play a game of Chess against another player or the computer")
|
chessboarddef._tt_help = S("Play a game of Chess against another player or the computer")
|
||||||
chessboarddef.on_blast = realchess.blast
|
chessboarddef.on_blast = realchess.blast
|
||||||
chessboarddef.can_dig = realchess.dig
|
chessboarddef.can_dig = realchess.can_dig
|
||||||
chessboarddef.on_construct = realchess.init
|
chessboarddef.on_construct = realchess.init
|
||||||
chessboarddef.on_receive_fields = realchess.fields
|
chessboarddef.on_receive_fields = realchess.fields
|
||||||
-- The move logic of Chess is here (at least for players)
|
-- The move logic of Chess is here (at least for players)
|
||||||
|
Loading…
Reference in New Issue
Block a user