Skip to content

feat(ships): add roll#66

Merged
lmProgramming merged 3 commits into
mainfrom
feat/add-roll
Jun 10, 2026
Merged

feat(ships): add roll#66
lmProgramming merged 3 commits into
mainfrom
feat/add-roll

Conversation

@lmProgramming

@lmProgramming lmProgramming commented Jun 10, 2026

Copy link
Copy Markdown
Owner

resolves #64

Summary by CodeRabbit

  • New Features

    • Added horizontal and lateral movement controls; ships now support separate horizontal/roll input mapping for improved flight dynamics.
  • Bug Fixes

    • Module detachment now properly evaluates all connection points for explosion spawning, instead of only the first point per connection.
  • Refactor

    • Removed pause and settings overlay functionality from the ship status panel.
    • Updated control allocation system to support directional inputs alongside forward and turn inputs.
  • Chores

    • Increased explosion spawn probability from 0.1 to 0.3.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bce4fa43-f83b-4147-a3b8-23f1364001ff

📥 Commits

Reviewing files that changed from the base of the PR and between 7f2e9c6 and 65b93d3.

⛔ Files ignored due to path filters (1)
  • Assets/Scenes/MainGame.unity is excluded by !**/*.unity
📒 Files selected for processing (17)
  • Assets/Scripts/Ships/Tests/ModuleConnectionTests.cs
  • Assets/Scripts/Ships/Tests/ModuleDestructionThresholdTests.cs
  • Assets/Scripts/Ships/Tests/ModuleJointLifecycleTests.cs
  • Assets/Scripts/Ships/Tests/ShipControlAllocatorThrustTests.cs
  • Assets/Scripts/Ships/Tests/ShipCrewAssignmentTests.cs
  • Assets/Scripts/Ships/Tests/ShipDestroyAllModulesTests.cs
  • Assets/Scripts/Ships/Tests/ShipDestructionJunkTests.cs
  • Assets/Scripts/Ships/Tests/ShipDisconnectionTests.cs
  • Assets/Scripts/Ships/Tests/ShipGameplayMovementTests.cs
  • Assets/Scripts/Ships/Tests/ShipSnapshotServiceTests.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/ShipTestBase.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/SmallMovableShipTestFactory.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/TestContainerFactory.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/Utils.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/Utils.cs.meta
  • Assets/Scripts/UI/MainGame/ShipStatusPanel.uxml
  • Assets/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 (2)
  • Assets/Scripts/Ships/Tests/TestHelpers/Utils.cs.meta
  • Assets/Scripts/Ships/Tests/TestHelpers/SmallMovableShipTestFactory.cs
🚧 Files skipped from review as they are similar to previous changes (14)
  • Assets/Scripts/Ships/Tests/TestHelpers/ShipTestBase.cs
  • Assets/Scripts/Ships/Tests/ModuleDestructionThresholdTests.cs
  • Assets/Scripts/Ships/Tests/ShipCrewAssignmentTests.cs
  • Assets/Scripts/Ships/Tests/ModuleConnectionTests.cs
  • Assets/Scripts/Ships/Tests/ShipSnapshotServiceTests.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/Utils.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/TestContainerFactory.cs
  • Assets/Scripts/Ships/Tests/ShipDestructionJunkTests.cs
  • Assets/Scripts/Ships/Tests/ShipDestroyAllModulesTests.cs
  • Assets/Scripts/Ships/Tests/ShipDisconnectionTests.cs
  • Assets/Scripts/Ships/Tests/ShipGameplayMovementTests.cs
  • Assets/Scripts/UI/MainGame/ShipStatusPanel.uxml
  • Assets/Scripts/Ships/Tests/ShipControlAllocatorThrustTests.cs
  • Assets/Scripts/Ships/Tests/ModuleJointLifecycleTests.cs

📝 Walkthrough

Walkthrough

Ship 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.

Changes

Horizontal lateral movement input feature

Layer / File(s) Summary
Ship engine-force contracts for horizontal input
Assets/Scripts/Ships/Ship.cs
Ship adds PendingHorizontalInput field and updates ApplyEngineForces(forwardInput, horizontalInput, turnInput, ...) and ApplyEngineForcesForTesting(...) to accept lateral control input.
Player and AI input mapping updates
Assets/Scripts/Ships/PlayerShip.cs, Assets/Scripts/Ships/AIShip.cs
PlayerShip reads Horizontal axis into PendingHorizontalInput and Roll axis into PendingTurnInput; AIShip clears horizontal input and forwards the new parameter to ApplyEngineForces.
SAS, direction solving, and control allocation with lateral force
Assets/Scripts/Ships/Ship.cs, Assets/Scripts/Ships/Systems/Gimbal/SasTurnInputResolver.cs, Assets/Scripts/Ships/Systems/Gimbal/EngineDirectionSolver.cs, Assets/Scripts/Ships/Systems/Gimbal/ControlAllocator.cs
SasTurnInputResolver.ResolveTurnInput and CalculateThrustCompensationTurnInput accept horizontalInput and check both forward and horizontal for turn-release conditions. EngineDirectionSolver introduces GetShipRight(shipForward) and incorporates lateral thrust into desired engine directions. ControlAllocator computes 2D requested force combining forward and lateral components, scaling by available thrust capacity.

Tests and test infrastructure alignment

Layer / File(s) Summary
Shared test container and helper utilities
Assets/Scripts/Ships/Tests/TestHelpers/TestContainerFactory.cs, Assets/Scripts/Ships/Tests/TestHelpers/ShipTestBase.cs, Assets/Scripts/Ships/Tests/TestHelpers/SmallMovableShipTestFactory.cs, Assets/Scripts/Ships/Tests/TestHelpers/Utils.cs, Assets/Scripts/Ships/Tests/TestHelpers/Utils.cs.meta
TestContainerFactory.CreateTestContainer() becomes parameterless, test base setup calls it without TestRoot.transform, small ship factory calls container.InjectGameObject(shipGo), and new Utils.SimulateForSeconds(float, Action) helper supports fixed-step test simulation.
Ship test setup injection sweep
Assets/Scripts/Ships/Tests/ModuleConnectionTests.cs, Assets/Scripts/Ships/Tests/ModuleDestructionThresholdTests.cs, Assets/Scripts/Ships/Tests/ModuleJointLifecycleTests.cs, Assets/Scripts/Ships/Tests/ShipCrewAssignmentTests.cs, Assets/Scripts/Ships/Tests/ShipDestroyAllModulesTests.cs, Assets/Scripts/Ships/Tests/ShipDestructionJunkTests.cs, Assets/Scripts/Ships/Tests/ShipDisconnectionTests.cs, Assets/Scripts/Ships/Tests/ShipSnapshotServiceTests.cs
Multiple test helpers now call Container.InjectGameObject(shipGo) immediately after wiring the ship, ensuring DI container visibility during test execution. File-structure braces are cleaned up where touched.
Control and movement test behavior updates
Assets/Scripts/Ships/Tests/TestHelpers/MovableShipTestProxy.cs, Assets/Scripts/Ships/Tests/ShipControlAllocatorThrustTests.cs, Assets/Scripts/Ships/Tests/ShipGameplayMovementTests.cs
MovableShipTestProxy exposes HorizontalInput property and passes it to ApplyEngineForces. Thrust tests call ApplyEngineForcesForTesting with the new 4-argument layout and a new test asserts horizontal input produces ≥0.9 thrust ratio. Movement tests switch to Utils.SimulateForSeconds and SAS heading test splits simulation into two settle periods.

Module detachment explosion behavior

Layer / File(s) Summary
Detachment explosion timing and sampling
Assets/Scripts/Ships/Modules/Module.cs
DetachAllConnections spawns detachment explosions before connection removal. SpawnExplosionsOnDetachment now iterates all stored Vector2Int pixels per connection (previously only the first pixel) and applies spawn probability per pixel point.
Detachment explosion probability constant
Assets/Scripts/Core/Constants/GameplayConstants.cs
ChanceOfSpawningExplosionOnDetachingConnectionPoint raised from 0.1f to 0.3f.

HUD pause/settings overlay removal

Layer / File(s) Summary
Pause/settings overlay markup removal
Assets/Scripts/UI/MainGame/ShipStatusPanel.uxml
ShipStatusPanel UXML removes pauseOverlayTemplate and settingsOverlayTemplate definitions, and removes corresponding pause-overlay-host and settings-overlay-host container elements.
ShipStatusPanelController pause logic cleanup
Assets/Scripts/UI/MainGame/ShipStatusPanelController.cs
Controller removes PauseStateEventChannel field, pause overlay/UI initialization, pause state toggle and quit-to-main-menu helpers, and Escape key LateUpdate handler. Pointer-blocker registration and lifecycle (OnEnable/OnDisable) are narrowed to HUD and SAS elements only.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🚀 Horizontal thrusters fire!
Left and right, a finer desire,
Tests now inject with care,
Pause overlays fade to air,
Explosions bloom on detach—brighter fire! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Several out-of-scope changes detected: GameplayConstants explosion probability increased (0.1→0.3), Module.DetachAllConnections explosion spawn logic refactored, Module.SpawnExplosionsOnDetachment now iterates all pixel points, ShipStatusPanel pause/settings UI removed, and DI container injection added across 10+ test files. These changes are unrelated to the Q/E roll and A/D horizontal movement feature in issue #64. Isolate roll and horizontal input feature changes into a focused commit. Move out-of-scope changes (explosion probability, Module logic, UI, DI test refactoring) to separate pull requests for clarity and focused review.
Docstring Coverage ⚠️ Warning Docstring coverage is 8.47% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(ships): add roll' directly describes the main feature being added—roll input/control for ships, which is the primary change evident across player/AI ship input handling and gimbal control system updates.
Linked Issues check ✅ Passed All changes align with issue #64 requirements: Q/E now control roll via PendingTurnInput [multiple ship files], while A/D control horizontal/left-right movement via PendingHorizontalInput [Ship, PlayerShip, AIShip, gimbal systems]. Input mapping, physics application, and control allocation all updated consistently.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-roll

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
Assets/Scripts/Ships/Modules/Module.cs (1)

373-376: ⚡ Quick win

Use AsValueEnumerable() for the inner pixel list enumeration.

The inner from worldPoint in allConnectionsPoints skips ZLinq value enumeration and can reintroduce avoidable allocations in this hot path; wrap it with allConnectionsPoints.AsValueEnumerable().

As per coding guidelines, "Use ZLinq .AsValueEnumerable() instead of System.Linq for 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5e0e20d and e7c8a12.

⛔ Files ignored due to path filters (1)
  • ProjectSettings/InputManager.asset is excluded by !**/*.asset
