Hello,
I try to create a mod that disallows locked chests from different players to be placed close to each other, because I am quiet feed up by the fact, that there are a lot of *insert vulgar expression here* around, who seem to only like to destroy other peoples works on public servers. In addition to normal stealing and vandalism filling the area with locked chests seem to be quiet common too and in that case you have basically lost and can only move somewhere else.
For example see here: This was a small house and my locked chest is in the middle of the chestwall
So I thought about fixing some of this aspects with a mod. My dream would be something like this:
- If you find an empty area you can build something and 'protect' it with locked chests
- griefers cannot destroy the area
- griefers cannot surround your chests with other chests. (this is the only thing the mods currently archives)
- If you don't visit the server for some days/weeks, the chest is replaced by a normal chest
--> someone else can reclaim the abandoned area
So far the mod does the following:
- locked chests from different players cannot be placed withing 5 nodes of a locked from another player
- if you punch a locked chest it converts itself to a normal chest keeping the content
But now I am stuck. I don't know how to do the following things:
- store some counter in the metadata of the node
- detect if the owner of the chest has interacted with the chest
- I suspect disallowing digging blocks around a locked chest is not possible in a performance friendly way in lua, or do I miss some nice function here?
I have uploaded the file so far at this place:
https://gitorious.org/chlue-minetest-mods/mod-spreaded_locked_chests/commits/dev
Does anyone have some hints how to proceed (if this is actually possible with the current mod api)