diff --git a/active_scene.tscn b/active_scene.tscn new file mode 100644 index 0000000..5553865 --- /dev/null +++ b/active_scene.tscn @@ -0,0 +1,78 @@ +[gd_scene load_steps=10 format=3 uid="uid://dfa6ep4o53s08"] + +[ext_resource type="Script" uid="uid://cci652umkym1f" path="res://test_scene.gd" id="1_8p2cu"] +[ext_resource type="PackedScene" uid="uid://cd08dp16bixfv" path="res://guildhall.tscn" id="1_fcxuj"] +[ext_resource type="PackedScene" uid="uid://c8ofw6na082gv" path="res://main_panel.tscn" id="2_8p2cu"] +[ext_resource type="Script" uid="uid://ccorfvcfa84gf" path="res://guildhall.gd" id="3_hyuu1"] +[ext_resource type="PackedScene" uid="uid://dly7in8ql1fn4" path="res://quest_log.tscn" id="4_tro8a"] +[ext_resource type="Script" uid="uid://blo7tb5135vfm" path="res://quest_board.gd" id="5_46fpu"] +[ext_resource type="Texture2D" uid="uid://bldpiytpdrge6" path="res://icon.svg" id="5_eenn6"] +[ext_resource type="PackedScene" uid="uid://drrtypncppjps" path="res://quest_board_window.tscn" id="5_uh7v7"] +[ext_resource type="Script" uid="uid://bnbljf6u2d3kh" path="res://visitor_spawner.gd" id="6_d0hfk"] + +[node name="Active Scene" type="Node2D"] +script = ExtResource("1_8p2cu") + +[node name="Guildhall" parent="." instance=ExtResource("1_fcxuj")] +position = Vector2(421, 161) +script = ExtResource("3_hyuu1") + +[node name="NavigationRegion2D" parent="Guildhall" index="0"] +position = Vector2(-8, 25) + +[node name="QuestBoard" type="StaticBody2D" parent="Guildhall/NavigationRegion2D" index="2"] +position = Vector2(942, 31) +input_pickable = true +script = ExtResource("5_46fpu") + +[node name="Sprite2D" type="Sprite2D" parent="Guildhall/NavigationRegion2D/QuestBoard"] +scale = Vector2(1.84375, 0.4375) +texture = ExtResource("5_eenn6") + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Guildhall/NavigationRegion2D/QuestBoard"] +polygon = PackedVector2Array(-118, -28, 118, -28, 118, 28, -118, 29) + +[node name="QuestBoardWindow" parent="Guildhall/NavigationRegion2D/QuestBoard" instance=ExtResource("5_uh7v7")] +position = Vector2i(0, 36) + +[node name="CharacterBody2D" parent="Guildhall" index="1"] +interaction_range = 100.0 + +[node name="NavigationAgent2D" parent="Guildhall/CharacterBody2D" index="1"] +path_desired_distance = 100.0 +target_desired_distance = 75.0 + +[node name="Queue" parent="Guildhall/Receptionist" index="3"] +position = Vector2(-6, 186) +direction = Vector2(0, 1) + +[node name="StateMachine" parent="Guildhall/Receptionist" index="4"] +starting_state = "Advance Queue" + +[node name="VisitorSpawner" type="Node2D" parent="Guildhall"] +position = Vector2(505, 870) +script = ExtResource("6_d0hfk") +total_visitors = 5 + +[node name="Timer" type="Timer" parent="Guildhall/VisitorSpawner"] + +[node name="UI" type="CanvasLayer" parent="."] + +[node name="VBoxContainer" type="VBoxContainer" parent="UI"] +offset_left = 1567.0 +offset_top = 23.0 +offset_right = 1903.0 +offset_bottom = 185.0 + +[node name="PanelContainer" parent="UI/VBoxContainer" instance=ExtResource("2_8p2cu")] +layout_mode = 2 + +[node name="Notices" type="Control" parent="UI/VBoxContainer"] +layout_mode = 2 + +[node name="Quest Log" parent="UI" instance=ExtResource("4_tro8a")] + +[connection signal="input_event" from="Guildhall/NavigationRegion2D/QuestBoard" to="Guildhall/NavigationRegion2D/QuestBoard" method="_input_event"] +[connection signal="timeout" from="Guildhall/VisitorSpawner/Timer" to="Guildhall/VisitorSpawner" method="_on_timer_timeout"] + +[editable path="Guildhall"] diff --git a/adventurer.gd b/adventurer.gd new file mode 100644 index 0000000..c01b6fd --- /dev/null +++ b/adventurer.gd @@ -0,0 +1,59 @@ +class_name Adventurer extends CharacterBody2D + +@onready var state_machine : StateMachine = $StateMachine +@onready var movement_speed : float = 400.0 +@onready var movement_target_position : Vector2 = global_position +@onready var nav_agent : NavigationAgent2D = $NavigationAgent2D + +var data : AdventurerData = null +var interaction_target = null +@onready var bubble : SpeechBubble = $SpeechBubble +@export var interaction_range : float = 75 +@export var stop_range : float = 25 + +func _ready() -> void: + state_machine.actor = self + state_machine.start() + +func _physics_process(delta: float) -> void: + if nav_agent.is_navigation_finished(): + if interaction_target: + try_interact(interaction_target) + #If they have an interaction target within range + #clear the target + #try_interact + return + + var curr_pos: Vector2 = global_position + var next_path_pos: Vector2 = nav_agent.get_next_path_position() + + velocity = curr_pos.direction_to(next_path_pos) * movement_speed + move_and_slide() + + +func approach(pos : Vector2) -> void: + var rid = get_world_2d().get_navigation_map() + var point : Vector2 = NavigationServer2D.map_get_closest_point(rid, pos) + set_movement_target(point) + +func approach_and_interact(obj : Interactable) -> void: + set_movement_target(obj.global_position) + nav_agent.target_desired_distance = interaction_range - 5 + interaction_target = obj + +func try_interact(obj : Interactable) -> void: + var df = obj.global_position - global_position + if df.length() > interaction_range: + approach_and_interact(obj) + else: + interact(obj) + interaction_target = null + +func interact(obj : Interactable) -> void: + obj.interact(self) + +func set_movement_target(target : Vector2) -> void: + nav_agent.target_position = target + +func show_speech_bubble(bubble_type : String) -> void: + bubble.try_show_speech(bubble_type) diff --git a/adventurer.gd.uid b/adventurer.gd.uid new file mode 100644 index 0000000..796ee2b --- /dev/null +++ b/adventurer.gd.uid @@ -0,0 +1 @@ +uid://cjqumk0kw2vte diff --git a/adventurer_data.gd b/adventurer_data.gd new file mode 100644 index 0000000..4ce76ab --- /dev/null +++ b/adventurer_data.gd @@ -0,0 +1,11 @@ +class_name AdventurerData extends Node + +var life : int = 1 +var max_life : int = 1 +var energy : int = 1 +var max_energy : int = 1 +var quest : Quest + +func assign_quest(quest : Quest) -> void: + self.quest = quest + quest.initiate(self) diff --git a/adventurer_data.gd.uid b/adventurer_data.gd.uid new file mode 100644 index 0000000..853197c --- /dev/null +++ b/adventurer_data.gd.uid @@ -0,0 +1 @@ +uid://0jl2qbvtmsik diff --git a/busy-dots.aseprite b/busy-dots.aseprite new file mode 100644 index 0000000..3a8efe9 Binary files /dev/null and b/busy-dots.aseprite differ diff --git a/busy-dots.png b/busy-dots.png new file mode 100644 index 0000000..0e6d3b5 Binary files /dev/null and b/busy-dots.png differ diff --git a/busy-dots.png.import b/busy-dots.png.import new file mode 100644 index 0000000..0923a0e --- /dev/null +++ b/busy-dots.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://1mmg270gotb1" +path="res://.godot/imported/busy-dots.png-31d70c9440af4478b802f06a1617b631.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://busy-dots.png" +dest_files=["res://.godot/imported/busy-dots.png-31d70c9440af4478b802f06a1617b631.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/end_shift_confirmation.gd b/end_shift_confirmation.gd new file mode 100644 index 0000000..9c51fa6 --- /dev/null +++ b/end_shift_confirmation.gd @@ -0,0 +1,10 @@ +extends ConfirmationDialog + + +func _on_confirmed() -> void: + Game.end_shift() + hide() + + +func _on_canceled() -> void: + hide() diff --git a/end_shift_confirmation.gd.uid b/end_shift_confirmation.gd.uid new file mode 100644 index 0000000..01bfd42 --- /dev/null +++ b/end_shift_confirmation.gd.uid @@ -0,0 +1 @@ +uid://dopd01h4q2uu8 diff --git a/end_shift_confirmation.tscn b/end_shift_confirmation.tscn new file mode 100644 index 0000000..b72192f --- /dev/null +++ b/end_shift_confirmation.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=2 format=3 uid="uid://st16n70uj5sc"] + +[ext_resource type="Script" uid="uid://dopd01h4q2uu8" path="res://end_shift_confirmation.gd" id="1_u27s3"] + +[node name="End Shift Confirmation" type="ConfirmationDialog"] +oversampling_override = 1.0 +size = Vector2i(319, 100) +ok_button_text = "Yes" +dialog_text = "Are you sure you want to end the shift?" +script = ExtResource("1_u27s3") + +[connection signal="canceled" from="." to="." method="_on_canceled"] +[connection signal="confirmed" from="." to="." method="_on_confirmed"] diff --git a/endpoint.gd b/endpoint.gd new file mode 100644 index 0000000..8057baf --- /dev/null +++ b/endpoint.gd @@ -0,0 +1,22 @@ +class_name Endpoint extends Control + +@export var percent : float = 0 +var filled: bool +var fill: bool : + get: + return filled + set(value): + if value != filled: + set_fill(value) + + +func set_fill(value : bool) -> void: + filled = value + if value: + $Dot.visible = true + $Fill.modulate = Color.SEA_GREEN + else: + $Dot.visible = false + $Fill.modulate = Color.BLACK + + diff --git a/endpoint.gd.uid b/endpoint.gd.uid new file mode 100644 index 0000000..c7c8e85 --- /dev/null +++ b/endpoint.gd.uid @@ -0,0 +1 @@ +uid://cf0pt0ty4uaas diff --git a/fsm/interact_with_employee.gd b/fsm/interact_with_employee.gd new file mode 100644 index 0000000..4465a68 --- /dev/null +++ b/fsm/interact_with_employee.gd @@ -0,0 +1,39 @@ +extends StateNode + +@export var employee_name : String = "" +@export var speech_bubble : String = "" +@export var wait_duration : float = 1 +@export var interaction_args : Array[String] = [] +var wait_remaining : float = 0 + +var employee : GuildEmployee +var actor + +func exit() -> void: + actor.show_speech_bubble("") + +func _process(delta: float) -> void: + if wait_remaining > 0: + wait_remaining -= delta + if wait_remaining <= 0: + wait_remaining = 0 + employee.interact(self, interaction_args[0]) + complete_state() + +func execute(subject, ...args : Array) -> void: + wait_remaining = wait_duration + actor = subject + + if len(args) > 0 and args[0] != "": + subject.show_speech_bubble(speech_bubble) + + #TODO: Possibly an error later with preexisting and extended lists + for arg in args.slice(1): + interaction_args.append(arg) + var emp = Guild.hall.employees.get(employee_name) + + if emp == null: + printerr("Employee %s not found!" % employee_name) + complete_state() + else: + employee = emp diff --git a/fsm/interact_with_employee.gd.uid b/fsm/interact_with_employee.gd.uid new file mode 100644 index 0000000..e079014 --- /dev/null +++ b/fsm/interact_with_employee.gd.uid @@ -0,0 +1 @@ +uid://bewrajxqdutsu diff --git a/fsm/machines/newbie.gd b/fsm/machines/newbie.gd new file mode 100644 index 0000000..91629df --- /dev/null +++ b/fsm/machines/newbie.gd @@ -0,0 +1,27 @@ +extends StateMachine + + +func advance_state() -> void: + var last_state = curr_state + var args : Array = [actor] + exit_state(curr_state) + match(last_state.name): + "Wait": + if last_state.next_state != "": + if !states.has(last_state.next_state): + printerr("Tried to switch to missing state %s" % last_state.next_state) + pass + enter_state(states[last_state.next_state]) + args.append_array(last_state.next_state_args) + else: + pass + "Queue": + enter_state(states["Wait"]) + args.append_array(["busy", "Register"]) + "Register": + enter_state(states["Register"]) + "Leave": + enter_state(states["Leave"]) + + if curr_state != null: + curr_state.execute.callv(args) diff --git a/fsm/machines/newbie.gd.uid b/fsm/machines/newbie.gd.uid new file mode 100644 index 0000000..c178394 --- /dev/null +++ b/fsm/machines/newbie.gd.uid @@ -0,0 +1 @@ +uid://dthatmb3if73u diff --git a/fsm/machines/receptionist.gd b/fsm/machines/receptionist.gd new file mode 100644 index 0000000..cbd7199 --- /dev/null +++ b/fsm/machines/receptionist.gd @@ -0,0 +1,23 @@ +extends StateMachine + + +func advance_state() -> void: + var last_state = curr_state + var args : Array = [actor] + exit_state(curr_state) + match(last_state.name): + "Wait": + if last_state.next_state != "": + if !states.has(last_state.next_state): + printerr("Tried to switch to missing state %s" % last_state.next_state) + pass + enter_state(states[last_state.next_state]) + args.append_array(last_state.next_state_args) + else: + pass + "Advance Queue": + enter_state(states["Wait"]) + args.append_array(["", "Advance Queue"]) + + if curr_state != null: + curr_state.execute.callv(args) diff --git a/fsm/machines/receptionist.gd.uid b/fsm/machines/receptionist.gd.uid new file mode 100644 index 0000000..8f94348 --- /dev/null +++ b/fsm/machines/receptionist.gd.uid @@ -0,0 +1 @@ +uid://cggu0yihq0unt diff --git a/fsm/machines/state_machine.gd b/fsm/machines/state_machine.gd new file mode 100644 index 0000000..1f7a77a --- /dev/null +++ b/fsm/machines/state_machine.gd @@ -0,0 +1,43 @@ +class_name StateMachine extends Node + +@export var starting_state : String = "" +var states : Dictionary[String, StateNode] = {} +var curr_state : StateNode = null +var actor = null +func _ready() -> void: + for child in get_children(): + if child is StateNode: + states[child.name] = child + child.state_machine = self + child.completed.connect(_on_state_completed) + + +func start() -> void: + if starting_state != "": + var state : StateNode = states.get(starting_state) + if state == null: + printerr("Starting state not found! Expected %s" % [starting_state]) + else: + enter_state(state) + curr_state.execute(actor) + +func exit_state(state : StateNode) -> void: + curr_state.exit() + curr_state = null + pass + +func enter_state(state : StateNode) -> void: + curr_state = state + curr_state.enter() + pass + + +func advance_state() -> void: + pass + + +func _on_state_completed(state : StateNode) -> void: + if state == curr_state: + advance_state() + else: + printerr("Wrong state completed! %s when expecting %s" % [state.name, curr_state]) diff --git a/fsm/machines/state_machine.gd.uid b/fsm/machines/state_machine.gd.uid new file mode 100644 index 0000000..617afd7 --- /dev/null +++ b/fsm/machines/state_machine.gd.uid @@ -0,0 +1 @@ +uid://u81fhi8157bg diff --git a/fsm/machines/test.gd b/fsm/machines/test.gd new file mode 100644 index 0000000..06e8cf6 --- /dev/null +++ b/fsm/machines/test.gd @@ -0,0 +1,22 @@ +extends StateMachine + +func advance_state() -> void: + var last_state = curr_state + var args : Array = [actor] + exit_state(curr_state) + match(last_state.name): + "Wait": + if last_state.next_state != "": + if !states.has(last_state.next_state): + printerr("Tried to switch to missing state %s" % last_state.next_state) + pass + enter_state(states[last_state.next_state]) + args.append_array(last_state.next_state_args) + else: + pass + "Test": + enter_state(states["Wait"]) + args.append_array(["busy", "Test"]) + + if curr_state != null: + curr_state.execute.callv(args) diff --git a/fsm/machines/test.gd.uid b/fsm/machines/test.gd.uid new file mode 100644 index 0000000..01c3f2e --- /dev/null +++ b/fsm/machines/test.gd.uid @@ -0,0 +1 @@ +uid://djd8pv5xbgud3 diff --git a/fsm/nodes/advance_queue.gd b/fsm/nodes/advance_queue.gd new file mode 100644 index 0000000..9173724 --- /dev/null +++ b/fsm/nodes/advance_queue.gd @@ -0,0 +1,6 @@ +extends StateNode + +func execute(subject, ...args : Array) -> void: + if !subject.busy: + subject.queue.try_advance() + complete_state() diff --git a/fsm/nodes/advance_queue.gd.uid b/fsm/nodes/advance_queue.gd.uid new file mode 100644 index 0000000..9f9e8b9 --- /dev/null +++ b/fsm/nodes/advance_queue.gd.uid @@ -0,0 +1 @@ +uid://csicx3fpxv7xt diff --git a/fsm/nodes/leave.gd b/fsm/nodes/leave.gd new file mode 100644 index 0000000..a350eda --- /dev/null +++ b/fsm/nodes/leave.gd @@ -0,0 +1 @@ +extends StateNode diff --git a/fsm/nodes/leave.gd.uid b/fsm/nodes/leave.gd.uid new file mode 100644 index 0000000..15b310d --- /dev/null +++ b/fsm/nodes/leave.gd.uid @@ -0,0 +1 @@ +uid://b0ewnwcibhu21 diff --git a/fsm/nodes/queue.gd b/fsm/nodes/queue.gd new file mode 100644 index 0000000..1f8c630 --- /dev/null +++ b/fsm/nodes/queue.gd @@ -0,0 +1,51 @@ +extends StateNode + +@export var employee : String = "" + +var target +var actor +var in_queue +var queued_at : GuildQueue +var next_state : String +var next_state_args : Array = [] + + +func execute(subject, ...args : Array) -> void: + actor = subject + #find the receptionist queue + var queue = Guild.hall.employees[employee].queue + #join the queue + join_queue(queue) + reposition_queue(queue.length-1) + + subject.nav_agent.navigation_finished.connect(_on_navigation_finished) + +func _on_navigation_finished() -> void: + actor.nav_agent.navigation_finished.disconnect(_on_navigation_finished) + if !in_queue: + complete_state() + +func join_queue(queue : GuildQueue) -> void: + queue.add_member(actor) + in_queue = true + queued_at = queue + queue.advanced.connect(_on_queue_advanced) + +func leave_queue() -> void: + in_queue = false + queued_at.advanced.disconnect(_on_queue_advanced) + queued_at = null + +func reposition_queue(idx : int) -> void: + var queue = queued_at + #if zero approach the receptionist with the intent to use her service at navigation complete. + actor.approach(queue.global_position + idx * queue.direction * 75) + +func _on_queue_advanced() -> void: + #find our place within the queue + var idx : int = queued_at.members.find(actor) + #We aren't in the queue, time to advance + if idx < 0: + leave_queue() + else: + reposition_queue(idx) diff --git a/fsm/nodes/queue.gd.uid b/fsm/nodes/queue.gd.uid new file mode 100644 index 0000000..5978983 --- /dev/null +++ b/fsm/nodes/queue.gd.uid @@ -0,0 +1 @@ +uid://y85swbbk8kbd diff --git a/fsm/nodes/state_node.gd b/fsm/nodes/state_node.gd new file mode 100644 index 0000000..5f815b3 --- /dev/null +++ b/fsm/nodes/state_node.gd @@ -0,0 +1,17 @@ +class_name StateNode extends Node + +var state_machine : StateMachine = null +signal completed(state : StateNode) + + +func enter() -> void: + pass + +func exit() -> void: + pass + +func execute(subject, ...args : Array) -> void: + pass + +func complete_state() -> void: + completed.emit(self) diff --git a/fsm/nodes/state_node.gd.uid b/fsm/nodes/state_node.gd.uid new file mode 100644 index 0000000..bed885e --- /dev/null +++ b/fsm/nodes/state_node.gd.uid @@ -0,0 +1 @@ +uid://c27ctn874rdns diff --git a/fsm/nodes/test.gd b/fsm/nodes/test.gd new file mode 100644 index 0000000..8f0c587 --- /dev/null +++ b/fsm/nodes/test.gd @@ -0,0 +1,13 @@ +extends StateNode + + +@export var message : String = "" +var target +func execute(subject, ...args : Array) -> void: + subject.approach(Game.player.global_position) + subject.nav_agent.navigation_finished.connect(_on_navigation_finished) + target = subject + +func _on_navigation_finished() -> void: + target.nav_agent.navigation_finished.disconnect(_on_navigation_finished) + complete_state() diff --git a/fsm/nodes/test.gd.uid b/fsm/nodes/test.gd.uid new file mode 100644 index 0000000..de75bbe --- /dev/null +++ b/fsm/nodes/test.gd.uid @@ -0,0 +1 @@ +uid://e8we6nmaob1k diff --git a/fsm/nodes/wait.gd b/fsm/nodes/wait.gd new file mode 100644 index 0000000..0d14d77 --- /dev/null +++ b/fsm/nodes/wait.gd @@ -0,0 +1,34 @@ +extends StateNode + + +@export var wait_duration : float = 1 +var wait_remaining : float = 0 +var next_state : String +var next_state_args : Array = [] +var actor +func exit() -> void: + actor.show_speech_bubble("") + +func _process(delta: float) -> void: + if wait_remaining > 0: + wait_remaining -= delta + if wait_remaining <= 0: + wait_remaining = 0 + complete_state() + +func execute(subject, ...args : Array) -> void: + wait_remaining = wait_duration + actor = subject + + if len(args) > 0 and args[0] != "": + subject.show_speech_bubble(args[0]) + + if len(args) > 1 and args[1] != "": + next_state = args[1] + else: + next_state = "" + + if len(args) > 2 and args[2] != "": + next_state_args = args[2] + else: + next_state_args = [] diff --git a/fsm/nodes/wait.gd.uid b/fsm/nodes/wait.gd.uid new file mode 100644 index 0000000..87fc662 --- /dev/null +++ b/fsm/nodes/wait.gd.uid @@ -0,0 +1 @@ +uid://dl3b5aywu1hf6 diff --git a/game_manager.gd b/game_manager.gd new file mode 100644 index 0000000..692e046 --- /dev/null +++ b/game_manager.gd @@ -0,0 +1,30 @@ +extends Node + +var player : Player = null +var panel : GamePanel = null +var quest_log : QuestLog = null +var active : bool = true +var end_shift_confirmation : ConfirmationDialog +var end_shift_confirm_template = preload("res://end_shift_confirmation.tscn") +func _ready() -> void: + end_shift_confirmation = end_shift_confirm_template.instantiate() + add_child(end_shift_confirmation) + +func _process(delta: float) -> void: + if active and Input.is_action_just_pressed("switch modes"): + confirm_end_shift() + + +func add_quest_progress_bar(quest : Quest) -> void: + panel.add_quest_progress_bar(quest) + +func confirm_end_shift() -> void: + end_shift_confirmation.popup_centered() + +func setup_visitor_ui(spawner: VisitorSpawner)-> void: + if panel: + panel.connect_visitor_spawner(spawner) + +func end_shift() -> void: + active = false + panel.switch_panel(active) diff --git a/game_manager.gd.uid b/game_manager.gd.uid new file mode 100644 index 0000000..010ba60 --- /dev/null +++ b/game_manager.gd.uid @@ -0,0 +1 @@ +uid://cr421faioc8cf diff --git a/guild.gd b/guild.gd new file mode 100644 index 0000000..73d7949 --- /dev/null +++ b/guild.gd @@ -0,0 +1,35 @@ +extends Node + + +const visitors = { + "test": { + "data":preload("res://test_adventurer.tscn"), + "sprite":preload("res://test_adventurer_sprite.tscn") + } +} + + + +var members : Array[AdventurerData] = [] +var quests : Dictionary[Quest,bool] = {} +var hall : Guildhall = null +var visitor_spawner : VisitorSpawner = null + +func register_guild_member(member : AdventurerData) -> void: + members.append(member) + +func add_quest(quest : Quest) -> void: + quests[quest] = false + Game.quest_log.add_entry(quest) + +func assign_quest(member : AdventurerData, quest : Quest) -> void: + member.assign_quest(quest) + quests[quest] = true #Mark it as active + Game.add_quest_progress_bar(quest) + +func spawn_visitor(pos : Vector2) -> void: + var visitor : AdventurerData = visitors["test"].data.instantiate() + var sprite : Adventurer = visitors["test"].sprite.instantiate() + sprite.data = visitor + hall.add_sprite(sprite) + sprite.global_position = pos diff --git a/guild.gd.uid b/guild.gd.uid new file mode 100644 index 0000000..c62e829 --- /dev/null +++ b/guild.gd.uid @@ -0,0 +1 @@ +uid://c7ymru8doa4a8 diff --git a/guild_employee.gd b/guild_employee.gd new file mode 100644 index 0000000..ac188e0 --- /dev/null +++ b/guild_employee.gd @@ -0,0 +1,10 @@ +class_name GuildEmployee extends Adventurer + +@export var speech :String +@onready var queue : GuildQueue = $Queue +var busy : bool + + +func interact(interactor, type : String = "") -> void: + if type == "register": + Guild.register_guild_member(interactor) diff --git a/guild_employee.gd.uid b/guild_employee.gd.uid new file mode 100644 index 0000000..9b1ad32 --- /dev/null +++ b/guild_employee.gd.uid @@ -0,0 +1 @@ +uid://b2unuudq5qfl diff --git a/guild_queue.gd b/guild_queue.gd new file mode 100644 index 0000000..aa44e8e --- /dev/null +++ b/guild_queue.gd @@ -0,0 +1,23 @@ +class_name GuildQueue extends Node2D + +var length : int : + get: + return len(members) +@export var direction : Vector2 = Vector2.ZERO +var members : Array[Adventurer] = [] +signal advanced() + +func add_member(member : Adventurer) -> void: + members.append(member) + #TODO: Instead retrieve the array length with a getter + +func try_advance() -> Adventurer: + if length > 0: + return advance() + else: + return null + +func advance() -> Adventurer: + var member = members.pop_front() + advanced.emit() + return member diff --git a/guild_queue.gd.uid b/guild_queue.gd.uid new file mode 100644 index 0000000..309bf79 --- /dev/null +++ b/guild_queue.gd.uid @@ -0,0 +1 @@ +uid://b0q2233msdtgo diff --git a/guildhall.gd b/guildhall.gd new file mode 100644 index 0000000..46bdcc9 --- /dev/null +++ b/guildhall.gd @@ -0,0 +1,15 @@ +class_name Guildhall extends Node2D + +var employees : Dictionary[String, GuildEmployee] = {} + +func _ready() -> void: + Guild.hall = self + for child in get_children(): + if child is GuildEmployee: + register_employee(child) + + +func register_employee(employee: GuildEmployee) -> void: + employees[employee.name] = employee +func add_sprite(sprite : Adventurer) -> void: + add_child(sprite) diff --git a/guildhall.gd.uid b/guildhall.gd.uid new file mode 100644 index 0000000..2efd778 --- /dev/null +++ b/guildhall.gd.uid @@ -0,0 +1 @@ +uid://ccorfvcfa84gf diff --git a/guildhall.tscn b/guildhall.tscn index 17b0061..bf7c045 100644 --- a/guildhall.tscn +++ b/guildhall.tscn @@ -1,17 +1,189 @@ -[gd_scene load_steps=2 format=4 uid="uid://cd08dp16bixfv"] +[gd_scene load_steps=18 format=4 uid="uid://cd08dp16bixfv"] [ext_resource type="TileSet" uid="uid://6im0g3eg6sr4" path="res://test_tiles.tres" id="1_qel1r"] +[ext_resource type="Script" uid="uid://dolqtw1ye4ras" path="res://player.gd" id="2_5n4iw"] +[ext_resource type="Texture2D" uid="uid://bldpiytpdrge6" path="res://icon.svg" id="2_w7eqs"] +[ext_resource type="Texture2D" uid="uid://cbamfadh7wwr7" path="res://speech-blip.png" id="4_2wofw"] +[ext_resource type="Script" uid="uid://b2unuudq5qfl" path="res://guild_employee.gd" id="4_g7jyq"] +[ext_resource type="Script" uid="uid://b0q2233msdtgo" path="res://guild_queue.gd" id="5_13vc8"] +[ext_resource type="Script" uid="uid://cggu0yihq0unt" path="res://fsm/machines/receptionist.gd" id="6_13vc8"] +[ext_resource type="Script" uid="uid://csicx3fpxv7xt" path="res://fsm/nodes/advance_queue.gd" id="7_hph4e"] +[ext_resource type="Script" uid="uid://dl3b5aywu1hf6" path="res://fsm/nodes/wait.gd" id="8_bog1h"] +[ext_resource type="Script" uid="uid://w57riwplc00t" path="res://speech_bubble.gd" id="10_50x1e"] +[ext_resource type="Texture2D" uid="uid://chnk20ey5qxfh" path="res://speech-emojis.png" id="11_50x1e"] + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_w7eqs"] +vertices = PackedVector2Array(814, 70.03906, 1070, 68.96094, 778, 138, 778, 54, 814, 10, 10, 10, 246, 54, 10, 630, 246, 138, 458, 630, 1070, 28, 1078, 28, 1078, 630, 566, 630, 566, 886, 458, 886) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2), PackedInt32Array(0, 2, 3), PackedInt32Array(4, 0, 3), PackedInt32Array(5, 4, 3), PackedInt32Array(5, 3, 6), PackedInt32Array(7, 5, 6), PackedInt32Array(7, 6, 8), PackedInt32Array(9, 7, 8), PackedInt32Array(9, 8, 2), PackedInt32Array(1, 10, 11), PackedInt32Array(1, 11, 12), PackedInt32Array(2, 1, 12), PackedInt32Array(2, 12, 13), PackedInt32Array(9, 2, 13), PackedInt32Array(9, 13, 14), PackedInt32Array(9, 14, 15)]) +sample_partition_type = 1 + +[sub_resource type="CircleShape2D" id="CircleShape2D_5n4iw"] +radius = 35.0 + +[sub_resource type="Animation" id="Animation_bog1h"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D3:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [0] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Sprite2D3:position") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, 0)] +} + +[sub_resource type="Animation" id="Animation_13vc8"] +resource_name = "busy" +length = 0.7000034 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D3:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1), +"update": 1, +"values": [0, 1, 8, 9, 16, 17, 24, 25] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Sprite2D3:position") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, 0)] +} + +[sub_resource type="Animation" id="Animation_lsinl"] +resource_name = "talk" +length = 0.40000334 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D3:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, -3)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Sprite2D3:frame") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1), +"update": 1, +"values": [2, 3, 10, 3, 2] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_uo85v"] +_data = { +&"RESET": SubResource("Animation_bog1h"), +&"busy": SubResource("Animation_13vc8"), +&"talk": SubResource("Animation_lsinl") +} [node name="Guildhall" type="Node2D"] -[node name="TileMapLayer" type="TileMapLayer" parent="."] -tile_map_data = PackedByteArray("AAABAAEAAAAOAAEAAAACAAEAAAAOAAEA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AoAAAACAAQAAAAPAAoAAAACAAQAAAAOAAoAAAACAAQAAAANAAoAAAACAAQAAAAMAAoAAAACAAQAAAALAAoAAAACAAQAAAAKAAoAAAACAAQAAAAJAAoAAAAGAAUAAAAIAAoAAAAFAAAAAAAHAAoAAAAFAAAAAAAGAAoAAAAFAAQAAAAFAAoAAAACAAQAAAAEAAoAAAACAAQAAAADAAoAAAACAAQAAAACAAoAAAACAAQAAAABAAoAAAACAAQAAAAAAAoAAAACAAQAAAD//wkAAAACAAUAAAD//wAAAAACAAUAAAD//wEAAAACAAUAAAD//wIAAAACAAUAAAD//wMAAAACAAUAAAD//wQAAAACAAUAAAD//wUAAAACAAUAAAD//wYAAAACAAUAAAD//wcAAAACAAUAAAD//wgAAAACAAUAAAAHAAsAAAAFAAAAAAAIAAsAAAAFAAAAAAAHAAwAAAAFAAAAAAAIAAwAAAAFAAAAAAAHAA0AAAAFAAAAAAAIAA0AAAAFAAAAAAA=") -tile_set = ExtResource("1_qel1r") +[node name="NavigationRegion2D" type="NavigationRegion2D" parent="."] +navigation_polygon = SubResource("NavigationPolygon_w7eqs") -[node name="TileMapLayer2" type="TileMapLayer" parent="."] +[node name="TileMapLayer" type="TileMapLayer" parent="NavigationRegion2D"] +tile_map_data = PackedByteArray("AAABAAEAAAAOAAEAAAACAAEAAAAOAAEAAAADAAEAAAAOAAEAAAAEAAEAAAAOAAEAAAAFAAIAAAAOAAEAAAAGAAIAAAAOAAEAAAAHAAIAAAAOAAEAAAAIAAIAAAAOAAEAAAAJAAIAAAAOAAEAAAAKAAIAAAAOAAEAAAAHAAEAAAAOAAEAAAAGAAEAAAAOAAEAAAAFAAEAAAAOAAEAAAACAAIAAAAOAAEAAAADAAIAAAAOAAEAAAAEAAIAAAAOAAEAAAABAAIAAAAOAAEAAAABAAMAAAAOAAEAAAABAAQAAAAOAAEAAAACAAQAAAAOAAEAAAADAAQAAAAOAAEAAAAEAAQAAAAOAAEAAAAFAAQAAAAOAAEAAAAGAAQAAAAOAA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AGAAUAAAAOAAEAAAAHAAUAAAAOAAEAAAAIAAUAAAAOAAEAAAAJAAUAAAAOAAEAAAAEAAUAAAAOAAEAAAADAAUAAAAOAAEAAAADAAcAAAAOAAEAAAACAAcAAAAOAAEAAAAEAAcAAAAOAAEAAAAFAAcAAAAOAAEAAAAGAAcAAAAOAAEAAAAHAAcAAAAOAAEAAAAFAAgAAAAOAAEAAAAEAAgAAAAOAAEAAAADAAgAAAAOAAEAAAARAP//AAABAAQAAAARAAoAAAABAAUAAAD//woAAAAAAAUAAAD/////AAAAAAQAAAAAAP//AAACAAQAAAABAP//AAACAAQAAAACAP//AAACAAQAAAADAP//AAACAAQAAAAEAP//AAACAAQAAAAFAP//AAACAAQAAAAGAP//AAACAAQAAAAHAP//AAACAAQAAAAIAP//AAACAAQAAAAJAP//AAACAAQAAAAKAP//AAACAAQAAAALAP//AAACAAQAAAAMAP//AAACAAQAAAANAP//AAACAAQAAAAOAP//AAACAAQAAAAPAP//AAACAAQAAAAQAP//AAACAAQAAAARAAAAAAACAAUAAAARAAEAAAACAAUAAAARAAIAAAACAAUAAAARAAMAAAACAAUAAAARAAQAAAACAAUAAAARAAUAAAACAAUAAAARAAYAAAACAAUAAAARAAcAAAACAAUAAAARAAgAAAACAAUAAAARAAkAAAACAAUAAAAQAAoAAAACAAQAAAAPAAoAAAACAAQAAAAOAAoAAAACAAQAAAANAAoAAAACAAQAAAAMAAoAAAACAAQAAAALAAoAAAACAAQAAAAKAAoAAAACAAQAAAAJAAoAAAAGAAUAAAAIAAoAAAAFAAAAAAAHAAoAAAAFAAAAAAAGAAoAAAAFAAQAAAAFAAoAAAACAAQAAAAEAAoAAAACAAQAAAADAAoAAAACAAQAAAACAAoAAAACAAQAAAABAAoAAAACAAQAAAAAAAoAAAACAAQAAAD//wkAAAACAAUAAAD//wAAAAACAAUAAAD//wEAAAACAAUAAAD//wIAAAACAAUAAAD//wMAAAACAAUAAAD//wQAAAACAAUAAAD//wUAAAACAAUAAAD//wYAAAACAAUAAAD//wcAAAACAAUAAAD//wgAAAACAAUAAAAHAAsAAAAFAAAAAAAIAAsAAAAFAAAAAAAHAAwAAAAFAAAAAAAIAAwAAAAFAAAAAAAHAA0AAAAFAAAAAAAIAA0AAAAFAAAAAAAAAAAAAAAOAAEAAAA=") +tile_set = ExtResource("1_qel1r") +collision_visibility_mode = 1 +navigation_visibility_mode = 1 + +[node name="TileMapLayer2" type="TileMapLayer" parent="NavigationRegion2D"] tile_map_data = PackedByteArray("AAAEAAEAAAASAAwAAAAFAAEAAAATAAwAAAAGAAEAAAATAAwAAAAHAAEAAAATAAwAAAAIAAEAAAATAAwAAAAJAAEAAAATAAwAAAAKAAEAAAATAAwAAAALAAEAAAAUAAwAAAANAAAAAAAKABEAAAAOAAAAAAAKABEAAAAPAAAAAAAKABEAAAAQAAAAAAAKABEAAAA=") tile_set = ExtResource("1_qel1r") [node name="CharacterBody2D" type="CharacterBody2D" parent="."] +position = Vector2(241, 364) +script = ExtResource("2_5n4iw") [node name="Sprite2D" type="Sprite2D" parent="CharacterBody2D"] +scale = Vector2(0.5, 0.5) +texture = ExtResource("2_w7eqs") + +[node name="NavigationAgent2D" type="NavigationAgent2D" parent="CharacterBody2D"] +path_desired_distance = 30.0 +avoidance_enabled = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"] +shape = SubResource("CircleShape2D_5n4iw") + +[node name="Receptionist" type="CharacterBody2D" parent="."] +modulate = Color(1.7602391, 1.7602391, 1.7602391, 1) +position = Vector2(518, 32) +script = ExtResource("4_g7jyq") + +[node name="Sprite2D" type="Sprite2D" parent="Receptionist"] +modulate = Color(0, 1, 0, 1) +scale = Vector2(0.5, 0.5) +texture = ExtResource("2_w7eqs") + +[node name="NavigationAgent2D" type="NavigationAgent2D" parent="Receptionist"] +path_desired_distance = 30.0 +avoidance_enabled = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Receptionist"] +shape = SubResource("CircleShape2D_5n4iw") + +[node name="Queue" type="Node2D" parent="Receptionist"] +position = Vector2(-6, 133) +script = ExtResource("5_13vc8") + +[node name="StateMachine" type="Node" parent="Receptionist"] +script = ExtResource("6_13vc8") + +[node name="Wait" type="Node" parent="Receptionist/StateMachine"] +script = ExtResource("8_bog1h") +wait_duration = 3.0 + +[node name="Advance Queue" type="Node" parent="Receptionist/StateMachine"] +script = ExtResource("7_hph4e") + +[node name="SpeechBubble" type="Sprite2D" parent="Receptionist"] +position = Vector2(39, -42) +texture = ExtResource("4_2wofw") +script = ExtResource("10_50x1e") + +[node name="Sprite2D3" type="Sprite2D" parent="Receptionist/SpeechBubble"] +texture = ExtResource("11_50x1e") +hframes = 8 +vframes = 8 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="Receptionist/SpeechBubble"] +libraries = { +&"": SubResource("AnimationLibrary_uo85v") +} diff --git a/hero_icon.gd b/hero_icon.gd new file mode 100644 index 0000000..0f20204 --- /dev/null +++ b/hero_icon.gd @@ -0,0 +1,5 @@ +class_name HeroIcon extends Sprite2D + + +func move(pos : Vector2) -> void: + pass diff --git a/hero_icon.gd.uid b/hero_icon.gd.uid new file mode 100644 index 0000000..1359288 --- /dev/null +++ b/hero_icon.gd.uid @@ -0,0 +1 @@ +uid://cxqkvnv4rwots diff --git a/hero_progress_bar.gd b/hero_progress_bar.gd deleted file mode 100644 index 5a30cca..0000000 --- a/hero_progress_bar.gd +++ /dev/null @@ -1,12 +0,0 @@ -extends Control - - -signal value_changed(value : float) -var min_value -var max_value -var step -var page -var value -var exp_edit -var rounded -var allow_greater diff --git a/hero_progress_bar.tscn b/hero_progress_bar.tscn deleted file mode 100644 index 2459259..0000000 --- a/hero_progress_bar.tscn +++ /dev/null @@ -1,165 +0,0 @@ -[gd_scene load_steps=15 format=3 uid="uid://cm8jwfg6rnnor"] - -[ext_resource type="Texture2D" uid="uid://vt3yvxm2ho7o" path="res://progress-fill.png" id="2_61u8r"] -[ext_resource type="Texture2D" uid="uid://b88n81qde4p3n" path="res://progress-bar.png" id="3_7p536"] -[ext_resource type="Texture2D" uid="uid://c6ptvokr5npl7" path="res://progress-marks.png" id="4_6vk2f"] -[ext_resource type="Texture2D" uid="uid://bcrg5ea4niu0e" path="res://progress-dot-fill.png" id="5_dxgqf"] -[ext_resource type="Texture2D" uid="uid://qxx2gxnsd3yg" path="res://hero.png" id="5_jas03"] -[ext_resource type="Texture2D" uid="uid://dotwwulusn1b1" path="res://speechbubble.png" id="6_61u8r"] - -[sub_resource type="AtlasTexture" id="AtlasTexture_8wucn"] -atlas = ExtResource("4_6vk2f") -region = Rect2(0, 32, 32, 32) -filter_clip = true - -[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_mf4ya"] -load_path = "res://.godot/imported/progress-dot-fill.png-a1e94128dc6c2f11bfa15c335ef05892.ctex" - -[sub_resource type="AtlasTexture" id="AtlasTexture_eu8pt"] -resource_local_to_scene = true -atlas = SubResource("CompressedTexture2D_mf4ya") -region = Rect2(0, 32, 32, 32) -filter_clip = true - -[sub_resource type="AtlasTexture" id="AtlasTexture_pg7md"] -atlas = ExtResource("4_6vk2f") -region = Rect2(32, 32, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_nyilg"] -atlas = ExtResource("4_6vk2f") -region = Rect2(32, 0, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_g6crn"] -atlas = ExtResource("5_dxgqf") -region = Rect2(0, 0, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_bnohr"] -resource_local_to_scene = true -atlas = SubResource("CompressedTexture2D_mf4ya") -region = Rect2(32, 0, 32, 32) -filter_clip = true - -[sub_resource type="AtlasTexture" id="AtlasTexture_mmi8n"] -atlas = ExtResource("4_6vk2f") -region = Rect2(32, 0, 32, 32) -filter_clip = true - -[node name="HeroProgressBar" type="TextureProgressBar"] -offset_right = 213.0 -offset_bottom = 14.0 -nine_patch_stretch = true -stretch_margin_left = 1 -stretch_margin_top = 2 -stretch_margin_right = 1 -stretch_margin_bottom = 2 -texture_under = ExtResource("2_61u8r") -texture_over = ExtResource("3_7p536") -texture_progress = ExtResource("2_61u8r") -tint_under = Color(0, 0, 0, 1) -tint_progress = Color(1, 1, 0, 1) - -[node name="TextureRect" type="TextureRect" parent="."] -layout_mode = 0 -offset_left = -21.0 -offset_top = -9.0 -offset_right = 11.0 -offset_bottom = 23.0 -texture = SubResource("AtlasTexture_8wucn") - -[node name="TextureRect4" type="TextureRect" parent="."] -self_modulate = Color(0, 0, 0, 1) -layout_mode = 0 -offset_left = -21.0 -offset_top = -9.0 -offset_right = 11.0 -offset_bottom = 23.0 -texture = SubResource("AtlasTexture_eu8pt") - -[node name="TextureRect8" type="TextureRect" parent="."] -layout_mode = 0 -offset_left = -21.0 -offset_top = -9.0 -offset_right = 11.0 -offset_bottom = 23.0 -texture = SubResource("AtlasTexture_pg7md") - -[node name="TextureRect6" type="TextureRect" parent="."] -layout_mode = 0 -offset_left = 96.0 -offset_top = -9.0 -offset_right = 128.0 -offset_bottom = 23.0 -texture = SubResource("AtlasTexture_nyilg") - -[node name="TextureRect7" type="TextureRect" parent="."] -modulate = Color(0, 0, 0, 1) -layout_mode = 0 -offset_left = 96.0 -offset_top = -9.0 -offset_right = 128.0 -offset_bottom = 23.0 -texture = SubResource("AtlasTexture_g6crn") - -[node name="TextureRect5" type="TextureRect" parent="."] -self_modulate = Color(0, 0, 0, 1) -layout_mode = 0 -offset_left = 213.0 -offset_top = -9.0 -offset_right = 245.0 -offset_bottom = 23.0 -texture = SubResource("AtlasTexture_bnohr") - -[node name="TextureRect3" type="TextureRect" parent="."] -layout_mode = 0 -offset_left = 213.0 -offset_top = -9.0 -offset_right = 245.0 -offset_bottom = 23.0 -texture = SubResource("AtlasTexture_mmi8n") - -[node name="Icon" type="Sprite2D" parent="."] -position = Vector2(-5, -12) -texture = ExtResource("5_jas03") - -[node name="NinePatchRect" type="NinePatchRect" parent="."] -layout_mode = 0 -offset_left = -5.0 -offset_top = -44.0 -offset_right = 69.0 -offset_bottom = -24.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -texture = ExtResource("6_61u8r") -patch_margin_left = 13 -patch_margin_top = 5 -patch_margin_right = 6 -patch_margin_bottom = 10 - -[node name="MarginContainer" type="MarginContainer" parent="NinePatchRect"] -layout_mode = 1 -anchors_preset = 2 -anchor_top = 1.0 -anchor_bottom = 1.0 -offset_left = 5.0 -offset_top = -22.0 -offset_right = 81.0 -offset_bottom = -2.0 -grow_vertical = 0 -theme_override_constants/margin_left = 0 -theme_override_constants/margin_top = 0 -theme_override_constants/margin_right = 0 -theme_override_constants/margin_bottom = 0 - -[node name="Label" type="Label" parent="NinePatchRect/MarginContainer"] -layout_mode = 2 -theme_override_colors/font_color = Color(0, 0, 0, 1) -theme_override_constants/line_spacing = -4 -theme_override_font_sizes/font_size = 8 -text = "I killed a dragon!" -autowrap_mode = 2 - -[node name="Container" type="Container" parent="."] -layout_mode = 0 -offset_top = -32.0 -offset_right = 75.0 -offset_bottom = 40.0 diff --git a/interactable.gd b/interactable.gd new file mode 100644 index 0000000..6282810 --- /dev/null +++ b/interactable.gd @@ -0,0 +1 @@ +class_name Interactable extends StaticBody2D diff --git a/interactable.gd.uid b/interactable.gd.uid new file mode 100644 index 0000000..ec0eab7 --- /dev/null +++ b/interactable.gd.uid @@ -0,0 +1 @@ +uid://dek37dgkvktjb diff --git a/main_panel.gd b/main_panel.gd index 4128776..62ef4ac 100644 --- a/main_panel.gd +++ b/main_panel.gd @@ -1,12 +1,42 @@ -extends PanelContainer +class_name GamePanel extends PanelContainer +const quest_progress_bar_template = preload("res://quest_progress_bar.tscn") + signal time_changed(time : float) @onready var timer : Timer = $Timer func _ready() -> void: - $Pass + Game.panel = self func _process(delta: float) -> void: time_changed.emit(timer.time_left) + +func add_quest_progress_bar(quest : Quest) -> void: + var qpb : QuestProgressBar = quest_progress_bar_template.instantiate() + qpb.setup(quest) + %QuestProgressList/VBoxContainer.add_child(qpb) + #TODO: Change the hero portrait to match + if quest.steps > 1: + for i in range(quest.steps-1): + qpb.add_waypoint(float(i) / quest.steps, quest.step_messages[i]) + + +func switch_panel(active : bool) -> void: + %Active.visible = active + %Passive.visible = !active + + +func _on_end_shift_pressed() -> void: + Game.confirm_end_shift() + +func _on_visitor_spawned(remaining : int, total : int) -> void: + update_visitor_count(total - remaining, total) + +func connect_visitor_spawner(spawner : VisitorSpawner) -> void: + spawner.visitor_spawned.connect(_on_visitor_spawned) + update_visitor_count(spawner.total_visitors - spawner.visitors_remaining, spawner.total_visitors) + +func update_visitor_count(current : int, total : int) -> void: + %Passive/VisitorsLabel.text = "Visitors: %d/%d" % [current, total] diff --git a/main_panel.tscn b/main_panel.tscn index e566255..79bb45e 100644 --- a/main_panel.tscn +++ b/main_panel.tscn @@ -3,12 +3,12 @@ [ext_resource type="Script" uid="uid://dhw85vqlvw33s" path="res://main_panel.gd" id="1_pdekv"] [ext_resource type="Script" uid="uid://4jrp67ckp7vt" path="res://timer_label.gd" id="2_5rs2c"] -[node name="PanelContainer" type="PanelContainer"] +[node name="MainPanel" type="PanelContainer"] anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 -offset_right = -573.0 -offset_bottom = -257.0 +offset_right = -870.0 +offset_bottom = -526.0 grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_pdekv") @@ -25,40 +25,67 @@ theme_override_constants/margin_right = 20 theme_override_constants/margin_bottom = 20 [node name="Passive" type="VBoxContainer" parent="MarginContainer"] -visible = false +unique_name_in_owner = true layout_mode = 2 [node name="Label" type="Label" parent="MarginContainer/Passive"] layout_mode = 2 -theme_override_font_sizes/font_size = 50 +theme_override_font_sizes/font_size = 28 text = "Time til Next Shift" horizontal_alignment = 1 [node name="TimerLabel" type="Label" parent="MarginContainer/Passive"] layout_mode = 2 -theme_override_font_sizes/font_size = 100 +theme_override_font_sizes/font_size = 28 text = "000:00:00.00" script = ExtResource("2_5rs2c") +[node name="VisitorsLabel" type="Label" parent="MarginContainer/Passive"] +layout_mode = 2 +theme_override_font_sizes/font_size = 28 +text = "000:00:00.00" +script = ExtResource("2_5rs2c") + +[node name="QuestProgressList" type="ScrollContainer" parent="MarginContainer/Passive"] +unique_name_in_owner = true +clip_contents = false +custom_minimum_size = Vector2(260, 100) +layout_mode = 2 +horizontal_scroll_mode = 0 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/Passive/QuestProgressList"] +custom_minimum_size = Vector2(300, 100) +layout_mode = 2 + [node name="Active" type="VBoxContainer" parent="MarginContainer"] +unique_name_in_owner = true +visible = false layout_mode = 2 [node name="Label" type="Label" parent="MarginContainer/Active"] layout_mode = 2 -theme_override_font_sizes/font_size = 50 +theme_override_font_sizes/font_size = 28 text = "Time til Next Shift" horizontal_alignment = 1 [node name="TimerLabel" type="Label" parent="MarginContainer/Active"] layout_mode = 2 -theme_override_font_sizes/font_size = 100 +theme_override_font_sizes/font_size = 28 text = "00:00:00.00" +horizontal_alignment = 1 script = ExtResource("2_5rs2c") [node name="Label3" type="Label" parent="MarginContainer/Active"] +visible = false layout_mode = 2 -theme_override_font_sizes/font_size = 100 +theme_override_font_sizes/font_size = 28 text = "00:00:00.00" +horizontal_alignment = 1 + +[node name="Button" type="Button" parent="MarginContainer/Active"] +layout_mode = 2 +text = "END SHIFT" [connection signal="time_changed" from="." to="MarginContainer/Passive/TimerLabel" method="_on_time_changed"] [connection signal="time_changed" from="." to="MarginContainer/Active/TimerLabel" method="_on_time_changed"] +[connection signal="pressed" from="MarginContainer/Active/Button" to="." method="_on_end_shift_pressed"] diff --git a/notice-icon.png b/notice-icon.png new file mode 100644 index 0000000..331a915 Binary files /dev/null and b/notice-icon.png differ diff --git a/notice-icon.png.import b/notice-icon.png.import new file mode 100644 index 0000000..8584336 --- /dev/null +++ b/notice-icon.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b7yco5065s41n" +path="res://.godot/imported/notice-icon.png-e62659f692815b5b1a43780c11b957b5.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://notice-icon.png" +dest_files=["res://.godot/imported/notice-icon.png-e62659f692815b5b1a43780c11b957b5.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/notice_panel.tscn b/notice_panel.tscn new file mode 100644 index 0000000..ce72a0c --- /dev/null +++ b/notice_panel.tscn @@ -0,0 +1,25 @@ +[gd_scene load_steps=2 format=3 uid="uid://b3lle4eammcwp"] + +[ext_resource type="Texture2D" uid="uid://b7yco5065s41n" path="res://notice-icon.png" id="1_1reoo"] + +[node name="NoticePanel" type="PanelContainer"] +offset_right = 321.0 +offset_bottom = 32.0 + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 2 + +[node name="TextureRect" type="TextureRect" parent="HBoxContainer"] +custom_minimum_size = Vector2(32, 32) +layout_mode = 2 +texture = ExtResource("1_1reoo") +expand_mode = 1 +stretch_mode = 4 + +[node name="Label" type="Label" parent="HBoxContainer"] +custom_minimum_size = Vector2(300, 24) +layout_mode = 2 +text = "Rania has joined the guild!" +horizontal_alignment = 1 +vertical_alignment = 1 +autowrap_mode = 2 diff --git a/player.gd b/player.gd new file mode 100644 index 0000000..2cf8b26 --- /dev/null +++ b/player.gd @@ -0,0 +1,66 @@ +class_name Player extends CharacterBody2D + +@onready var movement_speed : float = 400.0 +@onready var movement_target_position : Vector2 = global_position +@onready var nav_agent : NavigationAgent2D = $NavigationAgent2D + +var interaction_target = null +@export var interaction_range : float = 75 +@export var stop_range : float = 25 +func _ready() -> void: + Game.player = self + setup.call_deferred() + + +func setup(): + await get_tree().physics_frame + set_movement_target(movement_target_position) + + +func set_movement_target(target : Vector2) -> void: + nav_agent.target_position = target + +func _physics_process(delta: float) -> void: + + if nav_agent.is_navigation_finished(): + if interaction_target: + try_interact(interaction_target) + #If they have an interaction target within range + #clear the target + #try_interact + return + + var curr_pos: Vector2 = global_position + var next_path_pos: Vector2 = nav_agent.get_next_path_position() + + velocity = curr_pos.direction_to(next_path_pos) * movement_speed + + move_and_slide() + +func _unhandled_input(event: InputEvent) -> void: + var evt : InputEventMouseButton = event as InputEventMouseButton + if evt and evt.pressed: + approach(evt.global_position) + nav_agent.target_desired_distance = stop_range + interaction_target = null + +func approach(pos : Vector2) -> void: + var rid = get_world_2d().get_navigation_map() + var point : Vector2 = NavigationServer2D.map_get_closest_point(rid, pos) + set_movement_target(point) + +func approach_and_interact(obj : Interactable) -> void: + set_movement_target(obj.global_position) + nav_agent.target_desired_distance = interaction_range - 5 + interaction_target = obj + +func try_interact(obj : Interactable) -> void: + var df = obj.global_position - global_position + if df.length() > interaction_range: + approach_and_interact(obj) + else: + interact(obj) + interaction_target = null + +func interact(obj : Interactable) -> void: + obj.interact(self) diff --git a/player.gd.uid b/player.gd.uid new file mode 100644 index 0000000..304cde9 --- /dev/null +++ b/player.gd.uid @@ -0,0 +1 @@ +uid://dolqtw1ye4ras diff --git a/project.godot b/project.godot index 13453d2..7d11e05 100644 --- a/project.godot +++ b/project.godot @@ -14,10 +14,30 @@ config/name="pomchronicles" config/features=PackedStringArray("4.5", "Forward Plus") config/icon="res://icon.svg" +[autoload] + +Guild="*res://guild.gd" +Game="*res://game_manager.gd" + +[display] + +window/size/viewport_width=1920 +window/size/viewport_height=1080 +window/size/resizable=false +window/stretch/mode="canvas_items" + [dotnet] project/assembly_name="pomchronicles" +[input] + +"switch modes"={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194332,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} + [rendering] textures/canvas_textures/default_texture_filter=0 diff --git a/quest.gd b/quest.gd new file mode 100644 index 0000000..759c187 --- /dev/null +++ b/quest.gd @@ -0,0 +1,26 @@ +class_name Quest extends Object + + + + +var name : String = "A Basic Quest" +var desc : String = "The default quest, with no special anything." +var difficulty : int = 1 +var steps : int = 1 +var step_outcomes : Array = [ + {"pass":"I succeeded!", "fail":"I failed!"} +] + + + +var progress : float = 0 +var current_step : int = 0 +var taken : bool = false + +var questor : AdventurerData = null +var entry : QuestLogEntry = null + +func initiate(member : AdventurerData) -> void: + questor = member + taken = true + entry.update() diff --git a/quest.gd.uid b/quest.gd.uid new file mode 100644 index 0000000..7821fc5 --- /dev/null +++ b/quest.gd.uid @@ -0,0 +1 @@ +uid://bowt76gfx40pv diff --git a/quest_board.gd b/quest_board.gd new file mode 100644 index 0000000..aa98cee --- /dev/null +++ b/quest_board.gd @@ -0,0 +1,17 @@ +extends Interactable + +@onready var polygon : CollisionPolygon2D = $CollisionPolygon2D +@onready var window : QuestBoardWindow = $QuestBoardWindow + +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() diff --git a/quest_board.gd.uid b/quest_board.gd.uid new file mode 100644 index 0000000..359f1e2 --- /dev/null +++ b/quest_board.gd.uid @@ -0,0 +1 @@ +uid://blo7tb5135vfm diff --git a/quest_board_entry.gd b/quest_board_entry.gd new file mode 100644 index 0000000..80e0b11 --- /dev/null +++ b/quest_board_entry.gd @@ -0,0 +1,19 @@ +class_name QuestBoardEntry extends TextureButton + +var quest : Quest = null +@onready var icon : TextureRect = %Icon +@onready var name_label : Label = %NameLabel +@onready var status_label : Label = %StatusLabel + +func setup(quest : Quest) -> void: + self.quest = quest + name_label.text = quest.name + status_label.text = "Available" if !quest.taken else "Unavailable" + +func update() -> void: + status_label.text = "Available" if !quest.taken else "Unavailable" + + +func _on_pressed() -> void: + if pressed: + Guild.assign_quest(player.member, quest) diff --git a/quest_board_entry.gd.uid b/quest_board_entry.gd.uid new file mode 100644 index 0000000..e4f394e --- /dev/null +++ b/quest_board_entry.gd.uid @@ -0,0 +1 @@ +uid://hsks1qah12sh diff --git a/quest_board_entry.tscn b/quest_board_entry.tscn new file mode 100644 index 0000000..3e0aa52 --- /dev/null +++ b/quest_board_entry.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=3 format=3 uid="uid://bdbnxj1au1iir"] + +[ext_resource type="Script" uid="uid://hsks1qah12sh" path="res://quest_board_entry.gd" id="1_qfdrh"] +[ext_resource type="Texture2D" uid="uid://bldpiytpdrge6" path="res://icon.svg" id="2_ovx2i"] + +[node name="QuestBoardEntry" type="TextureButton"] +custom_minimum_size = Vector2(200, 50) +offset_right = 200.0 +offset_bottom = 50.0 +script = ExtResource("1_qfdrh") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="Icon" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(50, 50) +layout_mode = 2 +texture = ExtResource("2_ovx2i") +expand_mode = 1 + +[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"] +layout_mode = 2 + +[node name="NameLabel" type="Label" parent="HBoxContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Quest Name" + +[node name="StatusLabel" type="Label" parent="HBoxContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Quest Status" + +[connection signal="pressed" from="." to="." method="_on_pressed"] diff --git a/quest_board_window.gd b/quest_board_window.gd new file mode 100644 index 0000000..075d1bf --- /dev/null +++ b/quest_board_window.gd @@ -0,0 +1,24 @@ +class_name QuestBoardWindow extends Window + +const entry_template = preload("res://quest_log_entry.tscn") + +@onready var entry_list : VBoxContainer = %Entries +var entries : Array[QuestLogEntry] = [] + +func populate(quests : Array[Quest]) -> void: + for entry in entries: + entry.queue_free() + entries.clear() + for quest in quests: + if !quest.taken: + add_entry(quest) + +func add_entry(quest : Quest) -> void: + var qle : QuestLogEntry = entry_template.instantiate() + entries.append(qle) + entry_list.add_child(qle) + qle.setup(quest) + + +func _on_close_requested() -> void: + hide() diff --git a/quest_board_window.gd.uid b/quest_board_window.gd.uid new file mode 100644 index 0000000..a8b605d --- /dev/null +++ b/quest_board_window.gd.uid @@ -0,0 +1 @@ +uid://de4lnikqqk7b4 diff --git a/quest_board_window.tscn b/quest_board_window.tscn new file mode 100644 index 0000000..d9bf545 --- /dev/null +++ b/quest_board_window.tscn @@ -0,0 +1,31 @@ +[gd_scene load_steps=2 format=3 uid="uid://drrtypncppjps"] + +[ext_resource type="Script" uid="uid://de4lnikqqk7b4" path="res://quest_board_window.gd" id="1_0tsne"] + +[node name="QuestBoardWindow" type="Window"] +oversampling_override = 1.0 +title = "Quest Board" +size = Vector2i(231, 282) +popup_window = true +script = ExtResource("1_0tsne") + +[node name="MarginContainer" type="MarginContainer" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 5 +theme_override_constants/margin_top = 5 +theme_override_constants/margin_right = 5 +theme_override_constants/margin_bottom = 5 + +[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer"] +custom_minimum_size = Vector2(205, 215) +layout_mode = 2 + +[node name="Entries" type="VBoxContainer" parent="MarginContainer/ScrollContainer"] +unique_name_in_owner = true +layout_mode = 2 + +[connection signal="close_requested" from="." to="." method="_on_close_requested"] diff --git a/quest_log.gd b/quest_log.gd new file mode 100644 index 0000000..ae92ec2 --- /dev/null +++ b/quest_log.gd @@ -0,0 +1,16 @@ +class_name QuestLog extends Control + +const entry_template = preload("res://quest_log_entry.tscn") + +@onready var entry_list : VBoxContainer = %Entries +var entries : Array[QuestLogEntry] = [] + +func _ready() -> void: + Game.quest_log = self + +func add_entry(quest : Quest) -> void: + var qle : QuestLogEntry = entry_template.instantiate() + quest.entry = qle + entries.append(qle) + entry_list.add_child(qle) + qle.setup(quest) diff --git a/quest_log.gd.uid b/quest_log.gd.uid new file mode 100644 index 0000000..97ff46d --- /dev/null +++ b/quest_log.gd.uid @@ -0,0 +1 @@ +uid://opy1kwcgsh70 diff --git a/quest_log.tscn b/quest_log.tscn new file mode 100644 index 0000000..8738866 --- /dev/null +++ b/quest_log.tscn @@ -0,0 +1,28 @@ +[gd_scene load_steps=2 format=3 uid="uid://dly7in8ql1fn4"] + +[ext_resource type="Script" uid="uid://opy1kwcgsh70" path="res://quest_log.gd" id="1_fbxfu"] + +[node name="Quest Log" type="Control"] +layout_mode = 3 +anchors_preset = 0 +script = ExtResource("1_fbxfu") + +[node name="PanelContainer" type="PanelContainer" parent="."] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"] +layout_mode = 2 +theme_override_constants/margin_left = 5 +theme_override_constants/margin_top = 5 +theme_override_constants/margin_right = 5 +theme_override_constants/margin_bottom = 5 + +[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/MarginContainer"] +custom_minimum_size = Vector2(205, 215) +layout_mode = 2 + +[node name="Entries" type="VBoxContainer" parent="PanelContainer/MarginContainer/ScrollContainer"] +unique_name_in_owner = true +layout_mode = 2 diff --git a/quest_log_entry.gd b/quest_log_entry.gd new file mode 100644 index 0000000..bf89990 --- /dev/null +++ b/quest_log_entry.gd @@ -0,0 +1,14 @@ +class_name QuestLogEntry extends Panel + +var quest : Quest = null +@onready var icon : TextureRect = %Icon +@onready var name_label : Label = %NameLabel +@onready var status_label : Label = %StatusLabel + +func setup(quest : Quest) -> void: + self.quest = quest + name_label.text = quest.name + status_label.text = "Available" if !quest.taken else "Unavailable" + +func update() -> void: + status_label.text = "Available" if !quest.taken else "Unavailable" diff --git a/quest_log_entry.gd.uid b/quest_log_entry.gd.uid new file mode 100644 index 0000000..19dff40 --- /dev/null +++ b/quest_log_entry.gd.uid @@ -0,0 +1 @@ +uid://dfn0507e4nccu diff --git a/quest_log_entry.tscn b/quest_log_entry.tscn new file mode 100644 index 0000000..3e9ec3a --- /dev/null +++ b/quest_log_entry.tscn @@ -0,0 +1,33 @@ +[gd_scene load_steps=3 format=3 uid="uid://da0es74lcp66y"] + +[ext_resource type="Script" uid="uid://dfn0507e4nccu" path="res://quest_log_entry.gd" id="1_0aavb"] +[ext_resource type="Texture2D" uid="uid://bldpiytpdrge6" path="res://icon.svg" id="1_guj74"] + +[node name="Quest Log Entry" type="Panel"] +custom_minimum_size = Vector2(200, 50) +script = ExtResource("1_0aavb") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="Icon" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(50, 50) +layout_mode = 2 +texture = ExtResource("1_guj74") +expand_mode = 1 + +[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"] +layout_mode = 2 + +[node name="NameLabel" type="Label" parent="HBoxContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Quest Name" + +[node name="StatusLabel" type="Label" parent="HBoxContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Quest Status" diff --git a/quest_progress_bar.gd b/quest_progress_bar.gd new file mode 100644 index 0000000..9d9712b --- /dev/null +++ b/quest_progress_bar.gd @@ -0,0 +1,62 @@ +class_name QuestProgressBar extends Control + +const waypoint_template = preload("res://waypoint.tscn") +var length : float +var waypoints : Array = [] +@onready var hero_offset : Vector2 = %Hero.position +@onready var hero : HeroIcon = %Hero +@onready var startpoint : Endpoint = %Start +@onready var endpoint : Endpoint = %End +@onready var bar : TextureProgressBar = $ProgressBar +var quest : Quest = null +#signal value_changed(value : float) +#var min_value +#var max_value +#var step +#var page +#var value +#var exp_edit +#var rounded +#var allow_greater +func _ready() -> void: + length = size.x + if quest: + #Generate the waypoints + generate_waypoints() + #TODO: Change the hero's portrait + bar.value = quest.progress + hero.position = hero_offset + Vector2(length * bar.value / bar.max_value, 0) + +func generate_waypoints(): + if len(waypoints) > 0: + for wp in waypoints: + wp.queue_free() + waypoints = [] + + for i in range(1,quest.steps): + var pct : float = i / float(quest.steps) + add_waypoint( pct, quest.step_outcomes[i]) + +func add_waypoint(pct : float, msgs : Dictionary): + var wp = waypoint_template.instantiate() + waypoints.append(wp) + wp.percent = pct + %Waypoints.add_child(wp) + wp.global_position = global_position + Vector2(pct * length - 16, -9) + if bar.value / bar.max_value >= pct: + wp.fill = true + +func update_waypoints(value : float) -> void: + startpoint.fill = (bar.value / bar.max_value >= startpoint.percent) + for wp : Waypoint in waypoints: + wp.fill = (bar.value / bar.max_value >= wp.percent) + endpoint.fill = (bar.value / bar.max_value >= endpoint.percent) + +func setup(quest : Quest) -> void: + self.quest = quest + + + +func _on_value_changed(value : float) -> void: + hero.position = hero_offset + Vector2(length * bar.value / bar.max_value, 0) + update_waypoints(value) diff --git a/hero_progress_bar.gd.uid b/quest_progress_bar.gd.uid similarity index 100% rename from hero_progress_bar.gd.uid rename to quest_progress_bar.gd.uid diff --git a/quest_progress_bar.tscn b/quest_progress_bar.tscn new file mode 100644 index 0000000..a4dee89 --- /dev/null +++ b/quest_progress_bar.tscn @@ -0,0 +1,194 @@ +[gd_scene load_steps=16 format=3 uid="uid://cm8jwfg6rnnor"] + +[ext_resource type="Texture2D" uid="uid://vt3yvxm2ho7o" path="res://progress-fill.png" id="1_67v7s"] +[ext_resource type="Texture2D" uid="uid://b88n81qde4p3n" path="res://progress-bar.png" id="2_7mk3y"] +[ext_resource type="Script" uid="uid://cgi3tu0ussfk0" path="res://quest_progress_bar.gd" id="3_ngyoy"] +[ext_resource type="Script" uid="uid://cf0pt0ty4uaas" path="res://endpoint.gd" id="4_urnrp"] +[ext_resource type="Texture2D" uid="uid://c6ptvokr5npl7" path="res://progress-marks.png" id="5_0mjs1"] +[ext_resource type="Texture2D" uid="uid://qxx2gxnsd3yg" path="res://hero.png" id="6_c61hf"] +[ext_resource type="Script" uid="uid://cxqkvnv4rwots" path="res://hero_icon.gd" id="7_ej80i"] +[ext_resource type="Texture2D" uid="uid://dotwwulusn1b1" path="res://speechbubble.png" id="8_0hkgs"] +[ext_resource type="Script" uid="uid://c23pbcmig5v3s" path="res://update_bubble.gd" id="9_1vrqv"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_8wucn"] +atlas = ExtResource("5_0mjs1") +region = Rect2(0, 32, 32, 32) +filter_clip = true + +[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_mf4ya"] +load_path = "res://.godot/imported/progress-dot-fill.png-a1e94128dc6c2f11bfa15c335ef05892.ctex" + +[sub_resource type="AtlasTexture" id="AtlasTexture_eu8pt"] +resource_local_to_scene = true +atlas = SubResource("CompressedTexture2D_mf4ya") +region = Rect2(0, 32, 32, 32) +filter_clip = true + +[sub_resource type="AtlasTexture" id="AtlasTexture_pg7md"] +atlas = ExtResource("5_0mjs1") +region = Rect2(32, 32, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_bnohr"] +resource_local_to_scene = true +atlas = SubResource("CompressedTexture2D_mf4ya") +region = Rect2(32, 0, 32, 32) +filter_clip = true + +[sub_resource type="AtlasTexture" id="AtlasTexture_mmi8n"] +atlas = ExtResource("5_0mjs1") +region = Rect2(32, 0, 32, 32) +filter_clip = true + +[node name="QuestProgressBar" type="Control"] +custom_minimum_size = Vector2(250, 70) +layout_mode = 3 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -125.0 +offset_right = 125.0 +offset_bottom = 70.0 +grow_horizontal = 2 +script = ExtResource("3_ngyoy") + +[node name="ProgressBar" type="TextureProgressBar" parent="."] +custom_minimum_size = Vector2(213, 14) +layout_mode = 0 +offset_left = 18.0 +offset_top = 37.0 +offset_right = 231.0 +offset_bottom = 51.0 +max_value = 1.0 +step = 0.010000000009313226 +nine_patch_stretch = true +stretch_margin_left = 1 +stretch_margin_top = 2 +stretch_margin_right = 1 +stretch_margin_bottom = 2 +texture_under = ExtResource("1_67v7s") +texture_over = ExtResource("2_7mk3y") +texture_progress = ExtResource("1_67v7s") +tint_under = Color(0, 0, 0, 1) +tint_progress = Color(0.1804, 0.5451, 0.3412, 1) + +[node name="Start" type="Control" parent="ProgressBar"] +unique_name_in_owner = true +anchors_preset = 0 +offset_left = -16.0 +offset_top = -9.0 +offset_right = 24.0 +offset_bottom = 31.0 +script = ExtResource("4_urnrp") + +[node name="Over" type="TextureRect" parent="ProgressBar/Start"] +layout_mode = 0 +offset_right = 32.0 +offset_bottom = 32.0 +texture = SubResource("AtlasTexture_8wucn") + +[node name="Fill" type="TextureRect" parent="ProgressBar/Start"] +modulate = Color(0, 0, 0, 1) +layout_mode = 0 +offset_right = 32.0 +offset_bottom = 32.0 +texture = SubResource("AtlasTexture_eu8pt") + +[node name="Dot" type="TextureRect" parent="ProgressBar/Start"] +visible = false +layout_mode = 0 +offset_right = 32.0 +offset_bottom = 32.0 +texture = SubResource("AtlasTexture_pg7md") + +[node name="End" type="Control" parent="ProgressBar"] +unique_name_in_owner = true +anchors_preset = 0 +offset_left = 197.0 +offset_top = -9.0 +offset_right = 237.0 +offset_bottom = 31.0 +script = ExtResource("4_urnrp") +percent = 1.0 + +[node name="Fill" type="TextureRect" parent="ProgressBar/End"] +modulate = Color(0, 0, 0, 1) +layout_mode = 0 +offset_right = 32.0 +offset_bottom = 32.0 +texture = SubResource("AtlasTexture_bnohr") + +[node name="Over" type="TextureRect" parent="ProgressBar/End"] +layout_mode = 0 +offset_right = 32.0 +offset_bottom = 32.0 +texture = SubResource("AtlasTexture_mmi8n") + +[node name="Dot" type="TextureRect" parent="ProgressBar/End"] +visible = false +layout_mode = 0 +offset_right = 32.0 +offset_bottom = 32.0 +texture = SubResource("AtlasTexture_pg7md") + +[node name="Waypoints" type="Control" parent="ProgressBar"] +unique_name_in_owner = true +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="Hero" type="Sprite2D" parent="ProgressBar"] +unique_name_in_owner = true +position = Vector2(-1, -12) +texture = ExtResource("6_c61hf") +script = ExtResource("7_ej80i") + +[node name="UpdateBubble" type="NinePatchRect" parent="ProgressBar/Hero"] +clip_contents = true +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -61.0 +offset_top = -90.0 +offset_right = -42.0 +offset_bottom = -75.0 +grow_horizontal = 2 +grow_vertical = 2 +pivot_offset = Vector2(0, 15) +size_flags_horizontal = 3 +size_flags_vertical = 3 +texture = ExtResource("8_0hkgs") +patch_margin_left = 13 +patch_margin_top = 5 +patch_margin_right = 6 +patch_margin_bottom = 10 +axis_stretch_horizontal = 1 +axis_stretch_vertical = 1 +script = ExtResource("9_1vrqv") + +[node name="Label" type="Label" parent="ProgressBar/Hero/UpdateBubble"] +unique_name_in_owner = true +layout_mode = 0 +offset_left = 5.0 +offset_top = 1.0 +offset_right = 95.0 +offset_bottom = 37.0 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_constants/line_spacing = -4 +theme_override_font_sizes/font_size = 8 +text = "testing one 1 2 3" +vertical_alignment = 1 +autowrap_mode = 2 + +[node name="Timer" type="Timer" parent="ProgressBar/Hero/UpdateBubble"] +unique_name_in_owner = true + +[node name="Container" type="Container" parent="ProgressBar"] +layout_mode = 0 +offset_top = -32.0 +offset_right = 75.0 +offset_bottom = 40.0 + +[connection signal="value_changed" from="ProgressBar" to="ProgressBar" method="_on_value_changed"] +[connection signal="timeout" from="ProgressBar/Hero/UpdateBubble/Timer" to="ProgressBar/Hero/UpdateBubble" method="_on_timer_timeout"] diff --git a/speech-blip.png b/speech-blip.png new file mode 100644 index 0000000..9305e19 Binary files /dev/null and b/speech-blip.png differ diff --git a/speech-blip.png.import b/speech-blip.png.import new file mode 100644 index 0000000..12d3057 --- /dev/null +++ b/speech-blip.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cbamfadh7wwr7" +path="res://.godot/imported/speech-blip.png-c50e3b0aba379b71502b51f1275b953c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://speech-blip.png" +dest_files=["res://.godot/imported/speech-blip.png-c50e3b0aba379b71502b51f1275b953c.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/speech-emojis.png b/speech-emojis.png new file mode 100644 index 0000000..e720b03 Binary files /dev/null and b/speech-emojis.png differ diff --git a/speech-emojis.png.import b/speech-emojis.png.import new file mode 100644 index 0000000..41c111d --- /dev/null +++ b/speech-emojis.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://chnk20ey5qxfh" +path="res://.godot/imported/speech-emojis.png-ec187bee7f14b4adf4276f856bb01d86.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://speech-emojis.png" +dest_files=["res://.godot/imported/speech-emojis.png-ec187bee7f14b4adf4276f856bb01d86.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/speech-stuff.aseprite b/speech-stuff.aseprite new file mode 100644 index 0000000..61dcab5 Binary files /dev/null and b/speech-stuff.aseprite differ diff --git a/speech-talk.png b/speech-talk.png new file mode 100644 index 0000000..e8d472d Binary files /dev/null and b/speech-talk.png differ diff --git a/speech-talk.png.import b/speech-talk.png.import new file mode 100644 index 0000000..d524eef --- /dev/null +++ b/speech-talk.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bi8rmjyseoyyx" +path="res://.godot/imported/speech-talk.png-f54453937e9d82c29c903e5c8634c45b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://speech-talk.png" +dest_files=["res://.godot/imported/speech-talk.png-f54453937e9d82c29c903e5c8634c45b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/speech_bubble.gd b/speech_bubble.gd new file mode 100644 index 0000000..d0588aa --- /dev/null +++ b/speech_bubble.gd @@ -0,0 +1,14 @@ +class_name SpeechBubble extends Sprite2D + +@onready var anim_player : AnimationPlayer = $AnimationPlayer + +func try_show_speech(type : String = ""): + if type != "": + if anim_player.has_animation(type): + visible = true + anim_player.play(type) + else: + printerr("Tried to show speech bubble %s but speech bubble does not have that type!" % type) + visible = false + else: + visible = false diff --git a/speech_bubble.gd.uid b/speech_bubble.gd.uid new file mode 100644 index 0000000..0be2fce --- /dev/null +++ b/speech_bubble.gd.uid @@ -0,0 +1 @@ +uid://w57riwplc00t diff --git a/test_adventurer.tscn b/test_adventurer.tscn new file mode 100644 index 0000000..52ae7b9 --- /dev/null +++ b/test_adventurer.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://djirqtsrttqwe"] + +[ext_resource type="Script" uid="uid://0jl2qbvtmsik" path="res://adventurer_data.gd" id="1_jdutx"] + +[node name="Test Guildmember" type="Node"] +script = ExtResource("1_jdutx") diff --git a/test_adventurer_sprite.tscn b/test_adventurer_sprite.tscn new file mode 100644 index 0000000..9551d37 --- /dev/null +++ b/test_adventurer_sprite.tscn @@ -0,0 +1,114 @@ +[gd_scene load_steps=16 format=3 uid="uid://dew8gxu55ex6q"] + +[ext_resource type="Script" uid="uid://cjqumk0kw2vte" path="res://adventurer.gd" id="1_wif60"] +[ext_resource type="Texture2D" uid="uid://bldpiytpdrge6" path="res://icon.svg" id="2_rwbq5"] +[ext_resource type="Texture2D" uid="uid://cbamfadh7wwr7" path="res://speech-blip.png" id="3_71qlo"] +[ext_resource type="Texture2D" uid="uid://1mmg270gotb1" path="res://busy-dots.png" id="4_ay0uu"] +[ext_resource type="Script" uid="uid://w57riwplc00t" path="res://speech_bubble.gd" id="4_rwbq5"] +[ext_resource type="Script" uid="uid://djd8pv5xbgud3" path="res://fsm/machines/test.gd" id="5_snss2"] +[ext_resource type="Script" uid="uid://dl3b5aywu1hf6" path="res://fsm/nodes/wait.gd" id="6_1cj4e"] +[ext_resource type="Script" uid="uid://e8we6nmaob1k" path="res://fsm/nodes/test.gd" id="7_ux5kh"] +[ext_resource type="Script" uid="uid://bewrajxqdutsu" path="res://fsm/interact_with_employee.gd" id="9_snss2"] +[ext_resource type="Script" uid="uid://y85swbbk8kbd" path="res://fsm/nodes/queue.gd" id="10_1cj4e"] +[ext_resource type="Script" uid="uid://b0ewnwcibhu21" path="res://fsm/nodes/leave.gd" id="11_ux5kh"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_5n4iw"] +radius = 35.0 + +[sub_resource type="Animation" id="Animation_bog1h"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D3:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [0] +} + +[sub_resource type="Animation" id="Animation_13vc8"] +resource_name = "busy" +length = 0.7000034 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D3:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1), +"update": 1, +"values": [0, 1, 2, 3, 4, 5, 6, 0] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_uo85v"] +_data = { +&"RESET": SubResource("Animation_bog1h"), +&"busy": SubResource("Animation_13vc8") +} + +[node name="AdventurerSprite" type="CharacterBody2D"] +script = ExtResource("1_wif60") +interaction_range = null +stop_range = null + +[node name="Sprite2D" type="Sprite2D" parent="."] +modulate = Color(0, 1, 0, 1) +scale = Vector2(0.5, 0.5) +texture = ExtResource("2_rwbq5") + +[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."] +path_desired_distance = 30.0 +avoidance_enabled = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_5n4iw") + +[node name="SpeechBubble" type="Sprite2D" parent="."] +visible = false +position = Vector2(39, -42) +texture = ExtResource("3_71qlo") +script = ExtResource("4_rwbq5") + +[node name="Sprite2D3" type="Sprite2D" parent="SpeechBubble"] +position = Vector2(0, -4) +texture = ExtResource("4_ay0uu") +hframes = 2 +vframes = 4 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="SpeechBubble"] +libraries = { +&"": SubResource("AnimationLibrary_uo85v") +} + +[node name="StateMachine" type="Node" parent="."] +script = ExtResource("5_snss2") +starting_state = "Queue" + +[node name="Wait" type="Node" parent="StateMachine"] +script = ExtResource("6_1cj4e") +wait_duration = 3.0 + +[node name="Test" type="Node" parent="StateMachine"] +script = ExtResource("7_ux5kh") +message = "TEST COMPLETE!" + +[node name="Interact With Employee" type="Node" parent="StateMachine"] +script = ExtResource("9_snss2") +employee_name = "Receptionist" +speech_bubble = "Talk" +wait_duration = null +interaction_args = Array[String](["register"]) + +[node name="Queue" type="Node" parent="StateMachine"] +script = ExtResource("10_1cj4e") +employee = "Receptionist" + +[node name="Node" type="Node" parent="StateMachine"] +script = ExtResource("11_ux5kh") diff --git a/test_scene.gd b/test_scene.gd new file mode 100644 index 0000000..1d04e52 --- /dev/null +++ b/test_scene.gd @@ -0,0 +1,8 @@ +extends Node2D + +var test_adv = preload("res://test_adventurer.tscn") +func _ready() -> void: + var adv : AdventurerData = test_adv.instantiate() as AdventurerData + Guild.register_guild_member(adv) + var quest : Quest = Quest.new() + Guild.add_quest(quest) diff --git a/test_scene.gd.uid b/test_scene.gd.uid new file mode 100644 index 0000000..680a690 --- /dev/null +++ b/test_scene.gd.uid @@ -0,0 +1 @@ +uid://cci652umkym1f diff --git a/test_tiles.tres b/test_tiles.tres index 8405865..4b8286f 100644 --- a/test_tiles.tres +++ b/test_tiles.tres @@ -1,7 +1,25 @@ -[gd_resource type="TileSet" load_steps=3 format=3 uid="uid://6im0g3eg6sr4"] +[gd_resource type="TileSet" load_steps=6 format=3 uid="uid://6im0g3eg6sr4"] [ext_resource type="Texture2D" uid="uid://n5nal4ikpapx" path="res://spritesheet_tiles.png" id="1_jr0lo"] +[sub_resource type="NavigationPolygon" id="NavigationPolygon_0280p"] +vertices = PackedVector2Array(32, 32, -32, 32, -32, -32, 32, -32) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)]) +agent_radius = 0.0 + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_jr0lo"] +vertices = PackedVector2Array(32, 32, -32, 32, -32, -32, 32, -32) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)]) +agent_radius = 0.0 + +[sub_resource type="NavigationPolygon" id="NavigationPolygon_lhljm"] +vertices = PackedVector2Array(32, 32, -32, 32, -32, -32, 32, -32) +polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)]) +outlines = Array[PackedVector2Array]([PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)]) +agent_radius = 0.0 + [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_lhljm"] texture = ExtResource("1_jr0lo") separation = Vector2i(10, 10) @@ -11,7 +29,9 @@ texture_region_size = Vector2i(64, 64) 2:0/0 = 0 3:0/0 = 0 4:0/0 = 0 +4:0/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_lhljm") 5:0/0 = 0 +5:0/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_lhljm") 6:0/0 = 0 7:0/0 = 0 8:0/0 = 0 @@ -39,11 +59,17 @@ texture_region_size = Vector2i(64, 64) 21:1/0 = 0 20:1/0 = 0 19:1/0 = 0 +19:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 18:1/0 = 0 +18:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 17:1/0 = 0 +17:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 16:1/0 = 0 +16:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 15:1/0 = 0 +15:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 14:1/0 = 0 +14:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_0280p") 0:1/0 = 0 0:2/0 = 0 1:2/0 = 0 @@ -60,9 +86,13 @@ texture_region_size = Vector2i(64, 64) 12:3/0 = 0 13:3/0 = 0 14:3/0 = 0 +14:3/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 15:3/0 = 0 +15:3/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 16:3/0 = 0 +16:3/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 17:3/0 = 0 +17:3/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 18:4/0 = 0 19:4/0 = 0 20:4/0 = 0 @@ -72,10 +102,12 @@ texture_region_size = Vector2i(64, 64) 24:4/0 = 0 25:4/0 = 0 18:3/0 = 0 +18:3/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 6:3/0 = 0 5:3/0 = 0 4:3/0 = 0 19:3/0 = 0 +19:3/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 20:3/0 = 0 21:3/0 = 0 22:3/0 = 0 @@ -84,10 +116,15 @@ texture_region_size = Vector2i(64, 64) 23:3/0 = 0 20:2/0 = 0 19:2/0 = 0 +19:2/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 18:2/0 = 0 +18:2/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 17:2/0 = 0 +17:2/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 16:2/0 = 0 +16:2/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 15:2/0 = 0 +15:2/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 13:1/0 = 0 12:1/0 = 0 11:1/0 = 0 @@ -107,6 +144,7 @@ texture_region_size = Vector2i(64, 64) 12:2/0 = 0 13:2/0 = 0 14:2/0 = 0 +14:2/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_jr0lo") 7:2/0 = 0 23:2/0 = 0 22:2/0 = 0 @@ -581,4 +619,5 @@ texture_region_size = Vector2i(64, 64) [resource] tile_size = Vector2i(64, 64) physics_layer_0/collision_layer = 1 +navigation_layer_0/layers = 1 sources/0 = SubResource("TileSetAtlasSource_lhljm") diff --git a/update_bubble.gd b/update_bubble.gd new file mode 100644 index 0000000..b470ea7 --- /dev/null +++ b/update_bubble.gd @@ -0,0 +1,27 @@ +extends NinePatchRect + +@onready var label : Label = %Label +@onready var timer : Timer = %Timer + +func _ready() -> void: + show_message("TESTING, 1 2 3\nTESTING!!!!") + + +func show_message(msg : String, show_time : float = 1.0) -> void: + label.text = msg + appear.call(show_time) + +func appear(show_time : float): + var size : Vector2 = label.get_size() + size += get_minimum_size() / 2 + print(size) + var tween = create_tween() + tween.tween_property(self, "size", size, .25) + #tween.parallel().tween_property(self, "pivot_offset", Vector2(0, size.y), .5) + tween.parallel().tween_property(self, "position", Vector2(position.x, position.y-size.y/2), 0.25) + timer.start(show_time + .25) + +func _on_timer_timeout() -> void: + var tween = create_tween() + tween.tween_property(self, "modulate", Color(1,1,1,0), .5) + tween.tween_callback(queue_free) diff --git a/update_bubble.gd.uid b/update_bubble.gd.uid new file mode 100644 index 0000000..412557f --- /dev/null +++ b/update_bubble.gd.uid @@ -0,0 +1 @@ +uid://c23pbcmig5v3s diff --git a/visitor_spawner.gd b/visitor_spawner.gd new file mode 100644 index 0000000..7239887 --- /dev/null +++ b/visitor_spawner.gd @@ -0,0 +1,31 @@ +class_name VisitorSpawner extends Node2D + +@onready var timer : Timer = $Timer +@export var total_visitors : int = 0 +@export var min_time : float = 5 +@export var max_time : float = 10 +var visitors_remaining : int +signal visitor_spawned(current : int, total : int) + +func _ready() -> void: + Guild.visitor_spawner = self + visitors_remaining = total_visitors + if visitors_remaining > 0: + timer.start(randf_range(min_time, max_time)) + setup_ui.call_deferred() + +func setup_ui(): + Game.setup_visitor_ui(self) + + +func spawn_visitor() -> void: + Guild.spawn_visitor(global_position) + visitors_remaining-=1 + visitor_spawned.emit(visitors_remaining, total_visitors) + + +func _on_timer_timeout() -> void: + if visitors_remaining > 0: + spawn_visitor() + else: + timer.stop() diff --git a/visitor_spawner.gd.uid b/visitor_spawner.gd.uid new file mode 100644 index 0000000..f57484c --- /dev/null +++ b/visitor_spawner.gd.uid @@ -0,0 +1 @@ +uid://bnbljf6u2d3kh diff --git a/waypoint.gd b/waypoint.gd new file mode 100644 index 0000000..c36dd69 --- /dev/null +++ b/waypoint.gd @@ -0,0 +1,22 @@ +class_name Waypoint extends Control + +var percent : float = 0 +var filled: bool +var fill: bool : + get: + return filled + set(value): + if value != filled: + set_fill(value) + + +func set_fill(value : bool) -> void: + filled = value + if value: + $Dot.visible = true + $Fill.modulate = Color.SEA_GREEN + else: + $Dot.visible = false + $Fill.modulate = Color.BLACK + + diff --git a/waypoint.gd.uid b/waypoint.gd.uid new file mode 100644 index 0000000..316d75c --- /dev/null +++ b/waypoint.gd.uid @@ -0,0 +1 @@ +uid://dnytdxwuk6b7x diff --git a/waypoint.tscn b/waypoint.tscn new file mode 100644 index 0000000..37cf0be --- /dev/null +++ b/waypoint.tscn @@ -0,0 +1,46 @@ +[gd_scene load_steps=7 format=3 uid="uid://wnkqgapgh7br"] + +[ext_resource type="Script" uid="uid://dnytdxwuk6b7x" path="res://waypoint.gd" id="1_m8nlk"] +[ext_resource type="Texture2D" uid="uid://c6ptvokr5npl7" path="res://progress-marks.png" id="2_u6u05"] +[ext_resource type="Texture2D" uid="uid://bcrg5ea4niu0e" path="res://progress-dot-fill.png" id="3_ddqum"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_nyilg"] +atlas = ExtResource("2_u6u05") +region = Rect2(32, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_g6crn"] +atlas = ExtResource("3_ddqum") +region = Rect2(0, 0, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_m8nlk"] +atlas = ExtResource("2_u6u05") +region = Rect2(32, 32, 32, 32) + +[node name="Waypoint" type="Control"] +layout_mode = 3 +anchors_preset = 0 +offset_left = 96.0 +offset_top = -9.0 +offset_right = 128.0 +offset_bottom = 23.0 +script = ExtResource("1_m8nlk") + +[node name="Over" type="TextureRect" parent="."] +layout_mode = 0 +offset_right = 32.0 +offset_bottom = 32.0 +texture = SubResource("AtlasTexture_nyilg") + +[node name="Fill" type="TextureRect" parent="."] +modulate = Color(0, 0, 0, 1) +layout_mode = 0 +offset_right = 32.0 +offset_bottom = 32.0 +texture = SubResource("AtlasTexture_g6crn") + +[node name="Dot" type="TextureRect" parent="."] +visible = false +layout_mode = 0 +offset_right = 32.0 +offset_bottom = 32.0 +texture = SubResource("AtlasTexture_m8nlk")