diff --git a/component/ckm.go b/component/ckm.go index 958eaed..2e1e221 100644 --- a/component/ckm.go +++ b/component/ckm.go @@ -5,9 +5,11 @@ import ( ) var ( - CkmTag = ecs.NewTag() - CkmCircuitType = ecs.NewComponentType[CkmCircuit]() - CkmPslType = ecs.NewComponentType[CkmPsl]() + CkmTag = ecs.NewTag() + CkmCircuitType = ecs.NewComponentType[CkmCircuit]() + CkmPslType = ecs.NewComponentType[CkmPsl]() + CkmForceOpenTag = ecs.NewTag() + CkmForceCloseTag = ecs.NewTag() ) type CkmCircuit struct { diff --git a/sys/circuit_sys/ckm.go b/sys/circuit_sys/ckm.go index a090675..c8533eb 100644 --- a/sys/circuit_sys/ckm.go +++ b/sys/circuit_sys/ckm.go @@ -62,6 +62,16 @@ func (p *CkmSys) Update(world ecs.World) { 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 { posCom.Speed = -component.CalculateTwoPositionAvgSpeed(3*1000, world.Tick()) diff --git a/sys/circuit_sys/xcj.go b/sys/circuit_sys/xcj.go index 092e4c0..720bfff 100644 --- a/sys/circuit_sys/xcj.go +++ b/sys/circuit_sys/xcj.go @@ -28,6 +28,8 @@ func (x *XcjSys) Update(w ecs.World) { //紧急停车 if entry.HasComponent(component.XcjFaultTag) { component.RelayDriveType.Get(circuit.JTJ).Td = true + } else { + component.RelayDriveType.Get(circuit.JTJ).Td = false } } })