From 2b67a22485e93f09c347bb025b2ab312a88ec315 Mon Sep 17 00:00:00 2001 From: 20kdc Date: Mon, 4 Oct 2021 01:58:54 +0100 Subject: [PATCH] Stop casting AME energy into int because it underflows. (#4762) --- Content.Server/AME/AMENodeGroup.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Content.Server/AME/AMENodeGroup.cs b/Content.Server/AME/AMENodeGroup.cs index c652095c3c..2f998742f9 100644 --- a/Content.Server/AME/AMENodeGroup.cs +++ b/Content.Server/AME/AMENodeGroup.cs @@ -102,7 +102,7 @@ namespace Content.Server.AME } } - public int InjectFuel(int fuel, out bool overloading) + public float InjectFuel(int fuel, out bool overloading) { overloading = false; if(fuel > 0 && CoreCount > 0) @@ -137,7 +137,8 @@ namespace Content.Server.AME } } // Note the float conversions. The maths will completely fail if not done using floats. - return (int) ((((float) fuel) / CoreCount) * fuel * 20000); + // Oh, and don't ever stuff the result of this in an int. Seriously. + return (((float) fuel) / CoreCount) * fuel * 20000; } return 0; }