diff --git a/active_scene.tscn b/active_scene.tscn index 5553865..1ac2f5e 100644 --- a/active_scene.tscn +++ b/active_scene.tscn @@ -1,9 +1,8 @@ -[gd_scene load_steps=10 format=3 uid="uid://dfa6ep4o53s08"] +[gd_scene load_steps=9 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"] @@ -15,7 +14,6 @@ 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) diff --git a/fsm/interact_with_employee.gd b/fsm/interact_with_employee.gd index 4465a68..1541041 100644 --- a/fsm/interact_with_employee.gd +++ b/fsm/interact_with_employee.gd @@ -17,7 +17,7 @@ func _process(delta: float) -> void: wait_remaining -= delta if wait_remaining <= 0: wait_remaining = 0 - employee.interact(self, interaction_args[0]) + employee.interact(actor, interaction_args[0]) complete_state() func execute(subject, ...args : Array) -> void: diff --git a/fsm/machines/newbie.gd b/fsm/machines/newbie.gd index 91629df..b59c986 100644 --- a/fsm/machines/newbie.gd +++ b/fsm/machines/newbie.gd @@ -17,7 +17,7 @@ func advance_state() -> void: pass "Queue": enter_state(states["Wait"]) - args.append_array(["busy", "Register"]) + args.append_array(["busy", "Interact With Employee"]) "Register": enter_state(states["Register"]) "Leave": diff --git a/game_manager.gd b/game_manager.gd index 692e046..11b3ee5 100644 --- a/game_manager.gd +++ b/game_manager.gd @@ -9,6 +9,9 @@ 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) + var file =FileAccess.open("res://name.txt",FileAccess.READ) + var text =file.get_line() + var nmnames = text.remove_chars(" ").split(",") func _process(delta: float) -> void: if active and Input.is_action_just_pressed("switch modes"): @@ -28,3 +31,6 @@ func setup_visitor_ui(spawner: VisitorSpawner)-> void: func end_shift() -> void: active = false panel.switch_panel(active) + +func notice(msg : String, time : float = 1) -> void: + panel.notice(msg, time) diff --git a/guild.gd b/guild.gd index 73d7949..869efbf 100644 --- a/guild.gd +++ b/guild.gd @@ -15,8 +15,10 @@ var quests : Dictionary[Quest,bool] = {} var hall : Guildhall = null var visitor_spawner : VisitorSpawner = null -func register_guild_member(member : AdventurerData) -> void: +func register_guild_member(member : AdventurerData, first : bool = false) -> void: members.append(member) + if first: + Game.notice("%s has joined the guild!" % member.name, 5) func add_quest(quest : Quest) -> void: quests[quest] = false diff --git a/guild_employee.gd b/guild_employee.gd index ac188e0..6b2ed1a 100644 --- a/guild_employee.gd +++ b/guild_employee.gd @@ -7,4 +7,4 @@ var busy : bool func interact(interactor, type : String = "") -> void: if type == "register": - Guild.register_guild_member(interactor) + Guild.register_guild_member(interactor.data, true) diff --git a/guildhall.gd b/guildhall.gd index 46bdcc9..2940b80 100644 --- a/guildhall.gd +++ b/guildhall.gd @@ -11,5 +11,7 @@ func _ready() -> void: func register_employee(employee: GuildEmployee) -> void: employees[employee.name] = employee + + func add_sprite(sprite : Adventurer) -> void: add_child(sprite) diff --git a/guildhall.tscn b/guildhall.tscn index bf7c045..fbb1bfb 100644 --- a/guildhall.tscn +++ b/guildhall.tscn @@ -1,5 +1,6 @@ -[gd_scene load_steps=18 format=4 uid="uid://cd08dp16bixfv"] +[gd_scene load_steps=19 format=4 uid="uid://cd08dp16bixfv"] +[ext_resource type="Script" uid="uid://ccorfvcfa84gf" path="res://guildhall.gd" id="1_lsinl"] [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"] @@ -113,6 +114,7 @@ _data = { } [node name="Guildhall" type="Node2D"] +script = ExtResource("1_lsinl") [node name="NavigationRegion2D" type="NavigationRegion2D" parent="."] navigation_polygon = SubResource("NavigationPolygon_w7eqs") diff --git a/main_panel.gd b/main_panel.gd index 62ef4ac..3c58daa 100644 --- a/main_panel.gd +++ b/main_panel.gd @@ -1,6 +1,6 @@ class_name GamePanel extends PanelContainer - +const notice_template = preload("res://notice_panel.tscn") const quest_progress_bar_template = preload("res://quest_progress_bar.tscn") signal time_changed(time : float) @@ -40,3 +40,10 @@ func connect_visitor_spawner(spawner : VisitorSpawner) -> void: func update_visitor_count(current : int, total : int) -> void: %Passive/VisitorsLabel.text = "Visitors: %d/%d" % [current, total] + +func notice(msg : String, time : float) -> void: + var ntc : NoticePanel = notice_template.instantiate() + $MarginContainer.add_child(ntc) + ntc.message = msg + ntc.duration = time + diff --git a/names.txt b/names.txt new file mode 100644 index 0000000..5f109ec --- /dev/null +++ b/names.txt @@ -0,0 +1 @@ +Aseir, Haseid, Kheed, Zasheir, Fodel, Glar, Grigor, Igan, Ivor, Kosef, Mival, Pavel, Sergor, Darvin, Dorn, Evendur, Gorstag, Helm, Morn, Randal, Stedd, Ander, Blath, Bran, Frath, Geth, Lander, Luth, Malcer, Stor, Taman, Bareris, Kethoth, Mumed, Urhur, Borivik, Faurgar, Jandar, Kanithar, Madislak, Ralmevik, Shaumar, Vladislak, Chen, Chi, Fai, Jiang, Jun, Lian, Long, Meng, Shan, Wen, Anton, Diero, Marcon, Pieron, Rimardo, Romero, Salazar, Umbero, Atala, Ceidil, Hama, Jasmal, Meilil, Yasheira, Zasheida, Arveene, Esvele, Jhessail, Kerri, Lureene, Miri, Rowan, Tessele, Alethra, Kara, Katernin, Mara, Natali, Olma, Tana, Zora Betha, Cefrey, Kethra, Mara, Olga, Silifrey, Westra, Arizima, Chathi, Nephis, Nulara, Murithi, Sefris, Thola, Umara, Zolis, Hulmarra, Immith, Imzel, Navarra, Shevarra, Tammith. Yuldra, Bai, Chao, Jia, Lei, Mei, Qiao, Shui, Tai, Balama, Dona, Faila, Jalana, Luisa, Marta, Quara, Selise, Vonda \ No newline at end of file diff --git a/notice_panel.gd b/notice_panel.gd new file mode 100644 index 0000000..d67ac1a --- /dev/null +++ b/notice_panel.gd @@ -0,0 +1,18 @@ +class_name NoticePanel extends PanelContainer + + +var message : String : + get: + return %Label.text + set(value): + %Label.text = value + +var duration : float : + get: + return %Timer.wait_time + set(value): + %Timer.wait_time = value + %Timer.start() + +func _on_timer_timeout() -> void: + queue_free() diff --git a/notice_panel.gd.uid b/notice_panel.gd.uid new file mode 100644 index 0000000..cbaddfd --- /dev/null +++ b/notice_panel.gd.uid @@ -0,0 +1 @@ +uid://bqah2tc3d5otk diff --git a/notice_panel.tscn b/notice_panel.tscn index ce72a0c..2277175 100644 --- a/notice_panel.tscn +++ b/notice_panel.tscn @@ -1,10 +1,12 @@ -[gd_scene load_steps=2 format=3 uid="uid://b3lle4eammcwp"] +[gd_scene load_steps=3 format=3 uid="uid://b3lle4eammcwp"] [ext_resource type="Texture2D" uid="uid://b7yco5065s41n" path="res://notice-icon.png" id="1_1reoo"] +[ext_resource type="Script" uid="uid://bqah2tc3d5otk" path="res://notice_panel.gd" id="1_5lwqd"] [node name="NoticePanel" type="PanelContainer"] offset_right = 321.0 offset_bottom = 32.0 +script = ExtResource("1_5lwqd") [node name="HBoxContainer" type="HBoxContainer" parent="."] layout_mode = 2 @@ -17,9 +19,15 @@ expand_mode = 1 stretch_mode = 4 [node name="Label" type="Label" parent="HBoxContainer"] +unique_name_in_owner = true custom_minimum_size = Vector2(300, 24) layout_mode = 2 text = "Rania has joined the guild!" horizontal_alignment = 1 vertical_alignment = 1 autowrap_mode = 2 + +[node name="Timer" type="Timer" parent="."] +unique_name_in_owner = true + +[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] diff --git a/test_adventurer_sprite.tscn b/test_adventurer_sprite.tscn index 9551d37..0fb8e29 100644 --- a/test_adventurer_sprite.tscn +++ b/test_adventurer_sprite.tscn @@ -5,8 +5,8 @@ [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://dthatmb3if73u" path="res://fsm/machines/newbie.gd" id="6_snss2"] [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"] @@ -88,7 +88,7 @@ libraries = { } [node name="StateMachine" type="Node" parent="."] -script = ExtResource("5_snss2") +script = ExtResource("6_snss2") starting_state = "Queue" [node name="Wait" type="Node" parent="StateMachine"]