灯条

概述

灯条控制器可用于实现自定义警示灯条闪烁模式。同时支持定义多种可循环切换的闪烁模式。


文件信息

文件名 lightbar.lua
路径 /lua/vehicle/controller/lightbar.lua
类型 辅助功能
使用方式 多个对象

JBeam 属性

array
type
可切换的警示灯条模式数组
详见警示灯条模式 章节查看更多可用参数信息。
number
type
1
default
警示灯条启动时的默认模式


警示灯条模式

string
type
警示灯条模式名称
array
type
该模式的样式数据数组
详见 警示灯条模式样式 章节查看更多可用参数信息。


警示灯条模式样式

string
type
要控制的电控系统变量名称
number
type
电控系统被设置的值
number
type
当前数值的保持时长,结束后将为该电路设置下一个数值


公共函数

函数名
参数
描述
函数名
toggleMode()
参数
描述
在可用的警示灯条模式之间切换

用法示例

"controller": [
  ["fileName"],
  ["lightbar"]
],
"lightbar": {
  "defaultModeIndex": 1,
  "modes": [
    ["名称", "配置"]
    ["左侧信号灯", [
      ["电路", "数值", "时长"],
      ["blue_3", 1, 1.0],
      ["blue_2", 0, 0.1],
      ["white_2", 0, 0.2],
      ["blue_1", 0, 0.3],
      ["red_1", 0, 0.4],
      ["white_1", 0, 0.5],
      ["red_2", 0, 0.6],
      ["red_3", 0, 0.7],

      ["blue_3", 0, 0.0],
      ["blue_2", 1, 0.9],
      ["white_2", 1, 0.8],
      ["blue_1", 1, 0.7],
      ["red_1", 1, 0.6],
      ["white_1", 1, 0.5],
      ["red_2", 1, 0.4],
      ["red_3", 1, 0.3],
      ],
    ],
    ["右侧信号灯", [
      ["电路", "数值", "时长"],
      ["red_3", 1, 1.0],
      ["red_2", 0, 0.1],
      ["white_1", 0, 0.2],
      ["red_1", 0, 0.3],
      ["blue_1", 0, 0.4],
      ["white_2", 0, 0.5],
      ["blue_2", 0, 0.6],
      ["blue_3", 0, 0.7],

      ["red_3", 0, 0.0],
      ["red_2", 1, 0.9],
      ["white_1", 1, 0.8],
      ["red_1", 1, 0.7],
      ["blue_1", 1, 0.6],
      ["white_2", 1, 0.5],
      ["blue_2", 1, 0.4],
      ["blue_3", 1, 0.3],
      ],
    ],
  ],
}

上一次修订: 六月 2, 2026

还有其他问题?

加入我们的 Discord 服务器
Our documentation is currently incomplete and undergoing active development. If you have any questions or feedback, please visit this forum thread.