From 10fca2d34c1992c2abd0329c506b8ff402647be7 Mon Sep 17 00:00:00 2001 From: sasha80 Date: Tue, 4 Nov 2025 15:33:24 +0300 Subject: [PATCH 01/14] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=92=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5?= =?UTF-8?q?=D1=81=D1=81=D0=B5.=20=D0=A1=D1=82=D0=B0=D1=82=D0=B8=D1=87?= =?UTF-8?q?=D0=B5=D1=81=D0=BA=D0=B0=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + check-graph.py | 164 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 check-graph.py diff --git a/README.md b/README.md index 3fc369dd..aa9e0393 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,4 @@ - После клонирования запустить скрипт `git-hooks-config.sh` - В среде **Windows** запуск скрипта `git-hooks-config.sh` производить из оболочки `git bash` - Нужно обновить `settings.json` +- поиск циклических зависимостей diff --git a/check-graph.py b/check-graph.py new file mode 100644 index 00000000..73edca93 --- /dev/null +++ b/check-graph.py @@ -0,0 +1,164 @@ +# -*- coding: utf-8 -*- +import os +import re +import networkx as nx + +# pip install networkx plotly numpy scipy + +def build_class_graph(directory): + """Builds a directed acyclic graph of class dependencies.""" + # Create a graph to store the dependencies + graph = nx.DiGraph() + dependencies = {} + + # Find all .gd files in the directory + for root, dirs, files in os.walk(directory): + for file in files: + if not file.endswith(".gd"): + continue + + file_path = os.path.join(root, file) + # Find the class name in the file + with open(file_path, "r", encoding="utf-8") as f: + contents = f.read() + match = re.search(r"^class_name\s+(\w+)", contents, re.MULTILINE) + if not match: + continue + + class_name = match.group(1) + graph.add_node(class_name) + + # Find the dependencies of the class + for dep_match in re.finditer( + r"^\s*extends\s+(\w+)", contents, re.MULTILINE + ): + dep_name = dep_match.group(1) + graph.add_edge(class_name, dep_name) + + # Find all uses of the class name in other files + for root2, dirs2, files2 in os.walk(directory): + for file2 in files2: + if not file2.endswith(".gd"): + continue + + if file_path == os.path.join(root2, file2): + continue + + with open(os.path.join(root2, file2), "r", encoding="utf-8") as f2: + contents2 = f2.read() + if re.search(rf"\b{class_name}\b", contents2): + print( + file2.ljust(30, " "), + f"--> class_name {class_name}".ljust(50, " "), + f" from {file}", + ) + graph.add_edge(class_name, file2) + dependencies[file2] = file + + pos = nx.planar_layout(graph) + + # Set the node positions in the graph + nx.set_node_attributes(graph, pos, "pos") + + return graph, dependencies + + +def debug_graph(graph): + """Builds and visualizes a graph of class dependencies in the directory.""" + import plotly.graph_objects as go + + # Create the plotly figure + fig = go.Figure() + + # Add the nodes to the figure + for node in graph.nodes(): + x, y = graph.nodes[node]["pos"] + fig.add_trace( + go.Scatter( + x=[x], + y=[y], + text=[node], + hovertext=[f"Class: {node}"], + mode="markers", + marker=dict( + symbol="circle", size=20, line=dict(width=1, color="black"), + ), + name=node, + ) + ) + + # Add the edges to the figure + for edge in graph.edges(): + x0, y0 = graph.nodes[edge[0]]["pos"] + x1, y1 = graph.nodes[edge[1]]["pos"] + fig.add_trace( + go.Scatter( + x=[x0, x1], + y=[y0, y1], + text=[f"{edge[0]} -> {edge[1]}", ""], + hovertext=[f"Depends on: {edge[1]}", ""], + mode="lines+markers+text", + line=dict(width=2, color="black"), + marker=dict(size=0), + textposition="middle right", + showlegend=True, + ) + ) + + # Customize the layout and style of the figure + fig.update_layout( + title="Class Dependency Graph", + title_font_size=24, + margin=dict(l=20, r=20, t=50, b=20), + hovermode="closest", + plot_bgcolor="white", + showlegend=True, + ) + + # Show the figure + fig.show() + + +def find_circular_dependencies(dependencies): + """Finds circular dependencies between classes in the directory.""" + + circular_dependencies = [] + + for file, dependency in dependencies.items(): + visited = set() + path = [file] + + while dependency and dependency not in visited: + visited.add(dependency) + path.append(dependency) + dependency = dependencies.get(dependency) + + # Circular check + if dependency in path: + start_index = path.index(dependency) + circular_dependency = path[start_index:] + if circular_dependency not in circular_dependencies: + circular_dependencies.append(circular_dependency) + break + + # Convert circular_dependencies to dependency paths + dependency_paths = [] + for circular_dependency in circular_dependencies: + dependency_path = " -> ".join(circular_dependency) + dependency_paths.append(dependency_path) + + return dependency_paths + + +# Example usage +graph, dependencies = build_class_graph("./") +debug_graph(graph) +circular_deps = find_circular_dependencies(dependencies) +print("----------------------------------") +if circular_deps: + print(" Circular dependencies found!") + for dep in circular_deps: + print("\t", dep) +else: + print(" No circular dependencies found.") +print("----------------------------------") From 1fc284939c5b43a514ace9e305cec7e0754b878c Mon Sep 17 00:00:00 2001 From: sasha80 Date: Thu, 6 Nov 2025 16:51:23 +0300 Subject: [PATCH 02/14] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=A6=D0=B5=D0=BB=D0=B8=20=D1=81=20?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D0=BF=D0=BE=D0=B7=D0=BD=D0=B0=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D0=BC=20=D0=BF=D1=80=D0=BE=D1=82=D0=BE=D0=BA=D0=BE=D0=BB?= =?UTF-8?q?=D0=BE=D0=BC=20=D0=B2=D1=8B=D0=B4=D0=B5=D0=BB=D0=B8=D1=82=D1=8C?= =?UTF-8?q?=20=D1=86=D0=B2=D0=B5=D1=82=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/bip/bip.gd | 4 ++++ scenes/работа/работа.gd | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scenes/bip/bip.gd b/scenes/bip/bip.gd index 34497868..43dc3603 100644 --- a/scenes/bip/bip.gd +++ b/scenes/bip/bip.gd @@ -6,6 +6,10 @@ var selected: bool func set_track_visible(value: bool): $track.visible = value +## Задаёт цвет точки +func set_bip_color(val: Color): $bip.set_instance_shader_parameter('color', val) + + ## Присваивает заданное значение видимости индикатору выполнения. func set_ecm_visible(value: bool): $ecm_done.visible = value diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index 804c0314..17f30af7 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -252,9 +252,10 @@ func map_threat_to_bip(th: threats.Threat, bip: Control) -> bool: ## Обработчик сигнала обновления цели. -func on_threat_update(th): +func on_threat_update(th: threats.Threat): var bip = get_node('%d' % th.id) bip.update(th.tick_rx) + bip.set_bip_color(Color.CORAL if th.proto else Color.WHITE) bip.visible = map_threat_to_bip(th, bip) From 379504994cf65463197deda908c0fdb687173a7c Mon Sep 17 00:00:00 2001 From: sasha80 Date: Sat, 8 Nov 2025 11:04:11 +0300 Subject: [PATCH 03/14] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=A1=D0=BA=D1=80=D0=B8=D0=BF=D1=82=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BE=D1=82=D0=BB=D0=B0=D0=B4=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uarep-ctl.linux.x86_64 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 uarep-ctl.linux.x86_64 diff --git a/uarep-ctl.linux.x86_64 b/uarep-ctl.linux.x86_64 new file mode 100644 index 00000000..e599957f --- /dev/null +++ b/uarep-ctl.linux.x86_64 @@ -0,0 +1,12 @@ +#!/bin/bash + + +DATE_TIME=$(date "+%F %H-%M-%S") +LOG_PATH="/home/${USER}/$(basename "$0")-${DATE_TIME}.log" # Путь к файлу журнала. + +# { Вывод этого скрипта в файл журнала и консоль одновременно +# shellcheck disable=SC2015,SC2086 +test $1 = x$'\x00' && shift || { set -o pipefail ; ( exec 2>&1 ; $0 $'\x00' "$@" ) | tee "${LOG_PATH}" ; exit $? ; } +# } + +/opt/uarep-ctl/bin/uarep-ctl.linux.x86_64 -f -t --screen 1 From 91b79266df8901f4dd8801d5bccffef339823294 Mon Sep 17 00:00:00 2001 From: sasha80 Date: Sat, 8 Nov 2025 11:04:31 +0300 Subject: [PATCH 04/14] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generate-sertificate.sh | 2 ++ https-server.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 generate-sertificate.sh create mode 100644 https-server.py diff --git a/generate-sertificate.sh b/generate-sertificate.sh new file mode 100644 index 00000000..f62645d5 --- /dev/null +++ b/generate-sertificate.sh @@ -0,0 +1,2 @@ +#openssl req -x509 -newkey rsa:4096 -keyout key.pem -nodes -out cert.pem -sha256 -days 365 -subj "/C=RU/ST=NTC/L=TNIIS/O=Company Name/OU=Org/CN=www.example.com" +openssl req -new -x509 -keyout "html/server.pem" -out "html/server.pem" -days 365 -nodes diff --git a/https-server.py b/https-server.py new file mode 100644 index 00000000..f6eef3f6 --- /dev/null +++ b/https-server.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +from http import server # Python 3 +import ssl +import os + + +class MyHTTPRequestHandler(server.SimpleHTTPRequestHandler): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + +if __name__ == '__main__': + html_dir = os.path.join(os.path.dirname(__file__), 'html') + os.chdir(html_dir) + srv = server.HTTPServer(('', 8000), MyHTTPRequestHandler) + sdc = ssl.create_default_context() + srv.serve_forever() From 16ca216bdda7dcb5290e48f538a86dbac4f000b6 Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Sat, 8 Nov 2025 11:07:54 +0300 Subject: [PATCH 05/14] =?UTF-8?q?[PATCH]=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D0=B0.=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80?= =?UTF-8?q?=D0=BC=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BE=D1=82=20=D0=A2=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D1=81=D1=8B=20=D0=BD=D0=B0=20=D1=8D=D0=BA=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B5=20=D0=AD=D0=9C=D0=A1=20=D0=A2=D0=93.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/tabs-switch/tab-switch.tscn | 10 ++++---- scenes/эмс2/эмс2.tscn | 13 ++++++++++- scenes/эмс2/эмс_тг.gd | 37 ++++++++++++++++++++++++++++++ scenes/эмс2/эмс_тг.gd.uid | 1 + scripts/settings.gd | 2 +- scripts/signaller.gd | 2 ++ scripts/trassa.gd | 12 ++++++---- 7 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 scenes/эмс2/эмс_тг.gd create mode 100644 scenes/эмс2/эмс_тг.gd.uid diff --git a/scenes/tabs-switch/tab-switch.tscn b/scenes/tabs-switch/tab-switch.tscn index a9187a67..a148f043 100644 --- a/scenes/tabs-switch/tab-switch.tscn +++ b/scenes/tabs-switch/tab-switch.tscn @@ -47,11 +47,10 @@ theme_override_styles/tab_focus = SubResource("StyleBoxEmpty_41d34") theme_override_styles/tab_disabled = SubResource("StyleBoxEmpty_cw2ss") theme_override_styles/tabbar_background = SubResource("StyleBoxEmpty_nmdfd") theme_override_styles/panel = SubResource("StyleBoxEmpty_vap7n") -current_tab = 3 +current_tab = 0 script = ExtResource("1_fg0vd") [node name="Работа" parent="tab_switch" instance=ExtResource("2_u7p16")] -visible = false layout_mode = 2 metadata/_tab_index = 0 @@ -66,6 +65,7 @@ layout_mode = 2 metadata/_tab_index = 2 [node name="ЭМС" parent="tab_switch" instance=ExtResource("5_u71bh")] +visible = false layout_mode = 2 metadata/_tab_index = 3 @@ -95,15 +95,13 @@ script = ExtResource("8_tidwt") metadata/_edit_lock_ = true [node name="remote_control" type="Label" parent="."] -visible = false layout_mode = 2 -offset_left = 1358.0 -offset_right = 1501.0 +offset_left = 1244.0 +offset_right = 1401.0 offset_bottom = 27.0 tooltip_text = "Комплекс находится под внешним управлением" mouse_filter = 0 theme_override_colors/font_color = Color(0, 0, 0, 1) -theme_override_font_sizes/font_size = 14 theme_override_styles/normal = SubResource("StyleBoxFlat_o1r22") text = "Внешнее управление" horizontal_alignment = 1 diff --git a/scenes/эмс2/эмс2.tscn b/scenes/эмс2/эмс2.tscn index b88856c6..81fd3a08 100644 --- a/scenes/эмс2/эмс2.tscn +++ b/scenes/эмс2/эмс2.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=34 format=3 uid="uid://musb21x2u0xs"] +[gd_scene load_steps=35 format=3 uid="uid://musb21x2u0xs"] [ext_resource type="Texture2D" uid="uid://hkcvl2waf63s" path="res://scenes/эмс2/вид сверху.png" id="1_b7vcf"] +[ext_resource type="Script" uid="uid://bvlqgv7aapebl" path="res://scenes/эмс2/эмс_тг.gd" id="1_l3ueu"] [ext_resource type="Texture2D" uid="uid://0w6q4vfst0ry" path="res://scenes/эмс2/OP-63.png" id="3_8gk36"] [ext_resource type="Texture2D" uid="uid://coxhivvc6uibs" path="res://scenes/эмс2/Состояние РЭС 40.png" id="4_b3mus"] [ext_resource type="Texture2D" uid="uid://073el51yholj" path="res://scenes/эмс2/454.png" id="4_nqi0i"] @@ -39,6 +40,7 @@ load_path = "res://.godot/imported/Окно частот0.png-6b01791c971bddb013 load_path = "res://.godot/imported/Скруглённый квадрат серый.png-4655829309cca3b1dec2c9ae01376d54.ctex" [node name="Panel" type="Panel"] +script = ExtResource("1_l3ueu") [node name="Sprite2D" type="Sprite2D" parent="."] modulate = Color(1, 0.596078, 0.4, 1) @@ -106,6 +108,15 @@ position = Vector2(275.641, 38.4615) scale = Vector2(3.20513, 3.20513) texture = ExtResource("6_m57px") +[node name="lbl_trassa" type="Label" parent="454"] +layout_mode = 0 +offset_left = -42.0 +offset_top = -135.0 +offset_right = 221.0 +offset_bottom = -36.0 +theme_override_font_sizes/font_size = 100 +text = "Трасса" + [node name="Го" type="TextureRect" parent="."] layout_mode = 0 offset_left = 488.0 diff --git a/scenes/эмс2/эмс_тг.gd b/scenes/эмс2/эмс_тг.gd new file mode 100644 index 00000000..242bda14 --- /dev/null +++ b/scenes/эмс2/эмс_тг.gd @@ -0,0 +1,37 @@ +extends Panel + +func _ready() -> void: + var unit_trassa = network.get_unit_instance('уарэп-трасса') + unit_trassa.connect('line_changed', Callable(self, 'on_trassa_line_changed')) + signaller.connect('sector_klaster', Callable(self, 'on_sector_klaster').bind(unit_trassa)) + + +func on_trassa_line_changed(unit_trassa): + if unit_trassa.online: + $"454/СостояниеРэс3".self_modulate = Color.WEB_GREEN + $"СкруглённыйПрямоугольникБелый/Label3".text = 'Трасса' + $"СкруглённыйПрямоугольникБелый/Label4".text = 'Трасса' + $"СкруглённыйПрямоугольникБелый/Label5".text = 'Активный' + $"СкруглённыйПрямоугольникБелый/Label6".text = str(unit_trassa.daa) + $"СкруглённыйПрямоугольникБелый/Label7".text = str(unit_trassa.dap) + $"СкруглённыйПрямоугольникБелый/Label8".text = '1' + $"СкруглённыйПрямоугольникБелый/Label9".text = str(unit_trassa.lfb) + $"СкруглённыйПрямоугольникБелый/Label10".text = str(unit_trassa.lfb) + else: + $"454/СостояниеРэс3".self_modulate = Color.WHITE + $"СкруглённыйПрямоугольникБелый/Label3".text = '-' + $"СкруглённыйПрямоугольникБелый/Label4".text = '-' + $"СкруглённыйПрямоугольникБелый/Label5".text = '-' + $"СкруглённыйПрямоугольникБелый/Label6".text = '-' + $"СкруглённыйПрямоугольникБелый/Label7".text = '-' + $"СкруглённыйПрямоугольникБелый/Label8".text = '-' + $"СкруглённыйПрямоугольникБелый/Label9".text = '-' + $"СкруглённыйПрямоугольникБелый/Label10".text = '-' + + +func on_sector_klaster(data, unit_trassa): + $"СкруглённыйПрямоугольникБелый/Label6".text = str(unit_trassa.dap) + $"СкруглённыйПрямоугольникБелый/Label7".text = str(unit_trassa.daa) + $"СкруглённыйПрямоугольникБелый/Label8".text = '1' + $"СкруглённыйПрямоугольникБелый/Label9".text = str(unit_trassa.lfb) + $"СкруглённыйПрямоугольникБелый/Label10".text = str(unit_trassa.hfb) diff --git a/scenes/эмс2/эмс_тг.gd.uid b/scenes/эмс2/эмс_тг.gd.uid new file mode 100644 index 00000000..28502279 --- /dev/null +++ b/scenes/эмс2/эмс_тг.gd.uid @@ -0,0 +1 @@ +uid://bvlqgv7aapebl diff --git a/scripts/settings.gd b/scripts/settings.gd index fe308b99..17e62c9d 100644 --- a/scripts/settings.gd +++ b/scripts/settings.gd @@ -10,7 +10,7 @@ var UnitProfiles: Dictionary[StringName, Array] = { \ 'уарэп-яу07-частный': ['yau07rx', ['10.1.1.2', 50002, false, true], 'IP-адрес для приёма частных сообщений от ЯУ-07'], 'уарэп-яу07-общий': ['yau07rx', ['*', 50000, true, true], 'IP-адрес для приёма широковещательных сообщений от ЯУ-07'], 'уарэп-капсрпб': ['capsrpb', ['127.0.0.1', '127.0.0.1', 42023, 42022, false, true], 'IP-адрес для обмена сообщениями со службой \"МП550\" (СТЦ)'], - 'уарэп-трасса': ['trassa', ['127.0.0.1', '127.0.0.1', 50200, 10004, false, true], 'IP-адрес для обмена сообщениями с \"Трассой\"'], + 'уарэп-трасса': ['trassa', ['192.168.11.34', '192.168.11.105', 50200, 10004, false, true], 'IP-адрес для обмена сообщениями с \"Трассой\"'], 'уарэп-эмс': ['yau07tx', ['10.1.1.52', 50052, false, false], 'IP-адрес прибора УФ'], 'уарэп-яу07-2в': ['yau07tx', ['10.1.1.22', 50022, false, false], 'IP-адрес прибора ПРД-В2'], 'уарэп-яу07-2н': ['yau07tx', ['10.1.1.21', 50021, false, false], 'IP-адрес прибора ПРД-Н2'], diff --git a/scripts/signaller.gd b/scripts/signaller.gd index c72dcb76..e584cee4 100644 --- a/scripts/signaller.gd +++ b/scripts/signaller.gd @@ -30,6 +30,8 @@ signal режим_журнал() ## Вызывается при переходе в режим [b]ЭМС[/b]. signal режим_эмс() +## Вызывается при переходе в режим [b]ЭМС ТГ[/b]. +signal режим_эмс2() ## Вызывается при переходе в режим [b]Настройка[/b]. signal режим_настройки() diff --git a/scripts/trassa.gd b/scripts/trassa.gd index bd94b610..d9b0fbf6 100644 --- a/scripts/trassa.gd +++ b/scripts/trassa.gd @@ -35,6 +35,10 @@ class Trassa extends unit.Unit: [2000, 6000, 500, 100], [3500, 6000, 524, 50], [390, 6000, 374, 50*7]] + var lfb = 0 + var hfb = 0 + var dap = 0 + var daa = 0 # Инициализация func _init(nm: StringName, buttons: Array = []) -> void: @@ -105,10 +109,10 @@ class Trassa extends unit.Unit: if txe == true or rxe == true: sector_data["draw"] = true if data.has("lfb") and data.has("hfb") and data.has("dap") and data.has("daa"): - var lfb = int(data["lfb"]) - var hfb = int(data["hfb"]) - var dap = int(data["dap"]) - var daa = int(data["daa"]) + lfb = int(data["lfb"]) + hfb = int(data["hfb"]) + dap = int(data["dap"]) + daa = int(data["daa"]) for i in range(set_klaster.size()): var mapping = set_klaster[i] if lfb == mapping[0] and hfb == mapping[1]: From 06e909ad9cc71d5e83c2c0b31a3392230d9b5842 Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Sat, 8 Nov 2025 11:09:45 +0300 Subject: [PATCH 06/14] =?UTF-8?q?[PATCH]=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D0=B0.=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=B4=D0=BE=D0=B2=20?= =?UTF-8?q?=D1=81=D0=BE=D1=81=D1=82=D0=BE=D1=8F=D0=BD=D0=B8=D1=8F=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BC=D0=B5=D1=85=D0=B8=20=D0=B4=D0=BB=D1=8F=205=D0=9F-2?= =?UTF-8?q?8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/tcp5p28.gd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/tcp5p28.gd b/scripts/tcp5p28.gd index 999c2125..a86f7755 100644 --- a/scripts/tcp5p28.gd +++ b/scripts/tcp5p28.gd @@ -29,9 +29,9 @@ const MOD_TYPES: Array = [ const CU_STATE: Dictionary = { 0: 2, # Подготовка к выполнению 1: 1, # Выполняется - 2: 9, # Ошибка в команде + 2: 3, # Ошибка в команде 3: 7, # Занят выполнением другого ЦУ - 4: 9, # Неисправность + 4: 2, # Неисправность } class TCP5P28 extends unit.Unit: @@ -135,7 +135,7 @@ class TCP5P28 extends unit.Unit: continue var cu = ecms[id] cu_data.encode_u16(0, cu.ispp) - var state: int = CU_STATE[cu.svk] if CU_STATE.has(cu.svk) else 9 + var state: int = CU_STATE[cu.svk] if CU_STATE.has(cu.svk) else 8 cu_data.encode_u8(2, state) # Состояние выполнения команды cu_data.encode_u8(3, 0xFF) # Эффективность работы помехи data.append_array(cu_data) From 9720726d918cd0e3613920ad7bc36152638ea993 Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Sat, 8 Nov 2025 11:16:06 +0300 Subject: [PATCH 07/14] =?UTF-8?q?[PATCH]=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D0=B0.=20=D0=9F=D0=BE=D0=B4=D1=81=D1=87?= =?UTF-8?q?=D1=91=D1=82=20=D0=BE=D0=BF=D0=B0=D1=81=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D1=86=D0=B5=D0=BB=D0=B5=D0=B9=201=20=D1=80=D0=B0=D0=B7=20?= =?UTF-8?q?=D0=B2=20=D1=81=D0=B5=D0=BA=D1=83=D0=BD=D0=B4=D1=83.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/работа/работа.gd | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index 17f30af7..423b2e15 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -179,6 +179,7 @@ func _ready(): signaller.connect('update_scale_map', Callable(self, 'on_update_scale_label')) signaller.connect('sector_klaster', Callable(self, 'sector_klaster')) signaller.connect('clear_klaster', Callable(self, 'clear_all_klaster')) + signaller.connect('th_aoa_update', Callable(self, 'on_th_aoa_update')) var unit_nav = network.get_unit_instance('навигация') unit_nav.connect('data_received', on_navi_data_received) on_btn_center_toggled(true) @@ -596,6 +597,7 @@ func on_btn_close(btn): fs_closed.merge(fs_selected) signaller.emit_signal('update_fs_closed', fs_closed) + func on_btn_work(btn): await get_tree().create_timer(0.2).timeout btn.pressed = false @@ -605,6 +607,13 @@ func on_btn_work(btn): fs_closed[fs_index] = null signaller.emit_signal('update_fs_closed', fs_closed) + func _on_btn_all_work_pressed() -> void: fs_closed.clear() signaller.emit_signal('update_fs_closed', fs_closed) + + +func on_th_aoa_update(ths): + $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 From cebf645e4da139bb2cb3490e2516f8d78e8e9e12 Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Sat, 8 Nov 2025 12:18:38 +0300 Subject: [PATCH 08/14] =?UTF-8?q?Godot4.=20=D0=98=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=B5=D0=BF=D0=B0?= =?UTF-8?q?=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BE=D0=B2=20=D0=BD=D0=B0=20LF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/работа/работа.tscn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scenes/работа/работа.tscn b/scenes/работа/работа.tscn index 08aba720..8313ec3b 100644 --- a/scenes/работа/работа.tscn +++ b/scenes/работа/работа.tscn @@ -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"] From f6ee2d95a4533d522af4fe1cdc95fcc3378d592d Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Mon, 10 Nov 2025 11:05:05 +0300 Subject: [PATCH 09/14] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5.=20=D0=A3=D1=87=D1=91=D1=82=20?= =?UTF-8?q?=D0=BA=D1=83=D1=80=D1=81=D0=B0=20=D0=BF=D1=80=D0=B8=20=D1=81?= =?UTF-8?q?=D0=BD=D1=8F=D1=82=D0=B8=D0=B8=20=D0=BF=D0=BE=D0=BC=D0=B5=D1=85?= =?UTF-8?q?=D0=B8=20=D1=81=D0=BE=20=D1=81=D0=B2=D0=BE=D0=B5=D0=B9=20=D1=86?= =?UTF-8?q?=D0=B5=D0=BB=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/interfer.gd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/interfer.gd b/scripts/interfer.gd index 01c7f527..b43601c5 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -260,7 +260,8 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit_instance) -> v if not gos_flag: # Составляется список запретных секторов работы if (thr.proto in gos_protocols) and thr.fflags.proto: var fs_arr: Array = [] - prd.find_fs_index(thr.aoa, thr.freq, fs_arr) + 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] @@ -270,9 +271,7 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit_instance) -> v if thrs[ecm_i] == th_id: var ecm = ecms[ecm_i] ecm.params['freq'] = thr.freq - ecm.kni = thr.aoa - course - if ecm.kni < 0: - ecm.kni += 360 + ecm.kni = fposmod(thr.aoa - course, 360) call_ecm_proc(ecm) if ecm.nmfs in gos_nmfs: interfer_off(ecm, unit_instance) @@ -299,7 +298,8 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit_instance) -> v if auto_enabled: for thr in threats.values(): var fs_arr: Array = [] - prd.find_fs_index(thr.aoa, thr.freq, fs_arr) + var th_aoa = fposmod(thr.aoa - course, 360) + prd.find_fs_index(th_aoa, thr.freq, fs_arr) if fs_arr.size(): var need_continue = false for item in fs_arr: From 6a5eae450cfbbc42448da80e7fb9b58188f8ccd1 Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Mon, 10 Nov 2025 11:31:22 +0300 Subject: [PATCH 10/14] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5.=20=D0=9E=D0=B1=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D1=8F=D0=BD=D0=B8=D1=8F=20=D0=B2=D1=8B=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE=D0=BC=D0=B5=D1=85?= =?UTF-8?q?=D0=B8=20=D0=BF=D0=BE=20=D1=86=D0=B5=D0=BB=D0=B8=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B0=D0=BC=D0=BC=D0=BD?= =?UTF-8?q?=D0=BE=D0=BC=20=D1=81=D0=BD=D1=8F=D1=82=D0=B8=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BC=D0=B5=D1=85=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/работа/работа.gd | 1 + scripts/interfer.gd | 1 + scripts/signaller.gd | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index 423b2e15..8af52806 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -167,6 +167,7 @@ func _ready(): signaller.connect('threat_selected', Callable(self, 'on_threat_selected').bind(nodes)) signaller.connect('interfer_selected', Callable(self, 'on_interfer_selected').bind(nodes)) signaller.connect('interfer_new', Callable(self, 'on_interfer_new')) + signaller.connect('on_prog_ecm_off', Callable(self, 'on_interfer_new')) signaller.connect('interfer_off_all', Callable(self, 'on_interfer_off_all')) signaller.connect('interfer_prinuditelno', Callable(self, 'on_interfer_prinuditelno').bind(nodes)) signaller.connect('fs_selected', Callable(self, 'on_fs_selected')) diff --git a/scripts/interfer.gd b/scripts/interfer.gd index b43601c5..dde7b84e 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -677,6 +677,7 @@ func get_krp(threat: threats.Threat): func on_interfer_off(ecm: Interfer, ecms): var sz = ecms.size() + signaller.emit_signal('on_prog_ecm_off', ecm) ecms.erase(ecm.ispp) thrs.erase(ecm.ispp) interfer.cu.erase(ecm.ispp) diff --git a/scripts/signaller.gd b/scripts/signaller.gd index e584cee4..16c703b1 100644 --- a/scripts/signaller.gd +++ b/scripts/signaller.gd @@ -214,3 +214,8 @@ signal sector_klaster (new_sector_data) signal clear_klaster () + + +## Вызывается при программном отключении помехи.[br] +## [param ecm] - выключаемая помеха ([b]true[/b] +signal on_prog_ecm_off(ecm: interfer.Interfer) From 1e500dec2c08b1640fd7f3e8219803eee7a6f71d Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Mon, 10 Nov 2025 11:51:51 +0300 Subject: [PATCH 11/14] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=9D=D0=BE=D0=BC=D0=B5=D1=80=20=D1=86?= =?UTF-8?q?=D0=B5=D0=BB=D0=B8=20=D0=B8=20=D0=BD=D0=BE=D0=BC=D0=B5=D1=80=20?= =?UTF-8?q?=D1=81=D0=B5=D0=B0=D0=BD=D1=81=D0=B0=20=D0=BF=D0=BE=D0=BC=D0=B5?= =?UTF-8?q?=D1=85=D0=B8=20=D0=B2=20=D0=B7=D0=B0=D0=B3=D0=BE=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B5=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=20?= =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=BE=D1=82=D0=BE=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=B6=D0=B0=D0=B5=D1=82=D1=81=D1=8F=20=D0=B7=D0=BD?= =?UTF-8?q?=D0=B0=D1=87=D0=BA=D0=BE=D0=BC=20(=D0=B7=D0=B0=D0=BC=D0=B5?= =?UTF-8?q?=D1=87=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=B8=D1=81?= =?UTF-8?q?=D1=81=D0=B8=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/frame-ecm-list/scroll-ecm-list.gd | 4 ++-- scenes/frame-threats/scroll-threats.gd | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scenes/frame-ecm-list/scroll-ecm-list.gd b/scenes/frame-ecm-list/scroll-ecm-list.gd index e0f42344..23f9d4cf 100644 --- a/scenes/frame-ecm-list/scroll-ecm-list.gd +++ b/scenes/frame-ecm-list/scroll-ecm-list.gd @@ -7,8 +7,8 @@ const TableHeader = preload('res://table/header.tscn') ## Ячейка за const TABLE_HEADER = [ TableHeader, TableHeader, TableHeader , TableHeader ] ## Описание ряда заголовка. const TABLE_ROW = [ CellLineEdit, CellLineEdit, CellLineEdit , CellLineEdit ] ## Описание ряда. -const TABLE_HEADERS_TEXT = ['Номер', 'Название', 'Пеленг', 'Состояние' ] ## Заголовки таблицы. -const TABLE_COLUMN_SIZE = [ 75, 100, 90, 170 ] ## Ширины колонок. +const TABLE_HEADERS_TEXT = ['№', 'Название', 'Пеленг', 'Состояние' ] ## Заголовки таблицы. +const TABLE_COLUMN_SIZE = [ 65, 100, 90, 170 ] ## Ширины колонок. ## Состояние выполнения сеанса помехи const INTERFER_STATE = { diff --git a/scenes/frame-threats/scroll-threats.gd b/scenes/frame-threats/scroll-threats.gd index 377be5bc..50cf2bd0 100644 --- a/scenes/frame-threats/scroll-threats.gd +++ b/scenes/frame-threats/scroll-threats.gd @@ -10,7 +10,7 @@ const TableHeader = preload('res://table/header.tscn') ## Ячейка за 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_HEADERS_TEXT = ['№', 'Пеленг', 'Частота, МГц', 'Протокол' ] ## Заголовки таблицы. const TABLE_COLUMN_SIZE = [ 65, 145, 145, 90 ] ## Ширины колонок. From 78b6f5a14e9e8b847d6184158a68bfd6b561fea9 Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Mon, 10 Nov 2025 12:01:56 +0300 Subject: [PATCH 12/14] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=9F=D1=80=D0=B8=20=D0=B2=D1=8B=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D0=BD=D1=8F=D0=B5=D0=BC=D0=BE=D0=BC=20=D1=81=D0=B5?= =?UTF-8?q?=D0=B0=D0=BD=D1=81=D0=B5=20=D0=BF=D0=BE=D0=BC=D0=B5=D1=85=D0=B8?= =?UTF-8?q?=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BA=D1=80=D0=B0=D1=81=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20(=D0=B7=D0=B0=D0=BC=D0=B5=D1=87=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=B8=D1=81=D1=81=D0=B8=D0=B8?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/работа/работа.gd | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index 8af52806..6e9ca706 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -522,6 +522,14 @@ func update_fs_colors(): else: fs_colors[key] = color_select $canvas.set_band_colors(fs_colors) + if fs_emit.size(): + if $btn_activate.pressed: + $btn_activate.self_modulate = Color.RED + else: + $btn_activate.self_modulate = Color.WHITE + else: + $btn_activate.self_modulate = Color.WHITE + func unsel_fs_all(need_btns_off: bool): From 6ea649cf31cdf0151c528b1ef3113fc248af27c4 Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Mon, 10 Nov 2025 12:15:10 +0300 Subject: [PATCH 13/14] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=91=D0=BE=D0=BB=D0=B5=D0=B5=20=D1=8F?= =?UTF-8?q?=D1=80=D0=BA=D0=B8=D0=B9=20=D1=81=D0=B5=D0=BA=D1=82=D0=BE=D1=80?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=BD=D0=B0=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BF=D0=BE=D0=BC=D0=B5=D1=85=D0=B0=20(=D0=B7=D0=B0?= =?UTF-8?q?=D0=BC=D0=B5=D1=87=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=B8=D1=81=D1=81=D0=B8=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project.godot | 4 ++-- scenes/работа/работа.gd | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/project.godot b/project.godot index 39bda023..573868b3 100644 --- a/project.godot +++ b/project.godot @@ -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.92379, 0.0965192, 0.249261, 1) 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.92549, 0.0980392, 0.25098, 0.509804) interfer/closed_sectors=Color(0, 0, 0, 1) [autoload] diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index 6e9ca706..342c7c2e 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -98,7 +98,7 @@ func on_settings_changed(): color_closed = ProjectSettings.get_setting('application/interfer/closed_sectors', Color(0.0, 0.0, 0.0, 1.0)) color_emit_sel = color_select color_closed_emit = color_closed - + color_select *= Color(1.0, 1.0, 1.0, 0.0) color_ecm *= Color(1.0, 1.0, 1.0, 0.0) color_emit_sel *= Color(1.0, 1.0, 1.0, 0.2) From 3f469935bc3dc471ee48cad9a043d7a6f5650e46 Mon Sep 17 00:00:00 2001 From: MaD_CaT Date: Mon, 10 Nov 2025 16:10:08 +0300 Subject: [PATCH 14/14] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=9A=D0=BE=D0=BB=D0=BE=D0=BD=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=81=D0=BE=20=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81?= =?UTF-8?q?=D0=BE=D0=BC=20=D0=B2=D1=8B=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BF=D0=BE=D0=BC=D0=B5=D1=85=D0=B8=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=BA=D0=BE=D0=BD=D0=BA=D1=80=D0=B5=D1=82=D0=BD?= =?UTF-8?q?=D0=BE=D0=B9=20=D1=86=D0=B5=D0=BB=D0=B8.=20(=D0=B7=D0=B0=D0=BC?= =?UTF-8?q?=D0=B5=D1=87=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=B8?= =?UTF-8?q?=D1=81=D1=81=D0=B8=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/frame-threats/emit-led.tscn | 23 +++++ scenes/frame-threats/frame-threats.tscn | 2 +- scenes/frame-threats/scroll-threats.gd | 40 +++++++-- scenes/работа/работа.gd | 2 + scripts/interfer.gd | 111 ++++++++---------------- scripts/threats.gd | 2 + 6 files changed, 97 insertions(+), 83 deletions(-) create mode 100644 scenes/frame-threats/emit-led.tscn diff --git a/scenes/frame-threats/emit-led.tscn b/scenes/frame-threats/emit-led.tscn new file mode 100644 index 00000000..da699172 --- /dev/null +++ b/scenes/frame-threats/emit-led.tscn @@ -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") diff --git a/scenes/frame-threats/frame-threats.tscn b/scenes/frame-threats/frame-threats.tscn index e357f458..f3cba685 100644 --- a/scenes/frame-threats/frame-threats.tscn +++ b/scenes/frame-threats/frame-threats.tscn @@ -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") diff --git a/scenes/frame-threats/scroll-threats.gd b/scenes/frame-threats/scroll-threats.gd index 50cf2bd0..d20ef2da 100644 --- a/scenes/frame-threats/scroll-threats.gd +++ b/scenes/frame-threats/scroll-threats.gd @@ -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 diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index 342c7c2e..efec4e6f 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -590,6 +590,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: diff --git a/scripts/interfer.gd b/scripts/interfer.gd index dde7b84e..cacda5da 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -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 = [] @@ -576,58 +576,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 +663,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 + diff --git a/scripts/threats.gd b/scripts/threats.gd index 28f6dea5..5f39f51b 100644 --- a/scripts/threats.gd +++ b/scripts/threats.gd @@ -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]