📒 Files selected for processing (10)
  • Assets/Scripts/Core/Constants/GameplayConstants.cs
  • Assets/Scripts/Ships/AIShip.cs
  • Assets/Scripts/Ships/Modules/Module.cs
  • Assets/Scripts/Ships/PlayerShip.cs
  • Assets/Scripts/Ships/Ship.cs
  • Assets/Scripts/Ships/Systems/Gimbal/ControlAllocator.cs
  • Assets/Scripts/Ships/Systems/Gimbal/EngineDirectionSolver.cs
  • Assets/Scripts/Ships/Systems/Gimbal/SasTurnInputResolver.cs
  • Assets/Scripts/Ships/Tests/ShipControlAllocatorThrustTests.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/MovableShipTestProxy.cs

Comment thread Assets/Scripts/Ships/Modules/Module.cs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between e7c8a12 and 7f2e9c6.

⛔ Files ignored due to path filters (1)
  • Assets/Scenes/MainGame.unity is excluded by !**/*.unity
📒 Files selected for processing (22)
  • Assets/Scripts/Ships/Tests/ModuleConnectionTests.cs
  • Assets/Scripts/Ships/Tests/ModuleDestructionThresholdTests.cs
  • Assets/Scripts/Ships/Tests/ModuleJointLifecycleTests.cs
  • Assets/Scripts/Ships/Tests/ShipControlAllocatorThrustTests.cs
  • Assets/Scripts/Ships/Tests/ShipCrewAssignmentTests.cs
  • Assets/Scripts/Ships/Tests/ShipDestroyAllModulesTests.cs
  • Assets/Scripts/Ships/Tests/ShipDestructionJunkTests.cs
  • Assets/Scripts/Ships/Tests/ShipDisconnectionTests.cs
  • Assets/Scripts/Ships/Tests/ShipGameplayMovementTests.cs
  • Assets/Scripts/Ships/Tests/ShipSnapshotServiceTests.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/ShipTestBase.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/SmallMovableShipTestFactory.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/TestContainerFactory.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/TestModules.meta
  • Assets/Scripts/Ships/Tests/TestHelpers/TestModules/TestModule.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/TestModules/TestModule.cs.meta
  • Assets/Scripts/Ships/Tests/TestHelpers/TestModules/TestPowerModule.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/TestModules/TestPowerModule.cs.meta
  • Assets/Scripts/Ships/Tests/TestHelpers/Utils.cs
  • Assets/Scripts/Ships/Tests/TestHelpers/Utils.cs.meta
  • Assets/Scripts/UI/MainGame/ShipStatusPanel.uxml
  • Assets/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

Comment thread Assets/Scripts/Ships/Tests/ShipDestroyAllModulesTests.cs
@lmProgramming lmProgramming merged commit 85599ce into main Jun 10, 2026
3 checks passed
@lmProgramming lmProgramming deleted the feat/add-roll branch June 10, 2026 21: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.

add Q/E for roll and make A/D go left/right

1 participant