Skip to content

Smoke trails for nukes#3402

Open
Restart2008 wants to merge 2 commits intomainfrom
smoke
Open

Smoke trails for nukes#3402
Restart2008 wants to merge 2 commits intomainfrom
smoke

Conversation

@Restart2008
Copy link
Contributor

If this PR fixes an issue, link it below. If not, delete these two lines.
Resolves #(issue number)

Description: Added smoke trails to nukes for cooler in flight nuke animation, also put smoke trails under the special effects setting. When the player enables special effects setting then smoke trails is also enabled. When special effects is disabled then smoke trails is also disabled.

Describe the PR.

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Please put your Discord username so you can be contacted if a bug or regression is found:

DISCORD_USERNAME
Restart

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ee37a4fe-bec4-4008-8af3-6b47d272621f

📥 Commits

Reviewing files that changed from the base of the PR and between 8329dd4 and c8c3908.

📒 Files selected for processing (3)
  • src/client/graphics/fx/SmokeTrailFx.ts
  • src/client/graphics/layers/FxLayer.ts
  • src/client/graphics/layers/UnitLayer.ts

Walkthrough

The changes introduce a new smoke trail particle effect system for missiles, integrate it into the FX rendering layer to handle specific missile unit types (AtomBomb, HydrogenBomb, MIRV, MIRVWarhead, SAMMissile), and refactor coordinate handling in unit interactions to avoid mutating input parameters.

Changes

Cohort / File(s) Summary
Smoke Trail Particle System
src/client/graphics/fx/SmokeTrailFx.ts
New smoke trail effect class with internal particle lifecycle management. Particles spawn near units with slight offset, drift and grow over time, fade with age, and are removed when life expires. SmokeTrailFx emits particles on active units and manages rendering based on unit state and remaining particles.
FX Layer Integration
src/client/graphics/layers/FxLayer.ts
Added SmokeTrailFx import and per-unit missile trail tracking. Creates smoke trail effects for specific missile types (AtomBomb, HydrogenBomb, MIRV, MIRVWarhead, SAMMissile) on unit activation. Updates rendering condition to include missile trails and implements trail lifecycle cleanup during render ticks.
Unit Interaction Refactoring
src/client/graphics/layers/UnitLayer.ts
Refactored onMouseUp to use intermediate targetRef variable instead of mutating clickRef parameter. Updates validation and events (isOcean, MoveWarshipIntentEvent, warship selection) to use the new reference, eliminating parameter mutation patterns.

Sequence Diagram

sequenceDiagram
    participant Unit as Unit Activation
    participant FxLayer as FX Layer
    participant SmokeTrail as SmokeTrailFx
    participant Canvas as Canvas Render
    
    Unit->>FxLayer: Unit activated (missile type)
    FxLayer->>SmokeTrail: Create SmokeTrailFx(game, unitId)
    FxLayer->>FxLayer: Store in missileTrails map
    
    loop Each Render Frame
        FxLayer->>SmokeTrail: renderTick(duration, ctx)
        SmokeTrail->>SmokeTrail: Emit new particle if active
        SmokeTrail->>SmokeTrail: Update all particles (position, size, color)
        SmokeTrail->>Canvas: Draw particles to context
        SmokeTrail->>FxLayer: Return active status
        alt Effect Complete
            FxLayer->>FxLayer: Remove from missileTrails
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

Smoke trails bloom as missiles take flight ✨💨
Particles drift and fade into night
Each frame brings new wisps, old ones fade
A visual dance that effects have made
Canvas painted with ephemeral shade

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding smoke trail visual effects specifically for nuclear weapons in the game.
Description check ✅ Passed The description explains the purpose of the changes (smoke trails for nuke animations) and mentions integration with special effects setting, relating to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant