Skip to content

Conversation

CuddlyBunion341
Copy link
Owner

@CuddlyBunion341 CuddlyBunion341 commented Jan 24, 2025

In addition to the egui crate and the inspector crate, the entire state needs to be reworked because technical debt and problems:

  • When the user is searching for a entity in the inspector, the chat gets updated with the query contents of egui elements.
  • When clicking on items in the inspector, blocks get placed / destroyed in the background 😓.
  • The chatting system is very sketchy with the focus handling -> Rewrite.

CleanShot 2025-01-24 at 22 27 13@2x

I am so relieved that the chat system is no longer sketchy but looks like a genuinely robust solution with the state transitions 😄

New States

  • Playing
  • Chatting
  • Debugging

@CuddlyBunion341 CuddlyBunion341 self-assigned this Jan 24, 2025
Update,
(
player_systems::handle_controller_movement_system,
player_systems::handle_player_collider_events_system,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems contraversial at first:

Q: Why would you want to run the controller movement systems when the player is chatting?
A: What if the player jumped into the air and while in air opened up the chat? Without these systems, the player would fall through the ground.

mut next_state: ResMut<NextState<GameState>>,
key_input: Res<ButtonInput<KeyCode>>,
) {
if key_input.just_pressed(KeyCode::Tab) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love how clean the state transitions are here 😍

chat_input_query.get_single_mut(),
) {
info!("Handling unfocus state");
container_classes.remove_class("focused");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still unhappy with the classes, but what can I do 🤷‍♂️

@CuddlyBunion341 CuddlyBunion341 marked this pull request as ready for review January 25, 2025 00:31
@CuddlyBunion341 CuddlyBunion341 changed the title Integrate egui-inspector Integrate egui-inspector, add game states Jan 25, 2025

#chat_message_input {
margin: 0px;
margin-top: 15px;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change, but might aswell fix the margin..

) {
let mut window = window_query.single_mut();
if btn.just_pressed(MouseButton::Left) {
if btn.just_pressed(MouseButton::Left) && *current_state.get() != GameState::Debugging {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could check for playing and chatting instead...

Copy link
Owner Author

@CuddlyBunion341 CuddlyBunion341 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CuddlyBunion341 CuddlyBunion341 enabled auto-merge (squash) January 25, 2025 08:56
@CuddlyBunion341 CuddlyBunion341 merged commit dec2d6c into main Jan 25, 2025
3 checks passed
@CuddlyBunion341 CuddlyBunion341 deleted the feature/egui-inspector branch January 25, 2025 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant