Adds two fully-functional doors as craftable, buyable furniture. Lets modders create similar doors, as well as lockable door furniture with keys and key rings.
Adds (non-lockable) wooden and metal doors as furniture that can be crafted or purchased.
Provides an optional download that adds lockable wooden and metal doors as furniture that can be crafted or purchased.
Adds config options to change crafting and purchasing cost for the added doors.
Adds a very simple means for modders to create their own optionally-lockable door furniture.
Implements custom door furniture descriptions (the game does not normally allow custom furniture descriptions).
Implements door opening, closing, locking and unlocking by players.
Implements custom bounding boxes for doors, so players only collide with the door frame itself, rather than the entire tile.
Implements proper door animation for all four possible rotations as well as flipping for a total of eight possible positions per door.
Causes NPCs to open and close doors when walking through them.
Provides options for door auto-open and door auto-close after a specified delay.
Adds a door key item type for lockable doors and a key ring item type for key management.
Adds key naming, renaming, and copying.
Basic Usage
You can craft wooden doors using 10 wood and 5 hardwood or purchase them for 2000g from Robin.
You can craft metal doors using 10 iron bars and 5 refined quartz or purchase them for 5000g from Robin.
You can change the requrired ingredients and price in the config. Setting empty ingredients or negative price removes the item from crafting and purchasing respectively.
Holding a door, you can rotate it as with any other furniture. To flip the door horizontally, press the flip keybind (default F) while holding it.
After the door is placed, interacting with it will cause it to open or close.
Lockable Doors
The main mod file doesn't include any lockable doors, but adds full support for lockable doors. There is an optional file that adds two lockable doors that are otherwise identical to the two ordinary doors (apart from being named as lockable).
To lock a lockable door, walk up to it and press the lock key (default L). The first time you lock a door, it will give you a key and open a key naming menu to name the key. Keys only work on the door they were created for.
Locked doors cannot be picked up.
To unlock a lockable door, walk up to the locked door and press the lock key. The corresponding key must be in the player inventory.
Keys can be combined using the combine key (default middle mouse button), which turns them into a key ring. In an inventory, hold one key (or key ring), hover over another key (or key ring), and press the combine key.
To uncombine a key ring, hover over it while not holding anything, and press the combine key.
To make a copy of a door key, hover over it in an inventory and press the copy key (default C).
To rename a door key, hover over it in an inventory and press the rename key (default R).
Automation
You can set global automation for doors in the config.
Doors can be set to open automatically on collision. NPCs will automatically open doors when colliding with them (unless they are locked).
Doors can be set to close automatically after a delay in the config. NPCs will automatically close doors after 10 game ticks (can be changed in confg).
Automatic door closing timers only count down when no player or NPC is in range of the door.
Custom Door Sprites
To change the sprite for the two doors added by this mod, just target their sprite path using Content Patcher's EditImage function:
"aedenthorn.DoorFurniture_door"
To change the sprite for the default key and key ring items, target their sprite path using Content Patcher's EditImage function:
"aedenthorn.DoorFurniture_key"
Custom Doors
Creating basic custom doors is very simple.
First, create your custom door furniture using content patcher, e.g.:
Second, give your door furniture a sprite. This is the most difficult part, since the sprite needs three frames that are not identical to vanilla game sprites (for rotation 2 where the door knob is on the opposite side of the door). You can use the sprites included in this mod for reference.
Each door in the sprite requires 8 frames, as follows:
All fields can safely be omitted, unless you want custom functionality.
Field explanation is as follows:
Bounds - the collision bounds in pixels, one for each door rotation.
Type - used for the colored text to display as the category in tooltips.
Description - to be shown in place of generic furniture description in tooltips.
KeyItem - the ItemId of the type of item to use as a key for this type of door.
KeyRingItem - the ItemId of the type of item to use as a key ring for this type of door's keys.
OpenSound - played when the door opens.
CloseSound - played when the door closed.
LockSound - played when the door is locked.
UnlockSound - played when the door is unlocked.
AutoOpen - whether the door should auto-open when players collide with it, irrespective of the mod's config setting.
AutoCloseDelay - how many game ticks to wait before auto-closing the door (negative values means it won't auto-close.
Mod Config
You can use GMCM to edit the config variables. Options include:
Global auto-open and close settings
Door crafting and purchasing costs
Keybinds
Text Colors
Limitations
First, remember these are not map tiles, they are furniture. So, before I get asked a million times, no they won't magically recolor based on your map recolor mod. Fortunately, you can easily implement your own doors, or just change the sprite for the default doors as explained above.
NPCs do not respect locked doors - they will just walk through them; I think the alternative is probably not viable due to their schedules.
c96f0f63-11cc-49cc-a762-dd3f11d41e76
Technical
Requires SMAPI.
Implements a Generic Mod Config Menu interface to change config settings in-game. If you have GMCM Options, you can also change the colors in-game.