lua_PhysicsCollisionObject.cpp 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879
  1. #include "Base.h"
  2. #include "ScriptController.h"
  3. #include "lua_PhysicsCollisionObject.h"
  4. #include "Base.h"
  5. #include "Game.h"
  6. #include "Node.h"
  7. #include "PhysicsCharacter.h"
  8. #include "PhysicsCollisionObject.h"
  9. #include "PhysicsController.h"
  10. #include "PhysicsGhostObject.h"
  11. #include "PhysicsRigidBody.h"
  12. #include "PhysicsVehicle.h"
  13. #include "PhysicsVehicleWheel.h"
  14. #include "ScriptController.h"
  15. #include "lua_PhysicsCollisionObjectCollisionListenerEventType.h"
  16. #include "lua_PhysicsCollisionObjectType.h"
  17. #include "lua_PhysicsCollisionShapeType.h"
  18. namespace gameplay
  19. {
  20. void luaRegister_PhysicsCollisionObject()
  21. {
  22. const luaL_Reg lua_members[] =
  23. {
  24. {"addCollisionListener", lua_PhysicsCollisionObject_addCollisionListener},
  25. {"asCharacter", lua_PhysicsCollisionObject_asCharacter},
  26. {"asGhostObject", lua_PhysicsCollisionObject_asGhostObject},
  27. {"asRigidBody", lua_PhysicsCollisionObject_asRigidBody},
  28. {"asVehicle", lua_PhysicsCollisionObject_asVehicle},
  29. {"asVehicleWheel", lua_PhysicsCollisionObject_asVehicleWheel},
  30. {"collidesWith", lua_PhysicsCollisionObject_collidesWith},
  31. {"getCollisionShape", lua_PhysicsCollisionObject_getCollisionShape},
  32. {"getNode", lua_PhysicsCollisionObject_getNode},
  33. {"getShapeType", lua_PhysicsCollisionObject_getShapeType},
  34. {"getType", lua_PhysicsCollisionObject_getType},
  35. {"isDynamic", lua_PhysicsCollisionObject_isDynamic},
  36. {"isEnabled", lua_PhysicsCollisionObject_isEnabled},
  37. {"isKinematic", lua_PhysicsCollisionObject_isKinematic},
  38. {"removeCollisionListener", lua_PhysicsCollisionObject_removeCollisionListener},
  39. {"setEnabled", lua_PhysicsCollisionObject_setEnabled},
  40. {NULL, NULL}
  41. };
  42. const luaL_Reg* lua_statics = NULL;
  43. std::vector<std::string> scopePath;
  44. ScriptUtil::registerClass("PhysicsCollisionObject", lua_members, NULL, lua_PhysicsCollisionObject__gc, lua_statics, scopePath);
  45. }
  46. static PhysicsCollisionObject* getInstance(lua_State* state)
  47. {
  48. void* userdata = luaL_checkudata(state, 1, "PhysicsCollisionObject");
  49. luaL_argcheck(state, userdata != NULL, 1, "'PhysicsCollisionObject' expected.");
  50. return (PhysicsCollisionObject*)((ScriptUtil::LuaObject*)userdata)->instance;
  51. }
  52. int lua_PhysicsCollisionObject__gc(lua_State* state)
  53. {
  54. // Get the number of parameters.
  55. int paramCount = lua_gettop(state);
  56. // Attempt to match the parameters to a valid binding.
  57. switch (paramCount)
  58. {
  59. case 1:
  60. {
  61. if ((lua_type(state, 1) == LUA_TUSERDATA))
  62. {
  63. void* userdata = luaL_checkudata(state, 1, "PhysicsCollisionObject");
  64. luaL_argcheck(state, userdata != NULL, 1, "'PhysicsCollisionObject' expected.");
  65. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
  66. if (object->owns)
  67. {
  68. PhysicsCollisionObject* instance = (PhysicsCollisionObject*)object->instance;
  69. SAFE_DELETE(instance);
  70. }
  71. return 0;
  72. }
  73. lua_pushstring(state, "lua_PhysicsCollisionObject__gc - Failed to match the given parameters to a valid function signature.");
  74. lua_error(state);
  75. break;
  76. }
  77. default:
  78. {
  79. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  80. lua_error(state);
  81. break;
  82. }
  83. }
  84. return 0;
  85. }
  86. int lua_PhysicsCollisionObject_addCollisionListener(lua_State* state)
  87. {
  88. // Get the number of parameters.
  89. int paramCount = lua_gettop(state);
  90. // Attempt to match the parameters to a valid binding.
  91. switch (paramCount)
  92. {
  93. case 2:
  94. {
  95. do
  96. {
  97. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  98. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  99. {
  100. // Get parameter 1 off the stack.
  101. bool param1Valid;
  102. ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false, &param1Valid);
  103. if (!param1Valid)
  104. break;
  105. PhysicsCollisionObject* instance = getInstance(state);
  106. instance->addCollisionListener(param1);
  107. return 0;
  108. }
  109. } while (0);
  110. do
  111. {
  112. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  113. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  114. {
  115. // Get parameter 1 off the stack.
  116. const char* param1 = ScriptUtil::getString(2, false);
  117. PhysicsCollisionObject* instance = getInstance(state);
  118. instance->addCollisionListener(param1);
  119. return 0;
  120. }
  121. } while (0);
  122. lua_pushstring(state, "lua_PhysicsCollisionObject_addCollisionListener - Failed to match the given parameters to a valid function signature.");
  123. lua_error(state);
  124. break;
  125. }
  126. case 3:
  127. {
  128. do
  129. {
  130. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  131. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  132. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  133. {
  134. // Get parameter 1 off the stack.
  135. bool param1Valid;
  136. ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false, &param1Valid);
  137. if (!param1Valid)
  138. break;
  139. // Get parameter 2 off the stack.
  140. bool param2Valid;
  141. ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false, &param2Valid);
  142. if (!param2Valid)
  143. break;
  144. PhysicsCollisionObject* instance = getInstance(state);
  145. instance->addCollisionListener(param1, param2);
  146. return 0;
  147. }
  148. } while (0);
  149. do
  150. {
  151. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  152. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  153. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  154. {
  155. // Get parameter 1 off the stack.
  156. const char* param1 = ScriptUtil::getString(2, false);
  157. // Get parameter 2 off the stack.
  158. bool param2Valid;
  159. ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false, &param2Valid);
  160. if (!param2Valid)
  161. break;
  162. PhysicsCollisionObject* instance = getInstance(state);
  163. instance->addCollisionListener(param1, param2);
  164. return 0;
  165. }
  166. } while (0);
  167. lua_pushstring(state, "lua_PhysicsCollisionObject_addCollisionListener - Failed to match the given parameters to a valid function signature.");
  168. lua_error(state);
  169. break;
  170. }
  171. default:
  172. {
  173. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  174. lua_error(state);
  175. break;
  176. }
  177. }
  178. return 0;
  179. }
  180. int lua_PhysicsCollisionObject_asCharacter(lua_State* state)
  181. {
  182. // Get the number of parameters.
  183. int paramCount = lua_gettop(state);
  184. // Attempt to match the parameters to a valid binding.
  185. switch (paramCount)
  186. {
  187. case 1:
  188. {
  189. if ((lua_type(state, 1) == LUA_TUSERDATA))
  190. {
  191. PhysicsCollisionObject* instance = getInstance(state);
  192. void* returnPtr = (void*)instance->asCharacter();
  193. if (returnPtr)
  194. {
  195. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  196. object->instance = returnPtr;
  197. object->owns = false;
  198. luaL_getmetatable(state, "PhysicsCharacter");
  199. lua_setmetatable(state, -2);
  200. }
  201. else
  202. {
  203. lua_pushnil(state);
  204. }
  205. return 1;
  206. }
  207. lua_pushstring(state, "lua_PhysicsCollisionObject_asCharacter - Failed to match the given parameters to a valid function signature.");
  208. lua_error(state);
  209. break;
  210. }
  211. default:
  212. {
  213. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  214. lua_error(state);
  215. break;
  216. }
  217. }
  218. return 0;
  219. }
  220. int lua_PhysicsCollisionObject_asGhostObject(lua_State* state)
  221. {
  222. // Get the number of parameters.
  223. int paramCount = lua_gettop(state);
  224. // Attempt to match the parameters to a valid binding.
  225. switch (paramCount)
  226. {
  227. case 1:
  228. {
  229. if ((lua_type(state, 1) == LUA_TUSERDATA))
  230. {
  231. PhysicsCollisionObject* instance = getInstance(state);
  232. void* returnPtr = (void*)instance->asGhostObject();
  233. if (returnPtr)
  234. {
  235. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  236. object->instance = returnPtr;
  237. object->owns = false;
  238. luaL_getmetatable(state, "PhysicsGhostObject");
  239. lua_setmetatable(state, -2);
  240. }
  241. else
  242. {
  243. lua_pushnil(state);
  244. }
  245. return 1;
  246. }
  247. lua_pushstring(state, "lua_PhysicsCollisionObject_asGhostObject - Failed to match the given parameters to a valid function signature.");
  248. lua_error(state);
  249. break;
  250. }
  251. default:
  252. {
  253. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  254. lua_error(state);
  255. break;
  256. }
  257. }
  258. return 0;
  259. }
  260. int lua_PhysicsCollisionObject_asRigidBody(lua_State* state)
  261. {
  262. // Get the number of parameters.
  263. int paramCount = lua_gettop(state);
  264. // Attempt to match the parameters to a valid binding.
  265. switch (paramCount)
  266. {
  267. case 1:
  268. {
  269. if ((lua_type(state, 1) == LUA_TUSERDATA))
  270. {
  271. PhysicsCollisionObject* instance = getInstance(state);
  272. void* returnPtr = (void*)instance->asRigidBody();
  273. if (returnPtr)
  274. {
  275. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  276. object->instance = returnPtr;
  277. object->owns = false;
  278. luaL_getmetatable(state, "PhysicsRigidBody");
  279. lua_setmetatable(state, -2);
  280. }
  281. else
  282. {
  283. lua_pushnil(state);
  284. }
  285. return 1;
  286. }
  287. lua_pushstring(state, "lua_PhysicsCollisionObject_asRigidBody - Failed to match the given parameters to a valid function signature.");
  288. lua_error(state);
  289. break;
  290. }
  291. default:
  292. {
  293. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  294. lua_error(state);
  295. break;
  296. }
  297. }
  298. return 0;
  299. }
  300. int lua_PhysicsCollisionObject_asVehicle(lua_State* state)
  301. {
  302. // Get the number of parameters.
  303. int paramCount = lua_gettop(state);
  304. // Attempt to match the parameters to a valid binding.
  305. switch (paramCount)
  306. {
  307. case 1:
  308. {
  309. if ((lua_type(state, 1) == LUA_TUSERDATA))
  310. {
  311. PhysicsCollisionObject* instance = getInstance(state);
  312. void* returnPtr = (void*)instance->asVehicle();
  313. if (returnPtr)
  314. {
  315. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  316. object->instance = returnPtr;
  317. object->owns = false;
  318. luaL_getmetatable(state, "PhysicsVehicle");
  319. lua_setmetatable(state, -2);
  320. }
  321. else
  322. {
  323. lua_pushnil(state);
  324. }
  325. return 1;
  326. }
  327. lua_pushstring(state, "lua_PhysicsCollisionObject_asVehicle - Failed to match the given parameters to a valid function signature.");
  328. lua_error(state);
  329. break;
  330. }
  331. default:
  332. {
  333. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  334. lua_error(state);
  335. break;
  336. }
  337. }
  338. return 0;
  339. }
  340. int lua_PhysicsCollisionObject_asVehicleWheel(lua_State* state)
  341. {
  342. // Get the number of parameters.
  343. int paramCount = lua_gettop(state);
  344. // Attempt to match the parameters to a valid binding.
  345. switch (paramCount)
  346. {
  347. case 1:
  348. {
  349. if ((lua_type(state, 1) == LUA_TUSERDATA))
  350. {
  351. PhysicsCollisionObject* instance = getInstance(state);
  352. void* returnPtr = (void*)instance->asVehicleWheel();
  353. if (returnPtr)
  354. {
  355. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  356. object->instance = returnPtr;
  357. object->owns = false;
  358. luaL_getmetatable(state, "PhysicsVehicleWheel");
  359. lua_setmetatable(state, -2);
  360. }
  361. else
  362. {
  363. lua_pushnil(state);
  364. }
  365. return 1;
  366. }
  367. lua_pushstring(state, "lua_PhysicsCollisionObject_asVehicleWheel - Failed to match the given parameters to a valid function signature.");
  368. lua_error(state);
  369. break;
  370. }
  371. default:
  372. {
  373. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  374. lua_error(state);
  375. break;
  376. }
  377. }
  378. return 0;
  379. }
  380. int lua_PhysicsCollisionObject_collidesWith(lua_State* state)
  381. {
  382. // Get the number of parameters.
  383. int paramCount = lua_gettop(state);
  384. // Attempt to match the parameters to a valid binding.
  385. switch (paramCount)
  386. {
  387. case 2:
  388. {
  389. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  390. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  391. {
  392. // Get parameter 1 off the stack.
  393. bool param1Valid;
  394. ScriptUtil::LuaArray<PhysicsCollisionObject> param1 = ScriptUtil::getObjectPointer<PhysicsCollisionObject>(2, "PhysicsCollisionObject", false, &param1Valid);
  395. if (!param1Valid)
  396. {
  397. lua_pushstring(state, "Failed to convert parameter 1 to type 'PhysicsCollisionObject'.");
  398. lua_error(state);
  399. }
  400. PhysicsCollisionObject* instance = getInstance(state);
  401. bool result = instance->collidesWith(param1);
  402. // Push the return value onto the stack.
  403. lua_pushboolean(state, result);
  404. return 1;
  405. }
  406. lua_pushstring(state, "lua_PhysicsCollisionObject_collidesWith - Failed to match the given parameters to a valid function signature.");
  407. lua_error(state);
  408. break;
  409. }
  410. default:
  411. {
  412. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  413. lua_error(state);
  414. break;
  415. }
  416. }
  417. return 0;
  418. }
  419. int lua_PhysicsCollisionObject_getCollisionShape(lua_State* state)
  420. {
  421. // Get the number of parameters.
  422. int paramCount = lua_gettop(state);
  423. // Attempt to match the parameters to a valid binding.
  424. switch (paramCount)
  425. {
  426. case 1:
  427. {
  428. if ((lua_type(state, 1) == LUA_TUSERDATA))
  429. {
  430. PhysicsCollisionObject* instance = getInstance(state);
  431. void* returnPtr = (void*)instance->getCollisionShape();
  432. if (returnPtr)
  433. {
  434. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  435. object->instance = returnPtr;
  436. object->owns = false;
  437. luaL_getmetatable(state, "PhysicsCollisionShape");
  438. lua_setmetatable(state, -2);
  439. }
  440. else
  441. {
  442. lua_pushnil(state);
  443. }
  444. return 1;
  445. }
  446. lua_pushstring(state, "lua_PhysicsCollisionObject_getCollisionShape - Failed to match the given parameters to a valid function signature.");
  447. lua_error(state);
  448. break;
  449. }
  450. default:
  451. {
  452. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  453. lua_error(state);
  454. break;
  455. }
  456. }
  457. return 0;
  458. }
  459. int lua_PhysicsCollisionObject_getNode(lua_State* state)
  460. {
  461. // Get the number of parameters.
  462. int paramCount = lua_gettop(state);
  463. // Attempt to match the parameters to a valid binding.
  464. switch (paramCount)
  465. {
  466. case 1:
  467. {
  468. if ((lua_type(state, 1) == LUA_TUSERDATA))
  469. {
  470. PhysicsCollisionObject* instance = getInstance(state);
  471. void* returnPtr = (void*)instance->getNode();
  472. if (returnPtr)
  473. {
  474. ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
  475. object->instance = returnPtr;
  476. object->owns = false;
  477. luaL_getmetatable(state, "Node");
  478. lua_setmetatable(state, -2);
  479. }
  480. else
  481. {
  482. lua_pushnil(state);
  483. }
  484. return 1;
  485. }
  486. lua_pushstring(state, "lua_PhysicsCollisionObject_getNode - Failed to match the given parameters to a valid function signature.");
  487. lua_error(state);
  488. break;
  489. }
  490. default:
  491. {
  492. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  493. lua_error(state);
  494. break;
  495. }
  496. }
  497. return 0;
  498. }
  499. int lua_PhysicsCollisionObject_getShapeType(lua_State* state)
  500. {
  501. // Get the number of parameters.
  502. int paramCount = lua_gettop(state);
  503. // Attempt to match the parameters to a valid binding.
  504. switch (paramCount)
  505. {
  506. case 1:
  507. {
  508. if ((lua_type(state, 1) == LUA_TUSERDATA))
  509. {
  510. PhysicsCollisionObject* instance = getInstance(state);
  511. PhysicsCollisionShape::Type result = instance->getShapeType();
  512. // Push the return value onto the stack.
  513. lua_pushstring(state, lua_stringFromEnum_PhysicsCollisionShapeType(result));
  514. return 1;
  515. }
  516. lua_pushstring(state, "lua_PhysicsCollisionObject_getShapeType - Failed to match the given parameters to a valid function signature.");
  517. lua_error(state);
  518. break;
  519. }
  520. default:
  521. {
  522. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  523. lua_error(state);
  524. break;
  525. }
  526. }
  527. return 0;
  528. }
  529. int lua_PhysicsCollisionObject_getType(lua_State* state)
  530. {
  531. // Get the number of parameters.
  532. int paramCount = lua_gettop(state);
  533. // Attempt to match the parameters to a valid binding.
  534. switch (paramCount)
  535. {
  536. case 1:
  537. {
  538. if ((lua_type(state, 1) == LUA_TUSERDATA))
  539. {
  540. PhysicsCollisionObject* instance = getInstance(state);
  541. PhysicsCollisionObject::Type result = instance->getType();
  542. // Push the return value onto the stack.
  543. lua_pushstring(state, lua_stringFromEnum_PhysicsCollisionObjectType(result));
  544. return 1;
  545. }
  546. lua_pushstring(state, "lua_PhysicsCollisionObject_getType - Failed to match the given parameters to a valid function signature.");
  547. lua_error(state);
  548. break;
  549. }
  550. default:
  551. {
  552. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  553. lua_error(state);
  554. break;
  555. }
  556. }
  557. return 0;
  558. }
  559. int lua_PhysicsCollisionObject_isDynamic(lua_State* state)
  560. {
  561. // Get the number of parameters.
  562. int paramCount = lua_gettop(state);
  563. // Attempt to match the parameters to a valid binding.
  564. switch (paramCount)
  565. {
  566. case 1:
  567. {
  568. if ((lua_type(state, 1) == LUA_TUSERDATA))
  569. {
  570. PhysicsCollisionObject* instance = getInstance(state);
  571. bool result = instance->isDynamic();
  572. // Push the return value onto the stack.
  573. lua_pushboolean(state, result);
  574. return 1;
  575. }
  576. lua_pushstring(state, "lua_PhysicsCollisionObject_isDynamic - Failed to match the given parameters to a valid function signature.");
  577. lua_error(state);
  578. break;
  579. }
  580. default:
  581. {
  582. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  583. lua_error(state);
  584. break;
  585. }
  586. }
  587. return 0;
  588. }
  589. int lua_PhysicsCollisionObject_isEnabled(lua_State* state)
  590. {
  591. // Get the number of parameters.
  592. int paramCount = lua_gettop(state);
  593. // Attempt to match the parameters to a valid binding.
  594. switch (paramCount)
  595. {
  596. case 1:
  597. {
  598. if ((lua_type(state, 1) == LUA_TUSERDATA))
  599. {
  600. PhysicsCollisionObject* instance = getInstance(state);
  601. bool result = instance->isEnabled();
  602. // Push the return value onto the stack.
  603. lua_pushboolean(state, result);
  604. return 1;
  605. }
  606. lua_pushstring(state, "lua_PhysicsCollisionObject_isEnabled - Failed to match the given parameters to a valid function signature.");
  607. lua_error(state);
  608. break;
  609. }
  610. default:
  611. {
  612. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  613. lua_error(state);
  614. break;
  615. }
  616. }
  617. return 0;
  618. }
  619. int lua_PhysicsCollisionObject_isKinematic(lua_State* state)
  620. {
  621. // Get the number of parameters.
  622. int paramCount = lua_gettop(state);
  623. // Attempt to match the parameters to a valid binding.
  624. switch (paramCount)
  625. {
  626. case 1:
  627. {
  628. if ((lua_type(state, 1) == LUA_TUSERDATA))
  629. {
  630. PhysicsCollisionObject* instance = getInstance(state);
  631. bool result = instance->isKinematic();
  632. // Push the return value onto the stack.
  633. lua_pushboolean(state, result);
  634. return 1;
  635. }
  636. lua_pushstring(state, "lua_PhysicsCollisionObject_isKinematic - Failed to match the given parameters to a valid function signature.");
  637. lua_error(state);
  638. break;
  639. }
  640. default:
  641. {
  642. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  643. lua_error(state);
  644. break;
  645. }
  646. }
  647. return 0;
  648. }
  649. int lua_PhysicsCollisionObject_removeCollisionListener(lua_State* state)
  650. {
  651. // Get the number of parameters.
  652. int paramCount = lua_gettop(state);
  653. // Attempt to match the parameters to a valid binding.
  654. switch (paramCount)
  655. {
  656. case 2:
  657. {
  658. do
  659. {
  660. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  661. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  662. {
  663. // Get parameter 1 off the stack.
  664. bool param1Valid;
  665. ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false, &param1Valid);
  666. if (!param1Valid)
  667. break;
  668. PhysicsCollisionObject* instance = getInstance(state);
  669. instance->removeCollisionListener(param1);
  670. return 0;
  671. }
  672. } while (0);
  673. do
  674. {
  675. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  676. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  677. {
  678. // Get parameter 1 off the stack.
  679. const char* param1 = ScriptUtil::getString(2, false);
  680. PhysicsCollisionObject* instance = getInstance(state);
  681. instance->removeCollisionListener(param1);
  682. return 0;
  683. }
  684. } while (0);
  685. lua_pushstring(state, "lua_PhysicsCollisionObject_removeCollisionListener - Failed to match the given parameters to a valid function signature.");
  686. lua_error(state);
  687. break;
  688. }
  689. case 3:
  690. {
  691. do
  692. {
  693. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  694. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  695. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  696. {
  697. // Get parameter 1 off the stack.
  698. bool param1Valid;
  699. ScriptUtil::LuaArray<PhysicsCollisionObject::CollisionListener> param1 = ScriptUtil::getObjectPointer<PhysicsCollisionObject::CollisionListener>(2, "PhysicsCollisionObjectCollisionListener", false, &param1Valid);
  700. if (!param1Valid)
  701. break;
  702. // Get parameter 2 off the stack.
  703. bool param2Valid;
  704. ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false, &param2Valid);
  705. if (!param2Valid)
  706. break;
  707. PhysicsCollisionObject* instance = getInstance(state);
  708. instance->removeCollisionListener(param1, param2);
  709. return 0;
  710. }
  711. } while (0);
  712. do
  713. {
  714. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  715. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  716. (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
  717. {
  718. // Get parameter 1 off the stack.
  719. const char* param1 = ScriptUtil::getString(2, false);
  720. // Get parameter 2 off the stack.
  721. bool param2Valid;
  722. ScriptUtil::LuaArray<PhysicsCollisionObject> param2 = ScriptUtil::getObjectPointer<PhysicsCollisionObject>(3, "PhysicsCollisionObject", false, &param2Valid);
  723. if (!param2Valid)
  724. break;
  725. PhysicsCollisionObject* instance = getInstance(state);
  726. instance->removeCollisionListener(param1, param2);
  727. return 0;
  728. }
  729. } while (0);
  730. lua_pushstring(state, "lua_PhysicsCollisionObject_removeCollisionListener - Failed to match the given parameters to a valid function signature.");
  731. lua_error(state);
  732. break;
  733. }
  734. default:
  735. {
  736. lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
  737. lua_error(state);
  738. break;
  739. }
  740. }
  741. return 0;
  742. }
  743. int lua_PhysicsCollisionObject_setEnabled(lua_State* state)
  744. {
  745. // Get the number of parameters.
  746. int paramCount = lua_gettop(state);
  747. // Attempt to match the parameters to a valid binding.
  748. switch (paramCount)
  749. {
  750. case 2:
  751. {
  752. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  753. lua_type(state, 2) == LUA_TBOOLEAN)
  754. {
  755. // Get parameter 1 off the stack.
  756. bool param1 = ScriptUtil::luaCheckBool(state, 2);
  757. PhysicsCollisionObject* instance = getInstance(state);
  758. instance->setEnabled(param1);
  759. return 0;
  760. }
  761. lua_pushstring(state, "lua_PhysicsCollisionObject_setEnabled - Failed to match the given parameters to a valid function signature.");
  762. lua_error(state);
  763. break;
  764. }
  765. default:
  766. {
  767. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  768. lua_error(state);
  769. break;
  770. }
  771. }
  772. return 0;
  773. }
  774. }