Merge remote-tracking branch 'lepshiy/master' into проверка1

This commit is contained in:
sasha80
2024-10-25 15:32:09 +03:00
13 changed files with 246 additions and 9 deletions

View File

@@ -112,7 +112,10 @@ func _ready():
signaller.connect('interfer_rcv', Callable(self, 'on_interfer_rcv').bind(unit_5p28, ecms))
signaller.connect('interfer_new', Callable(self, 'send_ecm').bind(unit))
signaller.connect('interfer_off_all', Callable(self, 'on_interfer_off_all').bind(unit, ecms))
signaller.connect('th_aoa_update', Callable(self, 'on_th_aoa_update').bind(ecms, unit))
signaller.connect('interfer_off', Callable(self, 'on_interfer_off'))
threats.connect('threat_lost', Callable(self, 'on_threats_lost').bind(ecms, unit))
## Проверяет состояние отправки пакета и если не доставлен, повторяет отправку.
func on_timer_check_state(unit, ecms, resend_timeout):
@@ -124,6 +127,18 @@ func on_timer_check_state(unit, ecms, resend_timeout):
ecm.tick_tx = tick
func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit):
for thr in threats.values():
var th_id = thr.id
for ecm_i in thrs.keys():
if thrs[ecm_i] == th_id:
var ecm = ecms[ecm_i]
ecm.params['freq'] = thr.freq
ecm.kni = thr.aoa
send_ecm(ecm, unit)
signaller.emit_signal('fs_update_color', ecms)
## Производит приём состояния помех. [param unit] -> [param ecms].
func on_data_capsrpb_received(unit: capsrpb.CapsRpb, ecms: Dictionary):
if not unit.json_dic.has('ts'): return
@@ -247,6 +262,16 @@ func on_interfer_off_all(unit, ecms):
push_id(ecm.ispp)
send_ecm(ecm, unit)
signaller.emit_signal('interfer_off',ecm, ecms, thrs)
func on_threats_lost(th, ecms, unit):
for key in interfer.thrs:
if interfer.thrs[key] == th.id:
var ecm_id = key
var ecm = ecms[ecm_id]
ecm.krp = INTERFER_OFF
push_id(ecm.ispp)
send_ecm(ecm, unit)
signaller.emit_signal('interfer_off',ecm, ecms, thrs)
func pop_id():

View File

@@ -137,3 +137,8 @@ signal map_coords_changed(lan: float, lat: float)
## Вызывается при изменении размера изображения для отображения карты.[br]
## [param mode] - Вновь установленный режим.
signal map_mode_changed(mode: int)
## Вызывается при обновлении позиции(угла) цели.[br]
signal th_aoa_update(threats: Dictionary)
signal fs_update_color(ecms:Dictionary)

View File

@@ -51,11 +51,15 @@ func _ready() -> void:
var unit_5p28_key = repsettings.get_unit_key('уарэп-5п28')
var unit_5p28 = repnetwork.units_tcp[unit_5p28_key]
var timer_check_lost: = Timer.new()
var timer_aoa_update: = Timer.new()
add_child(timer_check_lost)
add_child(timer_aoa_update)
unit.connect('data_received', Callable(self, 'on_data_capsrpb_received').bind(threats))
unit_5p28.connect('get_threats', Callable(self, 'on_get_threats').bind(unit_5p28, 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)
timer_aoa_update.connect('timeout', Callable(self, 'on_timer_aoa_update').bind(threats))
timer_aoa_update.start(0.25)
signaller.connect('rto_threat_sel', Callable(self, 'on_rto_threat_sel').bind(threats))
signaller.connect('rto_threat_unsel', Callable(self, 'on_rto_threat_unsel').bind(threats))
signaller.connect('rto_threat_unsel_all', Callable(self, 'on_rto_threat_unsel_all').bind(threats))
@@ -72,12 +76,14 @@ func on_timer_check_lost(time_lost: int, threats: Dictionary):
call_deferred('emit_signal', 'threat_lost', th)
if sz != threats.size():
call_deferred('emit_signal', 'threats_resized', threats)
func on_timer_aoa_update(threats:Dictionary):
signaller.emit_signal('th_aoa_update', threats)
## отправляет словарь целей в юнит, для запаковки и отправки в 5П28.
func on_get_threats(unit, threats): unit.pack_threats(threats)
## Снимает выделение с цели, если нажать по отметке цели.
func on_rto_threat_unsel(th_id, threats): threats[th_id].selected = false