[Mod] locks [locks]

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

[Mod] locks [locks]

by Sokomine » Wed Nov 07, 2012 00:59

Update: (Version 1.20) Added support for pipeworks. Shared locked chests and furnaces can now connect to tubes - just like normal chests and furnaces.

Update: Made minor change to make it runnable with newer versions of Minetest and added shared locked furnaces.

This is how the modified locked xdoors2 look. It also shows a list of available commands:
Image

This mod adds functionality to lock and share objects that have been adopted to this mod. The owner (=the one who placed the object) can grant other players usage of the object. Thus, the object may be shared by several players while beeing inaccessible to others.

Sample usage of a shared locked chest:
Image

A modified chest, sign (both from the default game) and doors2 (a mod from xyz) come with the mod as sample objects. Other objects for which this mod might be of intrest could be protector, furnances, teleporters, batteries (technic) or whatever you need.

The chest is most likely the most useful object: If you want to give something to a player who isn't online or roams around elsewhere, you can just put it into a shared locked chest and add the player as one of those allowed to use that chest. He can then pick the stuff up whenever he's close to the chest.

Locked doors seem quite popular as well, though I have mixed feelings about them. They where one of the reasons this mod was created in the first place; still, placing locked doors requires to think about it. It is not that good if there are too many locked doors (multiplayer servers are there so that other people can have a look at your house!), so use with care.

Another way of granting access to a shared locked object is by setting a password with the /set command. If none is set then no one can gain access that way. If a password is set and someone types it in, that player gets access to the object. Thus you can create simple puzzles if you like.

Other ways of getting acces to such objects are the diglocks priv (anyone who has that priv can do the same things with the object as the original owner) and the openlocks priv (acts as if the player has been added by the owner as a legitimate user).

I'm working on a mod called "playergroups" that allows the player to create groups of playernames so that he/she can e.g. create a group "friends" and then do "/add :friends" on each shared locked object instead of typing all the names in for every object. That mod works to a degree, but there's no guarantee. The playergroups mod has not been tested extensively.

The textures (lock, key, keychain, door with lock) have been provided by Addi. Please consult textures/licence.txt.

Download: https://github.com/Sokomine/locks/zipball/master
Browse code: https://github.com/Sokomine/locks
Version: 1.20 Added support for pipeworks
1.16 Pressing ESC in newer MT versions aborts input again (as in older versions)
1.1 first Version
Licence: GPLv3
Supports: * Pipeworks
TODO: Add textures for shared locked signs, chests and furnaces. Help wanted!

In order to use your own shared locked objects, you do need a key:
Image

The keychain is necessary to acces shared locked objects of other players. May also be used for your own objects instead of a key. One keychain is enough for all shared locked objects you encounter:
Image

The lock is a craftitem used to craft shared locked objects:
Image

Shared locked chest:
Image

Shared locked sign:
Image

Shared locked xdoor2:
Image

Shared locked furnace:
Image

The mod can be seen in action on King Arthurs Land.
Attachments
locks.090514.zip
Current version (from 09.05.2014)
(33.18 KiB) Downloaded 253 times
locks.zip
Deprecated. Please ignore.
(33.03 KiB) Downloaded 181 times
locks.zip
Deprecated. Please ignore.
(31.76 KiB) Downloaded 191 times
Last edited by Sokomine on Sun Mar 20, 2016 19:36, edited 5 times in total.
A list of my mods can be found here.
 

User avatar
InfinityProject
Member
 
Posts: 1009
Joined: Sat Mar 17, 2012 00:52

by InfinityProject » Wed Nov 07, 2012 01:37

Very Nice! +1
 

Josh
Member
 
Posts: 1146
Joined: Fri Jun 29, 2012 23:11

by Josh » Wed Nov 07, 2012 02:09

Cool! +2
 

User avatar
Aqua
Member
 
Posts: 641
Joined: Wed Aug 22, 2012 09:11

by Aqua » Wed Nov 07, 2012 04:22

Nice work=D
Hi there ^.~
 

User avatar
Topywo
Member
 
Posts: 1718
Joined: Fri May 18, 2012 20:27

by Topywo » Wed Nov 07, 2012 10:47

The shared chest can be very usefull, good work! The textures are also looking good!
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Wed Nov 07, 2012 13:22

Awesome!

I have been waiting for ages to get a shared locked chest.

I thought about doing this a while ago, but i have no idea how FormSpec works

Can you make this mod into a mod pack, so server owners can chose which parts to add?
IE: Shared Locked boxes but not locked doors
Last edited by rubenwardy on Wed Nov 07, 2012 13:23, edited 1 time in total.
 

