Page 1 of 1

[Mod] Locked door [locked_door]

PostPosted: Wed Aug 01, 2012 00:00
by Koros
A mod that adds a door that can be only be open/closed by the person that placed it. However, it is meant to be used with node protection since people can just dig around it. Also, it currently has a bug where if a person places it where the door doesn't have enough room to be placed, it disappears instead of going back into the inventory. If anyone knows how to fix this, it would be greatly appreciated.

Craft Recipe:
Same as a regular door except steel for the handle.
'wood', 'wood'
'wood', 'steel_ingot'
'wood', 'wood'

Dependencies:
None. Only the default is required.

License:
Everything is under the WTFPL.

Download link:
https://github.com/MetalDescendant/minetest-mod--locked_door/zipball/master
After placing in the correct mod directory, rename the unzipped directory to "locked_door"

created on Minetest-c55 0.4.dev-20120606

PostPosted: Wed Aug 01, 2012 01:28
by mauvebic
you can use the node declarations' can_dig to check for ownership :-)

Ex.:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_node( 'riventest:door_a_c', {
    Description         = 'Top Closed Door',
        [...]
    can_dig = function(pos,player)
        meta = minetest.env:get_meta(pos)
        return has_door_privilege(meta, player)
    end,   
})


can_dig function either has to return true or false, if false, player can't dig the door.

(Though without node protection of any kind, they can dig anywhere around it :-/)

PostPosted: Wed Aug 01, 2012 10:18
by Koros
Thanks for the suggestion mauvebic. Unfortunately, it doesn't prevent people from sneaking through the door by digging and running into it, or at least it didn't stop that on my computer. Instead, I've made the door immortal when closed and able to be dug when open to stop that. I think i'll add your suggestion to my code though to protect the open doors that aren't under node protection.

PostPosted: Fri Dec 28, 2012 15:30
by Iqualfragile
please update, its kindof unusable right now

PostPosted: Fri Dec 28, 2012 15:47
by PilzAdam
The default minetest_game since 0.4.4 has locked steel doors.