rts-sim-module/sys/iscs_sys/iscs_pscada_wire_cabinet.go
2023-12-22 15:50:47 +08:00

25 lines
595 B
Go

package iscs_sys
import (
"joylink.club/ecs"
"joylink.club/ecs/filter"
"joylink.club/rtsssimulation/component"
)
type WireCabinetSystem struct {
query *ecs.Query
}
func NewWireCabinetSystem() *WireCabinetSystem {
return &WireCabinetSystem{
query: ecs.NewQuery(filter.Contains(component.UidType, component.WireCabinetType, component.DeviceExceptionType)),
}
}
func (s *WireCabinetSystem) Update(w ecs.World) {
s.query.Each(w, func(entry *ecs.Entry) {
wc := component.WireCabinetType.Get(entry)
de := component.DeviceExceptionType.Get(entry)
wc.Normal = de.Exception.Non()
})
}