@tool
extends Node
@onready var box_spawner: BoxSpawner = $"../BoxSpawner"
@onready var ul_1_3: BeltConveyorAssembly = $"../UL1_3"

var color_1
var color_2
var tag_group = "TagGroup0"
var display_color_1
var display_color_2

func _on_simulation_started() -> void:

	OIPComms.register_tag(tag_group, "UL1_3_JR_PB1.CTRL.STS.Log.LEN", 1)
	OIPComms.register_tag(tag_group, "UL1_3_JR_PB1.HMI.STATE", 1)
	
	## Register all 82 DATA tags
	for i in range(82):
		var data_tag = "UL1_3_JR_PB1.CTRL.STS.Log.DATA[" + str(i) + "]"
		OIPComms.register_tag(tag_group, data_tag, 1)
	pass
func _ready() -> void:
	
	SimulationEvents.simulation_started.connect(_on_simulation_started)



func _physics_process(delta: float) -> void:
	
	box_spawner.disable = ul_1_3.speed == 0
	#print(OIPComms.read_int32(tag_group,"[PLC]UL1_3_JR_PB1.HMI.STATE"))


	#print("Log String: ", Utils.read_string(tag_group, "UL1_3_JR_PB1.CTRL.STS.Log"))

	
