implement the deactivation of the chat messages enabled by default

* also update copyright and readme for this work.. original one are stalled
main
PICCORO Lenz McKAY 2022-08-14 16:20:53 -04:00
parent 6f5c13c553
commit 8d11f66ccc
4 changed files with 24 additions and 14 deletions

View File

@ -13,9 +13,7 @@ This mod is named `antipvp` and add a priv that give PvP(Player vs Player) invul
## tech information ## tech information
This is a fork from original https://notabug.org/gnuhacker/antipvp if still exits. Inproved version of the mod and maybe in future anti damage mod, main features are:
Main difference are:
* the message event is configurable so it doesn't flood the chat for every hit * the message event is configurable so it doesn't flood the chat for every hit
on multiple attacks (to all players or only involved) on multiple attacks (to all players or only involved)
@ -33,9 +31,6 @@ The `PVP` term means player versus player.
Can be downloaded from https://codeberg.org/minenux/minetest-mod-antipvp and Can be downloaded from https://codeberg.org/minenux/minetest-mod-antipvp and
must be named as `antipvp`. must be named as `antipvp`.
Original work can be downloaded from https://notabug.org/gnuhacker/pvpinvul if still exits.
### Configuration ### Configuration
You can set those configurations in the mod tab at the gui, or added those option You can set those configurations in the mod tab at the gui, or added those option
@ -45,7 +40,8 @@ to the minetest config file at game directory, to the main global config file.
| -------------------- | ---- | ------- | ----------- | | -------------------- | ---- | ------- | ----------- |
| pvpinvul_kill_hitter | bool | false | if enable, players that hit will be killed. | | pvpinvul_kill_hitter | bool | false | if enable, players that hit will be killed. |
| pvpinvul_admin_privs | bool | true | if enable, the admin of the server will be automaticaly with antipvp privilegies. | | pvpinvul_admin_privs | bool | true | if enable, the admin of the server will be automaticaly with antipvp privilegies. |
| pvpinvul_send_to_all | bool | true | if enable, when a hitter try to hurt to a invulnerable player, send the message to all players. | | pvpinvul_send_notify | bool | true | if enable, permit to send notifications chat messages to involved players, check the next setting for details |
| pvpinvul_send_to_all | bool | false | if enable, when a hitter try to hurt to a invulnerable player, send the message to all players. |
For more info check https://codeberg.org/venenux/venenux-minetest/src/branch/master/tutorials/manage-minetest-configuration.md For more info check https://codeberg.org/venenux/venenux-minetest/src/branch/master/tutorials/manage-minetest-configuration.md

View File

@ -1,6 +1,7 @@
-- Copyright (C) 2021 Sandro Del Toro De Ana -- Copyright (C) 2021 Sandro Del Toro De Ana
-- Copyright (C) 2022 PICCORO Lenz McKAY
-- This file is part of antipvp Minetest Mod. -- This file is part of antipvp Minetest Mod.
@ -48,7 +49,14 @@ local kill_hitter = core.settings:get_bool("antipvp_kill_hitter") or false
local admin_privs = core.settings:get_bool("antipvp_admin_privs") or true local admin_privs = core.settings:get_bool("antipvp_admin_privs") or true
local send_to_all = core.settings:get_bool("antipvp_send_to_all") or true local send_notify = core.settings:get_bool("antipvp_send_notify") or true
local send_to_all = core.settings:get_bool("antipvp_send_to_all") or false
if kill_hitter == nil then kill_hitter = false end
if admin_privs == nil then admin_privs = true end
if send_notify == nil then send_notify = true end
if send_to_all == nil then send_to_all = false end
-- compat with irc mod fork -- compat with irc mod fork
if core.get_modpath("irc") then if core.get_modpath("irc") then
@ -89,12 +97,14 @@ core.register_on_punchplayer(
core.chat_send_player(hitter_name, S("You can not hurt a God") ) core.chat_send_player(hitter_name, S("You can not hurt a God") )
core.chat_send_player(player_name, S("@1 try hurt you", hitter_name) ) core.chat_send_player(player_name, S("@1 try hurt you", hitter_name) )
if core.get_modpath("irc") then if core.get_modpath("irc") then
if send_to_all then if send_notify then
irc.saysec(hitter_name.." try hurt to "..player_name) if send_to_all then
else irc.saysec(hitter_name.." try hurt to "..player_name)
irc.saysec(player_name, hitter_name.." try hurt you") else
irc.saysec(player_name, hitter_name.." try hurt you")
end
end end
minetest.log("error","[antipvp] "..hitter_name.." try hurt to "..player_name) minetest.log("error","[antipvp] "..hitter_name.." try hurt to "..player_name)
end end
return true return true
end end

View File

@ -1,3 +1,4 @@
name = antipvp name = antipvp
title = antipvp
optional_depends = irc optional_depends = irc
description = PVP Invulnerability Privilege for players description = PVP Invulnerability Privilege for players

View File

@ -5,5 +5,8 @@ antipvp_kill_hitter (Kill hitter to antipvp privilegies) bool false
# if enable admin will be pvp invulnerable # if enable admin will be pvp invulnerable
antipvp_admin_privs (Give automatically to the admin of server pvp invulnerable privs) bool true antipvp_admin_privs (Give automatically to the admin of server pvp invulnerable privs) bool true
# if enabled send the notification of try to hurst you to the player
antipvp_send_notify (Send or not message notifiacion in chat of those involved) bool true
# if enabled send the activity of hurt to invulnerable players to all the chats! # if enabled send the activity of hurt to invulnerable players to all the chats!
antipvp_send_to_all (Send message to all the players and not only those involved) bool true antipvp_send_to_all (Send message to all the players and not only those involved) bool false