scriptedentity.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. enum TriggerShape
  2. {
  3. BOX,
  4. SPHERE,
  5. CYLINDER,
  6. }
  7. class ScriptedEntity extends EntityAI
  8. {
  9. /**
  10. \brief Sets collision properties for object
  11. \param mins \p vector Min values of box
  12. \param maxs \p vector Max values of box
  13. \param radius \p float Radius of bounding sphere
  14. \note This function is obsolete, use rather SetCollisionBox()
  15. */
  16. proto native void SetClippingInfo(vector mins, vector maxs, float radius);
  17. /**
  18. \brief Sets collision box for object
  19. \param mins \p vector Min values of box
  20. \param maxs \p vector Max values of box
  21. \note Automatically sets TriggerShape.BOX
  22. \n usage :
  23. @code
  24. vector mins = "-1 -1 -1";
  25. vector maxs = "1 1 1";
  26. SetCollisionBox(mins, maxs);
  27. @endcode
  28. */
  29. proto native void SetCollisionBox(vector mins, vector maxs);
  30. /**
  31. \brief Sets collision sphere for object
  32. \param radius \p float Radius of cylinder
  33. \note Automatically sets TriggerShape.SPHERE
  34. \n usage :
  35. @code
  36. SetCollisionSphere(3);
  37. @endcode
  38. */
  39. proto native void SetCollisionSphere(float radius);
  40. /**
  41. \brief Sets collision cylinder for object, representing cylinder from origin(center) up to defined positive height
  42. \param radius \p float Radius of cylinder
  43. \param height \p float Height of cylinder
  44. \note Automatically sets TriggerShape.CYLINDER
  45. \n usage :
  46. @code
  47. SetCollisionCylinder(3, 6);
  48. @endcode
  49. */
  50. proto native void SetCollisionCylinder(float radius, float height);
  51. /**
  52. \brief Sets collision cylinder for object, representing cylinder from origin(center), height can be defined in both directions
  53. \param radius \p float Radius of cylinder
  54. \param negativeHeigh \p float Negative height of cylinder
  55. \param positiveHeight \p float Positive height of cylinder
  56. \note Automatically sets TriggerShape.CYLINDER
  57. \n usage :
  58. @code
  59. SetCollisionCylinderTwoWay(3, -3, 3);
  60. @endcode
  61. */
  62. private proto native void SetCollisionCylinderTwoWayNative(float radius, float negativeHeight, float positiveHeight);
  63. /**
  64. \brief Input value validated version of SetCollisionCylinderTwoWay
  65. \param radius \p float Radius of cylinder
  66. \param negativeHeigh \p float Negative height of cylinder
  67. \param positiveHeight \p float Positive height of cylinder
  68. \note Automatically sets TriggerShape.CYLINDER
  69. \n usage :
  70. @code
  71. SetCollisionCylinderTwoWayValidated(3, -3, 3);
  72. @endcode
  73. */
  74. void SetCollisionCylinderTwoWay(float radius, float negativeHeight, float positiveHeight)
  75. {
  76. if (radius <=0)
  77. {
  78. ErrorEx("Radius has to >= 0");
  79. return;
  80. }
  81. if (negativeHeight > positiveHeight)
  82. {
  83. ErrorEx("Negative height cannot be higher than positive height");
  84. return;
  85. }
  86. SetCollisionCylinderTwoWayNative(radius, negativeHeight, positiveHeight);
  87. }
  88. //! Set the TriggerShape to be used, default is TriggerShape.BOX
  89. proto native void SetTriggerShape(TriggerShape shape);
  90. //! Get the current TriggerShape
  91. proto native TriggerShape GetTriggerShape();
  92. override bool IsInventoryVisible()
  93. {
  94. return false;
  95. }
  96. }