From 8d11f66ccc48cb0e0d0fb87c41b5822414314e34 Mon Sep 17 00:00:00 2001 From: PICCORO Lenz McKAY Date: Sun, 14 Aug 2022 16:20:53 -0400 Subject: [PATCH] implement the deactivation of the chat messages enabled by default * also update copyright and readme for this work.. original one are stalled --- README.md | 10 +++------- init.lua | 22 ++++++++++++++++------ mod.conf | 1 + settingtypes.txt | 5 ++++- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index dcf385d..d44b402 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,7 @@ This mod is named `antipvp` and add a priv that give PvP(Player vs Player) invul ## tech information -This is a fork from original https://notabug.org/gnuhacker/antipvp if still exits. - -Main difference are: +Inproved version of the mod and maybe in future anti damage mod, main features are: * the message event is configurable so it doesn't flood the chat for every hit 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 must be named as `antipvp`. -Original work can be downloaded from https://notabug.org/gnuhacker/pvpinvul if still exits. - - ### Configuration 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_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 diff --git a/init.lua b/init.lua index c0ca8ba..abdde1a 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,7 @@ -- Copyright (C) 2021 Sandro Del Toro De Ana +-- Copyright (C) 2022 PICCORO Lenz McKAY -- 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 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 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(player_name, S("@1 try hurt you", hitter_name) ) if core.get_modpath("irc") then - if send_to_all then - irc.saysec(hitter_name.." try hurt to "..player_name) - else - irc.saysec(player_name, hitter_name.." try hurt you") + if send_notify then + if send_to_all then + irc.saysec(hitter_name.." try hurt to "..player_name) + else + irc.saysec(player_name, hitter_name.." try hurt you") + 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 return true end diff --git a/mod.conf b/mod.conf index ac052dd..77bbe2b 100644 --- a/mod.conf +++ b/mod.conf @@ -1,3 +1,4 @@ name = antipvp +title = antipvp optional_depends = irc description = PVP Invulnerability Privilege for players diff --git a/settingtypes.txt b/settingtypes.txt index 325a722..175ad0f 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -5,5 +5,8 @@ antipvp_kill_hitter (Kill hitter to antipvp privilegies) bool false # if enable admin will be pvp invulnerable 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! -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