package device_sys import ( "joylink.club/ecs" "joylink.club/ecs/filter" "joylink.club/rtsssimulation/component" ) // FMQSys 蜂鸣系统 type AlarmSys struct { query *ecs.Query } func NewAlarmSys() *AlarmSys { return &AlarmSys{query: ecs.NewQuery(filter.Contains(component.AlarmDriveType, component.BitStateType))} } func (alarm *AlarmSys) Update(w ecs.World) { alarm.query.Each(w, func(entry *ecs.Entry) { drive := component.AlarmDriveType.Get(entry) state := component.BitStateType.Get(entry) if drive.Td != state.Val { state.Val = drive.Td } }) }