Integration (#2)

* set mod name

* implement privilege for changing own PvP state

* update readme
master
zeuner 2017-06-26 10:29:30 +02:00 committed by Pierre-Adrien Langrognet
parent 076d29d030
commit c876c0123a
3 changed files with 17 additions and 3 deletions

View File

@ -56,7 +56,6 @@ pvpplus.tournament_hud_update_all() -- Update the list and all player HUDs
## TODO
* Add a privilege for changing PvP state
* Add a formspec for managing tournaments, accessible from the inventory
* Testing

1
mod.conf Normal file
View File

@ -0,0 +1 @@
name = pvpplus

18
pvp.lua
View File

@ -1,3 +1,5 @@
minetest.register_privilege("pvp", "Can configure own PvP setting")
-- Private table
local pvptable = {}
@ -84,6 +86,14 @@ if minetest.get_modpath("unified_inventory") then
unified_inventory.register_button("pvp", {
type = "image",
image = "pvp.png",
condition = function(player)
return minetest.check_player_privs(
player:get_player_name(),
{
pvp = true
}
)
end,
action = function(player)
pvpplus.pvp_toggle(player:get_player_name())
end
@ -93,7 +103,9 @@ end
minetest.register_chatcommand("pvp_enable", {
params = "",
description = "Enables PvP",
privs = {},
privs = {
pvp = true
},
func = function(name, param)
if pvpplus.is_pvp(name) then
return false, "Your PvP is already enabled."
@ -104,7 +116,9 @@ minetest.register_chatcommand("pvp_enable", {
minetest.register_chatcommand("pvp_disable", {
params = "",
description = "Disables PvP",
privs = {},
privs = {
pvp = true
},
func = function(name, param)
if not pvpplus.is_pvp(name) then
return false, "Your PvP is already disabled."