tac.core.hardware v1.0.1

Handles peripheral detection, door control, and sign updates for the TAC system. Provides utilities for finding and interacting with ComputerCraft peripherals.

Author: Twijn
View on GitHub →

Examples

-- 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

Functions

MyExtension.init()

View source

In your extension:

HardwareManager.findPeripheralsOfType(filter)

View source

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.

Parameters:
Returns: table Array of peripheral names matching the filter

HardwareManager.updateDoorSign(door)

View source

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

Parameters:

HardwareManager.updateAllSigns(doors)

View source

Update all door signs Iterates through all doors and updates their signs with current information.

Parameters:

HardwareManager.showEnterAnimation(door, name, delay)

View source

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.

Parameters:

HardwareManager.showAccessDenied(door, reason)

View source

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.

Parameters:

HardwareManager.controlDoor(door, state)

View source

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

Parameters:

HardwareManager.openDoor(door, name, openTime)

View source

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.

Parameters: