Merge remote-tracking branch 'MaD_CaT/master'

# Conflicts:
#	scenes/btn_scale.tscn
#	scenes/tilemap.gd
#	scenes/работа.gd
#	scenes/работа.tscn
#	scripts/signaller.gd
This commit is contained in:
sasha80
2023-11-16 14:33:51 +03:00
22 changed files with 348 additions and 143 deletions

View File

@@ -26,6 +26,7 @@ class Threat:
var tick_rx: int ## Тик время обновления цели, мс.
var tmod: String ## Тип модуляции.
var width: float ## Ширина занимаемого диапазона частот, МГц.
var selected: bool ## Флаг, что цель выбрана
func _init(): clear_fflags()
func _to_string() -> String: return '<Threat>: номер:%d пеленг:%0.1f частота:%0.1f МГц' % [id, aoa, freq]
@@ -52,7 +53,9 @@ func _ready() -> void:
unit.connect('data_received', Callable(self, 'on_data_capsrpb_received').bind(threats))
timer_check_lost.connect('timeout', Callable(self, 'on_timer_check_lost').bind(repsettings.ThreatParams.time_lost, threats))
timer_check_lost.start(repsettings.ThreatParams.time_lost / 1000.0)
signaller.connect('rto_threat_sel', Callable(self, 'on_rto_threat_sel').bind(threats))
signaller.connect('threat_selected', Callable(self, 'on_threat_selected').bind(threats))
signaller.connect('interfer_init', Callable(self, 'on_interfer_init').bind(threats))
## Периодически удаляет устаревшие цели
func on_timer_check_lost(time_lost: int, threats: Dictionary):
@@ -66,6 +69,31 @@ func on_timer_check_lost(time_lost: int, threats: Dictionary):
call_deferred('emit_signal', 'threats_resized', threats)
## Выбирает цель, если нажать по отметке цели.
func on_rto_threat_sel(bip, threats):
for threat in threats.values():
threat.selected = false
threats[bip.name.to_int()].selected = true
## Выбирает цель, если выбрать в таблице
func on_threat_selected(th, threats):
for threat in threats.values():
threat.selected = false
th.selected = true
## Формирует список выбранных целей для включения помехи
func on_interfer_init(btn, threats):
var sel_threats: Array = []
for threat in threats.values():
if threat.selected:
sel_threats.append(threat)
if len(sel_threats):
signaller.emit_signal('interfer_create', btn, sel_threats)
## Производит приём целей
func on_data_capsrpb_received(unit: capsrpb.CapsRpb, threats: Dictionary):
if not unit.json_dic.has('ts'): return