CC:Optical
Adds sensor and cannon control peripherals to CC:Tweaked, compatible with Create:Aeronautics.

Sensors
Four variants with dynamic FOV zoom, target filtering, and scanning methods:
Optical Sensor (optical_sensor) — omni-directional by default (360° FOV) with a base range of 96 blocks. Supports narrowing FOV down to 15° for increased zoom range (up to 192 blocks). Requires direct line of sight (real terrain blocks only; sublevel terrain is transparent).
Directional Optical Sensor (directional_optical_sensor) — directional cone field of view (default 125°, adjustable down to 10°), base range 90 blocks at full FOV, zooming up to 512 blocks at minimum FOV.
Long Range Optical Sensor (long_range_optical_sensor) — directional cone field of view (default 125°, adjustable down to 10°), base range 96 blocks at full FOV, zooming up to 900 blocks at minimum FOV.
Radar (entity_radar) — omni-directional, base range 64 blocks, ignores line of sight. Placing adjacent Radar Booster (radar_booster) blocks adds +224 blocks per booster (up to 2 boosters for 512 blocks total). Adding a 2-block antenna (lightning rods or iron bars) on top of the radar or on any of its boosters multiplies the booster effect, boosting the radar range up to ~900 blocks. Position readings have Gaussian noise (increases with distance, varies by sensor altitude relative to sea level).
Detections work across sublevel boundaries. A sensor on an airship can spot another airship and the entities inside it. Each detection carries the sublevel UUID when the target is inside one. Decorative non-entities (paintings, item frames, displays, markers) are automatically ignored.
Detection fidelity decreases with range, but recognition distances scale dynamically with FOV zoom and booster upgrades. Beyond precision limits, targets are classified only by size (object_small/object_mid/object_large). Radar position noise grows linearly with distance and varies with the sensor's altitude relative to sea level.
Range & Recognition Scaling
| Sensor / Configuration | FOV / Addons | Max Range | Exact Type (type) | Player Name (name) |
|---|---|---|---|---|
| Optical Sensor | 360° (Omni) | 96 m | ≤ 56 m | ≤ 40 m |
| Optical Sensor | 15° (Zoom) | 192 m | ≤ 112 m | ≤ 80 m |
| Directional Optical | 125° (Full FOV) | 90 m | ≤ 56 m | ≤ 40 m |
| Directional Optical | 10° (Max Zoom) | 512 m | ≤ 318 m | ≤ 227 m |
| Long Range Optical | 125° (Full FOV) | 96 m | ≤ 56 m | ≤ 40 m |
| Long Range Optical | 10° (Max Zoom) | 900 m | ≤ 525 m | ≤ 375 m |
| Radar | Base (0 Boosters) | 64 m | ≤ 28 m | ≤ 18 m |
| Radar | 1 Booster | 288 m | ≤ 126 m | ≤ 81 m |
| Radar | 2 Boosters (Full Boost) | 512 m | ≤ 224 m | ≤ 144 m |
| Radar | 1 Booster + Antenna | 482 m | ≤ 211 m | ≤ 135 m |
| Radar | 2 Boosters + Antenna | 900 m | ≤ 394 m | ≤ 253 m |
Lua API
Sensor methods available in CC:Tweaked:
| Method | Parameters | Returns | Description |
|---|---|---|---|
scan | relativeCoords: boolean (optional) | table | Run an immediate scan. If true, returned positions are rotated into the sensor's sublevel local frame. |
setFov | fov: number | number | Sets optical field of view in degrees (clamped to [minFov, maxFov]). Narrower FOV increases effective range. Optical only. |
getFov | — | number | Returns current field of view in degrees. |
getMinFov | — | number | Returns minimum allowed field of view in degrees. |
getMaxFov | — | number | Returns maximum allowed field of view in degrees. |
getRange | — | number | Returns current effective detection range in blocks (scales dynamically with FOV). |
setFilter | typeOrList: string|table (optional) | string[] | Sets active target filter (by exact ID, short name, "sublevel", or size class "object_small"/"object_mid"/"object_large"). Unmatched entities do not count towards target limits. Pass nil to clear. |
getFilter | — | string[] | Returns array of currently active target filters. |
clearFilter | — | boolean | Clears all active filters. |
isOptical | — | boolean | Returns true if this is an optical sensor supporting FOV/zoom/filtering, false for radar. |
scan() return table
| Field | Type | Description |
|---|---|---|
count | number | Number of detections |
lastScanTick | number | Server tick when scan ran |
relativeCoords | boolean | Whether relative coordinates were used |
detections | table[] | Array of detection objects |
Detection fields
| Field | Type | Description |
|---|---|---|
id | string | Entity UUID (or sublevel UUID for sublevel bounding boxes) |
type | string | Entity registry name (e.g. "minecraft:zombie"), size class ("object_small"/"object_mid"/"object_large"), or "sublevel" |
name | string or nil | Player scoreboard name (if within name-precision distance) |
x, y, z | number | Offset from sensor origin (blocks) |
distance | number | Straight-line distance |
subLevelUUID | string or nil | UUID of the sublevel the entity is inside |
subLevelName | string or nil | Name of the sublevel |
Example
local sensor = peripheral.wrap("left")
-- Narrow FOV to boost range and focus only on sublevels
if sensor.isOptical() then
sensor.setFov(15)
sensor.setFilter("sublevel")
end
while true do
local res = sensor.scan(true)
print("Targets: " .. res.count)
for _, t in ipairs(res.detections) do
print(("%s @ %.1f m (x=%.1f, y=%.1f, z=%.1f)"):format(t.type, t.distance, t.x, t.y, t.z))
end
sleep(0.25)
end
CBC Cannon Mount
Wraps cannon mounts from Create Big Cannons as cbc_cannon_mount peripherals (additional type cannon_mount). Aim, fire, and query state from Lua.
| Method | Parameters | Returns | Description |
|---|---|---|---|
assemble | — | boolean | Assembles the cannon contraption |
disassemble | — | boolean | Disassembles |
fire | — | boolean | Fires the cannon |
isRunning | — | boolean | Whether assembled and running |
isAssembled | — | boolean | Same as isRunning |
isLoaded | — | boolean | Whether cannon can fire |
setPitch | pitch: number | boolean | Set target pitch (degrees) |
setYaw | yaw: number | boolean | Set target yaw (degrees) |
getPitch | — | number | Current pitch |
getYaw | — | number | Current yaw offset |
getX | — | number or nil | Controller X position |
getY | — | number or nil | Controller Y position |
getZ | — | number or nil | Controller Z position |
getMaxDepress | — | number or nil | Maximum depression angle |
getMaxElevate | — | number or nil | Maximum elevation angle |
getDirection | — | string or nil | Facing direction (north/south/east/west) |
getCannonWeight | — | number or nil | Cannon stress-weight |
Rotation can be restricted by config (cbcFreeRotationEnabled, cbcFreeRotationMaxWeight). Throws LuaException when blocked.
Fully compatible with CannonMountPeripheral from VS: Addition - same "cannon_mount" additional type, same method shapes.
For Server Owners
All features are configurable. Disable the CBC cannon mount peripheral (cbcPeripheralEnabled: false) to avoid conflicts with other mods that add the same peripheral (CC:CBC as example).
If you would like to translate the mod, have found a bug, or want to suggest something new:
Discord: Cyber_Jellyfish


