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

26 lines
610 B
Go

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