Page 1 of 1

Weak node protection for PVP

PostPosted: Mon Feb 20, 2017 15:49
by Naj
I'm thinking about a special protection system for PVP maps.

Idea is to make players build strongholds to protect their wealth and body.

In protected area, nodes are still digable by every one but:
1 - With a very low efficiency (maybe 100 times less efficient than unprotected nodes);
2 - Only when owner is connected (avoid offline players building demolition);
3 - Sends a warning to the owner when his/her protected nodes are being dug;

I'm not sure it is possible to code #1.

This means that minetest.is_protected should always return false (easy) and that tool efficiency or node hardness should depend on whether area is protected or not.

Do you have any idea of feasibility of this last aspect?

Re: Weak node protection for PVP

PostPosted: Mon Feb 20, 2017 18:29
by Byakuren
#1 is possible to code but would be a messy hack. You could make a duplicate of all digging tools and give the duplicate very large dig times. Every tick check if a player is in a protected area and wielding a digging tool, and replace it with the slow version if they are. If they are not in a protected area and are holding one of the slow versions, replace it with the normal version.

Re: Weak node protection for PVP

PostPosted: Tue Feb 21, 2017 08:40
by Naj
Thanks for the hack... it is a bit ugly :)

And it suppose that the mod should be aware of all digging Tools from other mods.

Re: Weak node protection for PVP

PostPosted: Tue Feb 21, 2017 17:30
by Byakuren
Naj wrote:Thanks for the hack... it is a bit ugly :)

And it suppose that the mod should be aware of all digging Tools from other mods.

To check if a tool is a digging tool you just have to check its digging groups. Mods might add new digging groups, so you might just change all dig times defined in all tools that have groups.

If you want to "go through" all the tools that will be defined, you can first apply the hack to existing tools in the registered items table, and then wrap minetest.register_tool so that it will register a duplicate for any newly-registered tools.

Re: Weak node protection for PVP

PostPosted: Sun Feb 26, 2017 15:21
by Krock
The protection mod LandRush already contains a setting where it is possible to grief someone's lands when its owner is online. It also notifies the owner when someone is actually griefing.

But it does not implement the slow digging - that would require a tool change ingame and per-player, which requires an engine change first to do this properly.

Re: Weak node protection for PVP

PostPosted: Sun Feb 26, 2017 20:52
by Xudo
You don't really need to protect all types of blocks.
You can implement special (colored) "team" block and assign group like "team1".
In addition, you can create "team" tools which are good for digging team1 blocks and are bad for digging team2, team3 etc blocks.
The question is: how to prevent getting other team tools.