function curve(t)t=t/1000 return(-(t-PeakRPM)^2*math.min(HP/PeakRPM^2,CurveMult^(PeakRPM/HP))+HP)*(t-t^Sharpness/(Sharpness*PeakRPM)^(Sharpness-1))end local t=curve(_Tune.PeakRPM)local J=math.max(curve(RPM)/(t/HP),0)


function curve(RPM)
	RPM=RPM/1000
	return ((-(RPM-PeakRPM)^2)*math.min(HP/(PeakRPM^2),CurveMult^(PeakRPM/HP))+HP)*(RPM-((RPM^Sharpness)/((Sharpness*PeakRPM)^(Sharpness-1))))
end

local PeakCurve = curve(_Tune.PeakRPM)
local Horsepower = math.max(curve(RPM)/(PeakCurve/HP),0)
