File tree 1 file changed +20
-11
lines changed
1 file changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -22,17 +22,26 @@ func _ready():
22
22
pass # Replace with function body.
23
23
24
24
func _input (event ):
25
- if (
26
- active and not
27
- dialogs .empty () and
28
- event .is_action_pressed ("interact" ) and not
29
- Dialogs .active
30
- ):
31
- if has_node ("Quest" ):
32
- var quest_dialog = get_node ("Quest" ).process ()
33
- if quest_dialog != "" :
34
- Dialogs .show_dialog (quest_dialog , character_name )
35
- return
25
+ # Bail if npc not active (player not inside the collider)
26
+ if not active :
27
+ return
28
+ # Bail if Dialogs singleton is showing another dialog
29
+ if Dialogs .active :
30
+ return
31
+ # Bail if the event is not a pressed "interact" action
32
+ if not event .is_action_pressed ("interact" ):
33
+ return
34
+
35
+ # If the character is a questgiver delegate getting the text
36
+ # to the Quest node, show it and end the function
37
+ if has_node ("Quest" ):
38
+ var quest_dialog = get_node ("Quest" ).process ()
39
+ if quest_dialog != "" :
40
+ Dialogs .show_dialog (quest_dialog , character_name )
41
+ return
42
+
43
+ # If we reached here and there are generic dialogs to show, rotate among them
44
+ if not dialogs .empty ():
36
45
Dialogs .show_dialog (dialogs [current_dialog ], character_name )
37
46
current_dialog = wrapi (current_dialog + 1 , 0 , dialogs .size ())
38
47
You can’t perform that action at this time.
0 commit comments