31 lines
722 B
Go
31 lines
722 B
Go
package iscs_sys
|
|
|
|
import (
|
|
"joylink.club/ecs"
|
|
"joylink.club/ecs/filter"
|
|
"joylink.club/rtsssimulation/component"
|
|
"joylink.club/rtsssimulation/consts"
|
|
)
|
|
|
|
// ChillerUnitSystem 冷水机组
|
|
type ChillerUnitSystem struct {
|
|
query *ecs.Query
|
|
}
|
|
|
|
func NewChillerUnitSystem() *ChillerUnitSystem {
|
|
return &ChillerUnitSystem{
|
|
query: ecs.NewQuery(filter.Contains(component.ChillerUnitType, component.DeviceExceptionType)),
|
|
}
|
|
}
|
|
func (s *ChillerUnitSystem) Update(w ecs.World) {
|
|
s.query.Each(w, func(entry *ecs.Entry) {
|
|
device := component.ChillerUnitType.Get(entry)
|
|
de := component.DeviceExceptionType.Get(entry)
|
|
//异常停止运行
|
|
if de.Exception != consts.DeviceExceptionNon {
|
|
device.Running = false
|
|
}
|
|
|
|
})
|
|
}
|