@@ -189,9 +189,9 @@ void CLuaVehicleDefs::AddClass ( lua_State* luaVM )
189
189
lua_classfunction ( luaVM, " getSirenParams" , " getVehicleSirenParams" );
190
190
lua_classfunction ( luaVM, " getSirens" , " getVehicleSirens" );
191
191
lua_classfunction ( luaVM, " getSirensOn" , " getVehicleSirensOn" );
192
- lua_classfunction ( luaVM, " getComponentPosition" , " getVehicleComponentPosition " );
192
+ lua_classfunction ( luaVM, " getComponentPosition" , OOP_GetVehicleComponentPosition );
193
193
lua_classfunction ( luaVM, " getComponentVisible" , " getVehicleComponentVisible" );
194
- lua_classfunction ( luaVM, " getComponentRotation" , " getVehicleComponentRotation " );
194
+ lua_classfunction ( luaVM, " getComponentRotation" , OOP_GetVehicleComponentRotation );
195
195
lua_classfunction ( luaVM, " getUpgrades" , " getVehicleUpgrades" );
196
196
lua_classfunction ( luaVM, " getUpgradeSlotName" , " getVehicleUpgradeSlotName" );
197
197
lua_classfunction ( luaVM, " getCompatibleUpgrades" , " getVehicleCompatibleUpgrades" );
@@ -3040,7 +3040,6 @@ int CLuaVehicleDefs::SetVehicleComponentPosition ( lua_State* luaVM )
3040
3040
return 1 ;
3041
3041
}
3042
3042
3043
-
3044
3043
int CLuaVehicleDefs::GetVehicleComponentPosition ( lua_State* luaVM )
3045
3044
{
3046
3045
// float, float, float getVehicleComponentPosition ( vehicle theVehicle, string theComponent [, string base = "root"] )
@@ -3071,6 +3070,34 @@ int CLuaVehicleDefs::GetVehicleComponentPosition ( lua_State* luaVM )
3071
3070
return 1 ;
3072
3071
}
3073
3072
3073
+ int CLuaVehicleDefs::OOP_GetVehicleComponentPosition ( lua_State* luaVM )
3074
+ {
3075
+ // float, float, float getVehicleComponentPosition ( vehicle theVehicle, string theComponent [, string base = "root"] )
3076
+ SString strComponent;
3077
+ CClientVehicle * pVehicle = NULL ;
3078
+ EComponentBaseType outputBase;
3079
+
3080
+ CScriptArgReader argStream ( luaVM );
3081
+ argStream.ReadUserData ( pVehicle );
3082
+ argStream.ReadString ( strComponent );
3083
+ argStream.ReadEnumString ( outputBase, EComponentBase::ROOT );
3084
+
3085
+ if ( !argStream.HasErrors () )
3086
+ {
3087
+ CVector vecPosition;
3088
+ if ( pVehicle->GetComponentPosition ( strComponent, vecPosition, outputBase ) )
3089
+ {
3090
+ lua_pushvector ( luaVM, vecPosition );
3091
+ return 1 ;
3092
+ }
3093
+ }
3094
+ else
3095
+ m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
3096
+
3097
+ lua_pushboolean ( luaVM, false );
3098
+ return 1 ;
3099
+ }
3100
+
3074
3101
int CLuaVehicleDefs::SetVehicleComponentRotation ( lua_State* luaVM )
3075
3102
{
3076
3103
// bool setVehicleComponentRotation ( vehicle theVehicle, string theComponent, float rotX, float rotY, float rotZ [, string base = "parent"] )
@@ -3132,6 +3159,36 @@ int CLuaVehicleDefs::GetVehicleComponentRotation ( lua_State* luaVM )
3132
3159
return 1 ;
3133
3160
}
3134
3161
3162
+ int CLuaVehicleDefs::OOP_GetVehicleComponentRotation ( lua_State* luaVM )
3163
+ {
3164
+ // float, float, float getVehicleComponentRotation ( vehicle theVehicle, string theComponent [, string base = "parent"] )
3165
+ SString strComponent;
3166
+ CClientVehicle * pVehicle = NULL ;
3167
+ EComponentBaseType outputBase;
3168
+
3169
+ CScriptArgReader argStream ( luaVM );
3170
+ argStream.ReadUserData ( pVehicle );
3171
+ argStream.ReadString ( strComponent );
3172
+ argStream.ReadEnumString ( outputBase, EComponentBase::PARENT );
3173
+
3174
+ if ( !argStream.HasErrors () )
3175
+ {
3176
+ CVector vecRotation;
3177
+ if ( pVehicle->GetComponentRotation ( strComponent, vecRotation, outputBase ) )
3178
+ {
3179
+ // Script uses degrees
3180
+ ConvertRadiansToDegrees ( vecRotation );
3181
+ lua_pushvector ( luaVM, vecRotation );
3182
+ return 1 ;
3183
+ }
3184
+ }
3185
+ else
3186
+ m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
3187
+
3188
+ lua_pushboolean ( luaVM, false );
3189
+ return 1 ;
3190
+ }
3191
+
3135
3192
int CLuaVehicleDefs::ResetVehicleComponentPosition ( lua_State* luaVM )
3136
3193
{
3137
3194
CScriptArgReader argStream ( luaVM );
0 commit comments