Skip to content

Queenstown stage - #615

Merged
AngeloTadeucci merged 2 commits into
masterfrom
stage
Oct 15, 2025
Merged

Queenstown stage#615
AngeloTadeucci merged 2 commits into
masterfrom
stage

Conversation

@AngeloTadeucci

@AngeloTadeucci AngeloTadeucci commented Oct 15, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Introduced performance stage management: players can start and end musical performances with ownership and party support.
    • Enforced a maximum performance duration (10 minutes) and per-tick stage updates for consistent timing.
  • Bug Fixes

    • Performances now end automatically when time expires or the performer leaves/disconnects, preventing stuck stages.
    • Prevented accidental movement of the current performer and added safeguards to avoid errors when no stage is present.

@coderabbitai

coderabbitai Bot commented Oct 15, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Renames a field property to PerformanceEndTick and updates its serialization; adds MaxPerformanceDuration constant; refactors PerformanceStageManager to depend on FieldManager and adds StartPerformance/EndPerformance/IsCurrentPerformer/Update APIs; calls PerformanceStage?.Update() per tick and simplifies InstrumentHandler start/end calls.

Changes

Cohort / File(s) Summary of Changes
Model field property rename
Maple2.Model/Game/IFieldProperty.cs
Renamed FieldPropertyMusicConcert.UnknownPerformanceEndTick (int) and updated serialization to write PerformanceEndTick.
Metadata constants
Maple2.Model/Metadata/Constants.cs
Added public static readonly TimeSpan MaxPerformanceDuration = TimeSpan.FromMinutes(10).
Performance stage manager & wiring
Maple2.Server.Game/Manager/Field/PerformanceStageManager.cs, Maple2.Server.Game/Manager/Field/FieldManager/.../FieldManager.cs
PerformanceStageManager now takes FieldManager, adds StartPerformance, EndPerformance, IsCurrentPerformer, and Update (owner/end-tick handling, field property application/clear). FieldManager.Update() now calls PerformanceStage?.Update() each tick.
Handlers & triggers
Maple2.Server.Game/PacketHandlers/InstrumentHandler.cs, Maple2.Server.Game/Trigger/TriggerContext.Player.cs
InstrumentHandler start/end handlers shortened to PerformanceStage?.StartPerformance(session) / ...EndPerformance(session); Trigger logic adds null check for Field.PerformanceStage and skips moving the current performer during KickMusicAudience.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Player as GameSession
  participant IH as InstrumentHandler
  participant PSM as PerformanceStageManager
  participant FM as FieldManager
  participant Field as Field/Properties

  rect rgba(225,245,254,0.6)
  Player->>IH: StartPerform
  IH->>PSM: StartPerformance(session)
  PSM->>PSM: ensure no active performance
  PSM->>FM: use FieldManager to access field
  PSM->>PSM: set owner, endTick = now + MaxPerformanceDuration
  PSM->>Field: apply FieldPropertyMusicConcert(PerformanceEndTick)
  PSM-->>IH: Started/ignored
  end
Loading
sequenceDiagram
  autonumber
  participant Tick as TickLoop
  participant PSM as PerformanceStageManager
  participant Field as Field/Properties

  rect rgba(232,245,233,0.6)
  loop each field tick
    Tick->>PSM: Update()
    alt time expired OR owner absent/disconnected
      PSM->>Field: remove FieldPropertyMusicConcert
      PSM->>PSM: clear owner/endTick
    else active
      PSM-->>PSM: maintain state
    end
  end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Zintixx

Poem

I hop on stage where tick lights glow,
Ten minutes play, then curtain low.
I tune my code, I tune my bow,
PerformanceEndTick tells us when to go.
A rabbit's nod — the show runs slow 🐇🎶

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
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.
Title Check ❓ Inconclusive The title “Queenstown stage” is too vague and does not clearly describe the primary change in the pull request; it omits any indication of what is being implemented or updated, making it difficult for reviewers to understand the scope at a glance. Consider revising the title to include an action and context, for example “Implement performance stage management for Queenstown map,” to clearly convey the main feature introduced by this pull request.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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 stage

📜 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 93514d5 and 7b45270.

📒 Files selected for processing (2)
  • Maple2.Server.Game/Manager/Field/FieldManager/FieldManager.cs (1 hunks)
  • Maple2.Server.Game/Trigger/TriggerContext.Player.cs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
Maple2.Server.Game/Trigger/TriggerContext.Player.cs (2)
Maple2.Server.Game/Manager/Field/FieldManager/FieldManager.cs (1)
  • TryGetPortal (451-454)
Maple2.Server.Game/Manager/Field/PerformanceStageManager.cs (1)
  • IsCurrentPerformer (79-91)
Maple2.Server.Game/Manager/Field/FieldManager/FieldManager.cs (1)
Maple2.Server.Game/Manager/Field/PerformanceStageManager.cs (1)
  • Update (93-110)
⏰ 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 (3)
Maple2.Server.Game/Manager/Field/FieldManager/FieldManager.cs (1)

340-340: LGTM! Performance stage update properly integrated.

The null-conditional call to PerformanceStage?.Update() is placed appropriately in the field tick loop and correctly handles the nullable PerformanceStage. This ensures performance timeouts and owner disconnections are checked each tick.

Maple2.Server.Game/Trigger/TriggerContext.Player.cs (2)

32-34: LGTM! Proper null guard for performance stage.

The early return when PerformanceStage is null is appropriate, as this method is specifically for performance-related functionality and should only operate when a performance stage exists.


40-43: LGTM! Correct performer protection logic.

The guard correctly prevents kicking the current performer by checking IsCurrentPerformer() and continuing the loop. The comment clearly explains the intent, and the logic properly handles both solo and party performances.


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 7b568c9 into master Oct 15, 2025
4 checks passed
@AngeloTadeucci
AngeloTadeucci deleted the stage branch October 15, 2025 18:34
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