@tool class_name MapPoint extends TextureButton @onready var panel : PanelContainer = %BriefPanel @onready var anim_player : AnimationPlayer = $AnimationPlayer var panel_shown : bool = false @export var primed : bool = false var locked : bool = true var mat : ShaderMaterial var _circle_size : float = 0 var circle_size: float: get(): return _circle_size set(value): _circle_size = value queue_redraw() var add_color : Color = Color(1,1,1,0) var threshold : float = .361 var thickness : float = 5 var max_circle_size : float = 200 @export var label : String = "" @export var id : Quest.Locations @export var locked_brief : String = "" @export var unlocked_brief : String = "" signal selected(location : Quest.Locations) func _ready() -> void: #TODO: Add a nine-patch and resize the banner based on the label contents %Label.text = label %Brief.text = locked_brief mat = %CanvasGroup.material if primed: anim_player.play("primed") func _process(delta: float) -> void: mat.set_shader_parameter("add_color", add_color) mat.set_shader_parameter("threshold", threshold) func reposition_brief() -> void: print(%BriefPanel.size.y) print(%Brief.size.y) %BriefPanel.pivot_offset = Vector2(0, %Brief.size.y) %BriefPanel.position.y += %BriefPanel.size.y - %Brief.size.y %Brief.get_line_height() func unlock() -> void: locked = false primed = false anim_player.play("unlock") print(%Brief.size.y) %Brief.text = unlocked_brief print(%Brief.size.y) reposition_brief.call_deferred() $AudioStreamPlayer2D.play() func _on_mouse_entered() -> void: if !panel_shown: panel.visible = true panel_shown = true pass # Replace with function body. func _buttonn_pressed() -> void: if primed: unlock() elif !locked: selected.emit(id) func _on_mouse_exited() -> void: if panel_shown: panel.visible = false panel_shown = false pass # Replace with function body. func _draw() -> void: if _circle_size != 0: draw_circle(global_position, _circle_size, add_color, false, thickness * (max_circle_size - _circle_size) / max_circle_size)