Skip to content

Integrate egui-inspector, add game states#32

Merged
cb341 merged 14 commits intomainfrom
feature/egui-inspector
Jan 25, 2025
Merged

Integrate egui-inspector, add game states#32
cb341 merged 14 commits intomainfrom
feature/egui-inspector

Conversation

@cb341
Copy link
Copy Markdown
Owner

@cb341 cb341 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

@cb341 cb341 self-assigned this Jan 24, 2025
Comment thread src/client/player/mod.rs
Update,
(
player_systems::handle_controller_movement_system,
player_systems::handle_player_collider_events_system,
Copy link
Copy Markdown
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.

Comment thread src/client/gui/systems.rs
mut next_state: ResMut<NextState<GameState>>,
key_input: Res<ButtonInput<KeyCode>>,
) {
if key_input.just_pressed(KeyCode::Tab) {
Copy link
Copy Markdown
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
Copy Markdown
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 🤷‍♂️

Comment thread src/client/chat/systems.rs Outdated
@cb341 cb341 marked this pull request as ready for review January 25, 2025 00:31
@cb341 cb341 changed the title Integrate egui-inspector Integrate egui-inspector, add game states Jan 25, 2025
Comment thread assets/chat.css

#chat_message_input {
margin: 0px;
margin-top: 15px;
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Owner Author

@cb341 cb341 left a comment

Choose a reason for hiding this comment

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

LGTM

@cb341 cb341 enabled auto-merge (squash) January 25, 2025 08:56
@cb341 cb341 merged commit dec2d6c into main Jan 25, 2025
@cb341 cb341 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