28 lines
708 B
Go
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
|
|
})
|
|
}
|