add handler for DisplayDollPoseSync#3273
add handler for DisplayDollPoseSync#3273lost-werewolf wants to merge 1 commit intoPryaxis:general-develfrom
Conversation
Also correct DisplayDollInventoryID
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Pull request overview
Adds server-side handling for display doll (mannequin) pose sync packets so pose changes are blocked in protected areas, and corrects the display doll packet subtype/ID mapping to match the game’s values.
Changes:
- Add
DisplayDollPoseSyncHandlerand register it inBouncerto enforce build permissions on pose changes. - Fix
DisplayDollInventoryIDnumeric values by introducingPose = 2and movingMiscto3.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
TShockAPI/Handlers/DisplayDollPoseSyncHandler.cs |
New packet handler for mannequin pose sync with permission enforcement and attempted client resync. |
TShockAPI/GetDataHandlers.cs |
Corrects display doll subtype/ID enum values and adds Pose. |
TShockAPI/Bouncer.cs |
Wires the new handler into the existing packet handler subscription flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
@greptile review |
Greptile SummaryAdds a new
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant GetDataHandlers
participant DisplayDollPoseSyncHandler
participant Bouncer/Permissions
Client->>GetDataHandlers: TileEntityDisplayDollItemSync (subtype=2, pose)
GetDataHandlers->>GetDataHandlers: HandleTileEntityDisplayDollItemSync()
GetDataHandlers->>GetDataHandlers: OnDisplayDollPoseSync()
GetDataHandlers->>DisplayDollPoseSyncHandler: OnReceive(DisplayDollPoseSyncEventArgs)
DisplayDollPoseSyncHandler->>Bouncer/Permissions: HasBuildPermission(X, Y)
alt Permission Denied
Bouncer/Permissions-->>DisplayDollPoseSyncHandler: false
DisplayDollPoseSyncHandler->>Client: SendErrorMessage("No permission")
DisplayDollPoseSyncHandler->>Client: SendData(TileEntityDisplayDollItemSync, subtype=Pose) [resync]
DisplayDollPoseSyncHandler->>GetDataHandlers: args.Handled = true
else Permission Granted
Bouncer/Permissions-->>DisplayDollPoseSyncHandler: true
Note over GetDataHandlers: Packet processed normally
end
Last reviewed commit: edb1b2c |
Adds a handler for DisplayDollPoseSync to prevent players from posing protected mannequins. Also makes a correction to
DisplayDollInventoryID-Miscis actually 3 according to the game (can be found inTerraria.GameConent.Tile_Entities.TEDisplayDoll.Read), whilePoseis 2. So Pose was added as 2 and Misc was moved to 3.Please let me know if further changs should be made. Was reluctant to rename
DisplayDollInventoryID, if it would be appropriate to, I can do so.