package iscs_sys import ( "joylink.club/ecs" "joylink.club/ecs/filter" "joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/consts" ) // DevicePlacingSystem 设备置牌 type DevicePlacingSystem struct { query *ecs.Query } func NewDevicePlacingSystem() *DevicePlacingSystem { return &DevicePlacingSystem{ query: ecs.NewQuery(filter.Contains(component.DevicePlacingType)), } } func (s *DevicePlacingSystem) Update(w ecs.World) { s.query.Each(w, func(entry *ecs.Entry) { device := component.DevicePlacingType.Get(entry) // placing := consts.DevicePlacingNon if entry.HasComponent(component.DevicePlacingOverhaulCardTag) { placing = consts.DevicePlacingOverhaulCard } if entry.HasComponent(component.DevicePlacingLandingCardTag) { placing = consts.DevicePlacingLandingCard } if entry.HasComponent(component.DevicePlacingHandTag) { placing = consts.DevicePlacingHand } if entry.HasComponent(component.DevicePlacingOtherCardTag) { placing = consts.DevicePlacingOtherCard } // if device.Placing != placing { device.Placing = placing } }) }