信号机强制点灯开发
This commit is contained in:
parent
93f2a74f86
commit
bf9d65c5a7
@ -231,10 +231,36 @@ func setSignalForceU(w ecs.World, e *ecs.Entry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 设置信号机强制黄红灯(引导信号)
|
||||
// 设置信号机强制红黄灯(引导信号)
|
||||
func setSignalForceHU(w ecs.World, e *ecs.Entry) error {
|
||||
if e.HasComponent(component.Signal2XH1ElectronicType) { // 2XH1信号机
|
||||
return fmt.Errorf("信号机不支持点黄红灯")
|
||||
return fmt.Errorf("信号机不支持点红黄灯")
|
||||
} else if e.HasComponent(component.Signal3XH1ElectronicType) { // 3XH1信号机
|
||||
signal3XH1 := component.Signal3XH1ElectronicType.Get(e)
|
||||
setRelayForce(signal3XH1.Z3XH1_DDJ, false)
|
||||
setRelayForce(signal3XH1.Z3XH1_LXJ, false)
|
||||
setRelayForce(signal3XH1.Z3XH1_ZXJ, false)
|
||||
setRelayForce(signal3XH1.Z3XH1_DJ, true)
|
||||
setRelayForce(signal3XH1.Z3XH1_2DJ, true)
|
||||
setRelayForce(signal3XH1.Z3XH1_YXJ, true)
|
||||
} else if e.HasComponent(component.Signal3XH2ElectronicType) { // 3XH2信号机
|
||||
signal3XH2 := component.Signal3XH2ElectronicType.Get(e)
|
||||
setRelayForce(signal3XH2.Z3XH2_DDJ, false)
|
||||
setRelayForce(signal3XH2.Z3XH2_LXJ, false)
|
||||
setRelayForce(signal3XH2.Z3XH2_DJ, true)
|
||||
setRelayForce(signal3XH2.Z3XH2_2DJ, true)
|
||||
setRelayForce(signal3XH2.Z3XH2_YXJ, true)
|
||||
} else if e.HasComponent(component.Signal3XH3ElectronicType) { // 3XH3信号机
|
||||
signal3XH3 := component.Signal3XH3ElectronicType.Get(e)
|
||||
setRelayForce(signal3XH3.Z3XH3_DDJ, false)
|
||||
setRelayForce(signal3XH3.Z3XH3_LXJ, false)
|
||||
setRelayForce(signal3XH3.Z3XH3_YXJ, true)
|
||||
setRelayForce(signal3XH3.Z3XH3_DJ, true)
|
||||
setRelayForce(signal3XH3.Z3XH3_2DJ, true)
|
||||
} else if e.HasComponent(component.Signal3XH4ElectronicType) { // 3XH4信号机
|
||||
return fmt.Errorf("信号机不支持点红黄灯")
|
||||
} else {
|
||||
return fmt.Errorf("未知的信号机型号")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user