This page documents the simple adjacent-block detection callback used by agents such as robots.
- Repository:
opencomputers - Typical Lua component names: usually part of
robotor other agent-like devices - Backing trait:
WorldControl
- Syntax:
device.detect(side) - Returns:
boolean, string - Purpose: Checks what occupies the adjacent block space on the specified side.
Return value meanings:
- First value: whether the side is considered occupied or blocked for interaction purposes.
- Second value: a category string describing what was found.
Known category strings in this source version:
airentityliquidreplaceablepassablesolid
Interpretation notes:
airreturnsfalse, "air".entity,passable, andsolidreturntruewith their respective labels.liquidandreplaceabledepend on the result of a break-permission style event check.
local robot = require("robot")
local sides = require("sides")
local blocked, kind = robot.detect(sides.front)
print("Blocked:", blocked)
print("Kind:", kind)opencomputers-inventory-world-controlrobot