featured antipvp:quiet node box to provide a secure (or a trap) place

* check if inside the area, and place is valid after check privs and player
* provide a ratio value configuration (less ratio, more like trap)
* update readme with licensing and information
* add expensive crafting recipe, obsidian brick, gold block and rose
This commit is contained in:
mckaygerhard 2023-01-02 22:58:53 -04:00
parent 5123fbc2f3
commit 313491f1b0
3 changed files with 88 additions and 8 deletions

View File

@ -13,10 +13,15 @@ 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.
This is a pvp invulnerability mod based on most others, mostly the most is
part of the venenux minenux server antimods mod, but in single simplified way.
Main difference are:
* do not hit performance of the server and the source code is more
didactically to learn by some users that wanst to modify (Check license please).
* it feature antipvp block that depending of configuration, on anarchy servers
can be a tramp or a hope, use with care
* the message event is configurable so it doesn't flood the chat for every hit
on multiple attacks (to all players or only involved)
* It provides backguard compatibility and stability for older engines, so
@ -33,8 +38,9 @@ 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.
WE only use telegram so find us for support https://t.me/+dvlpBEDUq3gzMTcx
For more info we use all the tools of Final Minetest by oldcoder http://minetest.org
### Configuration
@ -43,15 +49,46 @@ to the minetest config file at game directory, to the main global config file.
| config option | type | default | description |
| -------------------- | ---- | ------- | ----------- |
| 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. |
| antipvp_kill_hitter | bool | false | if enable, players that hit will be killed. |
| antipvp_admin_privs | bool | true | if enable, the admin of the server will be automaticaly with antipvp privilegies. |
| antipvp_send_to_all | bool | true | if enable, when a hitter try to hurt to a invulnerable player, send the message to all players. |
| antipvp_area_ratio | int | 2 | number in blocks to define peacefull antipvp area around the antipvp block. |
For more info check https://codeberg.org/venenux/venenux-minetest/src/branch/master/tutorials/manage-minetest-configuration.md
### Nodes
The `antipvp:quiet` block is a block that allows you to define an area out of damage
from other players, depending on how the radius of `antipvp_area_ratio` is configured,
**it can be helfully, a danger or a trap on anarchic servers**.
### crafting
```
{ "default:obsidianbrick", "default:goldblock", "default:obsidianbrick" },
{ "default:goldblock", "flowers:rose", "default:goldblock" },
{ "default:obsidianbrick", "default:goldblock", "default:obsidianbrick" },
```
### Related mods
* the antipvp mod from BrunoMine only provide a simple area using the nodebox, this
mod is fully compatible with and do not cause conflicts
* the pvpinvul mod from gnuhacker is just a setting over an admin player, it
does not provide privilegies either do not permit configure the messages
* rest of anti pvp mods are based on areas, not in a node position configuration,
this mos its like more like protection area node boxes
* the idea of this mod is to be more equilibrate to permit a hope but not promote lazy
over the players, so will mantain those layer keep on moving
If you are interested in more mods there are a huge amount of in the historical repo
of the real minetest page at http://minetest.org
## License
Copyright (C) 2022 PICCORO Lenz McKAY
Some portion and first base code were posible thanks to:
Copyright (C) ???? Sandro Del Toro De Ana
LICENCE CC-BY-SA-NC
License CC-BY-NC-SA-3.0 only . due sources were lost.

View File

@ -50,6 +50,8 @@ 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 area_ratio = tonumber(minetest.setting_get("antipvp_area_ratio") or 3)
-- compat with irc mod fork
if core.get_modpath("irc") then
if irc.saysec == nil then
@ -68,6 +70,25 @@ core.register_privilege("antipvp", {
give_to_admin = privs_give_to_admin,
})
core.register_node("antipvp:quiet", {
description = "Anti PVP place",
tiles = {"default_obsidian.png^[colorize:white:36^heart.png"},
paramtype = "light",
paramtype2 = "wallmounted",
is_ground_content = false,
sunlight_propagates = true,
walkable = false,
groups = {choppy=3, level=3}
})
minetest.register_craft({
output = "antipvp:quiet",
recipe = {
{ "default:obsidianbrick", "default:goldblock", "default:obsidianbrick" },
{ "default:goldblock", "flowers:rose", "default:goldblock" },
{ "default:obsidianbrick", "default:goldblock", "default:obsidianbrick" },
}
})
core.register_on_punchplayer(
function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
@ -81,11 +102,14 @@ core.register_on_punchplayer(
local hitter_name = hitter:get_player_name()
local player_invul = core.check_player_privs(player_name, {antipvp=true})
local hitter_invul = core.check_player_privs(hitter_name, {antipvp=true})
local player_ppos = player:getpos()
-- first we check if player its invulnerable
if player_invul then
if kill_hitter and not hitter_invul then
hitter:set_hp(0)
end
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
@ -99,6 +123,22 @@ core.register_on_punchplayer(
return true
end
if not player_ppos then
return false
end
-- not a invulnerable player.. then check if are over protected place
if core.find_node_near(player_ppos, area_ratio, "antipvp:quiet") then
core.chat_send_player(hitter_name, "is at a peaceful area... ")
if core.get_modpath("irc") then
if send_to_all then
irc.saysec(hitter_name.." try hurt on of the peacefull areas")
else
irc.saysec(hitter_name, "Dont try hurt the peacefull area")
end
end
return true
end
end
)

View File

@ -7,3 +7,6 @@ antipvp_admin_privs (Give automatically to the admin of server pvp invulnerable
# 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
# if enabled send the activity of hurt to invulnerable players to all the chats!
antipvp_area_ratio (Ration in blocks of the peacefull antipvp block) int 3