2023-10-09 14:19:57 +08:00
|
|
|
|
package fi
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"joylink.club/ecs"
|
|
|
|
|
"joylink.club/rtsssimulation/component"
|
|
|
|
|
"joylink.club/rtsssimulation/entity"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// 2xh1信号机功能接口
|
|
|
|
|
|
|
|
|
|
// Drive2XH1Dd 点灯操作
|
2023-10-09 15:13:24 +08:00
|
|
|
|
// dd : true-物理点灯,false-物理灭灯
|
2023-10-09 14:19:57 +08:00
|
|
|
|
func Drive2XH1Dd(w ecs.World, signalId string, dd bool) {
|
|
|
|
|
w.Execute(func() {
|
|
|
|
|
wd := entity.GetWorldData(w)
|
|
|
|
|
signalEntry, ok := wd.EntityMap[signalId]
|
|
|
|
|
if ok {
|
|
|
|
|
state := component.Signal2XH1ElectronicType.Get(signalEntry)
|
|
|
|
|
drive := component.RelayDriveType.Get(state.Z2XH1_DDJ)
|
|
|
|
|
drive.Td = !dd
|
|
|
|
|
drive.Xq = !dd
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-09 15:13:24 +08:00
|
|
|
|
// Drive2XH1Lx 开通列车信号(绿灯亮)
|
|
|
|
|
func Drive2XH1Lx(w ecs.World, signalId string) {
|
2023-10-09 14:19:57 +08:00
|
|
|
|
w.Execute(func() {
|
|
|
|
|
wd := entity.GetWorldData(w)
|
|
|
|
|
signalEntry, ok := wd.EntityMap[signalId]
|
|
|
|
|
if ok {
|
|
|
|
|
state := component.Signal2XH1ElectronicType.Get(signalEntry)
|
|
|
|
|
drive := component.RelayDriveType.Get(state.Z2XH1_LXJ)
|
2023-10-09 15:13:24 +08:00
|
|
|
|
drive.Td = true
|
|
|
|
|
drive.Xq = true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Drive2XH1Non 开通禁止信号(红灯亮)
|
|
|
|
|
func Drive2XH1Non(w ecs.World, signalId string) {
|
|
|
|
|
w.Execute(func() {
|
|
|
|
|
wd := entity.GetWorldData(w)
|
|
|
|
|
signalEntry, ok := wd.EntityMap[signalId]
|
|
|
|
|
if ok {
|
|
|
|
|
state := component.Signal2XH1ElectronicType.Get(signalEntry)
|
|
|
|
|
drive := component.RelayDriveType.Get(state.Z2XH1_LXJ)
|
|
|
|
|
drive.Td = false
|
|
|
|
|
drive.Xq = false
|
2023-10-09 14:19:57 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|