From a2171c80a5f21c889a025b5a1441fab3d2ae3c2b Mon Sep 17 00:00:00 2001 From: AlexisinGit Date: Thu, 28 Aug 2025 05:50:28 -0700 Subject: [PATCH] fix: CrewShipFusion bug with SubroutineIndex (#2714) Crewship fusion didn't agree with player's choice. Expected results: ![image.png](/attachments/a61c96c7-1624-4dd4-9e4c-c6199d5af95a) What I actually get: ![image.png](/attachments/cf58aed4-18d9-4d97-8894-6c53762f366d) ``` export interface ICrewShipComponentFingerprint extends IInnateDamageFingerprint { SubroutineIndex?: number; } ``` The interface already demand SubroutineIndex to exist, so it would be unnecessary to check. Meanwhile, inferiorFingerprint.SubroutineIndex could be 0, 1, 2... and might be handled incorrectly as true/ false. Co-authored-by: AlexisinGit <136088944+AlexisinGit@users.noreply.github.com> Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2714 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AlexisinGit Co-committed-by: AlexisinGit --- src/controllers/api/crewShipFusionController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/api/crewShipFusionController.ts b/src/controllers/api/crewShipFusionController.ts index c0981f4f..a7b697c3 100644 --- a/src/controllers/api/crewShipFusionController.ts +++ b/src/controllers/api/crewShipFusionController.ts @@ -81,7 +81,7 @@ export const crewShipFusionController: RequestHandler = async (req, res) => { const newFval = (newPerc - rangeA[0]) / (rangeA[1] - rangeA[0]); buffA.Value = Math.trunc(newFval * 0x3fffffff); } - if (inferiorFingerprint.SubroutineIndex) { + if (inferiorFingerprint.SubroutineIndex !== undefined) { const useSuperiorSubroutine = tierA < tierB ? !payload.UseSubroutineA : payload.UseSubroutineA; if (!useSuperiorSubroutine) { fingerprint.SubroutineIndex = inferiorFingerprint.SubroutineIndex;