feat(ships): add roll#66
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (17)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (14)
📝 WalkthroughWalkthroughShip control is extended with separate horizontal (lateral) movement input that flows through player/AI input mapping into gimbal systems and control allocation. Test infrastructure is synchronized via container-less factory, comprehensive GameObject injection across test helpers, and shared test utilities. Module detachment explosions now spawn before connection removal and sample all stored pixels per connection, with the spawn probability raised from 0.1 to 0.3. HUD pause/settings overlay logic is removed from the ShipStatusPanel UI and controller. ChangesHorizontal lateral movement input feature
Tests and test infrastructure alignment
Module detachment explosion behavior
HUD pause/settings overlay removal
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
Assets/Scripts/Ships/Modules/Module.cs (1)
373-376: ⚡ Quick winUse
AsValueEnumerable()for the inner pixel list enumeration.The inner
from worldPoint in allConnectionsPointsskips ZLinq value enumeration and can reintroduce avoidable allocations in this hot path; wrap it withallConnectionsPoints.AsValueEnumerable().As per coding guidelines, "Use ZLinq
.AsValueEnumerable()instead ofSystem.Linqfor collection queries to avoid memory allocation".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Assets/Scripts/Ships/Modules/Module.cs` around lines 373 - 376, The LINQ comprehension over connectionPoints currently uses allConnectionsPoints in the inner query which causes ZLinq allocations; change the inner enumeration to use allConnectionsPoints.AsValueEnumerable() so the expression becomes from worldPoint in allConnectionsPoints.AsValueEnumerable() to preserve value-enumeration for the pixel lists referenced in the foreach that calls PixelatedRigidbody.LocalToWorldPoint and uses Random.value and GameplayConstants.ChanceOfSpawningExplosionOnDetachingConnectionPoint.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Assets/Scripts/Ships/Modules/Module.cs`:
- Around line 373-377: The current loop in Module.cs (iterating
connectionPoints.Values and calling _effectsSpawner.SpawnExplosion for each
PixelatedRigidbody.LocalToWorldPoint with probability
GameplayConstants.ChanceOfSpawningExplosionOnDetachingConnectionPoint) can spawn
an unbounded number of explosions; add a per-detach cap (e.g., int
maxExplosionsPerDetach or GameplayConstants.MaxExplosionsPerDetach) and enforce
it while iterating: accumulate spawned count and stop invoking
_effectsSpawner.SpawnExplosion once the cap is reached (or select up to N random
candidates before spawning), keeping the same probability logic but ensuring no
more than the cap are spawned per detach to avoid frame spikes and pool
thrashing.
---
Nitpick comments:
In `@Assets/Scripts/Ships/Modules/Module.cs`:
- Around line 373-376: The LINQ comprehension over connectionPoints currently
uses allConnectionsPoints in the inner query which causes ZLinq allocations;
change the inner enumeration to use allConnectionsPoints.AsValueEnumerable() so
the expression becomes from worldPoint in
allConnectionsPoints.AsValueEnumerable() to preserve value-enumeration for the
pixel lists referenced in the foreach that calls
PixelatedRigidbody.LocalToWorldPoint and uses Random.value and
GameplayConstants.ChanceOfSpawningExplosionOnDetachingConnectionPoint.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6bd043c6-2301-446c-8954-3011fe49c9e5
⛔ Files ignored due to path filters (1)
ProjectSettings/InputManager.assetis excluded by!**/*.asset
📒 Files selected for processing (10)
Assets/Scripts/Core/Constants/GameplayConstants.csAssets/Scripts/Ships/AIShip.csAssets/Scripts/Ships/Modules/Module.csAssets/Scripts/Ships/PlayerShip.csAssets/Scripts/Ships/Ship.csAssets/Scripts/Ships/Systems/Gimbal/ControlAllocator.csAssets/Scripts/Ships/Systems/Gimbal/EngineDirectionSolver.csAssets/Scripts/Ships/Systems/Gimbal/SasTurnInputResolver.csAssets/Scripts/Ships/Tests/ShipControlAllocatorThrustTests.csAssets/Scripts/Ships/Tests/TestHelpers/MovableShipTestProxy.cs
c5a5508 to
7f2e9c6
Compare
7f2e9c6 to
65b93d3
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Assets/Scripts/Ships/Tests/ShipDestroyAllModulesTests.cs`:
- Around line 157-160: The test calls InitializeModules() before performing
dependency injection, causing modules to initialize with uninjected
dependencies; move the Container.InjectGameObject(shipGo) call so it runs before
ship.InitializeModules() (i.e., inject the ship GameObject first, then call
Ship.InitializeModules()) to ensure modules receive their dependencies before
initialization.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 6ec299d6-f17a-4ecc-8cab-6edbcc6f3ea3
⛔ Files ignored due to path filters (1)
Assets/Scenes/MainGame.unityis excluded by!**/*.unity
📒 Files selected for processing (22)
Assets/Scripts/Ships/Tests/ModuleConnectionTests.csAssets/Scripts/Ships/Tests/ModuleDestructionThresholdTests.csAssets/Scripts/Ships/Tests/ModuleJointLifecycleTests.csAssets/Scripts/Ships/Tests/ShipControlAllocatorThrustTests.csAssets/Scripts/Ships/Tests/ShipCrewAssignmentTests.csAssets/Scripts/Ships/Tests/ShipDestroyAllModulesTests.csAssets/Scripts/Ships/Tests/ShipDestructionJunkTests.csAssets/Scripts/Ships/Tests/ShipDisconnectionTests.csAssets/Scripts/Ships/Tests/ShipGameplayMovementTests.csAssets/Scripts/Ships/Tests/ShipSnapshotServiceTests.csAssets/Scripts/Ships/Tests/TestHelpers/ShipTestBase.csAssets/Scripts/Ships/Tests/TestHelpers/SmallMovableShipTestFactory.csAssets/Scripts/Ships/Tests/TestHelpers/TestContainerFactory.csAssets/Scripts/Ships/Tests/TestHelpers/TestModules.metaAssets/Scripts/Ships/Tests/TestHelpers/TestModules/TestModule.csAssets/Scripts/Ships/Tests/TestHelpers/TestModules/TestModule.cs.metaAssets/Scripts/Ships/Tests/TestHelpers/TestModules/TestPowerModule.csAssets/Scripts/Ships/Tests/TestHelpers/TestModules/TestPowerModule.cs.metaAssets/Scripts/Ships/Tests/TestHelpers/Utils.csAssets/Scripts/Ships/Tests/TestHelpers/Utils.cs.metaAssets/Scripts/UI/MainGame/ShipStatusPanel.uxmlAssets/Scripts/UI/MainGame/ShipStatusPanelController.cs
💤 Files with no reviewable changes (1)
- Assets/Scripts/UI/MainGame/ShipStatusPanelController.cs
✅ Files skipped from review due to trivial changes (4)
- Assets/Scripts/Ships/Tests/TestHelpers/TestModules/TestPowerModule.cs.meta
- Assets/Scripts/Ships/Tests/TestHelpers/TestModules/TestModule.cs.meta
- Assets/Scripts/Ships/Tests/TestHelpers/Utils.cs.meta
- Assets/Scripts/Ships/Tests/TestHelpers/TestModules.meta
🚧 Files skipped from review as they are similar to previous changes (1)
- Assets/Scripts/Ships/Tests/ShipControlAllocatorThrustTests.cs
resolves #64
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores