2023-12-27 18:11:27 +08:00
|
|
|
|
package component
|
|
|
|
|
|
|
|
|
|
import "joylink.club/ecs"
|
|
|
|
|
|
|
|
|
|
// FluidPipe 流体管线
|
|
|
|
|
type FluidPipe struct {
|
2024-01-02 17:32:09 +08:00
|
|
|
|
Direction PipeFlowDirection //管线内综合流动方向
|
|
|
|
|
FlowSpeed float32 //管线内综合流量,m3/h
|
|
|
|
|
Sources []*SourceFlow //该管线内所有流体源投射的分量
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SourceFlow 流体源进入管线的流体描述
|
|
|
|
|
type SourceFlow struct {
|
|
|
|
|
Direction PipeFlowDirection
|
|
|
|
|
FlowSpeed float32
|
2023-12-27 18:11:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-29 17:00:26 +08:00
|
|
|
|
// PipeFlowDirection 管线内流体流动方向定义
|
|
|
|
|
type PipeFlowDirection int8
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
PipeFlowNon PipeFlowDirection = iota //流体未流动
|
|
|
|
|
PipeFlowAb //流体从管线的A->B
|
|
|
|
|
PipeFlowBa //流体从管线的B->A
|
|
|
|
|
)
|
|
|
|
|
|
2024-01-02 17:32:09 +08:00
|
|
|
|
func (d *PipeFlowDirection) IsFlowAb() bool {
|
|
|
|
|
return *d == PipeFlowAb
|
|
|
|
|
}
|
|
|
|
|
func (d *PipeFlowDirection) IsFlowBa() bool {
|
|
|
|
|
return *d == PipeFlowBa
|
|
|
|
|
}
|
|
|
|
|
func (d *PipeFlowDirection) IsFlowNon() bool {
|
|
|
|
|
return *d == PipeFlowNon
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-27 18:11:27 +08:00
|
|
|
|
// FluidDriver 流体驱动器
|
|
|
|
|
type FluidDriver struct {
|
2023-12-29 17:00:26 +08:00
|
|
|
|
On bool //true-输出流体驱动力;false-未输出流体驱动力
|
2023-12-27 18:11:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
FluidPipeType = ecs.NewComponentType[FluidPipe]() //流体管线
|
|
|
|
|
FluidDriverType = ecs.NewComponentType[FluidDriver]() //流体驱动器
|
|
|
|
|
)
|