Overview#
OpenSecurity is a specialized expansion for the OpenComputers mod, designed to provide players with advanced, programmable security systems. It bridges the gap between digital logic and physical defense, allowing users to write Lua scripts that control access to their bases. The mod introduces a variety of peripheral devices including biometric scanners, magnetic card readers, RFID systems, and high-energy defensive turrets.
In the 1.12.2 and 1.10.2 versions, OpenSecurity focuses on tight integration with the OpenComputers component system, ensuring that every block can be interacted with via a Computer, Microcontroller, or Robot. This mod is essential for players on multiplayer servers who need to protect their assets from intruders or for those who enjoy complex automation and access control systems.
Blocks#
The blocks in OpenSecurity serve as the primary interface between the physical world and the computer system. Most blocks function as OpenComputers components.
Alarm
The Alarm block is used to provide audible alerts. It can play a variety of pre-defined sounds or custom sounds defined in the configuration.
- API Methods:
alarm.setAlarm(string:name): Sets the sound to be played.alarm.listAlarms: Returns a list of available sounds.alarm.activate: Starts the alarm.alarm.deactivate: Stops the alarm.
Biometric Reader
This block identifies players who interact with it. It is perfect for creating owner-only access points.
- Event:
bioData(returns the player's UUID and name).
Card Writer
The Card Writer is used to encode data onto Magnetic Cards, RFID Cards, and Smart Cards. It is the central hub for creating your security credentials.
- API Methods:
cardWriter.write(string:data, string:label, boolean:lock, number:color): Writes data to the card in the slot.
Door Controller
This block is placed adjacent to Security Doors. It allows the computer to programmatically open or close the door, and can even lock it to prevent manual interaction.
- API Methods:
door.open: Opens the door.door.close: Closes the door.door.toggle: Toggles the door state.
Energy Turret
A powerful defensive block that consumes energy (RF/EU/OC) to fire beams at entities. It requires a high-tier computer to manage targeting logic.
- API Methods:
turret.setHeading(number:yaw): Rotates the turret.turret.setPitch(number:pitch): Tilts the turret.turret.fire: Discharges the beam.
Keypad
A 3x3 grid that allows players to input numeric codes. It does not store codes itself; it simply passes the input to the computer for validation.
- Event:
keypad(returns the button pressed and the player name).
Mag Card Reader
Reads Magnetic Cards when they are right-clicked on the block.
- Event:
magData(returns the data stored on the card).
RFID Reader
An active scanner that detects RFID Cards within a specific radius (default 16 blocks). It can read cards even if they are inside a player's inventory.
- API Methods:
rfidReader.scan(number:range): Scans for nearby RFID cards.
Security Door
A blast-resistant door that is nearly indestructible. It cannot be opened by hand and must be controlled by a Door Controller.
Nano-Fog Terminal
Controls the deployment of Nano-Fog, a programmable cloud of particles that can act as a solid wall, a damaging barrier, or a transparent window based on computer commands.
Items#
Items in OpenSecurity are primarily used for identification and authentication.
| Item | Description | Usage |
|---|---|---|
| Magnetic Card | A standard swipe card. | Used with the Mag Card Reader. |
| RFID Card | A passive transponder card. | Detected by the RFID Reader at a distance. |
| Smart Card | A high-security card. | Can store more data and requires specific authentication. |
| Nano-Fog Swarm | A collection of nanobots. | Used as fuel/material for the Nano-Fog Terminal. |
| Security Wrench | A tool for configuring blocks. | Used to rotate or dismantle OpenSecurity blocks. |
Mechanics and API#
The Event System
OpenSecurity relies heavily on the OpenComputers event bus. Instead of polling blocks constantly, your scripts should listen for specific signals.
Example Keypad Script:
local event = require("event")
while true do
local _, address, button, player = event.pull("keypad")
print(player.. " pressed button: ".. button)
end
Security Door Logic
Security Doors are unique because they are composed of two parts: the physical door blocks and the Door Controller. The door blocks themselves have no UI. To use them:
- Place the Security Door blocks.
- Place a Door Controller adjacent to the bottom block of the door.
- Connect the Door Controller to your OpenComputers network via cable.
- Use the
component.os_doorAPI to manipulate the state.
Energy Turret Targeting
The turret uses a spherical coordinate system (Yaw and Pitch). To track a player, you must calculate the vector between the turret's coordinates and the player's coordinates (often obtained via a Sensor or Radar from other mods) and convert that to angles.
Recipes#
Crafting in OpenSecurity follows the standard OpenComputers progression, requiring Microchips (Tier 1-3), Printed Circuit Boards (PCB), and various metals.
| Result | Ingredients |
|---|---|
| Alarm | Iron Ingots, Redstone, Note Block, Tier 1 Microchip |
| Keypad | Iron Ingots, Buttons, Tier 1 Microchip |
| Mag Card Reader | Iron Ingots, Redstone, Tier 2 Microchip |
| RFID Reader | Gold Ingots, Redstone, Tier 3 Microchip, Antenna |
| Energy Turret | Steel/Iron Plates, Tier 3 Microchip, Laser Focus, Energy Cell |
| Security Door | Iron Plates, Obsidian, Redstone |
Note: Recipes may vary slightly depending on whether OreDictionary is enabled or if other industrial mods are present.
Configuration#
The mod's behavior can be adjusted in the opensecurity.cfg file. Key configuration options include:
- Turret Damage: Adjusts the amount of damage dealt by the Energy Turret per shot.
- Turret Range: Sets the maximum distance the turret beam can travel.
- RFID Range: Defines the maximum radius for the RFID Reader (default is 16).
- Alarm Volume: Global multiplier for the alarm sound levels.
- Enable Door Breakage: If set to false, Security Doors are completely indestructible by players in survival mode.