Исправления. Переделка дельты на тик.

This commit is contained in:
MaD_CaT
2024-10-29 11:53:34 +03:00
parent 4a17300799
commit e3f2b4fff6
7 changed files with 17 additions and 20 deletions

View File

@@ -49,7 +49,7 @@ class TCP5P28 extends unit.Unit:
func _to_string() -> String: return String('капсрпб: "%s" %s ' % [self.name, ['отключен', 'на связи'][int(online)]])
func parse(data: PackedByteArray):
func parse(data: PackedByteArray, tick: int):
rx_tick = tick
if not online:
online = true
@@ -65,8 +65,7 @@ class TCP5P28 extends unit.Unit:
if cmd_type == CMD_TYPE_IN and external_cu:
set_interfer(data)
func process(delta: int):
tick += delta
func process(tick: int):
if online and ((tick - rx_tick) > ONLINE_TIMEOUT):
online = false
emit_signal('line_changed', self)