Skip to content

Conversation

@glinesbdev
Copy link
Contributor

@glinesbdev glinesbdev commented Jan 15, 2026

Maple2.Server.Game/Trigger/TriggerContext.Npc.cs

Currently, the NPC location / position check is using an exact match. For bugs like Twinkling Path being blocked by NPCs being in the "right position" but not in the "exact position", the quest was unable to progress after finding the first child due to this minor difference in position.

Summary by CodeRabbit

  • Bug Fixes
    • Improved NPC detection in trigger areas. NPCs are now correctly identified when trigger box boundaries intersect with their shapes, enhancing spawn and detection logic.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 15, 2026

Walkthrough

The changes expand collision detection logic for trigger objects by adding a new Intersects method to handle shape-based checks and updating NPC detection in trigger boxes to include shape intersections alongside positional containment, broadening the detection criteria.

Changes

Cohort / File(s) Summary
Trigger Shape Detection
Maple2.Model/Game/TriggerObject.cs
Added public Intersects(in IPrism shape) method to TriggerBox class that delegates shape intersection checks
NPC Trigger Detection
Maple2.Server.Game/Trigger/TriggerContext.Npc.cs
Enhanced NpcsInBox filtering to include NPCs where the box intersects their shape, expanding beyond position-only containment checks

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • Zintixx

Poem

🐰 A trigger learns to sense with care,
Intersecting shapes in the air!
NPCs now bloom in broader sight,
When boxes dance with collisions just right! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 'Prism NPC detection' is directly related to the main change, which adds Prism-based intersection detection for NPCs to fix position detection logic in quests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1882c32 and f1b2ea3.

📒 Files selected for processing (2)
  • Maple2.Model/Game/TriggerObject.cs
  • Maple2.Server.Game/Trigger/TriggerContext.Npc.cs
🧰 Additional context used
🧬 Code graph analysis (2)
Maple2.Server.Game/Trigger/TriggerContext.Npc.cs (3)
Maple2.Model/Game/TriggerObject.cs (2)
  • Contains (121-121)
  • Intersects (123-123)
Maple2.Tools/Collision/Prism.cs (2)
  • Contains (14-16)
  • Intersects (18-24)
Maple2.Database/Storage/Metadata/MapEntityStorage.cs (1)
  • Contains (142-144)
Maple2.Model/Game/TriggerObject.cs (4)
Maple2.Tools/Collision/IPolygon.cs (1)
  • Intersects (16-16)
Maple2.Tools/Collision/PointPrism.cs (2)
  • Intersects (26-28)
  • Intersects (33-35)
Maple2.Tools/Collision/Prism.cs (1)
  • Intersects (18-24)
Maple2.Tools/Collision/Circle.cs (1)
  • Intersects (43-49)
🔇 Additional comments (2)
Maple2.Model/Game/TriggerObject.cs (1)

123-124: LGTM!

The new Intersects method cleanly delegates to the underlying Prism.Intersects implementation. This follows the same pattern as the existing Contains method and properly exposes shape-based intersection checking needed for the NPC detection fix.

Maple2.Server.Game/Trigger/TriggerContext.Npc.cs (1)

277-277: Good fix for the NPC detection issue.

The OR condition correctly broadens detection to include NPCs whose shapes intersect the trigger box, addressing the quest-blocking issue mentioned in the PR objectives.

Consider consistency with MonstersInBox: The sibling method MonstersInBox (line 265) still uses only position containment. If monsters can have similar detection issues, you may want to apply the same intersection logic there for consistency.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

@AngeloTadeucci AngeloTadeucci merged commit dac84a3 into MS2Community:master Jan 15, 2026
4 checks passed
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.

3 participants