A little bit about locking
Let locking be the means to prevent use of some sort of device
Things that can be locked:
- Door (use = open)
- Chest (use = open)
- Magic portal (use = enter)
- Fountain (use = drink)
Types of unlock conditions
- Have XYZ key in inventory [active] [E]
- Actor being of a specific race, or having XYZ traits [E]
- Have all fragments of the key in inventory [active] [E]
- Time being midnight [W]
- A pressure plate being pressed [W]
- A lever having being pulled [W]
- A creature being dead [W]
- Any combination of the above, etc
Entity and world conditions
The unlock conditions are grouped as [E]ntity conditions, where the entity that tries to unlock should evaluate those to true, and [W]orld conditions, where when the state of the world changes with respect to the given conditions, the lock might activate/deactivate.
An actor can't explicitly lock or unlock a door with world conditions, as they need to change the state of the world in order to get these doors locked/unlocked (e.g. leave an item on a pressure plate, etc)
Active and passive entity conditions
[Active] entity conditions are ones that sort of require the user to do something, if we play out the scenario. Obviously no door opens because a key is in our pocket, but if it is in our pocket and we handle the door, and the door is locked, we can imagine us getting active and using that key in the lock.
Passive entity conditions don't need the actor to do something explicit. The actor handles the door, but the check happens in the background. The main difference gameplay-wise is that if there's a lock with a passive condition, after unlocking, the actor can't lock it again, as it is beyond the actor's actions.
Back-door
Locks can specify an unlock direction, so that if we somehow ended up in a locked room without the key (e.g. stepped on a teleporter trap), we can open it from the inside. Doing this bypasses all conditions, entity or world conditions. If we do have world conditions, the next time any of the condition changes (to any value), the lock will get enabled/disabled appropriately
Here's a video that shows a scenario of a lock with world-state conditions only: 3 pressure plates that need to be pressed, but we can also unlock from inside