修改构建protoRepository bug;增加获取道岔状态的函数
This commit is contained in:
parent
ff6910ed7b
commit
4b22cd1a42
@ -8,6 +8,14 @@ import (
|
||||
"joylink.club/rtsssimulation/system"
|
||||
)
|
||||
|
||||
type Position int
|
||||
|
||||
const (
|
||||
SK Position = iota //四开(不会起名字)
|
||||
D //定位
|
||||
F //反位
|
||||
)
|
||||
|
||||
// CreateSwitch2jzdj9Entity 双机zdj9
|
||||
// 默认定位
|
||||
func CreateSwitch2jzdj9Entity(w ecs.World, switchId string) *ecs.Entry {
|
||||
@ -59,3 +67,16 @@ func TurnToReverse(worldId ecs.WorldId, turnoutId string) {
|
||||
state.YCJ = true
|
||||
state.FCJ = true
|
||||
}
|
||||
|
||||
func GetState(worldId ecs.WorldId, turnoutId string) Position {
|
||||
sim := simulation.FindSimulation(worldId)
|
||||
turnoutEntry := system.FindEntityById(sim.World(), turnoutId)
|
||||
state := system.Switch2jZdj9StateComponent.Get(turnoutEntry)
|
||||
if state.ZDBJ {
|
||||
return D
|
||||
} else if state.ZFBJ {
|
||||
return F
|
||||
} else {
|
||||
return SK
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +259,10 @@ func buildTurnoutRelationShip(source *proto.Repository, repo *Repository) error
|
||||
for _, group := range protoData.RelayGroups {
|
||||
var relays []*Relay
|
||||
for _, id := range group.RelayIds {
|
||||
relays = append(relays, repo.relayMap[id])
|
||||
relay := repo.relayMap[id]
|
||||
if relay != nil {
|
||||
relays = append(relays, relay)
|
||||
}
|
||||
}
|
||||
turnout.relayGroups = append(turnout.relayGroups, &RelayGroup{
|
||||
code: group.Code,
|
||||
|
Loading…
Reference in New Issue
Block a user