User avatar
webdesigner97
Member
 
Posts: 1307
Joined: Mon Jul 30, 2012 19:16
GitHub: webD97
IRC: webdesigner97
In-game: webdesigner97

by webdesigner97 » Wed Nov 07, 2012 13:29

Sounds very cool! :D
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Wed Nov 07, 2012 14:57

Removing unwanted shared locked objects is quite easy: Just delete or comment out those lines at the end of init.lua that you don't want:
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
dofile(minetest.get_modpath("locks").."/shared_locked_chest.lua");
dofile(minetest.get_modpath("locks").."/shared_locked_sign_wall.lua");
dofile(minetest.get_modpath("locks").."/shared_locked_xdoors2.lua");

After that you can (but don't have to) delete the corresponding file as well, i.e. shared_locked_xdoors2.lua.

FormSpecs are quite useful. It is even possible to change them during the lifetime of the object. Unfortionately there is no way to react to a player right-clicking and to change the menu at that time. Thus I went for a simple FormSpec input line for the handling of the locks.
A list of my mods can be found here.
 

Dragonop
Member
 
Posts: 1178
Joined: Tue Oct 23, 2012 12:59
GitHub: Dragonop
IRC: Dragonop
In-game: Dragonop

by Dragonop » Wed Nov 07, 2012 19:55

THIS could be added to the main game +5
Last edited by Dragonop on Thu Dec 17, 2015 16:32, edited 2 times in total.
 

User avatar
addi
Member
 
Posts: 605
Joined: Thu Sep 20, 2012 03:16

by addi » Thu Nov 08, 2012 14:23

Topywo wrote:[...]The textures are also looking good!

thanks :-)
the textures was made by me XD
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Thu Nov 08, 2012 16:03

Locked doors are only useful if you incorporate node protection around them, but only the ones that use can_dig(). Protection mods that user after_place or on placenode, people have time to fly through before the nodes reappear.

Ideally, you could have protection built-in so that when player places a locked door, it has the effect of protecting the whole dwelling? save the server admins the trouble of setting up small zones :-)
"Fuck the hat." - Paulie Gualtieri
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Thu Nov 08, 2012 19:10

Right, without some sort of node protection the doors can be digged around and are more or less symbolic. Using them as tools to define protected areas is something I don't want - because that would lead to too many locked doors and inaccessible buildings. But the idea might be extended to another node - a node that can be placed as easily as a protector node and help define a larger area as protected.
A list of my mods can be found here.
 

fgr
Member
 
Posts: 85
Joined: Mon Sep 17, 2012 08:22

by fgr » Thu Nov 08, 2012 19:52

mauvebic wrote:....., it has the effect of protecting the whole dwelling? save the server admins the trouble of setting up small zones :-)


ummmm .... well, how you want to figure out how large the protected area / building / zone should be if you have neighbor?
 

clarksallador
Member
 
Posts: 57
Joined: Sun Sep 30, 2012 03:18

by clarksallador » Mon Dec 31, 2012 17:13

not working...again its from the lua
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Mon Dec 31, 2012 18:14

Can you be more specific? Just a "not working" doesn't help much. What does not work as expected? Which version are you running?
A list of my mods can be found here.
 

EnryStar
New member
 
Posts: 8
Joined: Thu Dec 27, 2012 11:15

by EnryStar » Mon Dec 31, 2012 19:26

Nice ! And whith fournaces ?
Last edited by EnryStar on Mon Dec 31, 2012 19:26, edited 1 time in total.
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Mon Dec 31, 2012 20:17

Furnances can be adapted in a similar way. Might make sense to include them. I'll have a look at the code of furnances.
A list of my mods can be found here.
 

clarksallador
Member
 
Posts: 57
Joined: Sun Sep 30, 2012 03:18

by clarksallador » Tue Jan 01, 2013 01:05

C:\Users\user\Downloads\minetest=0.4.3-win32\bin\..\games\minetest_game\mods\Sokomine-locks-4d336b5\init.lua
this also im using 0.4.3
 

User avatar
Topywo
Member
 
Posts: 1718
Joined: Fri May 18, 2012 20:27

by Topywo » Tue Jan 01, 2013 13:29

clarksallador wrote:C:\Users\user\Downloads\minetest=0.4.3-win32\bin\..\games\minetest_game\mods\Sokomine-locks-4d336b5\init.lua
this also im using 0.4.3


Try:

C:\Users\user\Downloads\minetest=0.4.3-win32\bin\..\games\minetest_game\mods\locks\init.lua

Works for most mods with a name/version number/master in the foldername.

