lua_PhysicsVehicle.cpp 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949
  1. #include "Base.h"
  2. #include "ScriptController.h"
  3. #include "lua_PhysicsVehicle.h"
  4. #include "Base.h"
  5. #include "Game.h"
  6. #include "MathUtil.h"
  7. #include "Node.h"
  8. #include "PhysicsCharacter.h"
  9. #include "PhysicsCollisionObject.h"
  10. #include "PhysicsController.h"
  11. #include "PhysicsGhostObject.h"
  12. #include "PhysicsRigidBody.h"
  13. #include "PhysicsVehicle.h"
  14. #include "PhysicsVehicleWheel.h"
  15. #include "ScriptController.h"
  16. #include "lua_PhysicsCollisionObjectCollisionListenerEventType.h"
  17. #include "lua_PhysicsCollisionObjectType.h"
  18. #include "lua_PhysicsCollisionShapeType.h"
  19. namespace gameplay
  20. {
  21. void luaRegister_PhysicsVehicle()
  22. {
  23. const luaL_Reg lua_members[] =
  24. {
  25. {"addCollisionListener", lua_PhysicsVehicle_addCollisionListener},
  26. {"addWheel", lua_PhysicsVehicle_addWheel},
  27. {"asCharacter", lua_PhysicsVehicle_asCharacter},
  28. {"asGhostObject", lua_PhysicsVehicle_asGhostObject},
  29. {"asRigidBody", lua_PhysicsVehicle_asRigidBody},
  30. {"asVehicle", lua_PhysicsVehicle_asVehicle},
  31. {"asVehicleWheel", lua_PhysicsVehicle_asVehicleWheel},
  32. {"collidesWith", lua_PhysicsVehicle_collidesWith},
  33. {"getBoostGain", lua_PhysicsVehicle_getBoostGain},
  34. {"getBoostSpeed", lua_PhysicsVehicle_getBoostSpeed},
  35. {"getBrakedownFull", lua_PhysicsVehicle_getBrakedownFull},
  36. {"getBrakedownStart", lua_PhysicsVehicle_getBrakedownStart},
  37. {"getBrakingForce", lua_PhysicsVehicle_getBrakingForce},
  38. {"getCollisionShape", lua_PhysicsVehicle_getCollisionShape},
  39. {"getDownforce", lua_PhysicsVehicle_getDownforce},
  40. {"getDrivedownFull", lua_PhysicsVehicle_getDrivedownFull},
  41. {"getDrivedownStart", lua_PhysicsVehicle_getDrivedownStart},
  42. {"getDrivingForce", lua_PhysicsVehicle_getDrivingForce},
  43. {"getNode", lua_PhysicsVehicle_getNode},
  44. {"getNumWheels", lua_PhysicsVehicle_getNumWheels},
  45. {"getRigidBody", lua_PhysicsVehicle_getRigidBody},
  46. {"getShapeType", lua_PhysicsVehicle_getShapeType},
  47. {"getSpeedKph", lua_PhysicsVehicle_getSpeedKph},
  48. {"getSpeedSmoothKph", lua_PhysicsVehicle_getSpeedSmoothKph},
  49. {"getSteerdownGain", lua_PhysicsVehicle_getSteerdownGain},
  50. {"getSteerdownSpeed", lua_PhysicsVehicle_getSteerdownSpeed},
  51. {"getSteeringGain", lua_PhysicsVehicle_getSteeringGain},
  52. {"getType", lua_PhysicsVehicle_getType},
  53. {"getWheel", lua_PhysicsVehicle_getWheel},
  54. {"isDynamic", lua_PhysicsVehicle_isDynamic},
  55. {"isEnabled", lua_PhysicsVehicle_isEnabled},
  56. {"isKinematic", lua_PhysicsVehicle_isKinematic},
  57. {"isStatic", lua_PhysicsVehicle_isStatic},
  58. {"removeCollisionListener", lua_PhysicsVehicle_removeCollisionListener},
  59. {"reset", lua_PhysicsVehicle_reset},
  60. {"setBoost", lua_PhysicsVehicle_setBoost},
  61. {"setBrakedown", lua_PhysicsVehicle_setBrakedown},
  62. {"setBrakingForce", lua_PhysicsVehicle_setBrakingForce},
  63. {"setDownforce", lua_PhysicsVehicle_setDownforce},
  64. {"setDrivedown", lua_PhysicsVehicle_setDrivedown},
  65. {"setDrivingForce", lua_PhysicsVehicle_setDrivingForce},
  66. {"setEnabled", lua_PhysicsVehicle_setEnabled},
  67. {"setSteerdown", lua_PhysicsVehicle_setSteerdown},
  68. {"setSteeringGain", lua_PhysicsVehicle_setSteeringGain},
  69. {"update", lua_PhysicsVehicle_update},
  70. {NULL, NULL}
  71. };
  72. const luaL_Reg* lua_statics = NULL;
  73. std::vector<std::string> scopePath;
  74. gameplay::ScriptUtil::registerClass("PhysicsVehicle", lua_members, NULL, NULL, lua_statics, scopePath);
  75. }
  76. static PhysicsVehicle* getInstance(lua_State* state)
  77. {
  78. void* userdata = luaL_checkudata(state, 1, "PhysicsVehicle");
  79. luaL_argcheck(state, userdata != NULL, 1, "'PhysicsVehicle' expected.");
  80. return (PhysicsVehicle*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance;
  81. }
  82. int lua_PhysicsVehicle_addCollisionListener(lua_State* state)
  83. {
  84. // Get the number of parameters.
  85. int paramCount = lua_gettop(state);
  86. // Attempt to match the parameters to a valid binding.
  87. switch (paramCount)
  88. {
  89. case 2:
  90. {
  91. do
  92. {
  93. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  94. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  95. {
  96. // Get parameter 1 off the stack.
  97. bool param1Valid;
  98. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false, &param1Valid);
  99. if (!param1Valid)
  100. break;
  101. PhysicsVehicle* instance = getInstance(state);
  102. instance->addCollisionListener(param1);
  103. return 0;
  104. }
  105. } while (0);
  106. do
  107. {
  108. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  109. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  110. {
  111. // Get parameter 1 off the stack.
  112. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  113. PhysicsVehicle* instance = getInstance(state);
  114. instance->addCollisionListener(param1);
  115. return 0;
  116. }
  117. } while (0);
  118. lua_pushstring(state, "lua_PhysicsVehicle_addCollisionListener - Failed to match the given parameters to a valid function signature.");
  119. lua_error(state);
  120. break;
  121. }
  122. case 3:
  123. {
  124. do
  125. {
  126. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  127. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  128. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  129. {
  130. // Get parameter 1 off the stack.
  131. bool param1Valid;
  132. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false, &param1Valid);
  133. if (!param1Valid)
  134. break;
  135. // Get parameter 2 off the stack.
  136. bool param2Valid;
  137. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false, &param2Valid);
  138. if (!param2Valid)
  139. break;
  140. PhysicsVehicle* instance = getInstance(state);
  141. instance->addCollisionListener(param1, param2);
  142. return 0;
  143. }
  144. } while (0);
  145. do
  146. {
  147. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  148. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  149. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  150. {
  151. // Get parameter 1 off the stack.
  152. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  153. // Get parameter 2 off the stack.
  154. bool param2Valid;
  155. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false, &param2Valid);
  156. if (!param2Valid)
  157. break;
  158. PhysicsVehicle* instance = getInstance(state);
  159. instance->addCollisionListener(param1, param2);
  160. return 0;
  161. }
  162. } while (0);
  163. lua_pushstring(state, "lua_PhysicsVehicle_addCollisionListener - Failed to match the given parameters to a valid function signature.");
  164. lua_error(state);
  165. break;
  166. }
  167. default:
  168. {
  169. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  170. lua_error(state);
  171. break;
  172. }
  173. }
  174. return 0;
  175. }
  176. int lua_PhysicsVehicle_addWheel(lua_State* state)
  177. {
  178. // Get the number of parameters.
  179. int paramCount = lua_gettop(state);
  180. // Attempt to match the parameters to a valid binding.
  181. switch (paramCount)
  182. {
  183. case 2:
  184. {
  185. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  186. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  187. {
  188. // Get parameter 1 off the stack.
  189. bool param1Valid;
  190. gameplay::ScriptUtil::LuaArray<PhysicsVehicleWheel> param1 = gameplay::ScriptUtil::getObjectPointer<PhysicsVehicleWheel>(2, "PhysicsVehicleWheel", false, &param1Valid);
  191. if (!param1Valid)
  192. {
  193. lua_pushstring(state, "Failed to convert parameter 1 to type 'PhysicsVehicleWheel'.");
  194. lua_error(state);
  195. }
  196. PhysicsVehicle* instance = getInstance(state);
  197. instance->addWheel(param1);
  198. return 0;
  199. }
  200. lua_pushstring(state, "lua_PhysicsVehicle_addWheel - Failed to match the given parameters to a valid function signature.");
  201. lua_error(state);
  202. break;
  203. }
  204. default:
  205. {
  206. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  207. lua_error(state);
  208. break;
  209. }
  210. }
  211. return 0;
  212. }
  213. int lua_PhysicsVehicle_asCharacter(lua_State* state)
  214. {
  215. // Get the number of parameters.
  216. int paramCount = lua_gettop(state);
  217. // Attempt to match the parameters to a valid binding.
  218. switch (paramCount)
  219. {
  220. case 1:
  221. {
  222. if ((lua_type(state, 1) == LUA_TUSERDATA))
  223. {
  224. PhysicsVehicle* instance = getInstance(state);
  225. void* returnPtr = (void*)instance->asCharacter();
  226. if (returnPtr)
  227. {
  228. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  229. object->instance = returnPtr;
  230. object->owns = false;
  231. luaL_getmetatable(state, "PhysicsCharacter");
  232. lua_setmetatable(state, -2);
  233. }
  234. else
  235. {
  236. lua_pushnil(state);
  237. }
  238. return 1;
  239. }
  240. lua_pushstring(state, "lua_PhysicsVehicle_asCharacter - Failed to match the given parameters to a valid function signature.");
  241. lua_error(state);
  242. break;
  243. }
  244. default:
  245. {
  246. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  247. lua_error(state);
  248. break;
  249. }
  250. }
  251. return 0;
  252. }
  253. int lua_PhysicsVehicle_asGhostObject(lua_State* state)
  254. {
  255. // Get the number of parameters.
  256. int paramCount = lua_gettop(state);
  257. // Attempt to match the parameters to a valid binding.
  258. switch (paramCount)
  259. {
  260. case 1:
  261. {
  262. if ((lua_type(state, 1) == LUA_TUSERDATA))
  263. {
  264. PhysicsVehicle* instance = getInstance(state);
  265. void* returnPtr = (void*)instance->asGhostObject();
  266. if (returnPtr)
  267. {
  268. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  269. object->instance = returnPtr;
  270. object->owns = false;
  271. luaL_getmetatable(state, "PhysicsGhostObject");
  272. lua_setmetatable(state, -2);
  273. }
  274. else
  275. {
  276. lua_pushnil(state);
  277. }
  278. return 1;
  279. }
  280. lua_pushstring(state, "lua_PhysicsVehicle_asGhostObject - Failed to match the given parameters to a valid function signature.");
  281. lua_error(state);
  282. break;
  283. }
  284. default:
  285. {
  286. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  287. lua_error(state);
  288. break;
  289. }
  290. }
  291. return 0;
  292. }
  293. int lua_PhysicsVehicle_asRigidBody(lua_State* state)
  294. {
  295. // Get the number of parameters.
  296. int paramCount = lua_gettop(state);
  297. // Attempt to match the parameters to a valid binding.
  298. switch (paramCount)
  299. {
  300. case 1:
  301. {
  302. if ((lua_type(state, 1) == LUA_TUSERDATA))
  303. {
  304. PhysicsVehicle* instance = getInstance(state);
  305. void* returnPtr = (void*)instance->asRigidBody();
  306. if (returnPtr)
  307. {
  308. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  309. object->instance = returnPtr;
  310. object->owns = false;
  311. luaL_getmetatable(state, "PhysicsRigidBody");
  312. lua_setmetatable(state, -2);
  313. }
  314. else
  315. {
  316. lua_pushnil(state);
  317. }
  318. return 1;
  319. }
  320. lua_pushstring(state, "lua_PhysicsVehicle_asRigidBody - Failed to match the given parameters to a valid function signature.");
  321. lua_error(state);
  322. break;
  323. }
  324. default:
  325. {
  326. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  327. lua_error(state);
  328. break;
  329. }
  330. }
  331. return 0;
  332. }
  333. int lua_PhysicsVehicle_asVehicle(lua_State* state)
  334. {
  335. // Get the number of parameters.
  336. int paramCount = lua_gettop(state);
  337. // Attempt to match the parameters to a valid binding.
  338. switch (paramCount)
  339. {
  340. case 1:
  341. {
  342. if ((lua_type(state, 1) == LUA_TUSERDATA))
  343. {
  344. PhysicsVehicle* instance = getInstance(state);
  345. void* returnPtr = (void*)instance->asVehicle();
  346. if (returnPtr)
  347. {
  348. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  349. object->instance = returnPtr;
  350. object->owns = false;
  351. luaL_getmetatable(state, "PhysicsVehicle");
  352. lua_setmetatable(state, -2);
  353. }
  354. else
  355. {
  356. lua_pushnil(state);
  357. }
  358. return 1;
  359. }
  360. lua_pushstring(state, "lua_PhysicsVehicle_asVehicle - Failed to match the given parameters to a valid function signature.");
  361. lua_error(state);
  362. break;
  363. }
  364. default:
  365. {
  366. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  367. lua_error(state);
  368. break;
  369. }
  370. }
  371. return 0;
  372. }
  373. int lua_PhysicsVehicle_asVehicleWheel(lua_State* state)
  374. {
  375. // Get the number of parameters.
  376. int paramCount = lua_gettop(state);
  377. // Attempt to match the parameters to a valid binding.
  378. switch (paramCount)
  379. {
  380. case 1:
  381. {
  382. if ((lua_type(state, 1) == LUA_TUSERDATA))
  383. {
  384. PhysicsVehicle* instance = getInstance(state);
  385. void* returnPtr = (void*)instance->asVehicleWheel();
  386. if (returnPtr)
  387. {
  388. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  389. object->instance = returnPtr;
  390. object->owns = false;
  391. luaL_getmetatable(state, "PhysicsVehicleWheel");
  392. lua_setmetatable(state, -2);
  393. }
  394. else
  395. {
  396. lua_pushnil(state);
  397. }
  398. return 1;
  399. }
  400. lua_pushstring(state, "lua_PhysicsVehicle_asVehicleWheel - Failed to match the given parameters to a valid function signature.");
  401. lua_error(state);
  402. break;
  403. }
  404. default:
  405. {
  406. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  407. lua_error(state);
  408. break;
  409. }
  410. }
  411. return 0;
  412. }
  413. int lua_PhysicsVehicle_collidesWith(lua_State* state)
  414. {
  415. // Get the number of parameters.
  416. int paramCount = lua_gettop(state);
  417. // Attempt to match the parameters to a valid binding.
  418. switch (paramCount)
  419. {
  420. case 2:
  421. {
  422. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  423. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  424. {
  425. // Get parameter 1 off the stack.
  426. bool param1Valid;
  427. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject> param1 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject>(2, "PhysicsCollisionObject", false, &param1Valid);
  428. if (!param1Valid)
  429. {
  430. lua_pushstring(state, "Failed to convert parameter 1 to type 'PhysicsCollisionObject'.");
  431. lua_error(state);
  432. }
  433. PhysicsVehicle* instance = getInstance(state);
  434. bool result = instance->collidesWith(param1);
  435. // Push the return value onto the stack.
  436. lua_pushboolean(state, result);
  437. return 1;
  438. }
  439. lua_pushstring(state, "lua_PhysicsVehicle_collidesWith - Failed to match the given parameters to a valid function signature.");
  440. lua_error(state);
  441. break;
  442. }
  443. default:
  444. {
  445. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  446. lua_error(state);
  447. break;
  448. }
  449. }
  450. return 0;
  451. }
  452. int lua_PhysicsVehicle_getBoostGain(lua_State* state)
  453. {
  454. // Get the number of parameters.
  455. int paramCount = lua_gettop(state);
  456. // Attempt to match the parameters to a valid binding.
  457. switch (paramCount)
  458. {
  459. case 1:
  460. {
  461. if ((lua_type(state, 1) == LUA_TUSERDATA))
  462. {
  463. PhysicsVehicle* instance = getInstance(state);
  464. float result = instance->getBoostGain();
  465. // Push the return value onto the stack.
  466. lua_pushnumber(state, result);
  467. return 1;
  468. }
  469. lua_pushstring(state, "lua_PhysicsVehicle_getBoostGain - Failed to match the given parameters to a valid function signature.");
  470. lua_error(state);
  471. break;
  472. }
  473. default:
  474. {
  475. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  476. lua_error(state);
  477. break;
  478. }
  479. }
  480. return 0;
  481. }
  482. int lua_PhysicsVehicle_getBoostSpeed(lua_State* state)
  483. {
  484. // Get the number of parameters.
  485. int paramCount = lua_gettop(state);
  486. // Attempt to match the parameters to a valid binding.
  487. switch (paramCount)
  488. {
  489. case 1:
  490. {
  491. if ((lua_type(state, 1) == LUA_TUSERDATA))
  492. {
  493. PhysicsVehicle* instance = getInstance(state);
  494. float result = instance->getBoostSpeed();
  495. // Push the return value onto the stack.
  496. lua_pushnumber(state, result);
  497. return 1;
  498. }
  499. lua_pushstring(state, "lua_PhysicsVehicle_getBoostSpeed - Failed to match the given parameters to a valid function signature.");
  500. lua_error(state);
  501. break;
  502. }
  503. default:
  504. {
  505. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  506. lua_error(state);
  507. break;
  508. }
  509. }
  510. return 0;
  511. }
  512. int lua_PhysicsVehicle_getBrakedownFull(lua_State* state)
  513. {
  514. // Get the number of parameters.
  515. int paramCount = lua_gettop(state);
  516. // Attempt to match the parameters to a valid binding.
  517. switch (paramCount)
  518. {
  519. case 1:
  520. {
  521. if ((lua_type(state, 1) == LUA_TUSERDATA))
  522. {
  523. PhysicsVehicle* instance = getInstance(state);
  524. float result = instance->getBrakedownFull();
  525. // Push the return value onto the stack.
  526. lua_pushnumber(state, result);
  527. return 1;
  528. }
  529. lua_pushstring(state, "lua_PhysicsVehicle_getBrakedownFull - Failed to match the given parameters to a valid function signature.");
  530. lua_error(state);
  531. break;
  532. }
  533. default:
  534. {
  535. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  536. lua_error(state);
  537. break;
  538. }
  539. }
  540. return 0;
  541. }
  542. int lua_PhysicsVehicle_getBrakedownStart(lua_State* state)
  543. {
  544. // Get the number of parameters.
  545. int paramCount = lua_gettop(state);
  546. // Attempt to match the parameters to a valid binding.
  547. switch (paramCount)
  548. {
  549. case 1:
  550. {
  551. if ((lua_type(state, 1) == LUA_TUSERDATA))
  552. {
  553. PhysicsVehicle* instance = getInstance(state);
  554. float result = instance->getBrakedownStart();
  555. // Push the return value onto the stack.
  556. lua_pushnumber(state, result);
  557. return 1;
  558. }
  559. lua_pushstring(state, "lua_PhysicsVehicle_getBrakedownStart - Failed to match the given parameters to a valid function signature.");
  560. lua_error(state);
  561. break;
  562. }
  563. default:
  564. {
  565. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  566. lua_error(state);
  567. break;
  568. }
  569. }
  570. return 0;
  571. }
  572. int lua_PhysicsVehicle_getBrakingForce(lua_State* state)
  573. {
  574. // Get the number of parameters.
  575. int paramCount = lua_gettop(state);
  576. // Attempt to match the parameters to a valid binding.
  577. switch (paramCount)
  578. {
  579. case 1:
  580. {
  581. if ((lua_type(state, 1) == LUA_TUSERDATA))
  582. {
  583. PhysicsVehicle* instance = getInstance(state);
  584. float result = instance->getBrakingForce();
  585. // Push the return value onto the stack.
  586. lua_pushnumber(state, result);
  587. return 1;
  588. }
  589. lua_pushstring(state, "lua_PhysicsVehicle_getBrakingForce - Failed to match the given parameters to a valid function signature.");
  590. lua_error(state);
  591. break;
  592. }
  593. default:
  594. {
  595. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  596. lua_error(state);
  597. break;
  598. }
  599. }
  600. return 0;
  601. }
  602. int lua_PhysicsVehicle_getCollisionShape(lua_State* state)
  603. {
  604. // Get the number of parameters.
  605. int paramCount = lua_gettop(state);
  606. // Attempt to match the parameters to a valid binding.
  607. switch (paramCount)
  608. {
  609. case 1:
  610. {
  611. if ((lua_type(state, 1) == LUA_TUSERDATA))
  612. {
  613. PhysicsVehicle* instance = getInstance(state);
  614. void* returnPtr = (void*)instance->getCollisionShape();
  615. if (returnPtr)
  616. {
  617. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  618. object->instance = returnPtr;
  619. object->owns = false;
  620. luaL_getmetatable(state, "PhysicsCollisionShape");
  621. lua_setmetatable(state, -2);
  622. }
  623. else
  624. {
  625. lua_pushnil(state);
  626. }
  627. return 1;
  628. }
  629. lua_pushstring(state, "lua_PhysicsVehicle_getCollisionShape - Failed to match the given parameters to a valid function signature.");
  630. lua_error(state);
  631. break;
  632. }
  633. default:
  634. {
  635. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  636. lua_error(state);
  637. break;
  638. }
  639. }
  640. return 0;
  641. }
  642. int lua_PhysicsVehicle_getDownforce(lua_State* state)
  643. {
  644. // Get the number of parameters.
  645. int paramCount = lua_gettop(state);
  646. // Attempt to match the parameters to a valid binding.
  647. switch (paramCount)
  648. {
  649. case 1:
  650. {
  651. if ((lua_type(state, 1) == LUA_TUSERDATA))
  652. {
  653. PhysicsVehicle* instance = getInstance(state);
  654. float result = instance->getDownforce();
  655. // Push the return value onto the stack.
  656. lua_pushnumber(state, result);
  657. return 1;
  658. }
  659. lua_pushstring(state, "lua_PhysicsVehicle_getDownforce - Failed to match the given parameters to a valid function signature.");
  660. lua_error(state);
  661. break;
  662. }
  663. default:
  664. {
  665. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  666. lua_error(state);
  667. break;
  668. }
  669. }
  670. return 0;
  671. }
  672. int lua_PhysicsVehicle_getDrivedownFull(lua_State* state)
  673. {
  674. // Get the number of parameters.
  675. int paramCount = lua_gettop(state);
  676. // Attempt to match the parameters to a valid binding.
  677. switch (paramCount)
  678. {
  679. case 1:
  680. {
  681. if ((lua_type(state, 1) == LUA_TUSERDATA))
  682. {
  683. PhysicsVehicle* instance = getInstance(state);
  684. float result = instance->getDrivedownFull();
  685. // Push the return value onto the stack.
  686. lua_pushnumber(state, result);
  687. return 1;
  688. }
  689. lua_pushstring(state, "lua_PhysicsVehicle_getDrivedownFull - Failed to match the given parameters to a valid function signature.");
  690. lua_error(state);
  691. break;
  692. }
  693. default:
  694. {
  695. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  696. lua_error(state);
  697. break;
  698. }
  699. }
  700. return 0;
  701. }
  702. int lua_PhysicsVehicle_getDrivedownStart(lua_State* state)
  703. {
  704. // Get the number of parameters.
  705. int paramCount = lua_gettop(state);
  706. // Attempt to match the parameters to a valid binding.
  707. switch (paramCount)
  708. {
  709. case 1:
  710. {
  711. if ((lua_type(state, 1) == LUA_TUSERDATA))
  712. {
  713. PhysicsVehicle* instance = getInstance(state);
  714. float result = instance->getDrivedownStart();
  715. // Push the return value onto the stack.
  716. lua_pushnumber(state, result);
  717. return 1;
  718. }
  719. lua_pushstring(state, "lua_PhysicsVehicle_getDrivedownStart - Failed to match the given parameters to a valid function signature.");
  720. lua_error(state);
  721. break;
  722. }
  723. default:
  724. {
  725. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  726. lua_error(state);
  727. break;
  728. }
  729. }
  730. return 0;
  731. }
  732. int lua_PhysicsVehicle_getDrivingForce(lua_State* state)
  733. {
  734. // Get the number of parameters.
  735. int paramCount = lua_gettop(state);
  736. // Attempt to match the parameters to a valid binding.
  737. switch (paramCount)
  738. {
  739. case 1:
  740. {
  741. if ((lua_type(state, 1) == LUA_TUSERDATA))
  742. {
  743. PhysicsVehicle* instance = getInstance(state);
  744. float result = instance->getDrivingForce();
  745. // Push the return value onto the stack.
  746. lua_pushnumber(state, result);
  747. return 1;
  748. }
  749. lua_pushstring(state, "lua_PhysicsVehicle_getDrivingForce - Failed to match the given parameters to a valid function signature.");
  750. lua_error(state);
  751. break;
  752. }
  753. default:
  754. {
  755. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  756. lua_error(state);
  757. break;
  758. }
  759. }
  760. return 0;
  761. }
  762. int lua_PhysicsVehicle_getNode(lua_State* state)
  763. {
  764. // Get the number of parameters.
  765. int paramCount = lua_gettop(state);
  766. // Attempt to match the parameters to a valid binding.
  767. switch (paramCount)
  768. {
  769. case 1:
  770. {
  771. if ((lua_type(state, 1) == LUA_TUSERDATA))
  772. {
  773. PhysicsVehicle* instance = getInstance(state);
  774. void* returnPtr = (void*)instance->getNode();
  775. if (returnPtr)
  776. {
  777. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  778. object->instance = returnPtr;
  779. object->owns = false;
  780. luaL_getmetatable(state, "Node");
  781. lua_setmetatable(state, -2);
  782. }
  783. else
  784. {
  785. lua_pushnil(state);
  786. }
  787. return 1;
  788. }
  789. lua_pushstring(state, "lua_PhysicsVehicle_getNode - Failed to match the given parameters to a valid function signature.");
  790. lua_error(state);
  791. break;
  792. }
  793. default:
  794. {
  795. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  796. lua_error(state);
  797. break;
  798. }
  799. }
  800. return 0;
  801. }
  802. int lua_PhysicsVehicle_getNumWheels(lua_State* state)
  803. {
  804. // Get the number of parameters.
  805. int paramCount = lua_gettop(state);
  806. // Attempt to match the parameters to a valid binding.
  807. switch (paramCount)
  808. {
  809. case 1:
  810. {
  811. if ((lua_type(state, 1) == LUA_TUSERDATA))
  812. {
  813. PhysicsVehicle* instance = getInstance(state);
  814. unsigned int result = instance->getNumWheels();
  815. // Push the return value onto the stack.
  816. lua_pushunsigned(state, result);
  817. return 1;
  818. }
  819. lua_pushstring(state, "lua_PhysicsVehicle_getNumWheels - Failed to match the given parameters to a valid function signature.");
  820. lua_error(state);
  821. break;
  822. }
  823. default:
  824. {
  825. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  826. lua_error(state);
  827. break;
  828. }
  829. }
  830. return 0;
  831. }
  832. int lua_PhysicsVehicle_getRigidBody(lua_State* state)
  833. {
  834. // Get the number of parameters.
  835. int paramCount = lua_gettop(state);
  836. // Attempt to match the parameters to a valid binding.
  837. switch (paramCount)
  838. {
  839. case 1:
  840. {
  841. if ((lua_type(state, 1) == LUA_TUSERDATA))
  842. {
  843. PhysicsVehicle* instance = getInstance(state);
  844. void* returnPtr = (void*)instance->getRigidBody();
  845. if (returnPtr)
  846. {
  847. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  848. object->instance = returnPtr;
  849. object->owns = false;
  850. luaL_getmetatable(state, "PhysicsRigidBody");
  851. lua_setmetatable(state, -2);
  852. }
  853. else
  854. {
  855. lua_pushnil(state);
  856. }
  857. return 1;
  858. }
  859. lua_pushstring(state, "lua_PhysicsVehicle_getRigidBody - Failed to match the given parameters to a valid function signature.");
  860. lua_error(state);
  861. break;
  862. }
  863. default:
  864. {
  865. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  866. lua_error(state);
  867. break;
  868. }
  869. }
  870. return 0;
  871. }
  872. int lua_PhysicsVehicle_getShapeType(lua_State* state)
  873. {
  874. // Get the number of parameters.
  875. int paramCount = lua_gettop(state);
  876. // Attempt to match the parameters to a valid binding.
  877. switch (paramCount)
  878. {
  879. case 1:
  880. {
  881. if ((lua_type(state, 1) == LUA_TUSERDATA))
  882. {
  883. PhysicsVehicle* instance = getInstance(state);
  884. PhysicsCollisionShape::Type result = instance->getShapeType();
  885. // Push the return value onto the stack.
  886. lua_pushstring(state, lua_stringFromEnum_PhysicsCollisionShapeType(result));
  887. return 1;
  888. }
  889. lua_pushstring(state, "lua_PhysicsVehicle_getShapeType - Failed to match the given parameters to a valid function signature.");
  890. lua_error(state);
  891. break;
  892. }
  893. default:
  894. {
  895. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  896. lua_error(state);
  897. break;
  898. }
  899. }
  900. return 0;
  901. }
  902. int lua_PhysicsVehicle_getSpeedKph(lua_State* state)
  903. {
  904. // Get the number of parameters.
  905. int paramCount = lua_gettop(state);
  906. // Attempt to match the parameters to a valid binding.
  907. switch (paramCount)
  908. {
  909. case 1:
  910. {
  911. if ((lua_type(state, 1) == LUA_TUSERDATA))
  912. {
  913. PhysicsVehicle* instance = getInstance(state);
  914. float result = instance->getSpeedKph();
  915. // Push the return value onto the stack.
  916. lua_pushnumber(state, result);
  917. return 1;
  918. }
  919. lua_pushstring(state, "lua_PhysicsVehicle_getSpeedKph - Failed to match the given parameters to a valid function signature.");
  920. lua_error(state);
  921. break;
  922. }
  923. default:
  924. {
  925. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  926. lua_error(state);
  927. break;
  928. }
  929. }
  930. return 0;
  931. }
  932. int lua_PhysicsVehicle_getSpeedSmoothKph(lua_State* state)
  933. {
  934. // Get the number of parameters.
  935. int paramCount = lua_gettop(state);
  936. // Attempt to match the parameters to a valid binding.
  937. switch (paramCount)
  938. {
  939. case 1:
  940. {
  941. if ((lua_type(state, 1) == LUA_TUSERDATA))
  942. {
  943. PhysicsVehicle* instance = getInstance(state);
  944. float result = instance->getSpeedSmoothKph();
  945. // Push the return value onto the stack.
  946. lua_pushnumber(state, result);
  947. return 1;
  948. }
  949. lua_pushstring(state, "lua_PhysicsVehicle_getSpeedSmoothKph - Failed to match the given parameters to a valid function signature.");
  950. lua_error(state);
  951. break;
  952. }
  953. default:
  954. {
  955. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  956. lua_error(state);
  957. break;
  958. }
  959. }
  960. return 0;
  961. }
  962. int lua_PhysicsVehicle_getSteerdownGain(lua_State* state)
  963. {
  964. // Get the number of parameters.
  965. int paramCount = lua_gettop(state);
  966. // Attempt to match the parameters to a valid binding.
  967. switch (paramCount)
  968. {
  969. case 1:
  970. {
  971. if ((lua_type(state, 1) == LUA_TUSERDATA))
  972. {
  973. PhysicsVehicle* instance = getInstance(state);
  974. float result = instance->getSteerdownGain();
  975. // Push the return value onto the stack.
  976. lua_pushnumber(state, result);
  977. return 1;
  978. }
  979. lua_pushstring(state, "lua_PhysicsVehicle_getSteerdownGain - Failed to match the given parameters to a valid function signature.");
  980. lua_error(state);
  981. break;
  982. }
  983. default:
  984. {
  985. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  986. lua_error(state);
  987. break;
  988. }
  989. }
  990. return 0;
  991. }
  992. int lua_PhysicsVehicle_getSteerdownSpeed(lua_State* state)
  993. {
  994. // Get the number of parameters.
  995. int paramCount = lua_gettop(state);
  996. // Attempt to match the parameters to a valid binding.
  997. switch (paramCount)
  998. {
  999. case 1:
  1000. {
  1001. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1002. {
  1003. PhysicsVehicle* instance = getInstance(state);
  1004. float result = instance->getSteerdownSpeed();
  1005. // Push the return value onto the stack.
  1006. lua_pushnumber(state, result);
  1007. return 1;
  1008. }
  1009. lua_pushstring(state, "lua_PhysicsVehicle_getSteerdownSpeed - Failed to match the given parameters to a valid function signature.");
  1010. lua_error(state);
  1011. break;
  1012. }
  1013. default:
  1014. {
  1015. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1016. lua_error(state);
  1017. break;
  1018. }
  1019. }
  1020. return 0;
  1021. }
  1022. int lua_PhysicsVehicle_getSteeringGain(lua_State* state)
  1023. {
  1024. // Get the number of parameters.
  1025. int paramCount = lua_gettop(state);
  1026. // Attempt to match the parameters to a valid binding.
  1027. switch (paramCount)
  1028. {
  1029. case 1:
  1030. {
  1031. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1032. {
  1033. PhysicsVehicle* instance = getInstance(state);
  1034. float result = instance->getSteeringGain();
  1035. // Push the return value onto the stack.
  1036. lua_pushnumber(state, result);
  1037. return 1;
  1038. }
  1039. lua_pushstring(state, "lua_PhysicsVehicle_getSteeringGain - Failed to match the given parameters to a valid function signature.");
  1040. lua_error(state);
  1041. break;
  1042. }
  1043. default:
  1044. {
  1045. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1046. lua_error(state);
  1047. break;
  1048. }
  1049. }
  1050. return 0;
  1051. }
  1052. int lua_PhysicsVehicle_getType(lua_State* state)
  1053. {
  1054. // Get the number of parameters.
  1055. int paramCount = lua_gettop(state);
  1056. // Attempt to match the parameters to a valid binding.
  1057. switch (paramCount)
  1058. {
  1059. case 1:
  1060. {
  1061. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1062. {
  1063. PhysicsVehicle* instance = getInstance(state);
  1064. PhysicsCollisionObject::Type result = instance->getType();
  1065. // Push the return value onto the stack.
  1066. lua_pushstring(state, lua_stringFromEnum_PhysicsCollisionObjectType(result));
  1067. return 1;
  1068. }
  1069. lua_pushstring(state, "lua_PhysicsVehicle_getType - Failed to match the given parameters to a valid function signature.");
  1070. lua_error(state);
  1071. break;
  1072. }
  1073. default:
  1074. {
  1075. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1076. lua_error(state);
  1077. break;
  1078. }
  1079. }
  1080. return 0;
  1081. }
  1082. int lua_PhysicsVehicle_getWheel(lua_State* state)
  1083. {
  1084. // Get the number of parameters.
  1085. int paramCount = lua_gettop(state);
  1086. // Attempt to match the parameters to a valid binding.
  1087. switch (paramCount)
  1088. {
  1089. case 2:
  1090. {
  1091. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1092. lua_type(state, 2) == LUA_TNUMBER)
  1093. {
  1094. // Get parameter 1 off the stack.
  1095. unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
  1096. PhysicsVehicle* instance = getInstance(state);
  1097. void* returnPtr = (void*)instance->getWheel(param1);
  1098. if (returnPtr)
  1099. {
  1100. gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
  1101. object->instance = returnPtr;
  1102. object->owns = false;
  1103. luaL_getmetatable(state, "PhysicsVehicleWheel");
  1104. lua_setmetatable(state, -2);
  1105. }
  1106. else
  1107. {
  1108. lua_pushnil(state);
  1109. }
  1110. return 1;
  1111. }
  1112. lua_pushstring(state, "lua_PhysicsVehicle_getWheel - Failed to match the given parameters to a valid function signature.");
  1113. lua_error(state);
  1114. break;
  1115. }
  1116. default:
  1117. {
  1118. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1119. lua_error(state);
  1120. break;
  1121. }
  1122. }
  1123. return 0;
  1124. }
  1125. int lua_PhysicsVehicle_isDynamic(lua_State* state)
  1126. {
  1127. // Get the number of parameters.
  1128. int paramCount = lua_gettop(state);
  1129. // Attempt to match the parameters to a valid binding.
  1130. switch (paramCount)
  1131. {
  1132. case 1:
  1133. {
  1134. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1135. {
  1136. PhysicsVehicle* instance = getInstance(state);
  1137. bool result = instance->isDynamic();
  1138. // Push the return value onto the stack.
  1139. lua_pushboolean(state, result);
  1140. return 1;
  1141. }
  1142. lua_pushstring(state, "lua_PhysicsVehicle_isDynamic - Failed to match the given parameters to a valid function signature.");
  1143. lua_error(state);
  1144. break;
  1145. }
  1146. default:
  1147. {
  1148. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1149. lua_error(state);
  1150. break;
  1151. }
  1152. }
  1153. return 0;
  1154. }
  1155. int lua_PhysicsVehicle_isEnabled(lua_State* state)
  1156. {
  1157. // Get the number of parameters.
  1158. int paramCount = lua_gettop(state);
  1159. // Attempt to match the parameters to a valid binding.
  1160. switch (paramCount)
  1161. {
  1162. case 1:
  1163. {
  1164. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1165. {
  1166. PhysicsVehicle* instance = getInstance(state);
  1167. bool result = instance->isEnabled();
  1168. // Push the return value onto the stack.
  1169. lua_pushboolean(state, result);
  1170. return 1;
  1171. }
  1172. lua_pushstring(state, "lua_PhysicsVehicle_isEnabled - Failed to match the given parameters to a valid function signature.");
  1173. lua_error(state);
  1174. break;
  1175. }
  1176. default:
  1177. {
  1178. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1179. lua_error(state);
  1180. break;
  1181. }
  1182. }
  1183. return 0;
  1184. }
  1185. int lua_PhysicsVehicle_isKinematic(lua_State* state)
  1186. {
  1187. // Get the number of parameters.
  1188. int paramCount = lua_gettop(state);
  1189. // Attempt to match the parameters to a valid binding.
  1190. switch (paramCount)
  1191. {
  1192. case 1:
  1193. {
  1194. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1195. {
  1196. PhysicsVehicle* instance = getInstance(state);
  1197. bool result = instance->isKinematic();
  1198. // Push the return value onto the stack.
  1199. lua_pushboolean(state, result);
  1200. return 1;
  1201. }
  1202. lua_pushstring(state, "lua_PhysicsVehicle_isKinematic - Failed to match the given parameters to a valid function signature.");
  1203. lua_error(state);
  1204. break;
  1205. }
  1206. default:
  1207. {
  1208. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1209. lua_error(state);
  1210. break;
  1211. }
  1212. }
  1213. return 0;
  1214. }
  1215. int lua_PhysicsVehicle_isStatic(lua_State* state)
  1216. {
  1217. // Get the number of parameters.
  1218. int paramCount = lua_gettop(state);
  1219. // Attempt to match the parameters to a valid binding.
  1220. switch (paramCount)
  1221. {
  1222. case 1:
  1223. {
  1224. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1225. {
  1226. PhysicsVehicle* instance = getInstance(state);
  1227. bool result = instance->isStatic();
  1228. // Push the return value onto the stack.
  1229. lua_pushboolean(state, result);
  1230. return 1;
  1231. }
  1232. lua_pushstring(state, "lua_PhysicsVehicle_isStatic - Failed to match the given parameters to a valid function signature.");
  1233. lua_error(state);
  1234. break;
  1235. }
  1236. default:
  1237. {
  1238. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1239. lua_error(state);
  1240. break;
  1241. }
  1242. }
  1243. return 0;
  1244. }
  1245. int lua_PhysicsVehicle_removeCollisionListener(lua_State* state)
  1246. {
  1247. // Get the number of parameters.
  1248. int paramCount = lua_gettop(state);
  1249. // Attempt to match the parameters to a valid binding.
  1250. switch (paramCount)
  1251. {
  1252. case 2:
  1253. {
  1254. do
  1255. {
  1256. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1257. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  1258. {
  1259. // Get parameter 1 off the stack.
  1260. bool param1Valid;
  1261. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false, &param1Valid);
  1262. if (!param1Valid)
  1263. break;
  1264. PhysicsVehicle* instance = getInstance(state);
  1265. instance->removeCollisionListener(param1);
  1266. return 0;
  1267. }
  1268. } while (0);
  1269. do
  1270. {
  1271. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1272. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  1273. {
  1274. // Get parameter 1 off the stack.
  1275. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  1276. PhysicsVehicle* instance = getInstance(state);
  1277. instance->removeCollisionListener(param1);
  1278. return 0;
  1279. }
  1280. } while (0);
  1281. lua_pushstring(state, "lua_PhysicsVehicle_removeCollisionListener - Failed to match the given parameters to a valid function signature.");
  1282. lua_error(state);
  1283. break;
  1284. }
  1285. case 3:
  1286. {
  1287. do
  1288. {
  1289. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1290. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  1291. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  1292. {
  1293. // Get parameter 1 off the stack.
  1294. bool param1Valid;
  1295. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false, &param1Valid);
  1296. if (!param1Valid)
  1297. break;
  1298. // Get parameter 2 off the stack.
  1299. bool param2Valid;
  1300. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false, &param2Valid);
  1301. if (!param2Valid)
  1302. break;
  1303. PhysicsVehicle* instance = getInstance(state);
  1304. instance->removeCollisionListener(param1, param2);
  1305. return 0;
  1306. }
  1307. } while (0);
  1308. do
  1309. {
  1310. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1311. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  1312. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  1313. {
  1314. // Get parameter 1 off the stack.
  1315. const char* param1 = gameplay::ScriptUtil::getString(2, false);
  1316. // Get parameter 2 off the stack.
  1317. bool param2Valid;
  1318. gameplay::ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = gameplay::ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false, &param2Valid);
  1319. if (!param2Valid)
  1320. break;
  1321. PhysicsVehicle* instance = getInstance(state);
  1322. instance->removeCollisionListener(param1, param2);
  1323. return 0;
  1324. }
  1325. } while (0);
  1326. lua_pushstring(state, "lua_PhysicsVehicle_removeCollisionListener - Failed to match the given parameters to a valid function signature.");
  1327. lua_error(state);
  1328. break;
  1329. }
  1330. default:
  1331. {
  1332. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  1333. lua_error(state);
  1334. break;
  1335. }
  1336. }
  1337. return 0;
  1338. }
  1339. int lua_PhysicsVehicle_reset(lua_State* state)
  1340. {
  1341. // Get the number of parameters.
  1342. int paramCount = lua_gettop(state);
  1343. // Attempt to match the parameters to a valid binding.
  1344. switch (paramCount)
  1345. {
  1346. case 1:
  1347. {
  1348. if ((lua_type(state, 1) == LUA_TUSERDATA))
  1349. {
  1350. PhysicsVehicle* instance = getInstance(state);
  1351. instance->reset();
  1352. return 0;
  1353. }
  1354. lua_pushstring(state, "lua_PhysicsVehicle_reset - Failed to match the given parameters to a valid function signature.");
  1355. lua_error(state);
  1356. break;
  1357. }
  1358. default:
  1359. {
  1360. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  1361. lua_error(state);
  1362. break;
  1363. }
  1364. }
  1365. return 0;
  1366. }
  1367. int lua_PhysicsVehicle_setBoost(lua_State* state)
  1368. {
  1369. // Get the number of parameters.
  1370. int paramCount = lua_gettop(state);
  1371. // Attempt to match the parameters to a valid binding.
  1372. switch (paramCount)
  1373. {
  1374. case 3:
  1375. {
  1376. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1377. lua_type(state, 2) == LUA_TNUMBER &&
  1378. lua_type(state, 3) == LUA_TNUMBER)
  1379. {
  1380. // Get parameter 1 off the stack.
  1381. float param1 = (float)luaL_checknumber(state, 2);
  1382. // Get parameter 2 off the stack.
  1383. float param2 = (float)luaL_checknumber(state, 3);
  1384. PhysicsVehicle* instance = getInstance(state);
  1385. instance->setBoost(param1, param2);
  1386. return 0;
  1387. }
  1388. lua_pushstring(state, "lua_PhysicsVehicle_setBoost - Failed to match the given parameters to a valid function signature.");
  1389. lua_error(state);
  1390. break;
  1391. }
  1392. default:
  1393. {
  1394. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  1395. lua_error(state);
  1396. break;
  1397. }
  1398. }
  1399. return 0;
  1400. }
  1401. int lua_PhysicsVehicle_setBrakedown(lua_State* state)
  1402. {
  1403. // Get the number of parameters.
  1404. int paramCount = lua_gettop(state);
  1405. // Attempt to match the parameters to a valid binding.
  1406. switch (paramCount)
  1407. {
  1408. case 3:
  1409. {
  1410. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1411. lua_type(state, 2) == LUA_TNUMBER &&
  1412. lua_type(state, 3) == LUA_TNUMBER)
  1413. {
  1414. // Get parameter 1 off the stack.
  1415. float param1 = (float)luaL_checknumber(state, 2);
  1416. // Get parameter 2 off the stack.
  1417. float param2 = (float)luaL_checknumber(state, 3);
  1418. PhysicsVehicle* instance = getInstance(state);
  1419. instance->setBrakedown(param1, param2);
  1420. return 0;
  1421. }
  1422. lua_pushstring(state, "lua_PhysicsVehicle_setBrakedown - Failed to match the given parameters to a valid function signature.");
  1423. lua_error(state);
  1424. break;
  1425. }
  1426. default:
  1427. {
  1428. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  1429. lua_error(state);
  1430. break;
  1431. }
  1432. }
  1433. return 0;
  1434. }
  1435. int lua_PhysicsVehicle_setBrakingForce(lua_State* state)
  1436. {
  1437. // Get the number of parameters.
  1438. int paramCount = lua_gettop(state);
  1439. // Attempt to match the parameters to a valid binding.
  1440. switch (paramCount)
  1441. {
  1442. case 2:
  1443. {
  1444. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1445. lua_type(state, 2) == LUA_TNUMBER)
  1446. {
  1447. // Get parameter 1 off the stack.
  1448. float param1 = (float)luaL_checknumber(state, 2);
  1449. PhysicsVehicle* instance = getInstance(state);
  1450. instance->setBrakingForce(param1);
  1451. return 0;
  1452. }
  1453. lua_pushstring(state, "lua_PhysicsVehicle_setBrakingForce - Failed to match the given parameters to a valid function signature.");
  1454. lua_error(state);
  1455. break;
  1456. }
  1457. default:
  1458. {
  1459. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1460. lua_error(state);
  1461. break;
  1462. }
  1463. }
  1464. return 0;
  1465. }
  1466. int lua_PhysicsVehicle_setDownforce(lua_State* state)
  1467. {
  1468. // Get the number of parameters.
  1469. int paramCount = lua_gettop(state);
  1470. // Attempt to match the parameters to a valid binding.
  1471. switch (paramCount)
  1472. {
  1473. case 2:
  1474. {
  1475. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1476. lua_type(state, 2) == LUA_TNUMBER)
  1477. {
  1478. // Get parameter 1 off the stack.
  1479. float param1 = (float)luaL_checknumber(state, 2);
  1480. PhysicsVehicle* instance = getInstance(state);
  1481. instance->setDownforce(param1);
  1482. return 0;
  1483. }
  1484. lua_pushstring(state, "lua_PhysicsVehicle_setDownforce - Failed to match the given parameters to a valid function signature.");
  1485. lua_error(state);
  1486. break;
  1487. }
  1488. default:
  1489. {
  1490. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1491. lua_error(state);
  1492. break;
  1493. }
  1494. }
  1495. return 0;
  1496. }
  1497. int lua_PhysicsVehicle_setDrivedown(lua_State* state)
  1498. {
  1499. // Get the number of parameters.
  1500. int paramCount = lua_gettop(state);
  1501. // Attempt to match the parameters to a valid binding.
  1502. switch (paramCount)
  1503. {
  1504. case 3:
  1505. {
  1506. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1507. lua_type(state, 2) == LUA_TNUMBER &&
  1508. lua_type(state, 3) == LUA_TNUMBER)
  1509. {
  1510. // Get parameter 1 off the stack.
  1511. float param1 = (float)luaL_checknumber(state, 2);
  1512. // Get parameter 2 off the stack.
  1513. float param2 = (float)luaL_checknumber(state, 3);
  1514. PhysicsVehicle* instance = getInstance(state);
  1515. instance->setDrivedown(param1, param2);
  1516. return 0;
  1517. }
  1518. lua_pushstring(state, "lua_PhysicsVehicle_setDrivedown - Failed to match the given parameters to a valid function signature.");
  1519. lua_error(state);
  1520. break;
  1521. }
  1522. default:
  1523. {
  1524. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  1525. lua_error(state);
  1526. break;
  1527. }
  1528. }
  1529. return 0;
  1530. }
  1531. int lua_PhysicsVehicle_setDrivingForce(lua_State* state)
  1532. {
  1533. // Get the number of parameters.
  1534. int paramCount = lua_gettop(state);
  1535. // Attempt to match the parameters to a valid binding.
  1536. switch (paramCount)
  1537. {
  1538. case 2:
  1539. {
  1540. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1541. lua_type(state, 2) == LUA_TNUMBER)
  1542. {
  1543. // Get parameter 1 off the stack.
  1544. float param1 = (float)luaL_checknumber(state, 2);
  1545. PhysicsVehicle* instance = getInstance(state);
  1546. instance->setDrivingForce(param1);
  1547. return 0;
  1548. }
  1549. lua_pushstring(state, "lua_PhysicsVehicle_setDrivingForce - Failed to match the given parameters to a valid function signature.");
  1550. lua_error(state);
  1551. break;
  1552. }
  1553. default:
  1554. {
  1555. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1556. lua_error(state);
  1557. break;
  1558. }
  1559. }
  1560. return 0;
  1561. }
  1562. int lua_PhysicsVehicle_setEnabled(lua_State* state)
  1563. {
  1564. // Get the number of parameters.
  1565. int paramCount = lua_gettop(state);
  1566. // Attempt to match the parameters to a valid binding.
  1567. switch (paramCount)
  1568. {
  1569. case 2:
  1570. {
  1571. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1572. lua_type(state, 2) == LUA_TBOOLEAN)
  1573. {
  1574. // Get parameter 1 off the stack.
  1575. bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
  1576. PhysicsVehicle* instance = getInstance(state);
  1577. instance->setEnabled(param1);
  1578. return 0;
  1579. }
  1580. lua_pushstring(state, "lua_PhysicsVehicle_setEnabled - Failed to match the given parameters to a valid function signature.");
  1581. lua_error(state);
  1582. break;
  1583. }
  1584. default:
  1585. {
  1586. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1587. lua_error(state);
  1588. break;
  1589. }
  1590. }
  1591. return 0;
  1592. }
  1593. int lua_PhysicsVehicle_setSteerdown(lua_State* state)
  1594. {
  1595. // Get the number of parameters.
  1596. int paramCount = lua_gettop(state);
  1597. // Attempt to match the parameters to a valid binding.
  1598. switch (paramCount)
  1599. {
  1600. case 3:
  1601. {
  1602. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1603. lua_type(state, 2) == LUA_TNUMBER &&
  1604. lua_type(state, 3) == LUA_TNUMBER)
  1605. {
  1606. // Get parameter 1 off the stack.
  1607. float param1 = (float)luaL_checknumber(state, 2);
  1608. // Get parameter 2 off the stack.
  1609. float param2 = (float)luaL_checknumber(state, 3);
  1610. PhysicsVehicle* instance = getInstance(state);
  1611. instance->setSteerdown(param1, param2);
  1612. return 0;
  1613. }
  1614. lua_pushstring(state, "lua_PhysicsVehicle_setSteerdown - Failed to match the given parameters to a valid function signature.");
  1615. lua_error(state);
  1616. break;
  1617. }
  1618. default:
  1619. {
  1620. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  1621. lua_error(state);
  1622. break;
  1623. }
  1624. }
  1625. return 0;
  1626. }
  1627. int lua_PhysicsVehicle_setSteeringGain(lua_State* state)
  1628. {
  1629. // Get the number of parameters.
  1630. int paramCount = lua_gettop(state);
  1631. // Attempt to match the parameters to a valid binding.
  1632. switch (paramCount)
  1633. {
  1634. case 2:
  1635. {
  1636. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1637. lua_type(state, 2) == LUA_TNUMBER)
  1638. {
  1639. // Get parameter 1 off the stack.
  1640. float param1 = (float)luaL_checknumber(state, 2);
  1641. PhysicsVehicle* instance = getInstance(state);
  1642. instance->setSteeringGain(param1);
  1643. return 0;
  1644. }
  1645. lua_pushstring(state, "lua_PhysicsVehicle_setSteeringGain - Failed to match the given parameters to a valid function signature.");
  1646. lua_error(state);
  1647. break;
  1648. }
  1649. default:
  1650. {
  1651. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  1652. lua_error(state);
  1653. break;
  1654. }
  1655. }
  1656. return 0;
  1657. }
  1658. int lua_PhysicsVehicle_update(lua_State* state)
  1659. {
  1660. // Get the number of parameters.
  1661. int paramCount = lua_gettop(state);
  1662. // Attempt to match the parameters to a valid binding.
  1663. switch (paramCount)
  1664. {
  1665. case 5:
  1666. {
  1667. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  1668. lua_type(state, 2) == LUA_TNUMBER &&
  1669. lua_type(state, 3) == LUA_TNUMBER &&
  1670. lua_type(state, 4) == LUA_TNUMBER &&
  1671. lua_type(state, 5) == LUA_TNUMBER)
  1672. {
  1673. // Get parameter 1 off the stack.
  1674. float param1 = (float)luaL_checknumber(state, 2);
  1675. // Get parameter 2 off the stack.
  1676. float param2 = (float)luaL_checknumber(state, 3);
  1677. // Get parameter 3 off the stack.
  1678. float param3 = (float)luaL_checknumber(state, 4);
  1679. // Get parameter 4 off the stack.
  1680. float param4 = (float)luaL_checknumber(state, 5);
  1681. PhysicsVehicle* instance = getInstance(state);
  1682. instance->update(param1, param2, param3, param4);
  1683. return 0;
  1684. }
  1685. lua_pushstring(state, "lua_PhysicsVehicle_update - Failed to match the given parameters to a valid function signature.");
  1686. lua_error(state);
  1687. break;
  1688. }
  1689. default:
  1690. {
  1691. lua_pushstring(state, "Invalid number of parameters (expected 5).");
  1692. lua_error(state);
  1693. break;
  1694. }
  1695. }
  1696. return 0;
  1697. }
  1698. }