mod query: private object destroyer

Post Reply
User avatar
lister
Member
Posts: 100
Joined: Mon Apr 11, 2016 23:14

mod query: private object destroyer

by lister » Post

is there a mod or an existing capability, like tnt, that would allow players to destroy private/locked objects? like for example a chest non-owner should not be able to open the chest, but should be able to destroy it, items and all; same for doors, etc.

User avatar
AspireMint
Member
Posts: 393
Joined: Mon Jul 09, 2012 12:59
GitHub: AspireMint
IRC: AspireMint
In-game: AspireMint
Location: Stuck at spawn

Re: mod query: private object destroyer

by AspireMint » Post

You can make new mod, put to init.lua:

Code: Select all

minetest.after(0, function()
    for nodename, def in pairs(minetest.registered_nodes) do
        if def["can_dig"] then
            def["can_dig"] = function() return true end
        end
    end
end)

User avatar
Krock
Developer
Posts: 4596
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: mod query: private object destroyer

by Krock » Post

To make it per-player specific, consider registering a new item which uses "on_use" (punch) to remove whatever node it's currently pointing at.

EDIT: Or just extend the "on_dig" function supplied above to take the player name in account.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
lister
Member
Posts: 100
Joined: Mon Apr 11, 2016 23:14

Re: mod query: private object destroyer

by lister » Post

awesome, these are both great suggestions, thanks :) xoxoxo

Post Reply

Who is online

Users browsing this forum: Elektrika, LMD and 1 guest