Handles peripheral detection, door control, and sign updates for the TAC system. Provides utilities for finding and interacting with ComputerCraft peripherals.
View on GitHub →-- In your extension:
function MyExtension.init(tac)
local Hardware = require("tac.core.hardware")
-- Open a door by ID
Hardware.openDoor("tenant_door_1")
-- Find all NFC readers
local readers = Hardware.findPeripheralsOfType("nfc_reader")
for _, reader in ipairs(readers) do
print("Found reader: " .. reader)
end
-- Update a sign after access
Hardware.updateSign("back", "Access Granted", "Welcome!")
-- Show access animations
Hardware.showEnterAnimation()
Hardware.showDenyAnimation()
end
HardwareManager.findPeripheralsOfType(filter)Find peripherals of a specific type Searches all connected peripherals and returns a list of names matching the specified type. Useful for finding NFC readers, modems, monitors, etc.
filter (string): The peripheral type to search for (e.g., "nfc_reader", "modem", "monitor")HardwareManager.updateDoorSign(door)Update a door sign with door information Updates a sign peripheral to display the door name and tags. The sign will show the door name on line 2 with decorative borders. - sign (string): Peripheral name of the sign - name (string): Door name to display - tags (table): Array of tag strings
door (table): Door configuration with fields:HardwareManager.updateAllSigns(doors)Update all door signs Iterates through all doors and updates their signs with current information.
doors (table): Persistent doors storage object with .getAll() methodHardwareManager.showEnterAnimation(door, name, delay)Show enter animation on monitors Displays a welcome animation on a door's sign, gradually revealing the user's name. After the animation completes, restores the sign to its normal state.
door (table): Door configuration with sign peripheralname (string): Name to display in the welcome messagedelay (number): Total animation duration in secondsHardwareManager.showAccessDenied(door, reason)Show access denied message on door sign Displays a flashing "ACCESS DENIED" message on a door's sign with a custom reason. The message flashes 3 times before restoring the sign to its normal state.
door (table): Door configuration with sign peripheralreason (string|nil): Reason for denial (defaults to "ACCESS DENIED")HardwareManager.controlDoor(door, state)Control door relay (open/close) Sets the redstone output state for all sides of a door's relay peripheral. Used to physically open or close doors connected via redstone. - relay (string): Peripheral name of the redstone relay
door (table): Door configuration with fields:state (boolean): true to activate relay (open door), false to deactivate (close door)HardwareManager.openDoor(door, name, openTime)Open door for specified time Opens a door, optionally displays a welcome animation, then automatically closes it. The door will remain open for the specified duration or the door's default open time.
door (table): Door configurationname (string|nil): User name to display in animation (nil to skip animation)openTime (number|nil): Time in seconds to keep door open (defaults to door.openTime or DEFAULT_OPEN_TIME)