lua_PhysicsCollisionObject.cpp 32 KB

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