Create: Avionics
让你的飞艇自动飞行。
为 Create: Aeronautics 中所有可配置的方块提供 CC: Tweaked 外围设备。读取姿态、高度、速度和航向。控制油门、螺旋桨和气球气体。用 Lua 编写你的自动驾驶程序(这是个糟糕的谐音梗,但依然如此!)
功能
- 热气球的高度保持
- 螺旋桨飞机的航向与俯仰自动驾驶
- 绑定方向盘的巡航控制
- 用于 mounted potato cannon(土豆加农炮)的追踪炮塔
- 以及你可以编写任何控制循环的其他功能
开始使用
双引擎飞船的航向保持:
local nav = peripheral.find("navigation_table")
local port, stbd = peripheral.find("analog_transmission")
local target = nav.getHeadingRad()
while true do
local err = (target - nav.getHeadingRad() + math.pi) % (2*math.pi) - math.pi
local diff = math.max(-5, math.min(5, err * 4))
port.setSignal(7 - diff); stbd.setSignal(7 + diff)
sleep(0.05)
end
三个外围设备,一个 P 控制器,飞船即可锁定航向。每个 Aeronautics(以及几乎每个 Create)方块都是一个外围设备——读取传感器,设置执行器,编写你想要的控制循环。
方块
- Avionics controller(航空电子设备控制器) — 一根电缆将飞船上的每个外围设备连接到你的计算机,命名遵循船首方向(例如
ship_velocity_sensor_forward_0、ship_propeller_bearing_aft_port_0)。同时也是飞船的应答机。指南
- Radar Mk.1(雷达 MK.1) — 单束扫描,范围 256 格:显示船只、地形、距离、接近速度和应答机名称。
- 气象仪器 — 温度计、湿度计、气压计、雨量计、日历;它们读取飞船所处空气的气象数据。指南
不仅限于飞行器
相同的 peripheral.find() 接口驱动着升降机、车辆以及整个旋转网络——不仅仅是会飞的东西。
Create Elevators(Create 电梯) — 枚举楼层,呼叫轿厢,读取其位置:
local lift = peripheral.find("Create_ElevatorPulley")
lift.setTargetFloor(lift.getFloors()[3].y) -- 发送轿厢到第 3 层
repeat sleep(0.1) until lift.isArrived()
print("Arrived: " .. lift.getCurrentFloor().short_name)
Kinetic SCADA(动能 SCADA 系统) — 遍历旋转网络,在过载时报警:
local draw, capacity = 0, 0
for _, name in ipairs(peripheral.getNames()) do
local p = peripheral.wrap(name)
if p.getNetworkId then -- 任何动能方块
draw = draw + p.getStressImpact()
capacity = capacity + p.getStressContribution()
if p.isOverstressed() then
print("OVERSTRESSED " .. p.getSelfId() .. " (" .. p.getKind() .. ")")
end
end
end
print(("Network load: %.0f / %.0f SU"):format(draw, capacity))
Vehicles(载具) — 对轮式挂载点进行转向和制动覆盖:
for _, w in ipairs({ peripheral.find("wheel_mount") }) do
w.setSteering(0.5) -- -1..1 -> +/-30 度
if w.getTouchingFriction() < 0.5 then w.setBrake(0) end -- 在湿滑路面上松开刹车
end
getKind、getSubnetworkAnchorId、getColumnContacts、getTouchingFriction —— 读取侧的功能同样丰富。
完整 API 文档 — 单位、体坐标系约定、所有方法说明。
阅读平行指南。5 Hz 和 20 Hz 的感觉是不同的。
安装
依赖: MC 1.21.1 · NeoForge 21.1.219+ · Create 6.0.10+ · Simulated/Aeronautics/Offroad 1.2.1+ · Sable 1.1.0+ · CC: Tweaked 1.115+
可选: Thermoo(为仪器提供气候模拟)· Serene Seasons(为日历提供季节支持)
需在客户端和服务端同时安装。
官方下载仅在此处发布:Modrinth、CurseForge 和 GitHub。其他列表均为重新上传,通常已过时。
社区
Discord — 提问、分享脚本、展示飞船。Bug 请提交至 GitHub Issues。
搭配模组
ccc · create-computercraft
源代码 · Issue
github.com/SolAstrius/CreateAvionics
MIT 协议。基于 RyanHCode 在 Simulated 中构建的 CC 外围设备基础 —— NOTICE。
由我本人 Sol Astrius Phoenix 制作。
Create: Avionics
Make your airship fly itself.
CC: Tweaked peripherals for every instrumentable block in Create: Aeronautics. Read attitude, altitude, velocity, bearing. Drive throttle, propellers, balloon gas. Write your autopilot in Lua (that's a bad pitch, but still!)
Build
- Altitude-hold for hot-air balloons
- Heading-and-pitch autopilots for propeller aircraft
- Cruise control bound to a steering wheel
- Tracked turrets for mounted potato cannons
- Whatever else you can write a control loop for
Start
Heading hold on a twin-engine ship:
local nav = peripheral.find("navigation_table")
local port, stbd = peripheral.find("analog_transmission")
local target = nav.getHeadingRad()
while true do
local err = (target - nav.getHeadingRad() + math.pi) % (2*math.pi) - math.pi
local diff = math.max(-5, math.min(5, err * 4))
port.setSignal(7 - diff); stbd.setSignal(7 + diff)
sleep(0.05)
end
Three peripherals, one P-controller, the ship locks heading. Every Aeronautics (and nearly every Create) block is a peripheral — read sensors, set actuators, write the loop you want.
Blocks
- Avionics controller — one cable connects every peripheral on the ship to your computer, under names that follow the ship's bow (
ship_velocity_sensor_forward_0, ship_propeller_bearing_aft_port_0). Also the ship's transponder. Guide
- Radar Mk.1 — one beam, 256 blocks: ships, terrain, distance, closing speed, transponder names.
- Weather instruments — thermometer, hygrometer, barometer, rain gauge, almanac; they read the air the ship is flying through. Guide
Not just aircraft
The same peripheral.find() surface drives lifts, vehicles, and your whole rotational network — not only things that fly.
Create Elevators — enumerate floors, call the cabin, read where it is:
local lift = peripheral.find("Create_ElevatorPulley")
lift.setTargetFloor(lift.getFloors()[3].y) -- send the cabin to the 3rd floor
repeat sleep(0.1) until lift.isArrived()
print("Arrived: " .. lift.getCurrentFloor().short_name)
Kinetic SCADA — walk the rotation network, alarm on overstress:
local draw, capacity = 0, 0
for _, name in ipairs(peripheral.getNames()) do
local p = peripheral.wrap(name)
if p.getNetworkId then -- any kinetic block
draw = draw + p.getStressImpact()
capacity = capacity + p.getStressContribution()
if p.isOverstressed() then
print("OVERSTRESSED " .. p.getSelfId() .. " (" .. p.getKind() .. ")")
end
end
end
print(("Network load: %.0f / %.0f SU"):format(draw, capacity))
Vehicles — steering and brake override on wheel mounts:
for _, w in ipairs({ peripheral.find("wheel_mount") }) do
w.setSteering(0.5) -- -1..1 -> +/-30 deg
if w.getTouchingFriction() < 0.5 then w.setBrake(0) end -- ease off on slippery stuff
end
getKind, getSubnetworkAnchorId, getColumnContacts, getTouchingFriction — the read side is as rich as the write side.
Full API docs — units, body-frame conventions, every method.
Read the parallel guide. 5 Hz and 20 Hz feel different.
Install
Needs: MC 1.21.1 · NeoForge 21.1.219+ · Create 6.0.10+ · Simulated/Aeronautics/Offroad 1.2.1+ · Sable 1.1.0+ · CC: Tweaked 1.115+
Optional: Thermoo (climate for the instruments) · Serene Seasons (the almanac's calendar)
Install on both client and server.
Official downloads are only here, on Modrinth, CurseForge and GitHub. Other listings are reuploads, usually outdated.
Community
Discord — questions, scripts, ships. Bugs go to GitHub issues.
Pairs with
ccc · create-computercraft
Source · Issues
github.com/SolAstrius/CreateAvionics
MIT. Built on RyanHCode's CC peripheral foundation in Simulated — NOTICE.
Created by yours truly, Sol Astrius Phoenix.
评论 0
登录后参与评分
还没有评论,来抢沙发吧