26 lines
610 B
Go
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()
|
||
|
})
|
||
|
}
|