rts-sim-module/component/equipment.go

21 lines
520 B
Go
Raw Normal View History

package component
import (
"unsafe"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component/component_data"
)
var (
RelayFaultForceType = ecs.NewComponentType[component_data.RelayFaultForce]()
)
func AddOrUpdateRelayFaultForce(entry *ecs.Entry, q bool) {
if entry.HasComponent(RelayFaultForceType) {
entry.SetComponent(RelayFaultForceType, unsafe.Pointer(&component_data.RelayFaultForce{Q: q}))
} else {
entry.AddComponent(RelayFaultForceType, unsafe.Pointer(&component_data.RelayFaultForce{Q: q}))
}
}