@@ -84,6 +84,7 @@ void CLuaVehicleDefs::LoadFunctions()
84
84
CLuaCFunctions::AddFunction (" setVehicleRespawnDelay" , SetVehicleRespawnDelay);
85
85
CLuaCFunctions::AddFunction (" setVehicleIdleRespawnDelay" , SetVehicleIdleRespawnDelay);
86
86
CLuaCFunctions::AddFunction (" setVehicleRespawnPosition" , SetVehicleRespawnPosition);
87
+ CLuaCFunctions::AddFunction (" setVehicleRespawnRotation" , SetVehicleRespawnRotation);
87
88
CLuaCFunctions::AddFunction (" getVehicleRespawnPosition" , GetVehicleRespawnPosition);
88
89
CLuaCFunctions::AddFunction (" getVehicleRespawnRotation" , GetVehicleRespawnRotation);
89
90
CLuaCFunctions::AddFunction (" respawnVehicle" , RespawnVehicle);
@@ -186,6 +187,8 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM)
186
187
lua_classfunction (luaVM, " getWheelStates" , " getVehicleWheelStates" );
187
188
lua_classfunction (luaVM, " getDoorOpenRatio" , " getVehicleDoorOpenRatio" );
188
189
lua_classfunction (luaVM, " getHandling" , " getVehicleHandling" );
190
+ lua_classfunction (luaVM, " getRespawnPosition" , " getVehicleRespawnPosition" );
191
+ lua_classfunction (luaVM, " getRespawnRotation" , " getVehicleRespawnRotation" );
189
192
190
193
lua_classfunction (luaVM, " setColor" , " setVehicleColor" );
191
194
lua_classfunction (luaVM, " setDamageProof" , " setVehicleDamageProof" );
@@ -202,6 +205,7 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM)
202
205
lua_classfunction (luaVM, " setPanelState" , " setVehiclePanelState" );
203
206
lua_classfunction (luaVM, " setRespawnDelay" , " setVehicleRespawnDelay" );
204
207
lua_classfunction (luaVM, " setRespawnPosition" , " setVehicleRespawnPosition" );
208
+ lua_classfunction (luaVM, " setRespawnRotation" , " setVehicleRespawnRotation" );
205
209
lua_classfunction (luaVM, " setSirensOn" , " setVehicleSirensOn" );
206
210
lua_classfunction (luaVM, " setTurretPosition" , " setVehicleTurretPosition" );
207
211
lua_classfunction (luaVM, " setDoorOpenRatio" , " setVehicleDoorOpenRatio" );
@@ -251,7 +255,7 @@ void CLuaVehicleDefs::AddClass(lua_State* luaVM)
251
255
lua_classvariable (luaVM, " idleRespawnDelay" , " setVehicleIdleRespawnDelay" , NULL );
252
256
lua_classvariable (luaVM, " respawnDelay" , " setVehicleRespawnDelay" , NULL );
253
257
lua_classvariable (luaVM, " respawnPosition" , " setVehicleRespawnPosition" , " getVehicleRespawnPosition" , SetVehicleRespawnPosition, OOP_GetVehicleRespawnPosition);
254
- lua_classvariable (luaVM, " respawnRotation" , NULL , " getVehicleRespawnRotation" , NULL , OOP_GetVehicleRespawnRotation);
258
+ lua_classvariable (luaVM, " respawnRotation" , " setVehicleRespawnRotation " , " getVehicleRespawnRotation" , SetVehicleRespawnRotation , OOP_GetVehicleRespawnRotation);
255
259
lua_classvariable (luaVM, " onGround" , NULL , " isVehicleOnGround" );
256
260
lua_classvariable (luaVM, " name" , NULL , " getVehicleName" );
257
261
lua_classvariable (luaVM, " vehicleType" , NULL , " getVehicleType" );
@@ -2299,6 +2303,47 @@ int CLuaVehicleDefs::GetVehicleRespawnRotation(lua_State* luaVM)
2299
2303
return 1 ;
2300
2304
}
2301
2305
2306
+ int CLuaVehicleDefs::SetVehicleRespawnPosition (lua_State* luaVM)
2307
+ {
2308
+ CElement* pElement;
2309
+ CVector vecPosition;
2310
+
2311
+ CScriptArgReader argStream (luaVM);
2312
+ argStream.ReadUserData (pElement);
2313
+ argStream.ReadVector3D (vecPosition);
2314
+
2315
+ if (argStream.NextIsVector3D ())
2316
+ {
2317
+ CVector vecRotation;
2318
+ argStream.ReadVector3D (vecRotation);
2319
+
2320
+ if (!argStream.HasErrors ())
2321
+ {
2322
+ if (CStaticFunctionDefinitions::SetVehicleRespawnPosition (pElement, vecPosition) &&
2323
+ CStaticFunctionDefinitions::SetVehicleRespawnRotation (pElement, vecRotation))
2324
+ {
2325
+ lua_pushboolean (luaVM, true );
2326
+ return 1 ;
2327
+ }
2328
+ }
2329
+ else
2330
+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
2331
+ }
2332
+ else if (!argStream.HasErrors ())
2333
+ {
2334
+ if (CStaticFunctionDefinitions::SetVehicleRespawnPosition (pElement, vecPosition))
2335
+ {
2336
+ lua_pushboolean (luaVM, true );
2337
+ return 1 ;
2338
+ }
2339
+ }
2340
+ else
2341
+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
2342
+
2343
+ lua_pushboolean (luaVM, false );
2344
+ return 1 ;
2345
+ }
2346
+
2302
2347
int CLuaVehicleDefs::GetVehicleRespawnPosition (lua_State* luaVM)
2303
2348
{
2304
2349
// float, float, float getVehicleRespawnPosition( vehicle theVehicle )
@@ -2326,20 +2371,18 @@ int CLuaVehicleDefs::GetVehicleRespawnPosition(lua_State* luaVM)
2326
2371
return 1 ;
2327
2372
}
2328
2373
2329
- int CLuaVehicleDefs::SetVehicleRespawnPosition (lua_State* luaVM)
2374
+ int CLuaVehicleDefs::SetVehicleRespawnRotation (lua_State* luaVM)
2330
2375
{
2331
2376
CElement* pElement;
2332
- CVector vecPosition;
2333
2377
CVector vecRotation;
2334
2378
2335
2379
CScriptArgReader argStream (luaVM);
2336
2380
argStream.ReadUserData (pElement);
2337
- argStream.ReadVector3D (vecPosition);
2338
- argStream.ReadVector3D (vecRotation, CVector ());
2381
+ argStream.ReadVector3D (vecRotation);
2339
2382
2340
2383
if (!argStream.HasErrors ())
2341
2384
{
2342
- if (CStaticFunctionDefinitions::SetVehicleRespawnPosition (pElement, vecPosition , vecRotation))
2385
+ if (CStaticFunctionDefinitions::SetVehicleRespawnRotation (pElement, vecRotation))
2343
2386
{
2344
2387
lua_pushboolean (luaVM, true );
2345
2388
return 1 ;
0 commit comments