[Mod] locks [locks]

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

[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 235 times
locks.zip
Deprecated. Please ignore.
(33.03 KiB) Downloaded 108 times
locks.zip
Deprecated. Please ignore.
(31.76 KiB) Downloaded 124 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
Location: World of Infinity, US
 

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

User avatar
Aqua
Member
 
Posts: 641
Joined: Wed Aug 22, 2012 09:11
Location: Sydney~Singapore

by Aqua » Wed Nov 07, 2012 04:22

Nice work=D
Hi there ^.~
 

User avatar
Topywo
Member
 
Posts: 1720
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
Moderator
 
Posts: 5545
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
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: 1323
Joined: Mon Jul 30, 2012 19:16
Location: Bergisch Gladbach, Germany
GitHub: webD97
IRC: webdesigner97
In-game: webdesigner97
 

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

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:
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
Location: Argentina
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: 638
Joined: Thu Sep 20, 2012 03:16
Location: Black-Forest, Germany
GitHub: adrido

by addi » Thu Nov 08, 2012 14:23

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

thanks :-)
the textures was made by me XD
 

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 :-)
 

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

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: 86
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
Location: Philippines

by clarksallador » Mon Dec 31, 2012 17:13

not working...again its from the lua
 

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

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: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

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
Location: Philippines

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: 1720
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: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

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: 34
Joined: Thu Mar 28, 2013 11:19
Location: /usr/bin/python2.7

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: 3616
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

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: 3018
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?
Recovering from the abomination I am. Clocking time for Garry's Mod I am too.
 

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

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: 638
Joined: Thu Sep 20, 2012 03:16
Location: Black-Forest, Germany
GitHub: adrido

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
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)
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
 

Next

Return to Mod Releases



Who is online

Users browsing this forum: Mikola and 10 guests