@@ -2736,156 +2736,149 @@ int CLuaVehicleDefs::GetVehicleHandling(lua_State* luaVM)
27362736 return 1 ;
27372737 }
27382738
2739- if (const auto * const entry = pVehicle->GetHandlingData ())
2740- {
2741- lua_newtable (luaVM);
2739+ const auto * const entry = pVehicle->GetHandlingData ();
27422740
2743- lua_pushnumber (luaVM, entry->GetMass ());
2744- lua_setfield (luaVM, -2 , " mass" );
2745- 2746- lua_pushnumber (luaVM, entry->GetTurnMass ());
2747- lua_setfield (luaVM, -2 , " turnMass" );
2748- 2749- lua_pushnumber (luaVM, entry->GetDragCoeff ());
2750- lua_setfield (luaVM, -2 , " dragCoeff" );
2751- 2752- lua_createtable (luaVM, 3 , 0 );
2753- CVector vecCenter = entry->GetCenterOfMass ();
2754- lua_pushnumber (luaVM, 1 );
2755- lua_pushnumber (luaVM, vecCenter.fX );
2756- lua_settable (luaVM, -3 );
2757- lua_pushnumber (luaVM, 2 );
2758- lua_pushnumber (luaVM, vecCenter.fY );
2759- lua_settable (luaVM, -3 );
2760- lua_pushnumber (luaVM, 3 );
2761- lua_pushnumber (luaVM, vecCenter.fZ );
2762- lua_settable (luaVM, -3 );
2763- lua_setfield (luaVM, -2 , " centerOfMass" );
2764- 2765- lua_pushnumber (luaVM, entry->GetPercentSubmerged ());
2766- lua_setfield (luaVM, -2 , " percentSubmerged" );
2767- 2768- lua_pushnumber (luaVM, entry->GetTractionMultiplier ());
2769- lua_setfield (luaVM, -2 , " tractionMultiplier" );
2770- 2771- CHandlingEntry::eDriveType eDriveType = entry->GetCarDriveType ();
2772- if (eDriveType == CHandlingEntry::FWD)
2773- lua_pushstring (luaVM, " fwd" );
2774- else if (eDriveType == CHandlingEntry::RWD)
2775- lua_pushstring (luaVM, " rwd" );
2776- else if (eDriveType == CHandlingEntry::FOURWHEEL)
2777- lua_pushstring (luaVM, " awd" );
2778- else // What the ... (yeah, security)
2779- lua_pushnil (luaVM);
2780- lua_setfield (luaVM, -2 , " driveType" );
2781- CHandlingEntry::eEngineType eEngineType = entry->GetCarEngineType ();
2782- if (eEngineType == CHandlingEntry::PETROL)
2783- lua_pushstring (luaVM, " petrol" );
2784- else if (eEngineType == CHandlingEntry::DIESEL)
2785- lua_pushstring (luaVM, " diesel" );
2786- else if (eEngineType == CHandlingEntry::ELECTRIC)
2787- lua_pushstring (luaVM, " electric" );
2788- else
2789- lua_pushnil (luaVM);
2790- lua_setfield (luaVM, -2 , " engineType" );
2741+ lua_newtable (luaVM);
27912742
2792- lua_pushnumber (luaVM, entry->GetNumberOfGears ());
2793- lua_setfield (luaVM, -2 , " numberOfGears" );
2743+ lua_pushnumber (luaVM, entry->GetMass ());
2744+ lua_setfield (luaVM, -2 , " mass" );
2745+ 2746+ lua_pushnumber (luaVM, entry->GetTurnMass ());
2747+ lua_setfield (luaVM, -2 , " turnMass" );
2748+ 2749+ lua_pushnumber (luaVM, entry->GetDragCoeff ());
2750+ lua_setfield (luaVM, -2 , " dragCoeff" );
2751+ 2752+ lua_createtable (luaVM, 3 , 0 );
2753+ CVector vecCenter = entry->GetCenterOfMass ();
2754+ lua_pushnumber (luaVM, 1 );
2755+ lua_pushnumber (luaVM, vecCenter.fX );
2756+ lua_settable (luaVM, -3 );
2757+ lua_pushnumber (luaVM, 2 );
2758+ lua_pushnumber (luaVM, vecCenter.fY );
2759+ lua_settable (luaVM, -3 );
2760+ lua_pushnumber (luaVM, 3 );
2761+ lua_pushnumber (luaVM, vecCenter.fZ );
2762+ lua_settable (luaVM, -3 );
2763+ lua_setfield (luaVM, -2 , " centerOfMass" );
2764+ 2765+ lua_pushnumber (luaVM, entry->GetPercentSubmerged ());
2766+ lua_setfield (luaVM, -2 , " percentSubmerged" );
2767+ 2768+ lua_pushnumber (luaVM, entry->GetTractionMultiplier ());
2769+ lua_setfield (luaVM, -2 , " tractionMultiplier" );
2770+ 2771+ CHandlingEntry::eDriveType eDriveType = entry->GetCarDriveType ();
2772+ if (eDriveType == CHandlingEntry::FWD)
2773+ lua_pushstring (luaVM, " fwd" );
2774+ else if (eDriveType == CHandlingEntry::RWD)
2775+ lua_pushstring (luaVM, " rwd" );
2776+ else if (eDriveType == CHandlingEntry::FOURWHEEL)
2777+ lua_pushstring (luaVM, " awd" );
2778+ else // What the ... (yeah, security)
2779+ lua_pushnil (luaVM);
2780+ lua_setfield (luaVM, -2 , " driveType" );
2781+ CHandlingEntry::eEngineType eEngineType = entry->GetCarEngineType ();
2782+ if (eEngineType == CHandlingEntry::PETROL)
2783+ lua_pushstring (luaVM, " petrol" );
2784+ else if (eEngineType == CHandlingEntry::DIESEL)
2785+ lua_pushstring (luaVM, " diesel" );
2786+ else if (eEngineType == CHandlingEntry::ELECTRIC)
2787+ lua_pushstring (luaVM, " electric" );
2788+ else
2789+ lua_pushnil (luaVM);
2790+ lua_setfield (luaVM, -2 , " engineType" );
27942791
2795- lua_pushnumber (luaVM, entry->GetEngineAcceleration ());
2796- lua_setfield (luaVM, -2 , " engineAcceleration " );
2792+ lua_pushnumber (luaVM, entry->GetNumberOfGears ());
2793+ lua_setfield (luaVM, -2 , " numberOfGears " );
27972794
2798- lua_pushnumber (luaVM, entry->GetEngineInertia ());
2799- lua_setfield (luaVM, -2 , " engineInertia " );
2795+ lua_pushnumber (luaVM, entry->GetEngineAcceleration ());
2796+ lua_setfield (luaVM, -2 , " engineAcceleration " );
28002797
2801- lua_pushnumber (luaVM, entry->GetMaxVelocity ());
2802- lua_setfield (luaVM, -2 , " maxVelocity " );
2798+ lua_pushnumber (luaVM, entry->GetEngineInertia ());
2799+ lua_setfield (luaVM, -2 , " engineInertia " );
28032800
2804- lua_pushnumber (luaVM, entry->GetBrakeDeceleration ());
2805- lua_setfield (luaVM, -2 , " brakeDeceleration " );
2801+ lua_pushnumber (luaVM, entry->GetMaxVelocity ());
2802+ lua_setfield (luaVM, -2 , " maxVelocity " );
28062803
2807- lua_pushnumber (luaVM, entry->GetBrakeBias ());
2808- lua_setfield (luaVM, -2 , " brakeBias " );
2804+ lua_pushnumber (luaVM, entry->GetBrakeDeceleration ());
2805+ lua_setfield (luaVM, -2 , " brakeDeceleration " );
28092806
2810- lua_pushboolean (luaVM, entry->GetABS ());
2811- lua_setfield (luaVM, -2 , " ABS " );
2807+ lua_pushnumber (luaVM, entry->GetBrakeBias ());
2808+ lua_setfield (luaVM, -2 , " brakeBias " );
28122809
2813- lua_pushnumber (luaVM, entry->GetSteeringLock ());
2814- lua_setfield (luaVM, -2 , " steeringLock " );
2810+ lua_pushboolean (luaVM, entry->GetABS ());
2811+ lua_setfield (luaVM, -2 , " ABS " );
28152812
2816- lua_pushnumber (luaVM, entry->GetTractionLoss ());
2817- lua_setfield (luaVM, -2 , " tractionLoss " );
2813+ lua_pushnumber (luaVM, entry->GetSteeringLock ());
2814+ lua_setfield (luaVM, -2 , " steeringLock " );
28182815
2819- lua_pushnumber (luaVM, entry->GetTractionBias ());
2820- lua_setfield (luaVM, -2 , " tractionBias " );
2816+ lua_pushnumber (luaVM, entry->GetTractionLoss ());
2817+ lua_setfield (luaVM, -2 , " tractionLoss " );
28212818
2822- lua_pushnumber (luaVM, entry->GetSuspensionForceLevel ());
2823- lua_setfield (luaVM, -2 , " suspensionForceLevel " );
2819+ lua_pushnumber (luaVM, entry->GetTractionBias ());
2820+ lua_setfield (luaVM, -2 , " tractionBias " );
28242821
2825- lua_pushnumber (luaVM, entry->GetSuspensionDamping ());
2826- lua_setfield (luaVM, -2 , " suspensionDamping " );
2822+ lua_pushnumber (luaVM, entry->GetSuspensionForceLevel ());
2823+ lua_setfield (luaVM, -2 , " suspensionForceLevel " );
28272824
2828- lua_pushnumber (luaVM, entry->GetSuspensionHighSpeedDamping ());
2829- lua_setfield (luaVM, -2 , " suspensionHighSpeedDamping " );
2825+ lua_pushnumber (luaVM, entry->GetSuspensionDamping ());
2826+ lua_setfield (luaVM, -2 , " suspensionDamping " );
28302827
2831- lua_pushnumber (luaVM, entry->GetSuspensionUpperLimit ());
2832- lua_setfield (luaVM, -2 , " suspensionUpperLimit " );
2828+ lua_pushnumber (luaVM, entry->GetSuspensionHighSpeedDamping ());
2829+ lua_setfield (luaVM, -2 , " suspensionHighSpeedDamping " );
28332830
2834- lua_pushnumber (luaVM, entry->GetSuspensionLowerLimit ());
2835- lua_setfield (luaVM, -2 , " suspensionLowerLimit " );
2831+ lua_pushnumber (luaVM, entry->GetSuspensionUpperLimit ());
2832+ lua_setfield (luaVM, -2 , " suspensionUpperLimit " );
28362833
2837- lua_pushnumber (luaVM, entry->GetSuspensionFrontRearBias ());
2838- lua_setfield (luaVM, -2 , " suspensionFrontRearBias " );
2834+ lua_pushnumber (luaVM, entry->GetSuspensionLowerLimit ());
2835+ lua_setfield (luaVM, -2 , " suspensionLowerLimit " );
28392836
2840- lua_pushnumber (luaVM, entry->GetSuspensionAntiDiveMultiplier ());
2841- lua_setfield (luaVM, -2 , " suspensionAntiDiveMultiplier " );
2837+ lua_pushnumber (luaVM, entry->GetSuspensionFrontRearBias ());
2838+ lua_setfield (luaVM, -2 , " suspensionFrontRearBias " );
28422839
2843- lua_pushnumber (luaVM, entry->GetCollisionDamageMultiplier ());
2844- lua_setfield (luaVM, -2 , " collisionDamageMultiplier " );
2840+ lua_pushnumber (luaVM, entry->GetSuspensionAntiDiveMultiplier ());
2841+ lua_setfield (luaVM, -2 , " suspensionAntiDiveMultiplier " );
28452842
2846- lua_pushnumber (luaVM, entry->GetSeatOffsetDistance ());
2847- lua_setfield (luaVM, -2 , " seatOffsetDistance " );
2843+ lua_pushnumber (luaVM, entry->GetCollisionDamageMultiplier ());
2844+ lua_setfield (luaVM, -2 , " collisionDamageMultiplier " );
28482845
2849- lua_pushnumber (luaVM, entry->GetHandlingFlags ());
2850- lua_setfield (luaVM, -2 , " handlingFlags " );
2846+ lua_pushnumber (luaVM, entry->GetSeatOffsetDistance ());
2847+ lua_setfield (luaVM, -2 , " seatOffsetDistance " );
28512848
2852- lua_pushnumber (luaVM, entry->GetModelFlags ());
2853- lua_setfield (luaVM, -2 , " modelFlags " );
2849+ lua_pushnumber (luaVM, entry->GetHandlingFlags ());
2850+ lua_setfield (luaVM, -2 , " handlingFlags " );
28542851
2855- lua_pushnumber (luaVM, entry->GetMonetary ());
2856- lua_setfield (luaVM, -2 , " monetary " );
2852+ lua_pushnumber (luaVM, entry->GetModelFlags ());
2853+ lua_setfield (luaVM, -2 , " modelFlags " );
28572854
2858- CHandlingEntry::eLightType eHeadType = entry->GetHeadLight ();
2859- if (eHeadType == CHandlingEntry::LONG)
2860- lua_pushstring (luaVM, " long" );
2861- else if (eHeadType == CHandlingEntry::SMALL)
2862- lua_pushstring (luaVM, " small" );
2863- else if (eHeadType == CHandlingEntry::BIG)
2864- lua_pushstring (luaVM, " big" );
2865- else
2866- lua_pushnil (luaVM);
2867- lua_setfield (luaVM, -2 , " headLight" );
2868- 2869- CHandlingEntry::eLightType eTailType = entry->GetTailLight ();
2870- if (eTailType == CHandlingEntry::LONG)
2871- lua_pushstring (luaVM, " long" );
2872- else if (eTailType == CHandlingEntry::SMALL)
2873- lua_pushstring (luaVM, " small" );
2874- else if (eTailType == CHandlingEntry::BIG)
2875- lua_pushstring (luaVM, " big" );
2876- else
2877- lua_pushnil (luaVM);
2878- lua_setfield (luaVM, -2 , " tailLight" );
2855+ lua_pushnumber (luaVM, entry->GetMonetary ());
2856+ lua_setfield (luaVM, -2 , " monetary" );
28792857
2880- lua_pushnumber (luaVM, entry->GetAnimGroup ());
2881- lua_setfield (luaVM, -2 , " animGroup" );
2882- }
2858+ CHandlingEntry::eLightType eHeadType = entry->GetHeadLight ();
2859+ if (eHeadType == CHandlingEntry::LONG)
2860+ lua_pushstring (luaVM, " long" );
2861+ else if (eHeadType == CHandlingEntry::SMALL)
2862+ lua_pushstring (luaVM, " small" );
2863+ else if (eHeadType == CHandlingEntry::BIG)
2864+ lua_pushstring (luaVM, " big" );
28832865 else
2884- {
2885- argStream.SetCustomError (" Invalid handling data" );
2886- m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
2887- lua_pushboolean (luaVM, false );
2888- }
2866+ lua_pushnil (luaVM);
2867+ lua_setfield (luaVM, -2 , " headLight" );
2868+ 2869+ CHandlingEntry::eLightType eTailType = entry->GetTailLight ();
2870+ if (eTailType == CHandlingEntry::LONG)
2871+ lua_pushstring (luaVM, " long" );
2872+ else if (eTailType == CHandlingEntry::SMALL)
2873+ lua_pushstring (luaVM, " small" );
2874+ else if (eTailType == CHandlingEntry::BIG)
2875+ lua_pushstring (luaVM, " big" );
2876+ else
2877+ lua_pushnil (luaVM);
2878+ lua_setfield (luaVM, -2 , " tailLight" );
2879+ 2880+ lua_pushnumber (luaVM, entry->GetAnimGroup ());
2881+ lua_setfield (luaVM, -2 , " animGroup" );
28892882 return 1 ;
28902883 }
28912884 else
@@ -3017,6 +3010,7 @@ int CLuaVehicleDefs::GetOriginalHandling(lua_State* luaVM)
30173010 lua_setfield (luaVM, -2 , " tailLight" );
30183011 lua_pushnumber (luaVM, entry->GetAnimGroup ());
30193012 lua_setfield (luaVM, -2 , " animGroup" );
3013+ 30203014 return 1 ;
30213015 }
30223016 else
0 commit comments