chore: remove dead SpaceZone combat-damage duplicates (superseded by SpaceCombatSystem, S1144) #675

Closed
opened 2026-07-17 18:50:59 +00:00 by spikerj · 1 comment
Owner

Found via S1144 (unused private member) triage. SpaceZone had private ApplyDamageToShip / ApplyDamageToSpacecraft methods that are never called — dead duplicates left over from a refactor.

The LIVE combat damage path is SpaceCombatSystem.ApplyDamageToShip/ApplyDamageToSpacecraft (public, invoked from SpaceCombatSystem's projectile-hit handling, covered by SpaceCombatSystemBroadcastTests and benchmarks). The SpaceZone private copies were superseded and orphaned.

Why it matters: two implementations of the same combat logic is a maintenance hazard — a developer could edit the dead SpaceZone copy expecting it to take effect (it never runs), a silent no-op bug. Confirmed the methods are unreferenced and removing them leaves the GameServer + GameServer.Tests building clean (their helpers — GetDamageMultiplier/GetDefaultHullResistance/GetFirstFunctionalModule — belong to other types and are still used by live SpaceZone code, so no cascade).

Removed the two dead methods (~160 lines). No behavior change (they never executed). SonarQube rule csharpsquid:S1144.

Found via S1144 (unused private member) triage. SpaceZone had private ApplyDamageToShip / ApplyDamageToSpacecraft methods that are never called — dead duplicates left over from a refactor. The LIVE combat damage path is SpaceCombatSystem.ApplyDamageToShip/ApplyDamageToSpacecraft (public, invoked from SpaceCombatSystem's projectile-hit handling, covered by SpaceCombatSystemBroadcastTests and benchmarks). The SpaceZone private copies were superseded and orphaned. **Why it matters:** two implementations of the same combat logic is a maintenance hazard — a developer could edit the dead SpaceZone copy expecting it to take effect (it never runs), a silent no-op bug. Confirmed the methods are unreferenced and removing them leaves the GameServer + GameServer.Tests building clean (their helpers — GetDamageMultiplier/GetDefaultHullResistance/GetFirstFunctionalModule — belong to other types and are still used by live SpaceZone code, so no cascade). Removed the two dead methods (~160 lines). No behavior change (they never executed). SonarQube rule csharpsquid:S1144.
Author
Owner

Resolved in spikersoft-backend PR #375 (merged to master). Removed the dead SpaceZone ApplyDamageToShip/ApplyDamageToSpacecraft duplicates (live path is SpaceCombatSystem); ~160 lines, no behavior change. Closing.

Resolved in spikersoft-backend PR #375 (merged to master). Removed the dead SpaceZone ApplyDamageToShip/ApplyDamageToSpacecraft duplicates (live path is SpaceCombatSystem); ~160 lines, no behavior change. Closing.
Sign in to join this conversation.