@@ -84,6 +84,8 @@ void CLuaVehicleDefs::LoadFunctions()
8484 CLuaCFunctions::AddFunction (" setVehicleRespawnDelay" , SetVehicleRespawnDelay);
8585 CLuaCFunctions::AddFunction (" setVehicleIdleRespawnDelay" , SetVehicleIdleRespawnDelay);
8686 CLuaCFunctions::AddFunction (" setVehicleRespawnPosition" , SetVehicleRespawnPosition);
87+ CLuaCFunctions::AddFunction (" getVehicleRespawnPosition" , GetVehicleRespawnPosition);
88+ CLuaCFunctions::AddFunction (" getVehicleRespawnRotation" , GetVehicleRespawnRotation);
8789 CLuaCFunctions::AddFunction (" respawnVehicle" , RespawnVehicle);
8890 CLuaCFunctions::AddFunction (" resetVehicleExplosionTime" , ResetVehicleExplosionTime);
8991 CLuaCFunctions::AddFunction (" resetVehicleIdleTime" , ResetVehicleIdleTime);
@@ -248,7 +250,8 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM)
248250 lua_classvariable (luaVM, " overrideLights" , " setVehicleOverrideLights" , " getVehicleOverrideLights" );
249251 lua_classvariable (luaVM, " idleRespawnDelay" , " setVehicleIdleRespawnDelay" , NULL );
250252 lua_classvariable (luaVM, " respawnDelay" , " setVehicleRespawnDelay" , NULL );
251- lua_classvariable (luaVM, " respawnPosition" , " setVehicleRespawnPosition" , NULL );
253+ lua_classvariable (luaVM, " respawnPosition" , " setVehicleRespawnPosition" , " getVehicleRespawnPosition" , SetVehicleRespawnPosition, OOP_GetVehicleRespawnPosition);
254+ lua_classvariable (luaVM, " respawnRotation" , NULL , " getVehicleRespawnRotation" , NULL , OOP_GetVehicleRespawnRotation);
252255 lua_classvariable (luaVM, " onGround" , NULL , " isVehicleOnGround" );
253256 lua_classvariable (luaVM, " name" , NULL , " getVehicleName" );
254257 lua_classvariable (luaVM, " vehicleType" , NULL , " getVehicleType" );
@@ -2221,6 +2224,108 @@ int CLuaVehicleDefs::SetVehicleRespawnDelay(lua_State* luaVM)
22212224 return 1 ;
22222225}
22232226
2227+ int CLuaVehicleDefs::OOP_GetVehicleRespawnRotation (lua_State* luaVM)
2228+ {
2229+ CElement* pElement = NULL ;
2230+
2231+ CScriptArgReader argStream (luaVM);
2232+ argStream.ReadUserData (pElement);
2233+
2234+ if (!argStream.HasErrors ())
2235+ {
2236+ CVector vecRotationDegress;
2237+ if (CStaticFunctionDefinitions::GetVehicleRespawnRotation (pElement, vecRotationDegress))
2238+ {
2239+ lua_pushvector (luaVM, vecRotationDegress);
2240+
2241+ return 1 ;
2242+ }
2243+ }
2244+ else
2245+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
2246+
2247+ lua_pushboolean (luaVM, false );
2248+ return 1 ;
2249+ }
2250+
2251+ int CLuaVehicleDefs::OOP_GetVehicleRespawnPosition (lua_State* luaVM)
2252+ {
2253+ CElement* pElement = NULL ;
2254+
2255+ CScriptArgReader argStream (luaVM);
2256+ argStream.ReadUserData (pElement);
2257+
2258+ if (!argStream.HasErrors ())
2259+ {
2260+ CVector vecPosition;
2261+ if (CStaticFunctionDefinitions::GetVehicleRespawnPosition (pElement, vecPosition))
2262+ {
2263+ lua_pushvector (luaVM, vecPosition);
2264+
2265+ return 1 ;
2266+ }
2267+ }
2268+ else
2269+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
2270+
2271+ lua_pushboolean (luaVM, false );
2272+ return 1 ;
2273+ }
2274+
2275+ int CLuaVehicleDefs::GetVehicleRespawnRotation (lua_State* luaVM)
2276+ {
2277+ // float, float, float getVehicleRespawnRotation( vehicle theVehicle )
2278+ CElement* pElement = NULL ;
2279+
2280+ CScriptArgReader argStream (luaVM);
2281+ argStream.ReadUserData (pElement);
2282+
2283+ if (!argStream.HasErrors ())
2284+ {
2285+ CVector vecRotationDegress;
2286+ if (CStaticFunctionDefinitions::GetVehicleRespawnRotation (pElement, vecRotationDegress))
2287+ {
2288+ lua_pushnumber (luaVM, vecRotationDegress.fX );
2289+ lua_pushnumber (luaVM, vecRotationDegress.fY );
2290+ lua_pushnumber (luaVM, vecRotationDegress.fZ );
2291+
2292+ return 3 ;
2293+ }
2294+ }
2295+ else
2296+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
2297+
2298+ lua_pushboolean (luaVM, false );
2299+ return 1 ;
2300+ }
2301+
2302+ int CLuaVehicleDefs::GetVehicleRespawnPosition (lua_State* luaVM)
2303+ {
2304+ // float, float, float getVehicleRespawnPosition( vehicle theVehicle )
2305+ CElement* pElement = NULL ;
2306+
2307+ CScriptArgReader argStream (luaVM);
2308+ argStream.ReadUserData (pElement);
2309+
2310+ if (!argStream.HasErrors ())
2311+ {
2312+ CVector vecPosition;
2313+ if (CStaticFunctionDefinitions::GetVehicleRespawnPosition (pElement, vecPosition))
2314+ {
2315+ lua_pushnumber (luaVM, vecPosition.fX );
2316+ lua_pushnumber (luaVM, vecPosition.fY );
2317+ lua_pushnumber (luaVM, vecPosition.fZ );
2318+
2319+ return 3 ;
2320+ }
2321+ }
2322+ else
2323+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
2324+
2325+ lua_pushboolean (luaVM, false );
2326+ return 1 ;
2327+ }
2328+
22242329int CLuaVehicleDefs::SetVehicleRespawnPosition (lua_State* luaVM)
22252330{
22262331 CElement* pElement;
0 commit comments