Рефактор.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user