package system import ( "github.com/yohamta/donburi/filter" "joylink.club/ecs" "joylink.club/rtsssimulation/components" "joylink.club/rtsssimulation/components/cstate" ) // 应答器查询 var baliseQuery *ecs.Query = ecs.NewQuery(filter.Contains(components.DeviceIdentityComponent, components.BaliseStateComponent)) // 应答器模拟系统 // 检测当有列车经过时,把报文发送给该列车 type BaliseSystem struct { } func NewTransponderSystem() *BaliseSystem { return &BaliseSystem{} } // world 执行 func (me *BaliseSystem) Update(w ecs.World) { } // // 发送消息到应答器 // 当要清空应答器中报文时,则message=nil func SendMessageToTransponder(world ecs.World, transponderId string, message *cstate.BaliseContent) bool { transponderEntry := queryEntityById(world, baliseQuery, transponderId) // if transponderEntry == nil { return false } // components.BaliseStateComponent.Get(transponderEntry).Content = message // return true }