extends Node2D class_name NumberNode @export_group("Values") @export var value : int @export var modifier : float enum Operations { NONE, ADDITION, SUBTRACTION, MULTIPLICATION, DIVISION, } @export var modifier_operation : Operations ## Scan for mouse as a target. Uncheck if player / AI. @export var do_scanning : bool = true @export_group("Visuals") @export_subgroup("Visual Nodes") @export var label : Label @export var label_modifier : Label @export var sprite : Sprite2D @export var sprite_modifier : Sprite2D @export_subgroup("Visual Values") @export var color : Color = Color.BLACK @export var min_scale : float @export var max_scale : float func _ready(): update_visuals() func _process(_delta): pass func join_from(node : NumberNode): node.value += self.value if self.modifier_operation == Operations.ADDITION: node.value += roundi(self.modifier) if self.modifier_operation == Operations.SUBTRACTION: node.value -= roundi(self.modifier) if self.modifier_operation == Operations.MULTIPLICATION: node.value = roundi(float(node.value) * self.modifier) if self.modifier_operation == Operations.DIVISION: node.value = roundi(float(node.value) / float(self.modifier)) node.position = self.position node.update_visuals() queue_free() func update_visuals(): label.text = str(self.value) sprite.modulate = color if self.modifier_operation == Operations.ADDITION: label_modifier.text = "+ " + str(self.modifier) sprite_modifier.visible = true label_modifier.visible = true if self.modifier_operation == Operations.SUBTRACTION: label_modifier.text = "- " + str(self.modifier) sprite_modifier.visible = true label_modifier.visible = true if self.modifier_operation == Operations.MULTIPLICATION: label_modifier.text = "× " + str(self.modifier) sprite_modifier.visible = true label_modifier.visible = true if self.modifier_operation == Operations.DIVISION: label_modifier.text = "÷ " + str(self.modifier) sprite_modifier.visible = true label_modifier.visible = true if self.modifier_operation == Operations.NONE: sprite_modifier.visible = false label_modifier.visible = false