Wiki 9Minecraft OpenSecurity Mod Wiki

OpenSecurity Mod — Guide

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: 1. Place the Security Door blocks. 2. Place a Door Controller adjacent to the bottom block of the door. 3. Connect the Door Controller to your OpenComputers network via cable. 4. Use the component.os_door API 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.