Multiplayer: Add client-side build/sell previews and fix various issues#4839
Merged
Loobinex merged 3 commits intoMay 26, 2026
Merged
Conversation
90bf4e8 to
0072ea3
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors multiplayer roomspace/cursor preview handling to make build/sell previews fully client-side (similar to existing dig prediction) and to fix several timing/state issues in highlight/tag preview behavior.
Changes:
- Adds client-side build/sell roomspace preview updates and reuses shared roomspace/packet-action logic.
- Refactors dig tag/untag mode selection to be derived from roomspace state/predicted tag modes (removing the old flag-based
set_tag_untag_modepath). - Renames/clarifies integer “mode” usage by switching call sites to
roomspace_*_modeenum values and consolidating packet action handling viaapply_roomspace_packet_action().
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/roomspace.h | Updates APIs to pass PlayerInfo/Packet, adds preview update helpers, and exposes shared packet-action application. |
| src/roomspace.c | Implements shared dig tag-mode derivation, highlight refactor, build/sell preview helpers, and apply_roomspace_packet_action(). |
| src/roomspace_prediction.c | Extends prediction pipeline to cover build/sell previews and refactors dig prediction to use the new shared APIs. |
| src/player_data.h | Removes unused PlaF_ChosenSlabHasActiveTask flag and simplifies swap_to_untag_mode field comment. |
| src/packets.h | Removes set_tag_untag_mode() declaration. |
| src/packets.c | Routes roomspace packet actions through apply_roomspace_packet_action() and updates mode comparisons to enums. |
| src/packets_input.c | Uses new preview helpers; removes set_tag_untag_mode() calls; updates dig cursor-tagging call signature. |
| src/engine_redraw.c | Updates pointer graphic selection to use drag_placement_mode enum value. |
| src/cursor_tag.h | Changes tag_cursor_blocks_dig() signature to accept PlayerInfo/Packet/RoomSpace. |
| src/cursor_tag.c | Updates implementation to use caller-provided packet/roomspace context (supporting prediction-driven rendering). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've spotted a couple of issues with roomspace prediction. The biggest issue was that holding CTRL while holding a creature would display the 5x5 dig box even when the cursor was not over a slab. There were also a few smaller timing issues where the cursor box could switch between client-side prediction and authoritative rendering at the wrong time. Threw in some integer enum renames as well. I've refactored it to use more shared code instead of duplicated code, which will be more resilient for any future changes to roomspace that people might make. The tag/untag state also needed to be simplified.
The roomspace preview box is now 100% client-side for building/selling as well, previously it was only client-side for digging.