Skip to content

Debug Triggers#580

Merged
AngeloTadeucci merged 1 commit intomasterfrom
debug-triggers
Oct 4, 2025
Merged

Debug Triggers#580
AngeloTadeucci merged 1 commit intomasterfrom
debug-triggers

Conversation

@AngeloTadeucci
Copy link
Collaborator

@AngeloTadeucci AngeloTadeucci commented Oct 3, 2025

Summary by CodeRabbit

  • New Features

    • Added “Show Triggers” option in 3D view with optional “Show Trigger Information” to display trigger boxes and labels.
    • New controls available in the Visualization Controls window.
  • Bug Fixes

    • Corrected edge conditions in sorted list removal to improve reliability of ordered collections.
  • Tests

    • Added comprehensive tests covering sorted list add/remove scenarios.
  • Chores

    • Adjusted logging timing during field removal for clearer diagnostics.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Adds trigger-visualization to the debug renderer with two toggles (ShowTriggers, ShowTriggerInformation), UI controls to manage them, and integrates trigger box/text rendering into the field render flow. Adjusts a log call order in FieldRemoved. Updates ListExtension.RemoveSorted boundary checks and introduces comprehensive unit tests.

Changes

Cohort / File(s) Summary of changes
3D Debug Rendering — Triggers
Maple2.Server.DebugGame/Graphics/DebugFieldRenderer.cs, Maple2.Server.DebugGame/Graphics/Ui/Windows/VisualizationControlsWindow.cs
Adds ShowTriggers and ShowTriggerInformation toggles; integrates rendering of trigger boxes and optional text labels; introduces RenderTriggerBoxes(...) and RenderTriggerTextLabels(); adds corresponding UI checkboxes with conditional indentation.
Graphics Context Cleanup/Logging
Maple2.Server.DebugGame/Graphics/DebugGraphicsContext.cs
Moves FieldRemoved(...) log invocation to occur after CleanUp(). No other logic changes.
List Extension Logic
Maple2.Tools/Extensions/ListExtension.cs
Revises RemoveSorted boundary early-exit conditions (first/last element comparisons) and adds clarifying comments; core search logic unchanged.
Unit Tests for List Extensions
Maple2.Server.Tests/Tools/ListExtensionTests.cs
Adds six tests covering AddSorted/RemoveSorted: random inputs, boundary insertions, first/last removals, duplicates, no-op removal, and custom descending comparer.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant UI as VisualizationControlsWindow
  participant R as DebugFieldRenderer
  participant G as Render Loop

  U->>UI: Toggle "Show Triggers"
  UI->>R: renderer.ShowTriggers = true/false
  U->>UI: Toggle "Show Trigger Information"
  UI->>R: renderer.ShowTriggerInformation = true/false

  loop Each frame
    G->>R: RenderField(...)
    alt ShowTriggers == true
      R->>R: RenderTriggerBoxes(window)
      alt ShowTriggerInformation == true
        R->>R: RenderTriggerTextLabels()
      else ShowTriggerInformation == false
        Note over R: Skip trigger labels
      end
    else ShowTriggers == false
      Note over R: Skip trigger rendering
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Zintixx

Poem

In fields I hop with joyous vigor,
New toggles flip—revealing each trigger.
Boxes glow, their secrets told,
Texts now whisper, brave and bold.
Lists keep order, neat and sorted—
Bugs be gone, as hops reported! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “Debug Triggers” succinctly captures the primary change of adding debug visualization toggles for trigger boxes and related information without extraneous detail, making it clear and directly related to the core functionality introduced in this pull request.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch debug-triggers

📜 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 f8cf0c0 and 6d7403e.

📒 Files selected for processing (5)
  • Maple2.Server.DebugGame/Graphics/DebugFieldRenderer.cs (3 hunks)
  • Maple2.Server.DebugGame/Graphics/DebugGraphicsContext.cs (1 hunks)
  • Maple2.Server.DebugGame/Graphics/Ui/Windows/VisualizationControlsWindow.cs (1 hunks)
  • Maple2.Server.Tests/Tools/ListExtensionTests.cs (1 hunks)
  • Maple2.Tools/Extensions/ListExtension.cs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
Maple2.Server.Tests/Tools/ListExtensionTests.cs (1)
Maple2.Tools/Extensions/ListExtension.cs (4)
  • AddSorted (8-10)
  • AddSorted (12-40)
  • RemoveSorted (42-44)
  • RemoveSorted (46-64)
Maple2.Server.DebugGame/Graphics/DebugFieldRenderer.cs (4)
Maple2.Server.DebugGame/Graphics/DebugFieldWindow.cs (2)
  • DebugFieldWindow (15-297)
  • DebugFieldWindow (33-42)
Maple2.Model/Game/TriggerObject.cs (1)
  • TriggerBox (113-119)
Maple2.Server.DebugGame/Graphics/Assets/CoreModels.cs (2)
  • CoreModels (7-257)
  • CoreModels (15-26)
Maple2.Server.DebugGame/Graphics/Resources/Mesh.cs (1)
  • Draw (98-116)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: build
🔇 Additional comments (7)
Maple2.Tools/Extensions/ListExtension.cs (1)

51-56: LGTM! Correct boundary logic for sorted removal.

The inverted boundary checks now correctly exit early when the item is outside the sorted range. The previous logic was incorrect and would have caused early returns when the item was within bounds. The added comments clarify the intent.

Maple2.Server.Tests/Tools/ListExtensionTests.cs (1)

1-116: LGTM! Comprehensive test coverage.

The test suite provides thorough coverage of AddSorted and RemoveSorted behavior, including:

  • Random input ordering
  • Boundary insertions/removals
  • Duplicate handling
  • No-op cases
  • Custom descending comparer

The tests align well with the corrected boundary logic in RemoveSorted.

Maple2.Server.DebugGame/Graphics/Ui/Windows/VisualizationControlsWindow.cs (1)

38-43: LGTM! UI controls follow existing patterns.

The new trigger visualization controls correctly gate ShowTriggerInformation behind ShowTriggers and follow the same pattern as the existing portal controls.

Maple2.Server.DebugGame/Graphics/DebugFieldRenderer.cs (4)

55-56: LGTM! Consistent toggle defaults.

The new trigger visualization toggles follow existing naming conventions and defaults, matching the pattern established for portals.


245-251: LGTM! Correct rendering flow integration.

The trigger rendering is properly gated by the toggles and positioned logically within the entity rendering sequence.


1183-1193: LGTM! Follows established rendering patterns.

The RenderTriggerBoxes method follows the same structure as other entity rendering methods (e.g., RenderVibrateObjects, RenderBoxColliders) and correctly uses the wireframe cube model.


1195-1214: LGTM! Consistent text label rendering.

The RenderTriggerTextLabels method follows the established pattern for rendering text labels (e.g., portals, actors) and uses consistent styling with the trigger box color theme.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Collaborator

@Zintixx Zintixx left a comment

Choose a reason for hiding this comment

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

sure

@AngeloTadeucci AngeloTadeucci merged commit c45ccca into master Oct 4, 2025
4 checks passed
@AngeloTadeucci AngeloTadeucci deleted the debug-triggers branch October 4, 2025 01:02
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.

2 participants

Comments