btm
This commit is contained in:
parent
8fdc707a97
commit
1d016f6fab
@ -13,3 +13,12 @@ func NewTrainEntity(w ecs.World, trainId string) *ecs.Entry {
|
||||
data.EntityMap[trainId] = te
|
||||
return te
|
||||
}
|
||||
func NewTrainWithBtmEntity(w ecs.World, trainId string) *ecs.Entry {
|
||||
data := GetWorldData(w)
|
||||
te := w.Entry(w.Create(component.UidType, component.TrainPositionInfoType, component.TrainBtmType))
|
||||
component.UidType.SetValue(te, component.Uid{Id: trainId})
|
||||
component.TrainPositionInfoType.Set(te, &component.TrainPositionInfo{})
|
||||
component.TrainBtmType.Set(te, &component.TrainBtm{})
|
||||
data.EntityMap[trainId] = te
|
||||
return te
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ func AddTrainToWorld(w ecs.World, trainId string) error {
|
||||
wd := entity.GetWorldData(w)
|
||||
_, find := wd.EntityMap[trainId]
|
||||
if !find {
|
||||
entity.NewTrainEntity(w, trainId)
|
||||
entity.NewTrainWithBtmEntity(w, trainId)
|
||||
}
|
||||
return ecs.NewOkEmptyResult()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user