But, that is all complicated. In Earth's equivalent tech timeframe, barring doors was common and effective, and keys were rare. I simply would like the system of door locking to involve a dwarf, so the overseer would 'q' the door and specify the direction for this bar/lock action, and a job would be created where a dwarf would move to that side of the door and lock it, with the presumption the dwarf is barring the door. If a dwarf is unhappy or afraid, they would bar the doors in rooms they own. The vampires would not be able to path to them, but likely would find some other, dumber braver dwarf to feed on.
By default the dwarves ought to just 'jam' the doors of any rooms they own and are in, this would work to keep outsiders, also they should jam common doors if the player or AI orders it. Locks should have to be fitted on existing doors manually or as a requirement to build special locked doors. Locks should require keys, the advantage of keys over mere jamming is that it allows folks to lock a room when they are away as opposed to merely being able to keep folks out when they are inside a room and don't want visitors.
All locks are made to use three keys, the civilization master key, the site master key and a personal key, however only privately assigned rooms use the latter. Blank keys are made (and traded) as ordinery objects, however they do not do anything until they are formatted. This is done by a position with the new
[KEY_HOLDER] token (all the vanilla positions), these positions always ensure they have one master key for the level at which the operate, formatting blank keys at a craftsdwarf's workshop and carrying it with them. It might be a good idea for Toady One to train the AI to consider retrieving any nearby lost master keys a top priority.
Private keys work somewhat differently. A lock is given a random number string when it is made (or generated on onload) and the dwarf who claims the room will take an existing blank key from the stockpile and head to a position holder with the
[KEY_MAKER] token. This results in that position holder formatting a key to that particular random number string, which the room holder would then carry about with them. In AI sites the keys are simply generated for the locks that are also generated, at the same time and placed in the hands of the rooms generated owner, however should they lose their keys they can do the exact same thing as they do in fortress mode to get new keys. It might be a good idea to make it possible to assign ordinary folks to be key-makers to stop very large fortresses position holders being constantly badgered by key requests.