package iscs_sys import ( "joylink.club/ecs" "joylink.club/ecs/filter" "joylink.club/rtsssimulation/component" ) // BasFanSystem ISCS BAS 风机 type BasFanSystem struct { query *ecs.Query } func NewBasFanSystem() *BasFanSystem { return &BasFanSystem{ query: ecs.NewQuery(filter.Contains(component.FanType)), } } func (s *BasFanSystem) Update(w ecs.World) { s.query.Each(w, func(entry *ecs.Entry) { fan := component.FanType.Get(entry) // fanState := component.FanStateType.Get(entry) fanState.Fc = fan.Fc fanState.Bypass = fan.Bypass fanState.Running = fan.Power != 0 fanState.Forward = fan.Power > 0 fanState.SoftStart = fan.SoftStart fanState.HighSpeed = fanState.Running && entry.HasComponent(component.HighSpeedModeFanTag) fanState.SlowSpeed = fanState.Running && entry.HasComponent(component.LowSpeedModeFanTag) }) }