30 - simple TextChat #43

Merged
luizcarlos1405 merged 1 commits from master into master 2021-04-11 18:04:32 +02:00
luizcarlos1405 commented 2021-04-10 16:42:18 +02:00 (Migrated from github.com)

Solves #30

Implements a simple TextChat that uses a sync variable to fill a chat history.

Features:

  • Open chat history with Y
  • Start typing with enter
  • Send message/stop typing with enter
  • Close chat history with y
  • Auto opens with a new message.

Other changes:

Now the player input is in an _inhandled_input callback instead of _input. We usually have to do this so any Control node that captures an input prevents the player from moving. Also, in the function walk we check if the input was handled before.

The LineEdit should mark ALL keyboard inputs as handled before they get to the player node, but it doesn't happen consistently. So I had to make a workaround marking them manually in the _unhandled_input in the TextChat script.

Now that the player input is under _unhandled_input I had to set the mouse filter as ignore for the player HUD and children because they were handling mouse moves.

Current state:
https://user-images.githubusercontent.com/15899938/114277808-30d86700-9a03-11eb-8013-77f3d3830f60.mp4

Solves #30 Implements a simple TextChat that uses a `sync` variable to fill a chat history. Features: * Open chat history with `Y` * Start typing with `enter` * Send message/stop typing with `enter` * Close chat history with `y` * Auto opens with a new message. Other changes: Now the player input is in an `_inhandled_input` callback instead of `_input`. We usually have to do this so any Control node that captures an input prevents the player from moving. Also, in the function `walk` we check if the input was handled before. The `LineEdit` should mark ALL keyboard inputs as handled before they get to the player node, but it doesn't happen consistently. So I had to make a workaround marking them manually in the `_unhandled_input` in the TextChat script. Now that the player input is under `_unhandled_input` I had to set the mouse filter as ignore for the player HUD and children because they were handling mouse moves. Current state: https://user-images.githubusercontent.com/15899938/114277808-30d86700-9a03-11eb-8013-77f3d3830f60.mp4
luizcarlos1405 commented 2021-04-10 16:43:14 +02:00 (Migrated from github.com)

It looks like I'm the only one trimming white space. Do you guys actually prefer this whitespace there? I'll not disrupt any patterns you have. I think most devs prefer to trim them, but I might be wrong. If you didn't know you can enable trimming in the Editor settings enabling this option in Text Editor > Files.

image

It looks like I'm the only one trimming white space. Do you guys actually prefer this whitespace there? I'll not disrupt any patterns you have. I think most devs prefer to trim them, but I might be wrong. If you didn't know you can enable trimming in the Editor settings enabling this option in Text Editor > Files. ![image](https://user-images.githubusercontent.com/15899938/114278008-194dae00-9a04-11eb-8cb6-d0583306cada.png)
unfa commented 2021-04-10 20:20:43 +02:00 (Migrated from github.com)

It looks like I'm the only one trimming white space. Do you guys actually prefer this whitespace there? I'll not disrupt any patterns you have. I think most devs prefer to trim them, but I might be wrong. If you didn't know you can enable trimming in the Editor settings enabling this option in Text Editor > Files.

image

Hey! Thank you for your awesome contribution! I think we should merge your PR very soon. Honestly @CombustibleLemonade is better qualified than me to review it ;)

Also - I am not sure what do you mean by trimming white space - do you mean: remove excessive white space from chat messages, or is this a coding style thing?

> It looks like I'm the only one trimming white space. Do you guys actually prefer this whitespace there? I'll not disrupt any patterns you have. I think most devs prefer to trim them, but I might be wrong. If you didn't know you can enable trimming in the Editor settings enabling this option in Text Editor > Files. > > ![image](https://user-images.githubusercontent.com/15899938/114278008-194dae00-9a04-11eb-8cb6-d0583306cada.png) Hey! Thank you for your awesome contribution! I think we should merge your PR very soon. Honestly @CombustibleLemonade is better qualified than me to review it ;) Also - I am not sure what do you mean by trimming white space - do you mean: remove excessive white space from chat messages, or is this a coding style thing?
luizcarlos1405 commented 2021-04-10 20:34:09 +02:00 (Migrated from github.com)

Code styling thing. Remove white space in empty lines and end of line if there's any. This avoids pointless changes in the git history and saves a little tiny bit of space in disk (not that tiny in large codebases, not our case here)

Code styling thing. Remove white space in empty lines and end of line if there's any. This avoids pointless changes in the git history and saves a little tiny bit of space in disk (not that tiny in large codebases, not our case here)
CombustibleLemonade commented 2021-04-11 18:07:28 +02:00 (Migrated from github.com)

Thank you for your work! There's one bug I found when testing: the chat history remains visible after disconnecting. Though, I'm not even sure if that's a bug or a feature, but we can fix it later when the need may arise. Trimming whitespace, and other standardization efforts for coding style are probably a good idea - maybe I should create a coding style document.

Thank you for your work! There's one bug I found when testing: the chat history remains visible after disconnecting. Though, I'm not even sure if that's a bug or a feature, but we can fix it later when the need may arise. Trimming whitespace, and other standardization efforts for coding style are probably a good idea - maybe I should create a coding style document.
CombustibleLemonade commented 2021-04-11 18:17:10 +02:00 (Migrated from github.com)

I just found something that's different from how it's shown in your example screencapture - on my end the text chat always disappears when entering character select mode. Did you change that?

I just found something that's different from how it's shown in your example screencapture - on my end the text chat always disappears when entering character select mode. Did you change that?
luizcarlos1405 commented 2021-04-11 21:17:31 +02:00 (Migrated from github.com)

Yes! I noticed and fixed it. It was certainly a bug. We adjust this kind of behavior later, maybe we want the chat open when on character select mode. To do this we would have to move the function I put into the show_menus elsewhere.

Yes! I noticed and fixed it. It was certainly a bug. We adjust this kind of behavior later, maybe we want the chat open when on character select mode. To do this we would have to move the function I put into the show_menus elsewhere.
unfa commented 2021-04-12 19:28:21 +02:00 (Migrated from github.com)

This is awesome! We've tested it and it's very nice!

I can think of a few improvements:

  • make Enter open the Chat window - right now to type one needs to hit Y and then Enter
  • exit the typing mode on respawn
  • add a chatting icon above player's head to let others know you're typing,
This is awesome! We've tested it and it's very nice! I can think of a few improvements: - make Enter open the Chat window - right now to type one needs to hit Y and then Enter - exit the typing mode on respawn - add a chatting icon above player's head to let others know you're typing,
This repo is archived. You cannot comment on pull requests.
There is no content yet.