lua_PhysicsGhostObject.cpp 32 KB

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