- Documentation
- Shared functions
- calculateEngineHandling
Function
calculateEngineHandling
Calculates which handling fields an engine would give in a model, without fitting it. It returns what setVehicleEngine would write into the vehicle, so it suits a preview in an engine shop.
Syntax
table calculateEngineHandling(int model, table spec [, float wear = 0, float extraMass = 0])Arguments
modelint- Vehicle model ID.
spectable- Engine table as in
setVehicleEngine. wearfloat, optional = 0- Wear 0..1.
extraMassfloat, optional = 0- Extra vehicle mass in kg (e.g. cargo).
Returns
Fields mass, turnMass, maxVelocity, engineAcceleration, engineInertia, engineType, numberOfGears, tractionMultiplier.
Example
local h = calculateEngineHandling(411, { power = 400 }, 0, 150)
outputDebugString("Vmax po swapie: " .. h.maxVelocity)
See also
setVehicleEngineFits a vehicle with an engine described by real-car parameters (power, torque, displacement, fuel, mass, gears) and calculates the handling fields from them: mass, top speed, acceleration, engine inertia, fuel type, number of gears and grip. An engine much stronger than the factory one reduces grip (wheelspin). Wear lowers power by up to 30%.nilrestores the factory engine. Good for tuning and engine-swap systems on RP servers.getVehiclePerformanceReturns a vehicle's performance in a player-friendly form: power in kW and HP, torque, mass, 0-100 km/h time and top speed. You can pass a vehicle (its engine and wear are used) or a model number, optionally with an engine to compare.