extends Node2D

var sock = PacketPeerUDP.new()
@onready var table_threads = get_node('tabs/threats/table_t')
@onready var btn_add_threads = get_node('tabs/threats/btn_add')
@onready var btn_del_threads = get_node('tabs/threats/btn_del')

@onready var table_pomehi = get_node('tabs/pomehi/table_p')

# Called when the node enters the scene tree for the first time.
func _ready():
    sock.bind(Consts.MAIN_ADDR[1], Consts.MAIN_ADDR[0])
    sock.set_dest_address(Consts.DST_ADDR[0], Consts.DST_ADDR[1])
    Threats.init_treats(table_threads, btn_add_threads, btn_del_threads)
    Pomehi.init_pomehi(table_pomehi)
    var timer = Timer.new()
    timer.connect('timeout', Callable(self, 'on_timeout').bind())
    add_child(timer) #to process
    timer.start(1) #to start


func on_timeout():
    sock.put_packet(Threats.get_threats_data())


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
#    pass
