CC:Optical
为 CC:Tweaked 添加传感器和火炮控制外围设备,兼容 Create:Aeronautics。

Sensors
四种变体,支持动态视场(FOV)变焦、目标过滤和扫描方法:
Optical Sensor (optical_sensor) — 默认为全向(360° FOV),基础范围为 96 格。支持将 FOV 缩小至 15° 以增加变焦范围(最高可达 192 格)。需要直接视线(仅限真实地形方块;下层地形视为透明)。
Directional Optical Sensor (directional_optical_sensor) — 定向锥形视场(默认 125°,可调低至 10°),在完整 FOV 下基础范围为 90 格,在最小 FOV 下变焦最高可达 512 格。
Long Range Optical Sensor (long_range_optical_sensor) — 定向锥形视场(默认 125°,可调低至 10°),在完整 FOV 下基础范围为 96 格,在最小 FOV 下变焦最高可达 900 格。
Radar (entity_radar) — 全向,基础范围 64 格,无视视线限制。在相邻位置放置 Radar Booster (radar_booster) 方块,每个助推器增加 +224 格范围(最多 2 个助推器,总计 512 格)。在雷达或其任意助推器顶部添加一个 2 格高的天线(闪电棒或铁栏杆)可倍增助推器效果,使雷达范围最高提升至约 900 格。位置读数存在高斯噪声(随距离增加而增大,并根据传感器相对于海平面的高度而变化)。
检测可跨越下层边界进行。飞艇上的传感器可以探测到另一艘飞艇及其内部的实体。当目标位于某个下层内时,每次检测都会携带该下层的 UUID。装饰性非实体(画作、物品展示框、显示终端、标记物)会被自动忽略。
检测精度随距离降低,但识别距离会根据 FOV 变焦和助推器升级动态缩放。超出精度限制后,目标仅按大小分类(object_small/object_mid/object_large)。雷达位置噪声随距离线性增长,并受传感器相对于海平面高度的影响。
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
CC:Tweaked 中可用的传感器方法:
| Method |
Parameters |
Returns |
Description |
scan |
relativeCoords: boolean (optional) |
table |
执行即时扫描。如果为 true,返回的位置将被旋转至传感器的下层本地坐标系中。 |
setFov |
fov: number |
number |
设置光学视场角度(限制在 [minFov, maxFov] 范围内)。更窄的 FOV 会增加有效范围。仅限光学传感器。 |
getFov |
— |
number |
返回当前视场角度。 |
getMinFov |
— |
number |
返回允许的最小视场角度。 |
getMaxFov |
— |
number |
返回允许的最大视场角度。 |
getRange |
— |
number |
返回当前有效检测范围(格)(随 FOV 动态缩放)。 |
setFilter |
typeOrList: string|table (optional) |
string[] |
设置活动目标过滤器(通过精确 ID、短名称、"sublevel" 或大小类 "object_small"/"object_mid"/"object_large")。未匹配到的实体不计入目标限制。传入 nil 以清除。 |
getFilter |
— |
string[] |
返回当前活动的目标过滤器数组。 |
clearFilter |
— |
boolean |
清除所有活动过滤器。 |
isOptical |
— |
boolean |
如果这是支持 FOV/变焦/过滤的光学传感器则返回 true,如果是雷达则返回 false。 |
scan() return table
| Field |
Type |
Description |
count |
number |
检测数量 |
lastScanTick |
number |
执行扫描时的服务器刻数 |
relativeCoords |
boolean |
是否使用了相对坐标 |
detections |
table[] |
检测对象数组 |
Detection fields
| Field |
Type |
Description |
id |
string |
实体 UUID(或下层包围盒的下层 UUID) |
type |
string |
实体注册表名称(例如 "minecraft:zombie")、大小类("object_small"/"object_mid"/"object_large")或 "sublevel" |
name |
string or nil |
玩家计分板名称(如果在名称精度距离内) |
x, y, z |
number |
相对于传感器原点的偏移量(格) |
distance |
number |
直线距离 |
subLevelUUID |
string or nil |
实体所在的下层 UUID |
subLevelName |
string or nil |
下层名称 |
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
将 Create Big Cannons 的火炮支架包装为 cbc_cannon_mount 外围设备(附加类型 cannon_mount)。可通过 Lua 瞄准、发射和查询状态。
| 方法 |
参数 |
返回值 |
描述 |
assemble |
— |
boolean |
组装炮台装置 |
disassemble |
— |
boolean |
拆卸 |
fire |
— |
boolean |
发射炮台 |
isRunning |
— |
boolean |
是否已组装并处于运行状态 |
isAssembled |
— |
boolean |
同 isRunning |
isLoaded |
— |
boolean |
炮台是否可以发射 |
setPitch |
pitch: number |
boolean |
设置目标俯仰角(度) |
setYaw |
yaw: number |
boolean |
设置目标偏航角(度) |
getPitch |
— |
number |
当前俯仰角 |
getYaw |
— |
number |
当前偏航偏移量 |
getX |
— |
number 或 nil |
控制器 X 坐标 |
getY |
— |
number 或 nil |
控制器 Y 坐标 |
getZ |
— |
number 或 nil |
控制器 Z 坐标 |
getMaxDepress |
— |
number 或 nil |
最大下俯角度 |
getMaxElevate |
— |
number 或 nil |
最大上仰角度 |
getDirection |
— |
string 或 nil |
朝向方向(north/south/east/west) |
getCannonWeight |
— |
number 或 nil |
炮台的应力权重 |
旋转可通过配置进行限制(cbcFreeRotationEnabled、cbcFreeRotationMaxWeight)。当被阻止时会抛出 LuaException。
完全兼容 VS: Addition 的 CannonMountPeripheral —— 使用相同的 "cannon_mount" 附加类型,方法签名一致。
面向服务器管理员
所有功能均可配置。禁用 CBC 炮台外设(cbcPeripheralEnabled: false)以避免与其他添加相同外设的模组发生冲突(例如 CC:CBC)。
如果您希望翻译该模组、发现 bug 或有新功能建议:
Discord: Cyber_Jellyfish
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
评论 0
登录后参与评分
还没有评论,来抢沙发吧