From c6dbf9a8128c75e2828c93f765c6071707d88067 Mon Sep 17 00:00:00 2001 From: sasha80 Date: Mon, 11 Sep 2023 09:13:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/interfer.gd | 12 ++++++------ scripts/threats.gd | 29 +++++++++++++++-------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/scripts/interfer.gd b/scripts/interfer.gd index 3ac2b4de..66786130 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -45,12 +45,12 @@ class Interfer: names.any(func(vn): if dic.has(vn): set(vn, dic[vn]); return false) -signal interfer_preparing(ecm: Interfer) ## Вызывается при запуске помехи -signal interfer_run(ecm: Interfer) ## Вызывается в момент начала работы помехи -signal interfer_error(ecm: Interfer, msg: String) ## Вызывается при ошибке -signal interfer_update(ecm: Interfer) ## Вызывается при обновлении помехи -signal interfer_new(ecm: Interfer) ## Вызывается при новой помехе -signal interfer_resized(ecms: Dictionary) ## Вызывается при изменении количества сеансов помех +signal interfer_preparing(ecm: Interfer) ## Вызывается в момент запуска помехи. +signal interfer_run(ecm: Interfer) ## Вызывается в момент начала работы помехи. +signal interfer_error(ecm: Interfer, msg: String) ## Вызывается при ошибке. +signal interfer_update(ecm: Interfer) ## Вызывается при обновлении помехи. +signal interfer_new(ecm: Interfer) ## Вызывается при создании новой помехи. +signal interfer_resized(ecms: Dictionary) ## Вызывается при изменении количества сеансов помех. ## Производит приём состояния помех. [param unit] -> [param ecms] diff --git a/scripts/threats.gd b/scripts/threats.gd index 00ac6c15..71349742 100644 --- a/scripts/threats.gd +++ b/scripts/threats.gd @@ -75,19 +75,20 @@ func on_data_capsrpb_received(unit: capsrpb.CapsRpb, threats: Dictionary): var mis = unit.json_dic['mis'] var sz: = threats.size() for dic_th in mis: - if dic_th.has('id'): - var id = int(dic_th['id']) - if threats.has(id): - var th = threats[id] - th.clear_fflags() - th.set_from_dic(dic_th) - th.tick_rx = unit.tick - call_deferred('emit_signal', 'threat_update', th) - else: - var th = Threat.new() - th.set_from_dic(dic_th) - threats[id] = th - th.tick_rx = unit.tick - call_deferred('emit_signal', 'threat_new', th) + if dic_th is Dictionary: + if dic_th.has('id'): + var id = int(dic_th['id']) + if threats.has(id): + var th = threats[id] + th.clear_fflags() + th.set_from_dic(dic_th) + th.tick_rx = unit.tick + call_deferred('emit_signal', 'threat_update', th) + else: + var th = Threat.new() + th.set_from_dic(dic_th) + threats[id] = th + th.tick_rx = unit.tick + call_deferred('emit_signal', 'threat_new', th) if sz != threats.size(): call_deferred('emit_signal', 'threats_resized', threats)