Files
pomchronicles/quest_board.gd

34 lines
1.0 KiB
GDScript

class_name QuestBoard extends Interactable
@onready var polygon : CollisionPolygon2D = $CollisionPolygon2D
@onready var window : QuestBoardWindow = $QuestBoardWindow
var busy : bool
signal interaction_complete()
func _ready() -> void:
register_board.call_deferred()
func register_board() -> void:
Guild.hall.board = self
func _input(event : InputEvent) -> void:
var evt : InputEventMouseButton = event as InputEventMouseButton
if evt and evt.button_index == MOUSE_BUTTON_LEFT and evt.pressed:
if Geometry2D.is_point_in_polygon(evt.position - polygon.global_position, polygon.polygon):
Game.player.try_interact(self)
get_viewport().set_input_as_handled()
func interact(interactor, type : String = "") -> void:
if interactor is Player:
window.populate(Guild.quests.keys())
window.popup_centered()
elif type == "quest":
#Go through all quests and create a list of open quests suitable for their level
#If that list is zero, return without giving them a quest
#Else pick a random quest from the list and assign it to them
pass