【增加组件存在判断】

This commit is contained in:
weizhihong 2023-12-07 16:13:34 +08:00
parent 401a30cf9b
commit 3582864835

View File

@ -56,32 +56,34 @@ func (p *PsdSys) Update(world ecs.World) {
psdState.Close = p.isAllAsdMotorClosed(asdList) psdState.Close = p.isAllAsdMotorClosed(asdList)
} }
//更新站台门控箱电路及PSC相关状态 //更新站台门控箱电路及PSC相关状态
pmc := component.PlatformMkxCircuitType.Get(entry) if entry.HasComponent(component.PlatformMkxCircuitType) {
var pcbTd bool pmc := component.PlatformMkxCircuitType.Get(entry)
var pobTd bool var pcbTd bool
var pabTd bool var pobTd bool
for _, mkxEntry := range pmc.MkxList { var pabTd bool
mkx := component.MkxType.Get(mkxEntry) for _, mkxEntry := range pmc.MkxList {
if mkx.PCB != nil && component.BitStateType.Get(mkx.PCB).Val { mkx := component.MkxType.Get(mkxEntry)
pcbTd = true if mkx.PCB != nil && component.BitStateType.Get(mkx.PCB).Val {
pcbTd = true
}
if mkx.POB != nil && component.BitStateType.Get(mkx.POB).Val {
pobTd = true
}
if mkx.PAB != nil && component.BitStateType.Get(mkx.PAB).Val {
pabTd = true
}
} }
if mkx.POB != nil && component.BitStateType.Get(mkx.POB).Val { if pmc.PCBJ != nil {
pobTd = true component.RelayDriveType.Get(pmc.PCBJ).Td = pcbTd
psc.MkxGM = component.BitStateType.Get(pmc.PCBJ).Val
} }
if mkx.PAB != nil && component.BitStateType.Get(mkx.PAB).Val { if pmc.POBJ != nil {
pabTd = true component.RelayDriveType.Get(pmc.POBJ).Td = pobTd
psc.MkxKM = component.BitStateType.Get(pmc.POBJ).Val
}
if pmc.PABJ != nil {
component.RelayDriveType.Get(pmc.PABJ).Td = pabTd
} }
}
if pmc.PCBJ != nil {
component.RelayDriveType.Get(pmc.PCBJ).Td = pcbTd
psc.MkxGM = component.BitStateType.Get(pmc.PCBJ).Val
}
if pmc.POBJ != nil {
component.RelayDriveType.Get(pmc.POBJ).Td = pobTd
psc.MkxKM = component.BitStateType.Get(pmc.POBJ).Val
}
if pmc.PABJ != nil {
component.RelayDriveType.Get(pmc.PABJ).Td = pabTd
} }
//设置滑动门电机通断电状态 //设置滑动门电机通断电状态
repo := entity.GetWorldData(world).Repo repo := entity.GetWorldData(world).Repo