mmsplugin.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /**
  2. * vim: set ts=4 :
  3. * =============================================================================
  4. * TF2 Econ Dynamic Extension
  5. * Copyright (C) 2023 nosoop. All rights reserved.
  6. * =============================================================================
  7. *
  8. * This program is free software; you can redistribute it and/or modify it under
  9. * the terms of the GNU General Public License, version 3.0, as published by the
  10. * Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  14. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  15. * details.
  16. *
  17. * You should have received a copy of the GNU General Public License along with
  18. * this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. * As a special exception, AlliedModders LLC gives you permission to link the
  21. * code of this program (as well as its derivative works) to "Half-Life 2," the
  22. * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
  23. * by the Valve Corporation. You must obey the GNU General Public License in
  24. * all respects for all other code used. Additionally, AlliedModders LLC grants
  25. * this exception to all derivative works. AlliedModders LLC defines further
  26. * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
  27. * or <http://www.sourcemod.net/license.php>.
  28. *
  29. * Version: $Id$
  30. */
  31. #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
  32. #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
  33. #include <smsdk_ext.h>
  34. class DynSchema : public SDKExtension
  35. {
  36. public:
  37. /**
  38. * @brief This is called after the initial loading sequence has been processed.
  39. *
  40. * @param error Error message buffer.
  41. * @param maxlength Size of error message buffer.
  42. * @param late Whether or not the module was loaded after map load.
  43. * @return True to succeed loading, false to fail.
  44. */
  45. virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
  46. /**
  47. * @brief This is called right before the extension is unloaded.
  48. */
  49. virtual void SDK_OnUnload();
  50. /**
  51. * @brief This is called once all known extensions have been loaded.
  52. * Note: It is is a good idea to add natives here, if any are provided.
  53. */
  54. //virtual void SDK_OnAllLoaded();
  55. /**
  56. * @brief Called when the pause state is changed.
  57. */
  58. //virtual void SDK_OnPauseChange(bool paused);
  59. /**
  60. * @brief this is called when Core wants to know if your extension is working.
  61. *
  62. * @param error Error message buffer.
  63. * @param maxlength Size of error message buffer.
  64. * @return True if working, false otherwise.
  65. */
  66. //virtual bool QueryRunning(char *error, size_t maxlength);
  67. public:
  68. #if defined SMEXT_CONF_METAMOD
  69. /**
  70. * @brief Called when Metamod is attached, before the extension version is called.
  71. *
  72. * @param error Error buffer.
  73. * @param maxlength Maximum size of error buffer.
  74. * @param late Whether or not Metamod considers this a late load.
  75. * @return True to succeed, false to fail.
  76. */
  77. virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
  78. /**
  79. * @brief Called when Metamod is detaching, after the extension version is called.
  80. * NOTE: By default this is blocked unless sent from SourceMod.
  81. *
  82. * @param error Error buffer.
  83. * @param maxlength Maximum size of error buffer.
  84. * @return True to succeed, false to fail.
  85. */
  86. //virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
  87. /**
  88. * @brief Called when Metamod's pause state is changing.
  89. * NOTE: By default this is blocked unless sent from SourceMod.
  90. *
  91. * @param paused Pause state being set.
  92. * @param error Error buffer.
  93. * @param maxlength Maximum size of error buffer.
  94. * @return True to succeed, false to fail.
  95. */
  96. //virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
  97. #endif
  98. private:
  99. bool Hook_LevelInitPost(const char *pMapName, char const *pMapEntities,
  100. char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background);
  101. };
  102. #endif //_INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_