Weak node protection for PVP

User avatar
Naj
Member
 
Posts: 170
Joined: Sat Sep 19, 2015 21:14
GitHub: pyrollo
In-game: naj

Weak node protection for PVP

by Naj » Mon Feb 20, 2017 15:49

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?
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: Weak node protection for PVP

by Byakuren » Mon Feb 20, 2017 18:29

#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.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
Naj
Member
 
Posts: 170
Joined: Sat Sep 19, 2015 21:14
GitHub: pyrollo
In-game: naj

Re: Weak node protection for PVP

by Naj » Tue Feb 21, 2017 08:40

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.
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: Weak node protection for PVP

by Byakuren » Tue Feb 21, 2017 17:30

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.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Weak node protection for PVP

by Krock » Sun Feb 26, 2017 15:21

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.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

Xudo
Member
 
Posts: 20
Joined: Wed Nov 09, 2016 16:43
GitHub: xudojnikomsk
In-game: Xudo

Re: Weak node protection for PVP

by Xudo » Sun Feb 26, 2017 20:52

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.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 34 guests

cron