Реализация автомата в двух состояниях (0 и 3)

This commit is contained in:
lepshiy
2024-12-11 10:54:23 +03:00
parent e4338d2f0f
commit 77ef3124d5
8 changed files with 41 additions and 10 deletions

View File

@@ -35,6 +35,7 @@ var id_array: Array ## Массив id воздействий.
var thrs: Dictionary ## Словарь воздействия для целей, ключ - id воздействия.
var fs: Dictionary ## Словарь воздействий для секторов, ключ - id воздействия.
var cu: Dictionary ## Словарь воздействий для 5П-28, ключ - id воздействия.
var auto_status: int = 0 # Статус скролла автомата
## Сеанс помехи.
class Interfer:
@@ -114,6 +115,9 @@ func _ready():
signaller.connect('interfer_off_all', Callable(self, 'on_interfer_off_all').bind(unit, ecms))
signaller.connect('th_aoa_update', Callable(self, 'on_th_aoa_update').bind(ecms, unit))
signaller.connect('interfer_off', Callable(self, 'on_interfer_off'))
signaller.connect('manual_control', Callable(self, 'on_manual_control'))
signaller.connect('full_auto', Callable(self, 'on_full_auto'))
signaller.connect('interfer_prenuditelno', Callable(self, 'on_interfer_prenuditelno'))
threats.connect('threat_lost', Callable(self, 'on_threats_lost').bind(ecms, unit))
@@ -126,6 +130,11 @@ func on_timer_check_state(unit, ecms, resend_timeout):
send_ecm(ecm, unit)
ecm.tick_tx = tick
func on_manual_control():
auto_status = 0
func on_full_auto():
auto_status = 3
func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit):
for thr in threats.values():
@@ -138,6 +147,15 @@ func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit):
send_ecm(ecm, unit)
signaller.emit_signal('fs_update_color', ecms)
if auto_status == 0:
return
if auto_status == 3:
for thr in threats.values():
thr.auto_selected = true
signaller.emit_signal('interfer_init', 'lchm1', [])
thr.auto_selected = false
## Производит приём состояния помех. [param unit] -> [param ecms].
func on_data_capsrpb_received(unit: capsrpb.CapsRpb, ecms: Dictionary):
@@ -234,7 +252,7 @@ func interfer_create(interfer_name, ecms, param, kni, id, dict, source_interfer)
ecm = Interfer.new()
ecm.ispp = ispp
ecms[ispp] = ecm
ecm.svk = STATE_TSMT # Подготовка к передаче сообщения
ecm.svk = STATE_TSMT # Подготовка к передаче сообщения
ecm.ss = msg_ss
ecm.kni = kni
ecm.krp = interfer_name