CapsAdmin

Untitled

May 30th, 2011
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.39 KB | None | 0 0
  1. local str = [[//#pragma region pe_params_pos
  2. function(SetPos)   
  3.     pe_params_pos params;
  4.  
  5.     params.pos = lua->CheckVec3(2);
  6.    
  7.     self->SetParams(&params);
  8.  
  9.     return 0;
  10. end
  11.  
  12. function(SetRotation)  
  13.     pe_params_pos params;
  14.  
  15.     params.q = lua->CheckQuat(2);
  16.    
  17.     self->SetParams(&params);
  18.  
  19.     return 0;
  20. end
  21.  
  22. function(SetScale) 
  23.     pe_params_pos params;
  24.  
  25.     params.scale = lua->CheckNumber(2);
  26.    
  27.     self->SetParams(&params);
  28.  
  29.     return 0;
  30. end
  31.  
  32. function(ActionPos)
  33.     if (lua->IsTable(2))
  34.     {
  35.         pe_params_pos params;
  36.  
  37.         lua->Push("RecalcBounds");
  38.         lua->GetTable(-2);
  39.         if(lua->IsVec3(-1))
  40.             params.bRecalcBounds = lua->CheckInteger(-1);
  41.  
  42.         lua->Push("SimClass");
  43.         lua->GetTable(-2);
  44.         if(lua->IsNumber(-1))
  45.             params.iSimClass = lua->CheckInteger(-1);
  46.  
  47.         lua->Push("Position");
  48.         lua->GetTable(-2);
  49.         if(lua->IsVec3(-1))
  50.             params.pos = lua->CheckVec3(-1);
  51.  
  52.         lua->Push("Rotation");
  53.         lua->GetTable(-2);
  54.         if(lua->IsNumber(-1))
  55.             params.q = lua->CheckQuat(-1);
  56.  
  57.         lua->Push("Scale");
  58.         lua->GetTable(-2);
  59.         if(lua->IsNumber(-1))
  60.             params.scale = lua->CheckInteger(-1);
  61.  
  62.         self->SetParams(&params);
  63.  
  64.         return 0;
  65.     }
  66.     return 0;
  67. end
  68.  
  69.  
  70. //#pragma endregion pe_params_pos
  71.  
  72. //#pragma region pe_params_outer_entity
  73. function(SetOuterPhysicalEntity)   
  74.     pe_params_outer_entity params;
  75.  
  76.     params.pOuterEntity = lua->CheckPhysics(2);
  77.    
  78.     self->SetParams(&params);
  79.  
  80.     return 0;
  81. end
  82. //#pragma endregion pe_params_outer_entity
  83.  
  84. //#pragma region pe_simulation_params
  85. function(SetDamping)   
  86.     pe_simulation_params params;
  87.  
  88.     params.damping = lua->CheckNumber(2);
  89.    
  90.     self->SetParams(&params);
  91.  
  92.     return 0;
  93. end
  94.  
  95. function(SetFreefallDamping)   
  96.     pe_simulation_params params;
  97.  
  98.     params.dampingFreefall = lua->CheckNumber(2);
  99.    
  100.     self->SetParams(&params);
  101.  
  102.     return 0;
  103. end
  104.  
  105. function(SetDensity)   
  106.     pe_simulation_params params;
  107.  
  108.     params.density = lua->CheckNumber(2);
  109.    
  110.     self->SetParams(&params);
  111.  
  112.     return 0;
  113. end
  114.  
  115. function(SetGravity)   
  116.     pe_simulation_params params;
  117.  
  118.     params.gravity = lua->CheckVec3(2);
  119.    
  120.     self->SetParams(&params);
  121.  
  122.     return 0;
  123. end
  124.  
  125. function(SetFreefallGravity)   
  126.     pe_simulation_params params;
  127.  
  128.     params.gravityFreefall = lua->CheckVec3(2);
  129.    
  130.     self->SetParams(&params);
  131.  
  132.     return 0;
  133. end
  134.  
  135. function(SetSimClass)  
  136.     pe_simulation_params params;
  137.  
  138.     params.iSimClass = lua->CheckInteger(2);
  139.    
  140.     self->SetParams(&params);
  141.  
  142.     return 0;
  143. end
  144.  
  145. function(SetMass)  
  146.     pe_simulation_params params;
  147.  
  148.     params.mass = lua->CheckNumber(2);
  149.    
  150.     self->SetParams(&params);
  151.  
  152.     return 0;
  153. end
  154.  
  155. function(SetMaxLoggedCollisions)   
  156.     pe_simulation_params params;
  157.  
  158.     params.maxLoggedCollisions = lua->CheckInteger(2);
  159.    
  160.     self->SetParams(&params);
  161.  
  162.     return 0;
  163. end
  164.  
  165. function(SetMaxTimeStep)   
  166.     pe_simulation_params params;
  167.  
  168.     params.maxTimeStep = lua->CheckNumber(2);
  169.    
  170.     self->SetParams(&params);
  171.  
  172.     return 0;
  173. end
  174.  
  175. function(SetMinEnergy) 
  176.     pe_simulation_params params;
  177.  
  178.     params.minEnergy = lua->CheckNumber(2);
  179.    
  180.     self->SetParams(&params);
  181.  
  182.     return 0;
  183. end
  184.  
  185. function(SetSoftness)  
  186.     pe_simulation_params params;
  187.  
  188.     params.softness = lua->CheckNumber(2);
  189.    
  190.     self->SetParams(&params);
  191.  
  192.     return 0;
  193. end
  194.  
  195. function(SetAngularSoftness)   
  196.     pe_simulation_params params;
  197.  
  198.     params.softnessAngular = lua->CheckNumber(2);
  199.    
  200.     self->SetParams(&params);
  201.  
  202.     return 0;
  203. end
  204.  
  205. function(SetGroupAngularSoftness)  
  206.     pe_simulation_params params;
  207.  
  208.     params.softnessAngularGroup = lua->CheckNumber(2);
  209.    
  210.     self->SetParams(&params);
  211.  
  212.     return 0;
  213. end
  214.  
  215. function(SetGroupSoftness) 
  216.     pe_simulation_params params;
  217.  
  218.     params.softnessGroup = lua->CheckNumber(2);
  219.    
  220.     self->SetParams(&params);
  221.  
  222.     return 0;
  223. end
  224. //#pragma endregion pe_simulation_params
  225.  
  226. //#pragma region pe_params_buoyancy
  227. function(SetFlowVariance)  
  228.     pe_params_buoyancy params;
  229.  
  230.     params.flowVariance = lua->CheckNumber(2);
  231.    
  232.     self->SetParams(&params);
  233.  
  234.     return 0;
  235. end
  236.  
  237. function(SetMedium)
  238.     pe_params_buoyancy params;
  239.  
  240.     params.iMedium = lua->CheckInteger(2);
  241.    
  242.     self->SetParams(&params);
  243.  
  244.     return 0;
  245. end
  246.  
  247. function(SetkWaterDensity) 
  248.     pe_params_buoyancy params;
  249.  
  250.     params.kwaterDensity = lua->CheckNumber(2);
  251.    
  252.     self->SetParams(&params);
  253.  
  254.     return 0;
  255. end
  256.  
  257. function(SetkWaterResistance)  
  258.     pe_params_buoyancy params;
  259.  
  260.     params.kwaterResistance = lua->CheckNumber(2);
  261.    
  262.     self->SetParams(&params);
  263.  
  264.     return 0;
  265. end
  266.  
  267. function(SetWaterDamping)  
  268.     pe_params_buoyancy params;
  269.  
  270.     params.waterDamping = lua->CheckNumber(2);
  271.    
  272.     self->SetParams(&params);
  273.  
  274.     return 0;
  275. end
  276.  
  277. function(SetWaterDensity)  
  278.     pe_params_buoyancy params;
  279.  
  280.     params.waterDensity = lua->CheckNumber(2);
  281.    
  282.     self->SetParams(&params);
  283.  
  284.     return 0;
  285. end
  286.  
  287. function(SetWaterEmin) 
  288.     pe_params_buoyancy params;
  289.  
  290.     params.waterEmin = lua->CheckNumber(2);
  291.    
  292.     self->SetParams(&params);
  293.  
  294.     return 0;
  295. end
  296.  
  297. function(SetWaterResistance)   
  298.     pe_params_buoyancy params;
  299.  
  300.     params.waterResistance = lua->CheckNumber(2);
  301.    
  302.     self->SetParams(&params);
  303.  
  304.     return 0;
  305. end
  306. //#pragma endregion pe_params_buoyancy
  307.  
  308. //#pragma region pe_params_flags
  309. function(SetFlags) 
  310.     pe_params_flags params;
  311.  
  312.     params.flags = lua->CheckInteger(2);
  313.    
  314.     self->SetParams(&params);
  315.  
  316.     return 0;
  317. end
  318. //#pragma endregion pe_params_flags
  319.  
  320. //#pragma region pe_action_impulse
  321. function(AddAngularImpulse)
  322.     pe_action_impulse params;
  323.  
  324.     params.angImpulse = lua->CheckVec3(2);
  325.    
  326.     self->Action(&params);
  327.  
  328.     return 0;
  329. end
  330.  
  331. function(AddImpulse)   
  332.     pe_action_impulse params;
  333.  
  334.     params.impulse = lua->CheckVec3(2);
  335.    
  336.     self->Action(&params);
  337.  
  338.     //lua_pop(-2);
  339.  
  340.     return 0;
  341. end
  342.  
  343. function(ActionImpulse)
  344.     if (lua->IsTable(2))
  345.     {
  346.         pe_action_impulse params;
  347.  
  348.         lua->Push("AngularImpulse");
  349.         lua->GetTable(2);
  350.         if(!lua->IsNil(-1))
  351.             params.angImpulse = lua->CheckVec3(-1);
  352.  
  353.         lua->Push("ApplyTime");
  354.         lua->GetTable(2);
  355.         if(!lua->IsNil(-1))
  356.             params.iApplyTime = lua->CheckInteger(-1);
  357.  
  358.         lua->Push("Impulse");
  359.         lua->GetTable(2);
  360.         if(!lua->IsNil(-1))
  361.             params.impulse = lua->CheckVec3(-1);
  362.  
  363.         lua->Push("Part");
  364.         lua->GetTable(2);
  365.         if(!lua->IsNil(-1))
  366.             params.ipart = lua->CheckInteger(-1);
  367.  
  368.         lua->Push("PartID");
  369.         lua->GetTable(2);
  370.         if(!lua->IsNil(-1))
  371.             params.partid = lua->CheckInteger(-1);
  372.  
  373.         lua->Push("Point");
  374.         lua->GetTable(2);
  375.         if(!lua->IsNil(-1))
  376.             params.pofunction(= lua->CheckVec3(-1);
  377.  
  378.         self->Action(&params);
  379.  
  380.         return 0;
  381.     }
  382.     return 0;
  383. end
  384. //#pragma endregion pe_action_impulse
  385.  
  386. //#pragma region pe_action_reset
  387. function(Reset)
  388.     pe_action_reset params;
  389.  
  390.     params.bClearContacts = lua->CheckInteger(2);
  391.    
  392.     self->Action(&params);
  393.  
  394.     return 0;
  395. end
  396. //#pragma endregion pe_action_reset
  397.  
  398. //#pragma region pe_action_awake
  399. function(Wake) 
  400.     pe_action_awake params;
  401.  
  402.     params.bAwake = lua->CheckInteger(2);
  403.    
  404.     self->Action(&params);
  405.  
  406.     return 0;
  407. end
  408. //#pragma endregion pe_action_awake
  409.  
  410. //#pragma region pe_action_set_velocity
  411. function(SetVelocity)  
  412.     pe_action_set_velocity params;
  413.  
  414.     params.v = lua->CheckVec3(2);
  415.    
  416.     self->Action(&params);
  417.  
  418.     return 0;
  419. end
  420.  
  421. function(SetAngularVelocity)   
  422.     pe_action_set_velocity params;
  423.  
  424.     params.w = lua->CheckVec3(2);
  425.    
  426.     self->Action(&params);
  427.  
  428.     return 0;
  429. end
  430.  
  431. function(ActionVelocity)   
  432.     if (lua->IsTable(2))
  433.     {
  434.         pe_action_set_velocity params;
  435.  
  436.         lua->Push("Part");
  437.         lua->GetTable(-2);
  438.         if(lua->IsNumber(-1))
  439.             params.ipart = lua->CheckInteger(-1);
  440.  
  441.         lua->Push("PartID");
  442.         lua->GetTable(-2);
  443.         if(lua->IsNumber(-1))
  444.             params.partid = lua->CheckInteger(-1);
  445.  
  446.         lua->Push("Velocity");
  447.         lua->GetTable(-2);
  448.         if(lua->IsNumber(-1))
  449.             params.v = lua->CheckVec3(-1);
  450.  
  451.         lua->Push("AngularVelocity");
  452.         lua->GetTable(-2);
  453.         if(lua->IsVec3(-1))
  454.             params.w = lua->CheckVec3(-1);
  455.  
  456.         self->Action(&params);
  457.  
  458.         return 0;
  459.     }
  460.     return 0;
  461. end
  462. //#pragma endregion pe_action_set_velocity
  463.  
  464. //#pragma endregion Set~
  465.  
  466. //#pragma region Get
  467.  
  468. //#pragma region pe_status_pos
  469. function(GetBBoxMin)   
  470.     pe_status_pos params;
  471.  
  472.     self->GetStatus(&params);
  473.    
  474.     lua->Push(params.BBox[0]);
  475.  
  476.     return 1;
  477. end
  478.  
  479. function(GetBBoxMax)   
  480.     pe_status_pos params;
  481.  
  482.     self->GetStatus(&params);
  483.    
  484.     lua->Push(params.BBox[1]);
  485.  
  486.     return 1;
  487. end
  488.  
  489. function(GetFlags) 
  490.     pe_status_pos params;
  491.  
  492.     self->GetStatus(&params);
  493.    
  494.     lua->Push(params.flags);
  495.  
  496.     return 1;
  497. end
  498.  
  499. function(GetSimClass)  
  500.     pe_status_pos params;
  501.  
  502.     self->GetStatus(&params);
  503.    
  504.     lua->Push(params.iSimClass);
  505.  
  506.     return 1;
  507. end
  508.  
  509. function(GetPartID)
  510.     pe_status_pos params;
  511.  
  512.     self->GetStatus(&params);
  513.    
  514.     lua->Push(params.partid);
  515.  
  516.     return 1;
  517. end
  518.  
  519. function(GetPos)   
  520.     pe_status_pos params;
  521.  
  522.     self->GetStatus(&params);
  523.    
  524.     lua->Push(params.pos);
  525.  
  526.     return 1;
  527. end
  528.  
  529. function(GetRotation)  
  530.     pe_status_pos params;
  531.  
  532.     self->GetStatus(&params);
  533.    
  534.     lua->Push(params.q);
  535.  
  536.     return 1;
  537. end
  538.  
  539. function(GetScale) 
  540.     pe_status_pos params;
  541.  
  542.     self->GetStatus(&params);
  543.    
  544.     lua->Push(params.scale);
  545.  
  546.     return 1;
  547. end
  548. //#pragma endregion pe_status_pos
  549.  
  550. //#pragma region pe_status_random
  551. function(GetRandomPos) 
  552.     pe_status_random params;
  553.  
  554.     self->GetStatus(&params);
  555.    
  556.     lua->Push(params.ran.vPos);
  557.     lua->Push(params.ran.vNorm);
  558.  
  559.     return 2;
  560. end
  561. //#pragma endregion pe_status_random
  562.  
  563. //#pragma region pe_status_dynamics
  564. function(GetAcceleration)  
  565.     pe_status_dynamics params;
  566.  
  567.     self->GetStatus(&params);
  568.    
  569.     lua->Push(params.a);
  570.  
  571.     return 1;
  572. end
  573.  
  574. function(GetCenterOfMass)  
  575.     pe_status_dynamics params;
  576.  
  577.     self->GetStatus(&params);
  578.    
  579.     lua->Push(params.centerOfMass);
  580.  
  581.     return 1;
  582. end
  583.  
  584. function(GetEnergy)
  585.     pe_status_dynamics params;
  586.  
  587.     self->GetStatus(&params);
  588.    
  589.     lua->Push(params.energy);
  590.  
  591.     return 1;
  592. end
  593.  
  594. function(GetMass)  
  595.     pe_status_dynamics params;
  596.  
  597.     self->GetStatus(&params);
  598.    
  599.     lua->Push(params.mass);
  600.  
  601.     return 1;
  602. end
  603.  
  604. function(GetNumberOfContacts)  
  605.     pe_status_dynamics params;
  606.  
  607.     self->GetStatus(&params);
  608.    
  609.     lua->Push(params.nContacts);
  610.  
  611.     return 1;
  612. end
  613.  
  614. function(GetSubmergedFraction) 
  615.     pe_status_dynamics params;
  616.  
  617.     self->GetStatus(&params);
  618.    
  619.     lua->Push(params.submergedFraction);
  620.  
  621.     return 1;
  622. end
  623. /*
  624. function(GetTimeInterval)  
  625.     pe_status_dynamics params;
  626.  
  627.     self->GetStatus(&params);
  628.    
  629.     lua->Push(params.time_interval);
  630.  
  631.     return 1;
  632. end*/
  633. function(GetVelocity)  
  634.     pe_status_dynamics params;
  635.  
  636.     self->GetStatus(&params);
  637.    
  638.     lua->Push(params.v);
  639.  
  640.     return 1;
  641. end
  642.  
  643. function(GetAngularVelocity)   
  644.     pe_status_dynamics params;
  645.  
  646.     self->GetStatus(&params);
  647.    
  648.     lua->Push(params.w);
  649.  
  650.     return 1;
  651. end
  652.  
  653. function(GetAngularAcceleration)   
  654.     pe_status_dynamics params;
  655.  
  656.     self->GetStatus(&params);
  657.    
  658.     lua->Push(params.wa);
  659.  
  660.     return 1;
  661. end
  662. //#pragma endregion pe_status_dynamics
  663.  
  664. //#pragma region pe_status_collisions
  665. function(GetLastCollisionAge)  
  666.     pe_status_collisions params;
  667.  
  668.     self->GetStatus(&params);
  669.    
  670.     lua->Push(params.age);
  671.  
  672.     return 1;
  673. end
  674.  
  675. function(GetLastCollisionID)   
  676.     pe_status_collisions params;
  677.  
  678.     self->GetStatus(&params);
  679.    
  680.     if(!params.pHistory) return 0;
  681.  
  682.     lua->Push(params.pHistory->idCollider);
  683.  
  684.     return 1;
  685. end
  686.  
  687. function(GetLastCollisionMaterials)
  688.     pe_status_collisions params;
  689.  
  690.     self->GetStatus(&params);
  691.  
  692.     if(!params.pHistory) return 0;
  693.    
  694.     lua->Push(params.pHistory->idmat[1]);
  695.     lua->Push(params.pHistory->idmat[2]);
  696.  
  697.     return 1;
  698. end
  699.  
  700. function(GetLastCollisionNormal)   
  701.     pe_status_collisions params;
  702.  
  703.     self->GetStatus(&params);
  704.  
  705.     if(!params.pHistory) return 0;
  706.    
  707.     lua->Push(params.pHistory->n);
  708.  
  709.     return 1;
  710. end
  711.  
  712. function(GetLastCollisionPoint)
  713.     pe_status_collisions params;
  714.  
  715.     self->GetStatus(&params);
  716.  
  717.     if(!params.pHistory) return 0;
  718.    
  719.     lua->Push(params.pHistory->pt);
  720.  
  721.     return 1;
  722. end
  723.  
  724. function(GetLastCollisionPoints)   
  725.     pe_status_collisions params;
  726.  
  727.     self->GetStatus(&params);
  728.  
  729.     if(!params.pHistory) return 0;
  730.    
  731.     lua->Push(params.pHistory->v[1]);
  732.     lua->Push(params.pHistory->v[2]);
  733.  
  734.     return 1;
  735. end
  736. //#pragma endregion pe_status_collisions
  737.  
  738. //#pragma region pe_status_timeslices
  739. function(GetPrecision) 
  740.     pe_status_timeslices params;
  741.  
  742.     self->GetStatus(&params);
  743.    
  744.     lua->Push(params.precision);
  745.  
  746.     return 1;
  747. end
  748.  
  749. function(GetTimeInterval)  
  750.     pe_status_timeslices params;
  751.  
  752.     self->GetStatus(&params);
  753.    
  754.     lua->Push(params.time_interval);
  755.  
  756.     return 1;
  757. end
  758. //#pragma endregion pe_status_timeslices
  759.  
  760. //#pragma region pe_status_awake
  761. function(IsAwake)  
  762.     pe_status_awake params;
  763.  
  764.     self->GetStatus(&params);
  765.    
  766.     lua->Push(params.lag);
  767.  
  768.     return 1;
  769. end
  770. //#pragma endregion pe_status_awake
  771.  
  772. //#pragma region Get~
  773.  
  774. //pe_params_articulated_body
  775. function(SetArticulatedBody)   
  776.     if (lua->IsTable(2))
  777.     {
  778.         pe_params_articulated_body params;
  779.  
  780.         lua->Push("Acceleration");
  781.         lua->GetTable(2);
  782.         if(!lua->IsNil(-1))
  783.             params.a = lua->CheckVec3(-1);
  784.  
  785.         lua->Push("ApplyDqext");
  786.         lua->GetTable(2);
  787.         if(!lua->IsNil(-1))
  788.             params.bApply_dqext = lua->ToBoolean(-1);
  789.  
  790.         lua->Push("Awake");
  791.         lua->GetTable(2);
  792.         if(!lua->IsNil(-1))
  793.             params.bAwake = lua->ToBoolean(-1);
  794.  
  795.         lua->Push("CheckCollisions");
  796.         lua->GetTable(2);
  797.         if(!lua->IsNil(-1))
  798.             params.bCheckCollisions = lua->ToBoolean(-1);
  799.  
  800.         lua->Push("CollisionResponse");
  801.         lua->GetTable(2);
  802.         if(!lua->IsNil(-1))
  803.             params.bCollisionResp = lua->ToBoolean(-1);
  804.  
  805.         lua->Push("ExpandHinges");
  806.         lua->GetTable(2);
  807.         if(!lua->IsNil(-1))
  808.             params.bExpandHinges = lua->ToBoolean(-1);
  809.  
  810.         lua->Push("Grounded");
  811.         lua->GetTable(2);
  812.         if(!lua->IsNil(-1))
  813.             params.bGrounded = lua->ToBoolean(-1);
  814.  
  815.         lua->Push("InheritVelocity");
  816.         lua->GetTable(2);
  817.         if(!lua->IsNil(-1))
  818.             params.bInheritVel = lua->ToBoolean(-1);
  819.  
  820.         lua->Push("RecalcJoints");
  821.         lua->GetTable(2);
  822.         if(!lua->IsNil(-1))
  823.             params.bRecalcJoints = lua->ToBoolean(-1);
  824.  
  825.         lua->Push("DampingLyingMode");
  826.         lua->GetTable(2);
  827.         if(!lua->IsNil(-1))
  828.             params.dampingLyingMode = lua->CheckNumber(-1);
  829.  
  830.         lua->Push("GravityLyingMode");
  831.         lua->GetTable(2);
  832.         if(!lua->IsNil(-1))
  833.             params.gravityLyingMode = lua->CheckVec3(-1);
  834.  
  835.         lua->Push("SimType");
  836.         lua->GetTable(2);
  837.         if(!lua->IsNil(-1))
  838.             params.iSimType = lua->CheckInteger(-1);
  839.  
  840.         lua->Push("SimTypeLyingMode");
  841.         lua->GetTable(2);
  842.         if(!lua->IsNil(-1))
  843.             params.iSimTypeLyingMode = lua->CheckInteger(-1);
  844.  
  845.         lua->Push("MinEnergyLyingMode");
  846.         lua->GetTable(2);
  847.         if(!lua->IsNil(-1))
  848.             params.minEnergyLyingMode = lua->CheckNumber(-1);
  849.  
  850.         lua->Push("CollidingLyingMode");
  851.         lua->GetTable(2);
  852.         if(!lua->IsNil(-1))
  853.             params.nCollLyingMode = lua->CheckInteger(-1);
  854.  
  855.         lua->Push("Roots");
  856.         lua->GetTable(2);
  857.         if(!lua->IsNil(-1))
  858.             params.nRoots = lua->CheckInteger(-1);
  859.  
  860.         lua->Push("Host");
  861.         lua->GetTable(2);
  862.         if(!lua->IsNil(-1))
  863.             params.pHost = Check(-1);
  864.  
  865.         lua->Push("Pivot");
  866.         lua->GetTable(2);
  867.         if(!lua->IsNil(-1))
  868.             params.pivot = lua->CheckVec3(-1);
  869.  
  870.         lua->Push("Vec3HostPivot");
  871.         lua->GetTable(2);
  872.         if(!lua->IsNil(-1))
  873.             params.posHostPivot = lua->CheckVec3(-1);
  874.  
  875.         lua->Push("QuatHostPivot");
  876.         lua->GetTable(2);
  877.         if(!lua->IsNil(-1))
  878.             params.qHostPivot = lua->CheckQuat(-1);
  879.  
  880.         lua->Push("ScaleBounceResponse");
  881.         lua->GetTable(2);
  882.         if(!lua->IsNil(-1))
  883.             params.scaleBounceResponse = lua->CheckNumber(-1);
  884.        
  885.         //I don't know what the following are shortened for
  886.         lua->Push("v");
  887.         lua->GetTable(2);
  888.         if(!lua->IsNil(-1))
  889.             params.v = lua->CheckVec3(-1);
  890.  
  891.         lua->Push("w");
  892.         lua->GetTable(2);
  893.         if(!lua->IsNil(-1))
  894.             params.w = lua->CheckVec3(-1);
  895.  
  896.         lua->Push("wa");
  897.         lua->GetTable(2);
  898.         if(!lua->IsNil(-1))
  899.             params.wa = lua->CheckVec3(-1);
  900.  
  901.         self->SetParams(&params);
  902.  
  903.         return 0;
  904.     }
  905.     return 0;
  906. end
  907.  
  908. function(SetJoint) 
  909.     if (lua->IsTable(2))
  910.     {
  911.         pe_params_jofunction(params;
  912.  
  913.         lua->Push("AnimationTimeStep");
  914.         lua->GetTable(2);
  915.         if(!lua->IsNil(-1))
  916.             params.animationTimeStep = lua->CheckNumber(-1);
  917.  
  918.         lua->Push("NoUpdate");
  919.         lua->GetTable(2);
  920.         if(!lua->IsNil(-1))
  921.             params.bNoUpdate = lua->ToBoolean(-1);
  922.  
  923.         lua->Push("Bounciness");
  924.         lua->GetTable(2);
  925.         if(!lua->IsNil(-1))
  926.             params.bounciness = lua->CheckVec3(-1);
  927.  
  928.         lua->Push("Flags");
  929.         lua->GetTable(2);
  930.         if(!lua->IsNil(-1))
  931.             params.flags = lua->CheckInteger(-1);
  932.  
  933.         lua->Push("FlagsPivot");
  934.         lua->GetTable(2);
  935.         if(!lua->IsNil(-1))
  936.             params.flagsPivot = lua->CheckInteger(-1);
  937.  
  938.         lua->Push("kd");
  939.         lua->GetTable(2);
  940.         if(!lua->IsNil(-1))
  941.             params.kd = lua->CheckVec3(-1);
  942.  
  943.         lua->Push("kdashpot");
  944.         lua->GetTable(2);
  945.         if(!lua->IsNil(-1))
  946.             params.kdashpot = lua->CheckVec3(-1);
  947.  
  948.         lua->Push("ks");
  949.         lua->GetTable(2);
  950.         if(!lua->IsNil(-1))
  951.             params.ks = lua->CheckVec3(-1);
  952.  
  953.         lua->Push("Limits1");
  954.         lua->GetTable(2);
  955.         if(!lua->IsNil(-1))
  956.             params.limits[1] = lua->CheckVec3(-1);
  957.  
  958.         lua->Push("Limits2");
  959.         lua->GetTable(2);
  960.         if(!lua->IsNil(-1))
  961.             params.limits[2] = lua->CheckVec3(-1);
  962.  
  963.         lua->Push("SelfCollidingParts");
  964.         lua->GetTable(2);
  965.         if(!lua->IsNil(-1))
  966.             params.nSelfCollidingParts = lua->CheckInteger(-1);
  967.  
  968.         lua->Push("op1");
  969.         lua->GetTable(2);
  970.         if(!lua->IsNil(-1))
  971.             params.op[1] = lua->CheckInteger(-1);
  972.        
  973.         lua->Push("op2");
  974.         lua->GetTable(2);
  975.         if(!lua->IsNil(-1))
  976.             params.op[2] = lua->CheckInteger(-1);
  977.        
  978.         lua->Push("Pivot");
  979.         lua->GetTable(2);
  980.         if(!lua->IsNil(-1))
  981.             params.pivot = lua->CheckVec3(-1);
  982.  
  983.         lua->Push("Angle");
  984.         lua->GetTable(2);
  985.         if(!lua->IsNil(-1))
  986.             params.q = Lua_Ang3::Check(-1);
  987.  
  988.         lua->Push("Quat0");
  989.         lua->GetTable(2);
  990.         if(!lua->IsNil(-1))
  991.             params.q0 = lua->CheckQuat(-1);
  992.  
  993.         lua->Push("qdashpot");
  994.         lua->GetTable(2);
  995.         if(!lua->IsNil(-1))
  996.             params.qdashpot = lua->CheckVec3(-1);
  997.  
  998.         lua->Push("qext");
  999.         lua->GetTable(2);
  1000.         if(!lua->IsNil(-1))
  1001.             params.qext = Lua_Ang3::Check(-1);
  1002.  
  1003.         lua->Push("AngleTarget");
  1004.         lua->GetTable(2);
  1005.         if(!lua->IsNil(-1))
  1006.             params.qtarget = Lua_Ang3::Check(-1);
  1007.  
  1008.         lua->Push("rAnimationTimeStep");
  1009.         lua->GetTable(2);
  1010.         if(!lua->IsNil(-1))
  1011.             params.ranimationTimeStep = lua->CheckNumber(-1);
  1012.        
  1013.         lua->Push(self->SetParams(&params));
  1014.  
  1015.         return 0;
  1016.     }
  1017.     return 0;
  1018. end
  1019.  
  1020. function(AddConstraint)
  1021.     if (lua->IsTable(2))
  1022.     {
  1023.         pe_action_add_constrafunction(params;
  1024.  
  1025.         lua->Push("Damping");
  1026.         lua->GetTable(2);
  1027.         if(!lua->IsNil(-1))
  1028.             params.damping = lua->CheckNumber(-1);
  1029.  
  1030.         lua->Push("Flags");
  1031.         lua->GetTable(2);
  1032.         if(!lua->IsNil(-1))
  1033.             params.flags = lua->CheckInteger(-1);
  1034.  
  1035.         lua->Push("ID");
  1036.         lua->GetTable(2);
  1037.         if(!lua->IsNil(-1))
  1038.             params.id = lua->CheckInteger(-1);
  1039.  
  1040.         lua->Push("MaxBendTorque");
  1041.         lua->GetTable(2);
  1042.         if(!lua->IsNil(-1))
  1043.             params.maxBendTorque = lua->CheckNumber(-1);
  1044.  
  1045.         lua->Push("MaxPullForce");
  1046.         lua->GetTable(2);
  1047.         if(!lua->IsNil(-1))
  1048.             params.maxPullForce = lua->CheckNumber(-1);
  1049.  
  1050.         lua->Push("PartID1");
  1051.         lua->GetTable(2);
  1052.         if(!lua->IsNil(-1))
  1053.             params.partid[1] = lua->CheckInteger(-1);
  1054.  
  1055.         lua->Push("PartID2");
  1056.         lua->GetTable(2);
  1057.         if(!lua->IsNil(-1))
  1058.             params.partid[2] = lua->CheckInteger(-1);
  1059.        
  1060.         lua->Push("Buddy");
  1061.         lua->GetTable(2);
  1062.         if(!lua->IsNil(-1))
  1063.             params.pBuddy = Check(-1);
  1064.  
  1065.         lua->Push("ConstraintEntity");
  1066.         lua->GetTable(2);
  1067.         if(!lua->IsNil(-1))
  1068.             params.pConstraintEntity = Check(-1);
  1069.  
  1070.         lua->Push("Point1");
  1071.         lua->GetTable(2);
  1072.         if(!lua->IsNil(-1))
  1073.             params.pt[1] = lua->CheckVec3(-1);
  1074.  
  1075.         lua->Push("Point1");
  1076.         lua->GetTable(2);
  1077.         if(!lua->IsNil(-1))
  1078.             params.pt[2] = lua->CheckVec3(-1);
  1079.  
  1080.         lua->Push("QuatFrame1");
  1081.         lua->GetTable(2);
  1082.         if(!lua->IsNil(-1))
  1083.             params.qframe[1] = lua->CheckQuat(-1);
  1084.        
  1085.         lua->Push("QuatFrame1");
  1086.         lua->GetTable(2);
  1087.         if(!lua->IsNil(-1))
  1088.             params.qframe[2] = lua->CheckQuat(-1);
  1089.  
  1090.         lua->Push("SensorRadius");
  1091.         lua->GetTable(2);
  1092.         if(!lua->IsNil(-1))
  1093.             params.sensorRadius = lua->CheckNumber(-1);
  1094.  
  1095.         lua->Push("XLimits1");
  1096.         lua->GetTable(2);
  1097.         if(!lua->IsNil(-1))
  1098.             params.xlimits[1] = lua->CheckNumber(-1);
  1099.  
  1100.         lua->Push("XLimits2");
  1101.         lua->GetTable(2);
  1102.         if(!lua->IsNil(-1))
  1103.             params.xlimits[2] = lua->CheckNumber(-1);
  1104.  
  1105.         lua->Push("YZLimits1");
  1106.         lua->GetTable(2);
  1107.         if(!lua->IsNil(-1))
  1108.             params.yzlimits[1] = lua->CheckNumber(-1);
  1109.  
  1110.         lua->Push("YZLimits2");
  1111.         lua->GetTable(2);
  1112.         if(!lua->IsNil(-1))
  1113.             params.yzlimits[2] = lua->CheckNumber(-1);
  1114.        
  1115.         self->Action(&params);
  1116.  
  1117.         return 0;
  1118.     }
  1119.     return 0;
  1120. end
  1121.  
  1122. function(GetEntity)
  1123.     lua->Push(gEnv->pEntitySystem->GetEntityFromPhysics(self));
  1124.     return 1;
  1125. end
  1126.  
  1127. #define GetProxy() \
  1128.     IEntity *entity = gEnv->pEntitySystem->GetEntityFromPhysics(self);\
  1129. \
  1130.     if(!entity) return 0;\
  1131. \
  1132.     IEntityPhysicalProxy *proxy = (IEntityPhysicalProxy *)entity->GetProxy(ENTITY_PROXY_PHYSICS);\
  1133. \
  1134.     if(!proxy) return 0;\
  1135. \
  1136.     proxy
  1137.  
  1138. #define CheckProxy() \
  1139.     IEntity *entity = gEnv->pEntitySystem->GetEntityFromPhysics(self);\
  1140. \
  1141.     if(!entity) return 0;\
  1142. \
  1143.     IEntityPhysicalProxy *proxy = (IEntityPhysicalProxy *)entity->GetProxy(ENTITY_PROXY_PHYSICS);\
  1144. \
  1145.     if(!proxy) return 0;\
  1146.    
  1147.    
  1148. function(AssignPhysicalEntity)
  1149.     ->AssignPhysicalEntity(Get(2), luaL_optint(3, -1));
  1150.  
  1151.     return 0;
  1152. end
  1153.  
  1154. function(DephysicalizeFoliage)
  1155.     GetProxy()->DephysicalizeFoliage(lua->ToBoolean(2));
  1156.  
  1157.     return 0;
  1158. end
  1159.  
  1160. function(EnablePhysics)
  1161.     GetProxy()->EnablePhysics(lua->ToBoolean(2));
  1162.  
  1163.     return 1;
  1164. end
  1165.  
  1166. function(EnableRestrictedRagdoll)
  1167.     GetProxy()->EnableRestrictedRagdoll(lua->ToBoolean(2));
  1168.  
  1169.     return 1;
  1170. end
  1171.  
  1172. function(GetLocalBounds)
  1173.     CheckProxy()
  1174.  
  1175.     AABB aabb;
  1176.  
  1177.     proxy->GetLocalBounds(aabb);
  1178.  
  1179.     lua->NewTable(L);
  1180.  
  1181.     lua->Push("Center");
  1182.     lua->Push(aabb.GetCenter());
  1183.     lua->SetTable(-3);
  1184.  
  1185.     lua->Push("Radius");
  1186.     lua->Push(aabb.GetRadius());
  1187.     lua->SetTable(-3);
  1188.  
  1189.     lua->Push("Size");
  1190.     lua->Push(aabb.GetSize());
  1191.     lua->SetTable(-3);
  1192.  
  1193.     lua->Push("Volume");
  1194.     lua->Push(aabb.GetVolume());
  1195.     lua->SetTable(-3);
  1196.  
  1197.     lua->Push("Max");
  1198.     lua->Push(aabb.max);
  1199.     lua->SetTable(-3);
  1200.  
  1201.     lua->Push("Min");
  1202.     lua->Push(aabb.min);
  1203.     lua->SetTable(-3);
  1204.  
  1205.     return 1;
  1206. end
  1207.  
  1208. function(GetWorldBounds)
  1209.     CheckProxy()
  1210.  
  1211.     AABB aabb;
  1212.  
  1213.     proxy->GetWorldBounds(aabb);
  1214.  
  1215.     lua->NewTable(L);
  1216.  
  1217.     lua->Push("Center");
  1218.     lua->Push(aabb.GetCenter());
  1219.     lua->SetTable(-3);
  1220.  
  1221.     lua->Push("Radius");
  1222.     lua->Push(aabb.GetRadius());
  1223.     lua->SetTable(-3);
  1224.  
  1225.     lua->Push("Size");
  1226.     lua->Push(aabb.GetSize());
  1227.     lua->SetTable(-3);
  1228.  
  1229.     lua->Push("Volume");
  1230.     lua->Push(aabb.GetVolume());
  1231.     lua->SetTable(-3);
  1232.  
  1233.     lua->Push("Max");
  1234.     lua->Push(aabb.max);
  1235.     lua->SetTable(-3);
  1236.  
  1237.     lua->Push("Min");
  1238.     lua->Push(aabb.min);
  1239.     lua->SetTable(-3);
  1240.  
  1241.     return 1;
  1242. end
  1243.  
  1244. function(IsRestrictedRagdoll)
  1245.     CheckProxy()
  1246.  
  1247.     lua->Push(proxy->IsRestrictedRagdoll());
  1248.  
  1249.     return 1;
  1250. end]]
  1251.  
  1252. for _, line in pairs(str:Split"\n") do
  1253.     if line:find("function") then
  1254.         print(line:gsub("function", "REG") .. ";")
  1255.     end
  1256. end
Advertisement
Add Comment
Please, Sign In to add comment