Рефактор

This commit is contained in:
lepshiy
2024-12-11 10:54:23 +03:00
committed by sasha80
parent 6e74f8a142
commit d629b45032
5 changed files with 18 additions and 6 deletions

View File

@@ -17,7 +17,7 @@ const INTERFER_STATE = {
2: 'Ошибка',
3: 'Занято',
4: 'Неисправность',
5: ' ' }
5: '' }
## Состояние выполнения сеанса помехи

View File

@@ -7,6 +7,7 @@ func _ready():
on_value_changed(0)
signaller.connect('interfer_prenuditelno', Callable(self, 'on_interfer_prenuditelno'))
func on_value_changed(val):
val = int(val)
for nm in VAL_TO_LABEL.values():
@@ -16,6 +17,7 @@ func on_value_changed(val):
lbl1.self_modulate.a = 1.0
signaller.emit_signal(VAL_TO_EVENT[val])
func on_interfer_prenuditelno(_interfer_sectors):
self.set_value_no_signal(0)
on_value_changed(0)

View File

@@ -136,6 +136,14 @@ func on_manual_control():
func on_full_auto():
auto_status = 3
func on_manual_control():
auto_status = 0
func on_full_auto():
auto_status = 3
func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit):
for thr in threats.values():
var th_id = thr.id
@@ -159,10 +167,10 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit):
## Производит приём состояния помех. [param unit] -> [param ecms].
func on_data_capsrpb_received(unit: capsrpb.CapsRpb, ecms: Dictionary):
if not unit.json_dic.has('ts'): return
if not (unit.json_dic['ts'] is float): return
if unit.json_dic['ts'] != 5: return
if not unit.json_dic.has('msvk'): return
if not unit.json_dic.has('ts'): return
if not (unit.json_dic['ts'] is float): return
if unit.json_dic['ts'] != 5: return
if not unit.json_dic.has('msvk'): return
if not (unit.json_dic['msvk'] is Array): return
var msvk = unit.json_dic['msvk']
var sz: = ecms.size()
@@ -279,6 +287,7 @@ func on_interfer_off_all(unit, ecms):
send_ecm(ecm, unit)
signaller.emit_signal('interfer_off',ecm, ecms, thrs)
func on_threats_lost(th, ecms, unit):
for key in interfer.thrs:
if interfer.thrs[key] == th.id:

View File

@@ -151,4 +151,5 @@ signal th_aoa_update(threats: Dictionary)
## [param ecms] - <...>
signal fs_update_color(ecms: Dictionary)
signal socket_error(error: String)

View File

@@ -27,7 +27,7 @@ class Threat:
var tmod: String ## Тип модуляции.
var width: float ## Ширина занимаемого диапазона частот, МГц.
var selected: bool ## Флаг, что цель выбрана.
var auto_selected: bool = false #Флаг автомата для целей
var auto_selected: bool = false ## Флаг автомата для целей
func _init(): clear_fflags()
func _to_string() -> String: return 'номер: %d пеленг: %0.1f частота: %0.1f МГц' % [id, aoa, freq]