From 8ccd46aa6c97a933fd12c7b308da929115c9aa8e Mon Sep 17 00:00:00 2001 From: thesai <1021828630@qq.com> Date: Sun, 7 Apr 2024 13:38:30 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90bug=E3=80=91=E8=BD=A6=E5=BA=93?= =?UTF-8?q?=E9=97=A8=E5=BC=BA=E5=88=B6=E5=BC=80=E5=85=B3=E9=97=A8=E6=97=A0?= =?UTF-8?q?=E6=95=88=EF=BC=9B=E6=B4=97=E8=BD=A6=E6=9C=BA=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=95=85=E9=9A=9C=E5=90=8E=E4=BE=9D=E7=84=B6=E6=9C=89=E7=B4=A7?= =?UTF-8?q?=E6=80=A5=E5=81=9C=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- component/ckm.go | 8 +++++--- sys/circuit_sys/ckm.go | 10 ++++++++++ sys/circuit_sys/xcj.go | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) 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 } } })