Рефактор.

This commit is contained in:
sasha80
2023-09-11 09:13:05 +03:00
parent 8de59e41b5
commit c6dbf9a812
2 changed files with 21 additions and 20 deletions

View File

@@ -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)