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