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)