rts-sim-module/fi/psd.go

54 lines
1.3 KiB
Go

package fi
import (
"fmt"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity"
)
func ClosePsd(world ecs.World, id string) {
worldData := entity.GetWorldData(world)
world.Execute(func() {
entry, ok := worldData.EntityMap[id]
if ok {
psdDriveCircuit := component.PsdDriveCircuitType.Get(entry)
psdDriveCircuit.GMJ = true
psdDriveCircuit.KMJ4 = false
psdDriveCircuit.KMJ8 = false
} else {
fmt.Printf("未找到id=%s的屏蔽门\n", id)
}
})
}
func Km4Psd(world ecs.World, id string) {
worldData := entity.GetWorldData(world)
world.Execute(func() {
entry, ok := worldData.EntityMap[id]
if ok {
psdDriveCircuit := component.PsdDriveCircuitType.Get(entry)
psdDriveCircuit.GMJ = false
psdDriveCircuit.KMJ4 = true
psdDriveCircuit.KMJ8 = false
} else {
fmt.Printf("未找到id=%s的屏蔽门\n", id)
}
})
}
func Km8Psd(world ecs.World, id string) {
worldData := entity.GetWorldData(world)
world.Execute(func() {
entry, ok := worldData.EntityMap[id]
if ok {
psdDriveCircuit := component.PsdDriveCircuitType.Get(entry)
psdDriveCircuit.GMJ = false
psdDriveCircuit.KMJ4 = false
psdDriveCircuit.KMJ8 = true
} else {
fmt.Printf("未找到id=%s的屏蔽门\n", id)
}
})
}