Skip to content

use kick inside manage player window#2798

Merged
IntegratedQuantum merged 11 commits intoPixelGuys:masterfrom
Wunka:switch-manage
Apr 11, 2026
Merged

use kick inside manage player window#2798
IntegratedQuantum merged 11 commits intoPixelGuys:masterfrom
Wunka:switch-manage

Conversation

@Wunka
Copy link
Copy Markdown
Contributor

@Wunka Wunka commented Apr 1, 2026

Closes #2724

Changes:

  • Rename manage players window to just players window
  • On client only instances the players window uses the kick command
  • Put the players window directly into the pause window instead of having it inside the invite window
  • Show the manage player window to client only instances

One difference between the windows is still that the player opening the window is not shown for the client-side only version, while for the client-server version the player is in the list.

I would be ok with both versions that's why I take the question to the reviewers.

@Wunka Wunka moved this to Low Priority in PRs to review Apr 3, 2026
Comment thread src/gui/windows/pause.zig Outdated
if (main.server.world != null) {
list.add(Button.initText(.{0, 0}, 128, "Invite Player", gui.openWindowCallback("invite")));
}
list.add(Button.initText(.{0, 0}, 128, "Manage Players", gui.openWindowCallback("manage_players")));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should call it just players, since not everyone will be allowed to manage them.

As for the invite screen: I think it should stay accessible from this inventory directly, since it is not so obvious that you would get there from manage players.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment thread src/gui/windows/manage_players.zig Outdated
Comment thread src/gui/windows/players.zig Outdated

const old = main.settings.showIdWithName;
main.settings.showIdWithName = true;
defer main.settings.showIdWithName = old;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a hack, I don't like it. Instead you could just create a separate formatting function and call it with an Io.Writer.

Copy link
Copy Markdown
Contributor Author

@Wunka Wunka Apr 8, 2026

Choose a reason for hiding this comment

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

I have not found the right writer I should use... but I have found this alt method from the WriterGate PR.

@IntegratedQuantum IntegratedQuantum moved this from Low Priority to In review in PRs to review Apr 8, 2026
Comment thread src/gui/windows/players.zig Outdated
Comment thread src/gui/windows/players.zig Outdated
row.add(Label.init(.{0, 0}, 200, connection.user.?.name, .left));
row.add(Button.initText(.{0, 0}, 100, "Kick", .initWithPtr(kick, connection)));
} else {
const ip = std.fmt.allocPrint(main.stackAllocator.allocator, "{f}", .{connection.remoteAddress}) catch unreachable;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Incomplete connections should also be observable and cancelable by the server owner.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I brought it back. This had the same problem with the zero length name being skipped. but I now skip the the player himself. So it also now has the "no other player" info when needed.

Copy link
Copy Markdown
Contributor Author

@Wunka Wunka Apr 9, 2026

Choose a reason for hiding this comment

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

I hope I understood the isConnected check here is the right one. I don't know what I could else check (I am not that knowledgeable on the network code

Wunka and others added 2 commits April 9, 2026 07:32
Co-authored-by: IntegratedQuantum <43880493+IntegratedQuantum@users.noreply.github.com>
@Wunka Wunka changed the title use kick inside manage player and switch order of invite and manage players window use kick inside manage player Apr 9, 2026
@Wunka Wunka changed the title use kick inside manage player use kick inside manage player window Apr 9, 2026
Comment thread src/gui/windows/players.zig Outdated
Comment thread src/gui/windows/players.zig Outdated
Comment thread src/gui/windows/players.zig
Comment thread src/gui/windows/players.zig Outdated
userList[i].increaseRefCount();
if (userList[i].id == main.game.Player.id and connection.isConnected()) continue;
const row = HorizontalList.init();
if (connection.isConnected()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a lower level state, the connection is connected when it has done the initial connection handshake and is ready to transmit game data (like the player name).
You can use the handShakeState to check the progress of the game handshake where it exchanges the name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done. now it only shows the ip if the handshake is below the userData state. Also applied your suggestions with the function names

Comment thread src/gui/windows/players.zig Outdated
if (userList[i].id == main.game.Player.id and connection.isConnected()) continue;
const row = HorizontalList.init();
if (connection.isConnected()) {
if (@intFromEnum(connection.handShakeState.load(.monotonic)) >= @intFromEnum(main.network.Connection.HandShakeState.userData)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be >, since the protocol sets the value before actually processing the data.
Furthermore since it's unclear how this will change with the ECS (the entity might get created in a later step of the handshake), and generally avoid problems on future changes, I'd suggest to just check if the handshake is complete.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Member

@IntegratedQuantum IntegratedQuantum left a comment

Choose a reason for hiding this comment

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

Yay, I can finally kick the host

@IntegratedQuantum IntegratedQuantum merged commit 7c92c0a into PixelGuys:master Apr 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

use /kick command inside the manage player window

2 participants