local v=_Tune.Horsepower/100 local R=(((_Tune.Horsepower*(_TPsi*(_Tune.T_Efficiency/10)))/7.5)/2)/100 local E=(((_Tune.Horsepower*(_SPsi*(_Tune.S_Efficiency/10)))/7.5)/2)/100 local e=_Tune.PeakRPM/1000 local U=_Tune.PeakSharpness local Z=_Tune.CurveMult local a=_Tune.EqPoint/1000 function CurveN(R)R=R/1000 return(-(R-e)^2*math.min(v/e^2,Z^(e/v))+v)*(R-R^U/(U*e^(U-1)))end local F=CurveN(_Tune.PeakRPM)function CurveT(v)v=v/1000 return(-(v-e)^2*math.min(R/e^2,Z^(e/R))+R)*(v-v^U/(U*e^(U-1)))end local k=CurveT(_Tune.PeakRPM)function CurveS(v)v=v/1000 return(-(v-e)^2*math.min(E/e^2,Z^(e/E))+E)*(v-v^U/(U*e^(U-1)))end local B=CurveS(_Tune.PeakRPM)
--Engine Curve

local HP = _Tune.Horsepower / 100
local HP_T = ((_Tune.Horsepower * (_TPsi * (_Tune.T_Efficiency / 10)) / 7.5) / 2) / 100
local HP_S = ((_Tune.Horsepower * (_SPsi * (_Tune.S_Efficiency / 10)) / 7.5) / 2) / 100

local Peak = _Tune.PeakRPM / 1000
local Sharpness = _Tune.PeakSharpness
local CurveMult = _Tune.CurveMult
local EQ = _Tune.EqPoint / 1000

function CurveN(RPM)
	RPM = RPM / 1000
	return ((-(RPM - Peak) ^ 2) * math.min(HP / (Peak ^ 2), CurveMult ^ (Peak / HP)) + HP)
		* (RPM - ((RPM ^ Sharpness) / (Sharpness * Peak ^ (Sharpness - 1))))
end
local PeakCurveN = CurveN(_Tune.PeakRPM)

function CurveT(RPM)
	RPM = RPM / 1000
	return ((-(RPM - Peak) ^ 2) * math.min(HP_T / (Peak ^ 2), CurveMult ^ (Peak / HP_T)) + HP_T)
		* (RPM - ((RPM ^ Sharpness) / (Sharpness * Peak ^ (Sharpness - 1))))
end
local PeakCurveT = CurveT(_Tune.PeakRPM)

function CurveS(RPM)
	RPM = RPM / 1000
	return ((-(RPM - Peak) ^ 2) * math.min(HP_S / (Peak ^ 2), CurveMult ^ (Peak / HP_S)) + HP_S)
		* (RPM - ((RPM ^ Sharpness) / (Sharpness * Peak ^ (Sharpness - 1))))
end
local PeakCurveS = CurveS(_Tune.PeakRPM)