If it doesn't work, consider upgrading/installing the latest minetest version. But you still need to rename those kind of folders.
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Tue Jan 01, 2013 15:58

Ah, yes, sorry. All mods from github do carry a version number. Some people work around this by turning their mods into a modpack. But other mods will need renaming anyway. For my local singleplayer game, I do have a directory with a lot of mods and symlink those I want to have for the current game to the appropriate folder.
A list of my mods can be found here.
 

User avatar
sfan5-bot
Member
 
Posts: 35
Joined: Thu Mar 28, 2013 11:19

by sfan5-bot » Thu Mar 28, 2013 16:45

[EE] No License found


Please fix these Mistakes and report this post, a moderator will delete it
If you believe I have made a Mistake contact sfan5
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Wed Jul 10, 2013 20:51

Fixed a minor bug that caused the mod not to run with some recent versions.

Added shared locked furnaces.

Textures for the shared locked objects (sign, chest, furnace - maybe similar to the door?) are welcome!

License added. Re-added images after they where lost due to the disappearance of zimg.eu.
Last edited by Sokomine on Wed Jul 10, 2013 20:52, edited 1 time in total.
A list of my mods can be found here.
 

User avatar
Inocudom
Member
 
Posts: 2889
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Thu Jul 11, 2013 02:28

Does this work with homedecor's doors?
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Thu Jul 11, 2013 03:52

No, it only works with the doors it comes with - the ones shown in the first screenshot. The mod is built so that adapting it to new objects is pretty easy. The doors from homedecor could be adopted if homedecor where to depend on the locks mod (not very likely) or if new versions of them with support for the locks mod where created. The doors need some technical changes to support the lock-functionality (i.e. adding a configuration line in a formspec, checking if they're allowed to be opened etc.)
A list of my mods can be found here.
 

User avatar
addi
Member
 
Posts: 605
Joined: Thu Sep 20, 2012 03:16

by addi » Fri Jul 12, 2013 02:28

Here a short instruction how to add a optional dependence on this mod and execute your own functions if it is installed.

you must only change 2 things

first:
add locks? to depends.txt
depends.txt
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
default
locks?

!important dont forgett the ? after the locks

it makes a optional dependence to the locks mod. if it is installed it is loading first.

the next step is:
add this function to init.lua (or somewhere other)
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
if locks then
local MODPATH = minetest.get_modpath(minetest.get_modname());
dofile(MODPATH.."/shared_locked.lua")
end


!important you must check if the locks api is registered! only to check with minetest.get_modpath("locks") will crash the server if you forgett to add the locks? into depends.txt

step 3:

create the file shared_locked.lua
and register the nodes in it and using the locks api
 

User avatar
addi
Member
 
Posts: 605
Joined: Thu Sep 20, 2012 03:16

by addi » Sun Dec 15, 2013 13:52

due the new feature of minetest 0.4.8 the text of the shared locked signs dose change if the formspec is canceled with the ESC key.
it dose also happen to the other shared locked stuff
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Tue Dec 17, 2013 02:10

Thanks for the bug report. I've fixed it and uploaded a new version to github. Aborting input ought to work now as before.
A list of my mods can be found here.
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Sat Jan 11, 2014 02:25

Upon request, I've added support for pipeworks. Tubes from that mod can be used with the shared locked chest and furnace like with a normal chest and furnace (i.e. tubes can connect to them). There's also a command
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
/pipeworks

which you can enter into the command window of shared locked chests/furnaces to toggle output to tubes on or off. Right now this does not work because pipeworks epects another return value than what the MT documentation says, so watch out for new versions of pipeworks.
A list of my mods can be found here.
 

Nore
Member
 
Posts: 468
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Sat Jan 11, 2014 06:59

Sokomine wrote:Upon request, I've added support for pipeworks. Tubes from that mod can be used with the shared locked chest and furnace like with a normal chest and furnace (i.e. tubes can connect to them). There's also a command
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
/pipeworks

which you can enter into the command window of shared locked chests/furnaces to toggle output to tubes on or off. Right now this does not work because pipeworks epects another return value than what the MT documentation says, so watch out for new versions of pipeworks.

Done ;)
 

User avatar
Achilles
Member
 
Posts: 246
Joined: Sun Dec 15, 2013 11:55
In-game: Achilles

by Achilles » Sat Jan 18, 2014 17:41

WOW, i really like this mod. Thanks for doing it.
Can you only use keys to open shared locked doors, chests and etc, or can you also:
1) set a password/passwords
2) Add a clients name to the shared locked door/chest so that he/she can open it.
The Ironic Thing About Common Sense Is That It Isn't Very Common
 

Next

Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 80 guests

cron