摁钮旁路及旁路复位还原
This commit is contained in:
parent
29325f98db
commit
25e65d2229
@ -16,10 +16,10 @@ var (
|
|||||||
BitStateType = ecs.NewComponentType[BitState]()
|
BitStateType = ecs.NewComponentType[BitState]()
|
||||||
)
|
)
|
||||||
|
|
||||||
type Bypass struct {
|
/*type Bypass struct {
|
||||||
BypassEnable bool // 摁钮,钥匙 是否旁路
|
BypassEnable bool // 摁钮,钥匙 是否旁路
|
||||||
OldVal bool //摁钮旁路旧值
|
OldVal bool //摁钮旁路旧值
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// 唯一ID组件
|
// 唯一ID组件
|
||||||
type Uid struct {
|
type Uid struct {
|
||||||
@ -50,7 +50,7 @@ func CalculateTwoPositionAvgSpeed(t int, tick int) int32 {
|
|||||||
|
|
||||||
// 仅有两状态的组件
|
// 仅有两状态的组件
|
||||||
type BitState struct {
|
type BitState struct {
|
||||||
Bypass
|
//Bypass
|
||||||
Val bool
|
Val bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ var AlarmDriveType = ecs.NewComponentType[AlarmDrive]()
|
|||||||
|
|
||||||
// 挡位组件
|
// 挡位组件
|
||||||
type GearState struct {
|
type GearState struct {
|
||||||
Bypass
|
//Bypass
|
||||||
Val int32
|
Val int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@ package fi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"joylink.club/bj-rtsts-server/dto/request_proto"
|
|
||||||
|
|
||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
"joylink.club/rtsssimulation/entity"
|
"joylink.club/rtsssimulation/entity"
|
||||||
@ -60,7 +58,7 @@ func SwitchKeyGear(w ecs.World, id string, gear int32) error {
|
|||||||
return result.Err
|
return result.Err
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetBypassBtn(w ecs.World, id string, p request_proto.BypassOperationReq_Operation) error {
|
/*func SetBypassBtn(w ecs.World, id string, p request_proto.BypassOperationReq_Operation) error {
|
||||||
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
@ -98,4 +96,4 @@ func convertBypassBoolVal(p request_proto.BypassOperationReq_Operation) bool {
|
|||||||
val = false
|
val = false
|
||||||
}
|
}
|
||||||
return val
|
return val
|
||||||
}
|
}*/
|
||||||
|
@ -114,9 +114,9 @@ func (ibp *IBPSys) empState(entry *ecs.Entry, s *component.EmpElectronic) {
|
|||||||
func getIbpBtnVal(entry *ecs.Entry) bool {
|
func getIbpBtnVal(entry *ecs.Entry) bool {
|
||||||
btn := component.BitStateType.Get(entry)
|
btn := component.BitStateType.Get(entry)
|
||||||
//旁路后返回之前的值
|
//旁路后返回之前的值
|
||||||
if btn.BypassEnable {
|
/* if btn.BypassEnable {
|
||||||
return btn.OldVal
|
return btn.OldVal
|
||||||
}
|
}*/
|
||||||
return btn.Val
|
return btn.Val
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,9 +124,9 @@ func getIbpBtnVal(entry *ecs.Entry) bool {
|
|||||||
func getIbpKeyVal(entry *ecs.Entry) bool {
|
func getIbpKeyVal(entry *ecs.Entry) bool {
|
||||||
btn := component.GearStateType.Get(entry)
|
btn := component.GearStateType.Get(entry)
|
||||||
//旁路后返回之前的值
|
//旁路后返回之前的值
|
||||||
if btn.BypassEnable {
|
/* if btn.BypassEnable {
|
||||||
return btn.OldVal
|
return btn.OldVal
|
||||||
}
|
}*/
|
||||||
return btn.Val == 0
|
return btn.Val == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,24 +72,18 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
mkx := component.MkxType.Get(mkxEntry)
|
mkx := component.MkxType.Get(mkxEntry)
|
||||||
//门控箱站台门关闭
|
//门控箱站台门关闭
|
||||||
pcb := component.BitStateType.Get(mkx.PCB)
|
pcb := component.BitStateType.Get(mkx.PCB)
|
||||||
if !pcb.BypassEnable {
|
if mkx.PCB != nil && pcb.Val {
|
||||||
if mkx.PCB != nil && pcb.Val {
|
pcbTd = true
|
||||||
pcbTd = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//门控箱站台门打开
|
//门控箱站台门打开
|
||||||
pob := component.BitStateType.Get(mkx.POB)
|
pob := component.BitStateType.Get(mkx.POB)
|
||||||
if !pob.BypassEnable {
|
if mkx.POB != nil && pob.Val {
|
||||||
if mkx.POB != nil && pob.Val {
|
pobTd = true
|
||||||
pobTd = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//门控箱站台确认
|
//门控箱站台确认
|
||||||
pab := component.BitStateType.Get(mkx.PAB)
|
pab := component.BitStateType.Get(mkx.PAB)
|
||||||
if !pab.BypassEnable {
|
if mkx.PAB != nil && pab.Val {
|
||||||
if mkx.PAB != nil && pab.Val {
|
pabTd = true
|
||||||
pabTd = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if pmc.PCBJ != nil {
|
if pmc.PCBJ != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user