rts-sim-module/fi/relay.go
walker 9401b15142 组件调整
实体加载调整
继电器、断相保护器、道岔转辙机、道岔、道岔电路等系统调整
继电器、道岔对外接口调整
2024-01-12 18:20:21 +08:00

28 lines
708 B
Go

package fi
import (
"unsafe"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/component/component_data"
)
// 继电器功能接口
// 设置继电器强制故障
func SetRelayFaultForce(w ecs.World, id string, q bool) error {
return updateEntity(w, id, "继电器", func(entry *ecs.Entry) error {
entry.AddComponent(component.RelayFaultForceType, unsafe.Pointer(&component_data.RelayFaultForce{Q: q}))
return nil
})
}
// 取消继电器强制故障
func CancelRelayFaultForce(w ecs.World, id string) error {
return updateEntity(w, id, "继电器", func(entry *ecs.Entry) error {
entry.RemoveComponent(component.RelayFaultForceType)
return nil
})
}