fixed buggy dialogue on visible console

This commit is contained in:
2023-02-24 14:50:57 +01:00
parent 2c7a696821
commit 8132530da3
2 changed files with 6 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ public partial class console : PopupPanel
private static RichTextLabel textblock;
private LineEdit line;
private Dictionary commandDict;
private string error = "Not found! :(\n";
private string error = "Not found! :(";
//functions with capital letters can't be used inside the console
public override void _Ready()
@@ -21,13 +21,13 @@ public partial class console : PopupPanel
if (Input.IsActionJustPressed("console"))
{
Visible = !Visible;
line.GrabFocus();
player.allowMovement = !Visible;
line.GrabFocus();
}
/*if (OS.ReadStringFromStdIn() != "") //not tested yet
OnLineEditTextSubmitted(OS.ReadStringFromStdIn());*/
}
private void OnPopupHide() => player.allowMovement = true;
private void OnPopupHide() { if (dialog_bubble.isTalking == false) player.allowMovement = true; }
private void OnLineEditTextSubmitted(string command)
{
line.Clear();

View File

@@ -11,6 +11,7 @@ public partial class dialog_bubble : CanvasLayer
public string title;
public Area2D triggerArea;
public static bool forceClose;
public static bool isTalking;
/*TODO:
- Dont repeat the same randomized dialogue after you get asked do you need something "else"
- add tree support (example: "story" key)
@@ -48,6 +49,7 @@ public partial class dialog_bubble : CanvasLayer
GatherDialog("message");
Visible = true;
isTalking = true;
}
public void GatherDialog(string key)
{
@@ -162,6 +164,7 @@ public partial class dialog_bubble : CanvasLayer
GetNode<Label>("box/name_label").Text = "???";
richText.Text = "";
if (GetParent().Name == "player") player.allowMovement = true;
isTalking = false;
forceClose = false;
}
}