diff --git a/scripts/interfer.gd b/scripts/interfer.gd index 4dcc22dc..238cf78d 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -277,10 +277,10 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit_instance) -> v var ecm_active = true if not gos_flag: if ecm.nmfs in gos_nmfs: - interfer_off(ecm, unit_instance) + signaller.emit_signal('interfer_off', ecm) ecm_active = false if ecm_active and (prd.fs_caps_id[ecm.nmfs] in fs_closed): - interfer_off(ecm, unit_instance) + signaller.emit_signal('interfer_off', ecm) var th_id = thr.id for ecm_i in thrs.keys(): @@ -290,9 +290,9 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit_instance) -> v ecm.kni = fposmod(thr.aoa - course, 360) call_ecm_proc(ecm) if ecm.nmfs in gos_nmfs: - interfer_off(ecm, unit_instance) + signaller.emit_signal('interfer_off', ecm) elif prd.fs_caps_id[ecm.nmfs] in fs_closed: - interfer_off(ecm, unit_instance) + signaller.emit_signal('interfer_off', ecm) else: send_ecm(ecm, unit_instance) signaller.emit_signal('fs_update_color', ecms) @@ -382,7 +382,7 @@ func on_interfer_create(interfer_name, sel_threats, fs_arr, power, u, ecms) -> v for ecm in ecms.values(): if ecm.nmfs == item.nmfs: if item.priority > ecm.priority: - interfer_off(ecm, u) + signaller.emit_signal('interfer_off', ecm) elif item.priority < ecm.priority: need_continue = true break @@ -504,17 +504,17 @@ func send_ecm(ecm, unit0) -> void: unit0.tx_stack.append(json_data) -func on_interfer_off_all(unit0, ecms: Dictionary) -> void: +func on_interfer_off_all(_unit0, ecms: Dictionary) -> void: for ecm in ecms.values(): - interfer_off(ecm, unit0) + signaller.emit_signal('interfer_off', ecm) -func on_threats_lost(th, ecms, unit0) -> void: +func on_threats_lost(th, ecms, _unit0) -> void: for key in interfer.thrs: if interfer.thrs[key] == th.id: var ecm_id = key var ecm = ecms[ecm_id] - interfer_off(ecm, unit0) + signaller.emit_signal('interfer_off', ecm) func pop_id() -> int: @@ -647,13 +647,19 @@ func get_krp(threat: threats.Threat): return krp -func on_interfer_off(ecm: Interfer, _ecms, unit_caps): +func on_interfer_off(ecm: Interfer, ecms, unit_caps): ecm.krp = INTERFER_OFF send_ecm(ecm, unit_caps) - - -func interfer_off(ecm, _unit_caps): - signaller.emit_signal('interfer_off', ecm) + if not unit_caps.online: + var sz = ecms.size() + signaller.emit_signal('on_prog_ecm_off', ecm) + ecms.erase(ecm.ispp) + thrs.erase(ecm.ispp) + cu.erase(ecm.ispp) + fs.erase(ecm.ispp) + push_id(ecm.ispp) + if sz != ecms.size(): + interfer.call_deferred('emit_signal', 'interfer_resized', ecms) func on_interfer_new(ecm, unit_caps):