Skip to content

Fix loudspeaker - #513

Merged
AngeloTadeucci merged 1 commit into
masterfrom
fix-loudspeaker
Jun 24, 2025
Merged

Fix loudspeaker#513
AngeloTadeucci merged 1 commit into
masterfrom
fix-loudspeaker

Conversation

@AngeloTadeucci

@AngeloTadeucci AngeloTadeucci commented Jun 24, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of notice cubes to prevent unintended state changes for certain control types.
    • Enhanced the coordinate command output to display both standard and alternative position formats.
  • Refactor

    • Simplified notice settings by removing unused position data and streamlining property initialization.
  • New Features

    • Cube notice settings packets now include position data for improved context.

@coderabbitai

coderabbitai Bot commented Jun 24, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes refactor the CubeNoticeSettings class by removing the Position property and its constructors, updating its initialization, and modifying related instantiations. Additional logic is added to prevent state updates for "Notice" cubes, and packet serialization is updated to include the cube's position. The coord command now displays both Vector3 and Vector3B formats.

Changes

File(s) Change Summary
Maple2.Model/Game/Cube/ConfigurableCube.cs Removed Position property and constructors from CubeNoticeSettings; updated property initializations and serialization.
Maple2.Model/Game/Cube/InteractCube.cs Updated instantiation of CubeNoticeSettings to use parameterless constructor.
Maple2.Server.Game/Model/Field/Entity/FieldFunctionInteract.cs Added early return in Update for cubes with ControlType.Notice.
Maple2.Server.Game/Packets/HomeActionPacket.cs Modified SendCubeNoticeSettings to write cube position (Vector3B) to the packet.
Maple2.Server.Game/Commands/CoordCommand.cs Enhanced coord command to display both Vector3 and Vector3B representations.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Server
    participant Cube
    participant Packet

    Client->>Server: Place Loudspeaker-type Cube
    Server->>Cube: Instantiate CubeNoticeSettings (no position)
    Server->>Packet: SendCubeNoticeSettings (includes position)
    Packet->>Client: Deliver cube notice settings with position
    Note over Server: On Update, if ControlType == Notice<br>return early (no state change)
Loading

Assessment against linked issues

Objective Addressed Explanation
Prevent client crash/disconnect when entering map with Loudspeaker-type cube (#507)
Ensure correct serialization and transmission of cube notice settings with position (#507)
Avoid processing or state changes for Notice control type cubes (#507)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes were found based on the objectives from the linked issues.

Possibly related PRs

Suggested reviewers

  • Zintixx

Poem

In the meadow of cubes, a bug took flight,
Loudspeakers crashed maps, causing a fright.
With code now refined, and positions in tow,
Notice cubes behave, as packets now flow.
The bunny hops on, with a gleeful cheer,
For crashes are gone, and springtime is here!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f6e77c and 609bd50.

📒 Files selected for processing (5)
  • Maple2.Model/Game/Cube/ConfigurableCube.cs (1 hunks)
  • Maple2.Model/Game/Cube/InteractCube.cs (1 hunks)
  • Maple2.Server.Game/Commands/CoordCommand.cs (2 hunks)
  • Maple2.Server.Game/Model/Field/Entity/FieldFunctionInteract.cs (1 hunks)
  • Maple2.Server.Game/Packets/HomeActionPacket.cs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: format
  • GitHub Check: build
  • GitHub Check: build
🔇 Additional comments (6)
Maple2.Server.Game/Commands/CoordCommand.cs (2)

5-5: Import added for Vector3B support.

The Maple2.Model.Common import is correctly added to support the Vector3B cast operation in the enhanced output.


38-38: Enhanced coordinate display for debugging.

Good enhancement to show both Vector3 and Vector3B formats. This provides comprehensive coordinate information for debugging purposes and aligns with the PR's focus on Vector3B handling.

Maple2.Model/Game/Cube/InteractCube.cs (1)

35-35: Constructor updated to match CubeNoticeSettings refactoring.

The change to use the parameterless constructor is consistent with the removal of the Position property from CubeNoticeSettings class. Position data is now handled separately in packet serialization.

Maple2.Server.Game/Packets/HomeActionPacket.cs (1)

62-62: Position data correctly handled in packet serialization.

Good solution to explicitly write the cube's position to the packet after removing it from CubeNoticeSettings. This maintains the expected packet structure while supporting the refactored data model.

Maple2.Server.Game/Model/Field/Entity/FieldFunctionInteract.cs (1)

23-25: Appropriate exclusion of Notice cubes from state updates.

The early return for Notice control type cubes is logical and aligns with the PR's focus on fixing loudspeaker (notice cube) behavior. Notice cubes should not have automatic state transitions like other interactive cubes.

Maple2.Model/Game/Cube/ConfigurableCube.cs (1)

34-35: Clean refactoring with inline property initialization.

The removal of the Position property and its replacement with inline default initialization is well-executed. This decouples position handling from the notice settings, which is appropriately handled at the packet level instead.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@AngeloTadeucci
AngeloTadeucci merged commit 03f1efe into master Jun 24, 2025
@AngeloTadeucci
AngeloTadeucci deleted the fix-loudspeaker branch June 24, 2025 01:19
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.

when a Loudspeaker-type cube is placed in a Plot, the game client crashes upon entering that map.

2 participants