2023-12-14 13:33:18 +08:00
|
|
|
package entity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"joylink.club/ecs"
|
|
|
|
"joylink.club/rtsssimulation/component"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NewNetworkHostEntity 创建网络设备、网络主机等实体
|
|
|
|
func NewNetworkHostEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.NetworkHostType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewSmokeDetectorEntity 创建烟感实体
|
|
|
|
func NewSmokeDetectorEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.SmokeDetectorType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewTemperatureDetectorEntity 创建温感实体
|
|
|
|
func NewTemperatureDetectorEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.TemperatureDetectorType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewManualFireAlarmButtonEntity 创建手动火灾报警按钮实体
|
|
|
|
func NewManualFireAlarmButtonEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.ManualFireAlarmButtonType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewGasFireExtinguisherEntity 创建气体灭火器实体
|
|
|
|
func NewGasFireExtinguisherEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.GasFireExtinguisherType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewAlarmBellEntity 创建警铃实体
|
|
|
|
func NewAlarmBellEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.AlarmBellType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// 创建防火卷帘
|
|
|
|
func newFireRollerShutterEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.FireRollerShutterType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewPartitionTypeFireRollerShutterEntity 创建隔断型防火卷帘
|
|
|
|
func NewPartitionTypeFireRollerShutterEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
entry := newFireRollerShutterEntity(w, id)
|
|
|
|
entry.AddComponent(component.PartitionTypeFireRollerShutterTag)
|
|
|
|
return entry
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewEvacuationTypeFireRollerShutterEntity 创建疏散型防火卷帘
|
|
|
|
func NewEvacuationTypeFireRollerShutterEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
entry := newFireRollerShutterEntity(w, id)
|
|
|
|
entry.AddComponent(component.EvacuationTypeFireRollerShutterTag)
|
|
|
|
return entry
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewFirePumpEntity 创建消防泵实体
|
|
|
|
func NewFirePumpEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
entry := NewWaterPumpEntity(w, id)
|
|
|
|
entry.AddComponent(component.FirePumpTag)
|
|
|
|
return entry
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewSprayPumpEntity 创建喷淋泵实体
|
|
|
|
func NewSprayPumpEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
entry := NewWaterPumpEntity(w, id)
|
|
|
|
entry.AddComponent(component.SprayPumpTag)
|
|
|
|
return entry
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewStabilizedPressurePumpEntity 创建稳压泵实体
|
|
|
|
func NewStabilizedPressurePumpEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
entry := NewWaterPumpEntity(w, id)
|
|
|
|
entry.AddComponent(component.StabilizedPressurePumpTag)
|
|
|
|
return entry
|
|
|
|
}
|
2023-12-14 16:17:54 +08:00
|
|
|
|
|
|
|
// NewFasAcsEntity 创建火警ACS联动实体
|
|
|
|
func NewFasAcsEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.FasAcsType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewFasAfcEntity 创建火警AFC联动实体
|
|
|
|
func NewFasAfcEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.FasAfcType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewWaterFlowIndicatorEntity 创建水流指示器实体
|
|
|
|
func NewWaterFlowIndicatorEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.WaterFlowIndicatorType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewSignalButterflyValveEntity 创建信号蝶阀实体
|
|
|
|
func NewSignalButterflyValveEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
entry := NewElectricControlValveEntity(w, id)
|
|
|
|
entry.AddComponent(component.SignalButterflyValveTag)
|
|
|
|
return entry
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewPressureSwitchEntity 压力开关是与电器开关相结合的装置,当到达预先设定的流体压力时,开关接点动作
|
|
|
|
func NewPressureSwitchEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
entry := NewElectricControlValveEntity(w, id)
|
|
|
|
entry.AddComponent(component.PressureSwitchTag)
|
|
|
|
return entry
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewNonFirePowerSourceEntity 创建非消防电源实体
|
|
|
|
func NewNonFirePowerSourceEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.NonFirePowerSourceType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewPumpStartButtonEntity 创建启泵按钮实体
|
|
|
|
func NewPumpStartButtonEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.PumpStartButtonType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewTemperatureSensingCableEntity 创建感温电缆实体
|
|
|
|
func NewTemperatureSensingCableEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.TemperatureSensingCableType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewElevatorToOriginalPosModuleEntity 电梯归首功能模块实体
|
|
|
|
func NewElevatorToOriginalPosModuleEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.ElevatorToOriginalPosModuleType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewFireDamperEntity 创建防火阀实体
|
|
|
|
func NewFireDamperEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.FireDamperType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewElectricSmokeFireDamperEntity 创建电动防火防烟阀实体
|
|
|
|
func NewElectricSmokeFireDamperEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.ElectricSmokeFireDamperType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewFireInterconnectionSignalEntity 创建火灾互联互通信号设备实体
|
|
|
|
func NewFireInterconnectionSignalEntity(w ecs.World, id string) *ecs.Entry {
|
|
|
|
wd := GetWorldData(w)
|
|
|
|
e, ok := wd.EntityMap[id]
|
|
|
|
if !ok {
|
|
|
|
e := w.Entry(w.Create(component.UidType, component.FireInterconnectionSignalType))
|
|
|
|
component.UidType.SetValue(e, component.Uid{Id: id})
|
|
|
|
wd.EntityMap[id] = e
|
|
|
|
}
|
|
|
|
return e
|
|
|
|
}
|