【bug】车库门强制开关门无效;洗车机取消故障后依然有紧急停车

This commit is contained in:
thesai 2024-04-07 13:38:30 +08:00
parent 4371dad391
commit 8ccd46aa6c
3 changed files with 17 additions and 3 deletions

View File

@ -5,9 +5,11 @@ import (
) )
var ( var (
CkmTag = ecs.NewTag() CkmTag = ecs.NewTag()
CkmCircuitType = ecs.NewComponentType[CkmCircuit]() CkmCircuitType = ecs.NewComponentType[CkmCircuit]()
CkmPslType = ecs.NewComponentType[CkmPsl]() CkmPslType = ecs.NewComponentType[CkmPsl]()
CkmForceOpenTag = ecs.NewTag()
CkmForceCloseTag = ecs.NewTag()
) )
type CkmCircuit struct { type CkmCircuit struct {

View File

@ -62,6 +62,16 @@ func (p *CkmSys) Update(world ecs.World) {
slog.Error(err.Error()) slog.Error(err.Error())
} }
} }
//强制开门
if entry.HasComponent(component.CkmForceOpenTag) {
posCom.Pos = consts.TwoPosMax
posCom.Speed = 0
return
} else if entry.HasComponent(component.CkmForceCloseTag) {
posCom.Pos = consts.TwoPosMin
posCom.Speed = 0
return
}
//驱动 //驱动
if component.BitStateType.Get(circuit.GMJ).Val { if component.BitStateType.Get(circuit.GMJ).Val {
posCom.Speed = -component.CalculateTwoPositionAvgSpeed(3*1000, world.Tick()) posCom.Speed = -component.CalculateTwoPositionAvgSpeed(3*1000, world.Tick())

View File

@ -28,6 +28,8 @@ func (x *XcjSys) Update(w ecs.World) {
//紧急停车 //紧急停车
if entry.HasComponent(component.XcjFaultTag) { if entry.HasComponent(component.XcjFaultTag) {
component.RelayDriveType.Get(circuit.JTJ).Td = true component.RelayDriveType.Get(circuit.JTJ).Td = true
} else {
component.RelayDriveType.Get(circuit.JTJ).Td = false
} }
} }
}) })