rts-sim-module/entity/iscs_tfds.go
2023-12-15 15:43:54 +08:00

33 lines
1009 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package entity
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
)
// NewTFDSHostEntity 创建TFDS主机实体
func NewTFDSHostEntity(w ecs.World, id string, checkPoints []*ecs.Entry) *ecs.Entry {
wd := GetWorldData(w)
e, ok := wd.EntityMap[id]
if !ok {
//TFDS主机状态网络主机状态+被监控的感温光纤的状态
//被监控的感温光纤的状态:有被监控的光纤上的所有检测点的状态综合计算得到
e := w.Entry(w.Create(component.UidType, component.NetworkHostType, component.TFDSHostType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}
return e
}
// NewTofCheckPointEntity 创建感温光纤工程检测点实体
func NewTofCheckPointEntity(w ecs.World, id string) *ecs.Entry {
wd := GetWorldData(w)
e, ok := wd.EntityMap[id]
if !ok {
e := w.Entry(w.Create(component.UidType, component.TofCheckPointType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}
return e
}