Compare commits
15 Commits
64cbf59ac6
...
e1cd37bcfd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1cd37bcfd | ||
|
|
dcd806309c | ||
|
|
3915bd59d1 | ||
|
|
ae96a8aa97 | ||
|
|
9aeacea4d7 | ||
|
|
22fe43a062 | ||
|
|
cee75d02cf | ||
|
|
4f3f4ff7f8 | ||
|
|
3cbba93658 | ||
|
|
9d476859b1 | ||
|
|
5657892887 | ||
|
|
606f5ea689 | ||
|
|
6c62419bdb | ||
|
|
5991a079c7 | ||
|
|
2a29e4bd54 |
@@ -28,7 +28,7 @@ interfer/center_offset=Vector2(200, 225)
|
||||
interfer/default_color0=Color(0.38, 0.47, 0.51, 1)
|
||||
interfer/default_color1=Color(0.39, 0.44, 0.5, 1)
|
||||
interfer/select_color=Color(1, 1, 1, 1)
|
||||
interfer/interfer_color=Color(0.58, 0.47, 0.51, 1)
|
||||
interfer/interfer_color=Color(0.9, 0.1, 0.25, 0.9)
|
||||
interfer/resend_timeout=1000.0
|
||||
config/external_cu=false
|
||||
config/unit_rr_request_period=20.0
|
||||
@@ -36,7 +36,7 @@ config/kems_files_path="user://kems/"
|
||||
config/emsg_files_path="user://emsg/"
|
||||
config/settings_path="user://settings.json"
|
||||
config/unit_bpo_request_period=20.0
|
||||
interfer/emit_color=Color(0.58, 0.471, 0.51, 0.2)
|
||||
interfer/emit_color=Color(0.9, 0.1, 0.25, 0.5)
|
||||
interfer/closed_sectors=Color(0, 0, 0, 1)
|
||||
|
||||
[autoload]
|
||||
|
||||
@@ -122,7 +122,8 @@ func on_interfer_new(ecm, table_index):
|
||||
# Будем надеяться, что отложенные вызовы производятся в том же порядке
|
||||
$table.call_deferred('clear_rows_selected')
|
||||
$table.call_deferred('set_row_selected', i_row, true)
|
||||
signaller.emit_signal('interfer_selected', ecm)
|
||||
if not interfer.auto_enabled:
|
||||
signaller.emit_signal('interfer_selected', ecm)
|
||||
|
||||
|
||||
func on_interfer_off(ecm, table_index):
|
||||
|
||||
23
scenes/frame-threats/emit-led.tscn
Normal file
23
scenes/frame-threats/emit-led.tscn
Normal file
@@ -0,0 +1,23 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://d012h4hxf2anf"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b3woliae871je" path="res://data/отметка-неопред.png" id="1_0a4l0"]
|
||||
|
||||
[node name="emit-led" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="texture-led" type="TextureButton" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 26.0
|
||||
offset_top = 11.0
|
||||
offset_right = 3.0
|
||||
offset_bottom = -12.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture_normal = ExtResource("1_0a4l0")
|
||||
@@ -35,5 +35,5 @@ script = ExtResource("2_empn3")
|
||||
|
||||
[node name="table" type="GridContainer" parent="scroll"]
|
||||
layout_mode = 2
|
||||
columns = 4
|
||||
columns = 5
|
||||
script = ExtResource("3_4bupu")
|
||||
|
||||
@@ -5,14 +5,16 @@ class_name scroll_threats extends ScrollContainer
|
||||
|
||||
const CellLineEdit = preload('res://table/ячейка-2.tscn') ## Ячейка таблицы.
|
||||
const TableHeader = preload('res://table/header.tscn') ## Ячейка заголовок таблицы.
|
||||
const EmitLed = preload('res://scenes/frame-threats/emit-led.tscn') ## Ячейка заголовок таблицы.
|
||||
|
||||
const TABLE_HEADER = [ TableHeader, TableHeader, TableHeader, TableHeader , TableHeader ] ## Описание ряда заголовка.
|
||||
const TABLE_ROW = [ CellLineEdit, CellLineEdit, CellLineEdit, CellLineEdit, EmitLed ] ## Описание ряда.
|
||||
const TABLE_COLUMN_PARAM = ['id', 'aoa', 'freq', 'proto', 'emit' ] ## Параметры цели отображаемые в таблице.
|
||||
const TABLE_HEADERS_TEXT = ['№', 'Пеленг', 'Частота, МГц', 'Протокол', 'Помеха' ] ## Заголовки таблицы.
|
||||
const TABLE_COLUMN_SIZE = [ 65, 70, 110, 140, 65] ## Ширины колонок.
|
||||
|
||||
const TABLE_HEADER = [ TableHeader, TableHeader, TableHeader, TableHeader ] ## Описание ряда заголовка.
|
||||
const TABLE_ROW = [ CellLineEdit, CellLineEdit, CellLineEdit, CellLineEdit ] ## Описание ряда.
|
||||
const TABLE_COLUMN_PARAM = ['id', 'aoa', 'freq', 'proto' ] ## Параметры цели отображаемые в таблице.
|
||||
const TABLE_HEADERS_TEXT = ['№', 'Пеленг', 'Частота, МГц', 'Протокол' ] ## Заголовки таблицы.
|
||||
const TABLE_COLUMN_SIZE = [ 65, 145, 145, 90 ] ## Ширины колонок.
|
||||
|
||||
const TABLE_TEXT_ROWS = 4
|
||||
const EMIT_STATE_COL = 4
|
||||
|
||||
## Снимает выделение цели.
|
||||
func on_rto_threat_unsel(_th_id): $table.clear_rows_selected()
|
||||
@@ -63,6 +65,17 @@ func on_threat_update(th, table_index: Dictionary):
|
||||
var row = map_th_to_row(th)
|
||||
var i_row = table_index[th.id]
|
||||
$table.set_row_text(i_row, row)
|
||||
var emit_node = $table.get_node2(EMIT_STATE_COL, i_row)
|
||||
var emit_txr = emit_node.get_node('texture-led')
|
||||
if th.emit_state == 0:
|
||||
emit_txr.visible = false
|
||||
elif th.emit_state == 1:
|
||||
emit_txr.visible = true
|
||||
emit_txr.self_modulate = Color.ORANGE
|
||||
elif th.emit_state == 2:
|
||||
emit_txr.visible = true
|
||||
emit_txr.self_modulate = Color.RED
|
||||
|
||||
|
||||
|
||||
## Обрабатывает сигнал [b]threat_lost[/b].
|
||||
@@ -78,7 +91,7 @@ func on_threat_new(th, table_index):
|
||||
$table.add_row(TABLE_ROW)
|
||||
var row = map_th_to_row(th)
|
||||
$table.set_row_text(i_row, row)
|
||||
$table.set_row_editable(i_row, false)
|
||||
disable_edit($table, TABLE_TEXT_ROWS, i_row)
|
||||
$table.set_node_user_data(0, i_row, th)
|
||||
table_index[th.id] = i_row
|
||||
|
||||
@@ -86,10 +99,11 @@ func on_threat_new(th, table_index):
|
||||
## Преобразует цель в строку таблицы.
|
||||
func map_th_to_row(th) -> Array:
|
||||
var row: = Array()
|
||||
row.resize(TABLE_COLUMN_PARAM.size())
|
||||
row.resize(TABLE_TEXT_ROWS)
|
||||
var i_col: int = 0
|
||||
for param_name in TABLE_COLUMN_PARAM:
|
||||
var val = th.get(param_name)
|
||||
if val == null: continue
|
||||
row[i_col] = '%0.1f' % val if val is float else '%s' % val
|
||||
if not th.fflags[param_name]:
|
||||
row[i_col] = ''
|
||||
@@ -104,3 +118,13 @@ func on_rto_threat_sel(th_id, tbl):
|
||||
if node.text.to_int() == th_id:
|
||||
row_pressed(i)
|
||||
break
|
||||
|
||||
|
||||
## Отключает возможность редактирования LineEdit в таблице.[br]
|
||||
## [param tbl] - таблица,[br]
|
||||
## [param num_col] - номер колонки,[br]
|
||||
## [param i_row] - номер столбца.[br]
|
||||
func disable_edit(tbl, num_col: int, i_row: int):
|
||||
for col in num_col:
|
||||
var node: LineEdit = tbl.get_node2(col, i_row)
|
||||
node.editable = false
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.7 KiB |
@@ -3,6 +3,5 @@
|
||||
[ext_resource type="Texture2D" uid="uid://cj1f2uy6qfvki" path="res://scenes/tilemap/23900.png" id="1_v0nwa"]
|
||||
|
||||
[node name="23900" type="Sprite2D"]
|
||||
rotation = 4.71239
|
||||
scale = Vector2(0.496934, 0.496934)
|
||||
texture = ExtResource("1_v0nwa")
|
||||
|
||||
@@ -64,7 +64,7 @@ const SETTING_TABLE = [
|
||||
['Адрес БПО правого борта', TableEdit, TableEdit, 'http-адрес для запроса состояния прибора БПО'],
|
||||
['Период опроса состояния БПО, секунды', TableEdit, TableEdit, 'Время в секундах' ],
|
||||
['Период опроса состояния АФСП, секунды', TableEdit, TableEdit, 'Время в секундах' ],
|
||||
['уареп-трасса', TableEdit, TableEdit, 'IP-адрес для связи с Трассой [<адрес этого узла>, <адрес удалённого узла>, <порт этого узла>, <порт удалённого узла>]'],
|
||||
['уарэп-трасса', TableEdit, TableEdit, 'IP-адрес для связи с Трассой [<адрес этого узла>, <адрес удалённого узла>, <порт этого узла>, <порт удалённого узла>]'],
|
||||
['Включить работу по своим целям', TableEdit, TableToggle, 'Разрешает работу в секторе со своей целью'],
|
||||
['Список своих протоколов', TableEdit, TableEdit, 'Список протоколов целей, по которым запрещено работать' ], ]
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ var strob_band_begin: float ## Ширина строба в моме
|
||||
var strob_dir_begin: float ## Направление антенны в момент начала перетаскивания.
|
||||
var strob_width_begin: float ## Ширина строба по углу в момент начала перетаскивания.
|
||||
var view_mode: MapViewMode ## Режим отображения карты
|
||||
var thrs_dict: Dictionary ## Ссылка на словарь целей
|
||||
var thrs_dict: Dictionary ## Ссылка на словарь целей
|
||||
var gos_flag = true ## Флаг работать по своим целям
|
||||
var color_ecm: Color
|
||||
var color_select: Color
|
||||
var color_emit: Color
|
||||
@@ -92,6 +93,7 @@ func on_enter_tree() -> void: call_deferred('on_button_strobe_pressed')
|
||||
|
||||
|
||||
func on_settings_changed():
|
||||
gos_flag = ProjectSettings.get_setting('application/config/Включить работу по своим целям', true)
|
||||
color_emit = ProjectSettings.get_setting('application/interfer/emit_color', Color(0.58, 0.47, 0.51, 1.0))
|
||||
color_ecm = ProjectSettings.get_setting('application/interfer/interfer_color', Color(0.58, 0.47, 0.51, 1.0))
|
||||
color_select = ProjectSettings.get_setting('application/interfer/select_color', Color(1.0, 1.0, 1.0, 1.0))
|
||||
@@ -109,9 +111,7 @@ func on_settings_changed():
|
||||
|
||||
## Обработчик сигнала изменения списка целей.
|
||||
func on_threats_resized(ths: Dictionary):
|
||||
$count_all_pad/count_all.text = '%02d' % ths.size()
|
||||
var c: int = ths.values().filter(func(th: threats.Threat): return th.proto != '').size()
|
||||
$count_danger_pad/count_danger.text = '%02d' % c
|
||||
count_threats(ths)
|
||||
thrs_dict = ths
|
||||
|
||||
|
||||
@@ -529,7 +529,6 @@ func update_fs_colors():
|
||||
$btn_activate.self_modulate = Color.WHITE
|
||||
else:
|
||||
$btn_activate.self_modulate = Color.WHITE
|
||||
|
||||
|
||||
|
||||
func unsel_fs_all(need_btns_off: bool):
|
||||
@@ -590,6 +589,8 @@ func on_btn_center_toggled(toggled_on: bool) -> void:
|
||||
func on_btn_activate_toggled(toggled_on: bool) -> void:
|
||||
$btn_activate.tooltip_text = 'Включает подавление (%s)' % ('включено' if toggled_on else 'отключено')
|
||||
signaller.emit_signal('emit_changed', toggled_on)
|
||||
if not toggled_on:
|
||||
$btn_activate.self_modulate = Color.WHITE
|
||||
|
||||
|
||||
func on_update_coordinates_label(coordinates_label) -> void:
|
||||
@@ -623,6 +624,14 @@ func _on_btn_all_work_pressed() -> void:
|
||||
|
||||
|
||||
func on_th_aoa_update(ths):
|
||||
count_threats(ths)
|
||||
|
||||
|
||||
func count_threats(ths):
|
||||
$count_all_pad/count_all.text = '%02d' % ths.size()
|
||||
var c: int = ths.values().filter(func(th: threats.Threat): return th.proto != '').size()
|
||||
var c: int = 0
|
||||
if gos_flag:
|
||||
c = ths.values().filter(func(th: threats.Threat): return th.proto != '').size()
|
||||
else:
|
||||
c = ths.values().filter(func(th: threats.Threat): return ((th.proto != '') and th.proto not in interfer.gos_protocols)).size()
|
||||
$count_danger_pad/count_danger.text = '%02d' % c
|
||||
|
||||
@@ -379,12 +379,12 @@ texture_normal = ExtResource("14_ggrwd")
|
||||
[connection signal="drag_continue" from="." to="." method="_on_drag_continue"]
|
||||
[connection signal="toggled" from="btn_view" to="." method="on_button_view_toggled"]
|
||||
[connection signal="toggled" from="chk_auto" to="." method="on_value_changed"]
|
||||
[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"]
|
||||
[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate"]
|
||||
[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"]
|
||||
[connection signal="toggled" from="btn_center" to="." method="on_btn_center_toggled"]
|
||||
[connection signal="button_down" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_down"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_button_up"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_up"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_button_up"]
|
||||
[connection signal="button_down" from="zoom_minus" to="tilemap" method="_on_zoom_minus_button_down"]
|
||||
[connection signal="button_up" from="zoom_minus" to="tilemap" method="_on_zoom_button_up"]
|
||||
[connection signal="pressed" from="btn_all_work" to="." method="_on_btn_all_work_pressed"]
|
||||
|
||||
@@ -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]
|
||||
@@ -257,15 +258,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 +296,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 = []
|
||||
@@ -366,13 +367,23 @@ 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:
|
||||
kni += 360.0
|
||||
var id = item.id
|
||||
param['freq'] = item.freq
|
||||
param['width'] = item.width
|
||||
param['width'] = item.width * 1.5
|
||||
if (item.rkrp != '') and item.fflags.rkrp and auto_enabled:
|
||||
var krp = get_krp(item)
|
||||
if krp != '':
|
||||
@@ -454,13 +465,16 @@ 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) # Значение по умолчанию
|
||||
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:
|
||||
@@ -477,7 +491,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 +526,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):
|
||||
@@ -561,8 +577,12 @@ 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
|
||||
ecm.params['width'] = threat.width
|
||||
var width = threat.width * 1.5
|
||||
if width < settings.WIDTH_MIN:
|
||||
width = settings.WIDTH_MIN
|
||||
ecm.params['width'] = width
|
||||
if (threat.rkrp != '') and threat.fflags.rkrp and auto_enabled:
|
||||
var krp = get_krp(threat)
|
||||
if krp != '':
|
||||
@@ -576,58 +596,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):
|
||||
@@ -654,7 +624,7 @@ func set_rparams(threat: threats.Threat, params: Dictionary):
|
||||
if threat.rparams.has('width'):
|
||||
params['width'] = threat.rparams['width']
|
||||
else:
|
||||
params['width'] = threat.width
|
||||
params['width'] = threat.width * 1.5
|
||||
if threat.rparams.has('filename'):
|
||||
params['filename'] = threat.rparams['filename']
|
||||
|
||||
@@ -713,3 +683,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
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ var UnitProfiles: Dictionary[StringName, Array] = { \
|
||||
const FREQ_MAX: = 6000.0
|
||||
const FREQ_MIN: = 400.0
|
||||
const WIDTH_MAX: = 120.0
|
||||
const WIDTH_MIN: = 0.0
|
||||
const WIDTH_MIN: = 5.0
|
||||
const DUR_MAX: = 1000000.0
|
||||
const PERIOD_MAX: = 1000000.0
|
||||
const UM_MIN: = -5.0
|
||||
|
||||
@@ -28,6 +28,9 @@ class Threat:
|
||||
var width: float ## Ширина занимаемого диапазона частот, МГц.
|
||||
var selected: bool ## Флаг, что цель выбрана.
|
||||
var auto_selected: bool = false ## Флаг автомата для целей
|
||||
var emit_state: int = 0 ## 0 - подавление не назначено, 1 - назначено, 2 - выполняется
|
||||
var nmfs: int ## Индекс модуля ФС, в зону действия которого попала цель
|
||||
var priority: int ## Приоритет опасности цели
|
||||
|
||||
func _init(): clear_fflags()
|
||||
func _to_string() -> String: return 'номер: %d пеленг: %0.1f частота: %0.1f МГц' % [id, aoa, freq]
|
||||
@@ -140,6 +143,10 @@ func on_data_capsrpb_received(unit: capsrpb.CapsRpb, threats: Dictionary):
|
||||
th.clear_fflags()
|
||||
th.set_from_dic(dic_th)
|
||||
th.tick_rx = unit.tick
|
||||
if th.fflags.proto and th.proto != '':
|
||||
th.priority = 1
|
||||
else:
|
||||
th.priority = 0
|
||||
call_deferred('emit_signal', 'threat_update', th)
|
||||
else:
|
||||
var th: = Threat.new()
|
||||
|
||||
Reference in New Issue
Block a user