Skip to content

Commit

Permalink
Merge pull request #368 from CheezusChrust/engine-consistency
Browse files Browse the repository at this point in the history
Make engine torque/hp readings consistent with overlay
  • Loading branch information
Stooberton authored Aug 18, 2023
2 parents b5aae0c + b1eac45 commit 5ce7b37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lua/acf/menu/items_cl/engines.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ local function UpdateEngineStats(Label, Data)
local MinPower = RPM.PeakMin
local MaxPower = RPM.PeakMax
local Mass = ACF.GetProperMass(Data.Mass)
local Torque = math.floor(Data.Torque)
local TorqueFeet = math.floor(Data.Torque * 0.73)
local Torque = math.Round(Data.Torque)
local TorqueFeet = math.Round(Data.Torque * 0.73)
local Type = EngineTypes.Get(Data.Type)
local Efficiency = Type.Efficiency * GetEfficiencyMult()
local FuelList = ""
Expand All @@ -58,7 +58,7 @@ local function UpdateEngineStats(Label, Data)
Data.Fuel[K] = Fuel -- TODO: Replace once engines use the proper class functions
end

local Power = PowerText:format(Torque, TorqueFeet, PeakTqRPM, math.floor(PeakkW), math.floor(PeakkW * 1.34), PeakkWRPM)
local Power = PowerText:format(Torque, TorqueFeet, PeakTqRPM, math.Round(PeakkW), math.Round(PeakkW * 1.34), PeakkWRPM)

Label:SetText(RPMText:format(RPM.Idle, MinPower, MaxPower, RPM.Limit, Mass, FuelList, Power))
end
Expand Down
6 changes: 3 additions & 3 deletions lua/entities/acf_engine/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ function ENT:UpdateOutputs()
local Power = self.Torque * self.FlyRPM / 9548.8

WireLib.TriggerOutput(self, "Fuel Use", self.FuelUsage)
WireLib.TriggerOutput(self, "Torque", math.floor(self.Torque))
WireLib.TriggerOutput(self, "Power", math.floor(Power))
WireLib.TriggerOutput(self, "RPM", math.floor(self.FlyRPM))
WireLib.TriggerOutput(self, "Torque", Round(self.Torque))
WireLib.TriggerOutput(self, "Power", Round(Power))
WireLib.TriggerOutput(self, "RPM", Round(self.FlyRPM))
end

local Text = "%s\n\n%s\nPower: %s kW / %s hp\nTorque: %s Nm / %s ft-lb\nPowerband: %s - %s RPM\nRedline: %s RPM"
Expand Down

0 comments on commit 5ce7b37

Please sign in to comment.