[PATCH] Доработка. Колонка со статусом выполнения помехи для конкретной цели. (замечание "комиссии")

This commit is contained in:
MaD_CaT
2025-11-13 13:17:18 +03:00
committed by sasha80
parent 4f3f4ff7f8
commit cee75d02cf
7 changed files with 104 additions and 87 deletions

View File

@@ -257,15 +257,28 @@ func on_timer_check_state(unit_instance, ecms, resend_timeout) -> void:
func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit_instance) -> void:
gos_nmfs.clear()
for thr in threats.values():
if not gos_flag: # Составляется список запретных секторов работы
if (thr.proto in gos_protocols) and thr.fflags.proto:
var fs_arr: Array = []
var th_aoa = fposmod(thr.aoa - course, 360)
prd.find_fs_index(th_aoa, thr.freq, fs_arr)
if fs_arr.size():
for item in fs_arr:
var nmfs = prd.FS_PRD[item][1]
gos_nmfs.append(nmfs)
var fs_arr: Array = []
var th_aoa = fposmod(thr.aoa - course, 360)
prd.find_fs_index(th_aoa, thr.freq, fs_arr)
if fs_arr.size():
for item in fs_arr:
var nmfs = prd.FS_PRD[item][1]
thr.nmfs = nmfs
if (thr.proto in gos_protocols) and thr.fflags.proto and (not gos_flag):
gos_nmfs.append(nmfs)
thr.emit_state = 0
for ecm in ecms.values():
if thr.nmfs == ecm.nmfs:
set_th_emit(thr, ecm)
var ecm_active = true
if not gos_flag:
if ecm.nmfs in gos_nmfs:
interfer_off(ecm, unit_instance)
ecm_active = false
if ecm_active and (prd.fs_caps_id[ecm.nmfs] in fs_closed):
interfer_off(ecm, unit_instance)
var th_id = thr.id
for ecm_i in thrs.keys():
if thrs[ecm_i] == th_id:
@@ -282,19 +295,6 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit_instance) -> v
signaller.emit_signal('fs_update_color', ecms)
prd.update_fs_state(ecms, trenazh_mode)
for ecm in ecms.values():
var ecm_active = true
if not gos_flag:
if ecm.nmfs in gos_nmfs:
interfer_off(ecm, unit_instance)
ecm_active = false
if ecm_active and (prd.fs_caps_id[ecm.nmfs] in fs_closed):
interfer_off(ecm, unit_instance)
if not auto_enabled:
return
if auto_enabled:
for thr in threats.values():
var fs_arr: Array = []
@@ -454,12 +454,12 @@ func interfer_create(u, interfer_name, ecms, param, kni, id, dict, source_interf
ecm = Interfer.new()
ecm.ispp = ispp
ecms[ispp] = ecm
ecm.modulation = emit_enable
ecm.kni = kni
ecm.krp = interfer_name
ecm.params = param
ecm.powp = power
ecm.source_interfer = source_interfer
ecm.modulation = emit_enable
ecm.um = param.get('um', 15.0) # Значение по умолчанию
call_ecm_proc(ecm)
var set_nmfs_ok = set_nmfs(ecm)
@@ -477,7 +477,7 @@ func interfer_create(u, interfer_name, ecms, param, kni, id, dict, source_interf
func send_ecm(ecm, unit0) -> void:
if ecm.krp != INTERFER_OFF:
if not emit_enable:
if not ecm.modulation:
ecm.svk = 0
call_deferred('emit_signal', 'interfer_update', ecm)
return
@@ -512,8 +512,10 @@ func push_id(id: int) -> void:
id_array.sort()
func on_emit_changed(state, _ecms) -> void:
func on_emit_changed(state, ecms) -> void:
emit_enable = state
for ecm in ecms.values():
ecm.modulation = state
func call_all_diap(ecm, ecm_params: Dictionary):
@@ -576,58 +578,8 @@ func on_threats_update(threat, ecms, unit_caps):
if ecm.kni < 0:
ecm.kni += 360
set_nmfs(ecm)
if threat.tmod != 'fm':
if ecm != null:
send_ecm(ecm, unit_caps)
return
var th_fm_dict: Dictionary
var fs_index_arr: Array
prd.find_fs_index(threat.aoa, threat.freq, fs_index_arr)
if fs_index_arr.size() == 0:
if ecm != null:
send_ecm(ecm, unit_caps)
return
var fs_index = fs_index_arr[0]
var nmfs = prd.FS_PRD[fs_index][1]
if ecm == null:
for ecm_i in ecms.values():
if nmfs != ecm_i.nmfs: continue
if ecm_i.svk != 1: continue
ecm = ecm_i
if ecm == null: return
for th_index in thrs_dict:
if thrs_dict[th_index].tmod != 'fm': continue
fs_index_arr = []
prd.find_fs_index(thrs_dict[th_index].aoa, thrs_dict[th_index].freq, fs_index_arr)
if fs_index_arr.size() == 0: continue
if fs_index_arr[0] != fs_index: continue
th_fm_dict[th_index] = thrs_dict[th_index]
if len(th_fm_dict) > 1:
pass
send_ecm(ecm, unit_caps)
func get_freq_range(freq_range_dict: Dictionary, th_dict: Dictionary):
for key_i in th_dict:
var min_range: int = 6000
var key_min = null
for key_j in th_dict:
if key_i == key_j: continue
var width = (th_dict[key_i].width / 2) + (th_dict[key_j].width / 2)
var freq_range = abs(th_dict[key_i].freq - th_dict[key_j].freq) + width
if freq_range < min_range:
key_min = key_j
min_range = freq_range
var max_width = 0
for key in PDCHM_PARAMS['files'].keys():
if max_width < key: max_width = key
if min_range > max_width:
th_dict.erase(key_i)
continue
else:
if key_min == null: continue
freq_range_dict[key_i] = [th_dict[key_i], th_dict[key_min], min_range]
if ecm != null:
send_ecm(ecm, unit_caps)
func find_threat(freq: int, aoa: float):
@@ -713,3 +665,16 @@ func call_ecm_proc(ecm):
func on_update_fs_closed(fs_dict):
fs_closed = fs_dict
func set_th_emit(th: threats.Threat, ecm: Interfer):
var freq_min = ecm.params['freq'] - ecm.params.get('width', settings.WIDTH_MAX)/2
var freq_max = ecm.params['freq'] + ecm.params.get('width', settings.WIDTH_MAX)/2
if (th.freq >= freq_min) and (th.freq <= freq_max):
if ecm.svk == 1:
th.emit_state = 2
elif th.emit_state == 2:
return
else:
th.emit_state = 1

View File

@@ -28,6 +28,8 @@ class Threat:
var width: float ## Ширина занимаемого диапазона частот, МГц.
var selected: bool ## Флаг, что цель выбрана.
var auto_selected: bool = false ## Флаг автомата для целей
var emit_state: int = 0 ## 0 - подавление не назначено, 1 - назначено, 2 - выполняется
var nmfs:int ## Индекс модуля ФС, в зону действия которого попала цель
func _init(): clear_fflags()
func _to_string() -> String: return 'номер: %d пеленг: %0.1f частота: %0.1f МГц' % [id, aoa, freq]