From 1798ee0a69b3a48a05ab9d53a04fd4b668d44b77 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 7 Dec 2023 18:07:05 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9ibp=E7=94=B5?= =?UTF-8?q?=E8=B7=AF=E9=80=BB=E8=BE=91=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sys/circuit_sys/ibp.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/circuit_sys/ibp.go b/sys/circuit_sys/ibp.go index f7e318f..caaab97 100644 --- a/sys/circuit_sys/ibp.go +++ b/sys/circuit_sys/ibp.go @@ -8,26 +8,30 @@ import ( // ibp 系统 type IBPSys struct { - query *ecs.Query + empQuery *ecs.Query + spksQuery *ecs.Query } // ibp盘系统 func NewIBPSys() *IBPSys { return &IBPSys{ - query: ecs.NewQuery(filter.Contains(component.SpkElectronicType, component.EmpElectronicType)), + empQuery: ecs.NewQuery(filter.Contains(component.EmpElectronicType)), + spksQuery: ecs.NewQuery(filter.Contains(component.SpkElectronicType)), } } // 控制电路更新 func (ibp *IBPSys) Update(w ecs.World) { - ibp.query.Each(w, func(entry *ecs.Entry) { - spkState := component.SpkElectronicType.Get(entry) - ibp.spkControl(entry, spkState) - ibp.spksState(entry, spkState) + ibp.empQuery.Each(w, func(entry *ecs.Entry) { empState := component.EmpElectronicType.Get(entry) ibp.empControl(entry, empState) ibp.empState(entry, empState) }) + ibp.spksQuery.Each(w, func(entry *ecs.Entry) { + spkState := component.SpkElectronicType.Get(entry) + ibp.spkControl(entry, spkState) + ibp.spksState(entry, spkState) + }) } // 人员防护继电器控制电路逻辑