One Hour One Life Forums

a multiplayer game of parenting and civilization building

You are not logged in.

#1 2018-05-01 02:25:51

jasonrohrer
Administrator
Registered: 2017-02-13
Posts: 4,805

How locks work

I saw someone saying something like, "Why bother making a lock?  All someone has to do is make a key and open it."

That's not true... so I thought I'd clear up some confusion.

Locks use a new object system called "variable objects."  They only show up as a single object in the crafting tree, as seen here:

https://kazetsukai.github.io/onetech/#9 … y----%2410

BUT, notice the $10 part of the description comment.  That is a variable that will be filled at runtime with ten different values (1...10) to make ten different locks.

Only the matching key works in a given lock.

And the only way to get a key for that lock is to craft the right numbered lock-and-key combo from scratch OR get a hold of the original key and duplicate it.

I'm using $10 to test the system, but $50 or $100 is possible.

But even with only 10 keys, opening a lock is not a simple matter.


Also, I'm aware that there is a bit of an information leak here, in that the map sent to the client contains the actual item ID of the lock and not the ID of the base object.  Yes, the client hides the comment from the description, but an easy client mod can change that.

The solution is coming in the near future, where any variable objects will be replaced with their parent, non-variable item ID before being sent to the client.  So, for example, all locked doors would be seen client-side as object 921, instead of 1205, 1206, 1207, etc (the locked door objects that are created at runtime).


Variable objects can be used for other things besides keys and locks...  maybe even for naturally-occurring items.

Offline

Board footer

Powered by FluxBB