[PATCH] Доработка. Добавлен приоритет цели и помехи, в автомате помехи с меньшим приоритетом снимаются.

This commit is contained in:
MaD_CaT
2025-11-13 14:03:39 +03:00
committed by sasha80
parent 22fe43a062
commit 9aeacea4d7
2 changed files with 21 additions and 1 deletions

View File

@@ -125,6 +125,7 @@ class Interfer:
var modulation: bool ## Модуляция для включения усилителей
var um: float ## Угол места для помехи.
var nmfs: int = 0 ## Номер модуля ФС в нумерации СТЦ
var priority: int = 0 ## Приоритет помехи
func _to_string() -> String:
return 'номер: %d название: %s частота: %0.1f МГц пеленг: %0.1f гр.' % [ispp, ITERFER_MODE[krp][0], params['freq'], kni]
@@ -366,6 +367,16 @@ func map_mpchf_to_seczaps(unit_instance: unit.Unit, _seczaps: Dictionary):
## Вызыватся, когда пользователь выбрал помеху и выбраны цели.
func on_interfer_create(interfer_name, sel_threats, fs_arr, power, u, ecms) -> void:
for item in sel_threats:
if auto_enabled:
var need_continue = false
for ecm in ecms.values():
if ecm.nmfs == item.nmfs:
if item.priority > ecm.priority:
interfer_off(ecm, u)
elif item.priority < ecm.priority:
need_continue = true
break
if need_continue: continue
var param: Dictionary = {}
var kni: float = item.aoa - course
if kni < 0:
@@ -461,6 +472,9 @@ func interfer_create(u, interfer_name, ecms, param, kni, id, dict, source_interf
ecm.powp = power
ecm.source_interfer = source_interfer
ecm.um = param.get('um', 15.0) # Значение по умолчанию
if source_interfer == SOURCE_INTERFER[0]:
if thrs_dict.has(dict[ispp]):
ecm.priority = thrs_dict[dict[ispp]].priority
call_ecm_proc(ecm)
var set_nmfs_ok = set_nmfs(ecm)
if set_nmfs_ok != Error.OK:
@@ -563,6 +577,7 @@ func on_threats_update(threat, ecms, unit_caps):
for ecm_i in thrs.keys():
if thrs[ecm_i] == th_id:
ecm = ecms[ecm_i]
ecm.priority = threat.priority
ecm.params['freq'] = threat.freq
var width = threat.width * 1.5
if width < settings.WIDTH_MIN: