More work on registering via FSM
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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":
|
||||
|
||||
@@ -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)
|
||||
|
||||
4
guild.gd
4
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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
1
names.txt
Normal file
1
names.txt
Normal file
@@ -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
|
||||
18
notice_panel.gd
Normal file
18
notice_panel.gd
Normal file
@@ -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()
|
||||
1
notice_panel.gd.uid
Normal file
1
notice_panel.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bqah2tc3d5otk
|
||||
@@ -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"]
|
||||
|
||||
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user