Change PvP state in pvpplus.add_to_tournament

master
upsilon 2017-03-26 12:18:02 +02:00
parent 2073728b6e
commit 954ce04b21
No known key found for this signature in database
GPG Key ID: A80DAE1F266E1C3C
2 changed files with 9 additions and 5 deletions

View File

@ -9,10 +9,6 @@ function pvpplus.pvp_set(player_name, state)
return false, "The state parameter has to be a boolean."
end
if pvpplus.is_playing_tournament(player_name) then
return false, "PvP state cannot be changed while playing a tournament."
end
local player = minetest.get_player_by_name(player_name)
pvptable[player_name] = state
@ -84,7 +80,11 @@ unified_inventory.register_button("pvp", {
type = "image",
image = "pvp.png",
action = function(player)
pvpplus.pvp_toggle(player:get_player_name())
if pvpplus.is_playing_tournament(player_name) then
minetest.chat_send_player(player_name, "PvP state cannot be changed while playing a tournament.")
else
pvpplus.pvp_toggle(player:get_player_name())
end
end
})

View File

@ -272,6 +272,10 @@ function pvpplus.add_to_tournament(player_name)
tournament.sent_damages[player_name] = 0
tournament.received_damages[player_name] = 0
tournament.kills[player_name] = 0
tournament.previous_pvp_states[player_name] = pvpplus.is_pvp(player_name)
-- Enable PvP
pvpplus.pvp_enable(player_name)
-- Send a chat message
if minetest.get_player_by_name(player_name) then