Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make engine torque/hp readings consistent with overlay #368

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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