gameDM.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. // ----------------------------------------------------------------------------
  23. // DeathmatchGame
  24. // ----------------------------------------------------------------------------
  25. // Depends on methods found in gameCore.cs. Those added here are specific to
  26. // this game type and/or over-ride the "default" game functionaliy.
  27. //
  28. // The desired Game Type must be added to each mission's LevelInfo object.
  29. // - gameType = "Deathmatch";
  30. // If this information is missing then the GameCore will default to Deathmatch.
  31. // ----------------------------------------------------------------------------
  32. function DeathMatchGame::onMissionLoaded(%game)
  33. {
  34. //echo (%game @"\c4 -> "@ %game.class @" -> DeathMatchGame::onMissionLoaded");
  35. $Server::MissionType = "DeathMatch";
  36. parent::onMissionLoaded(%game);
  37. }
  38. function DeathMatchGame::initGameVars(%game)
  39. {
  40. //echo (%game @"\c4 -> "@ %game.class @" -> DeathMatchGame::initGameVars");
  41. //-----------------------------------------------------------------------------
  42. // What kind of "player" is spawned is either controlled directly by the
  43. // SpawnSphere or it defaults back to the values set here. This also controls
  44. // which SimGroups to attempt to select the spawn sphere's from by walking down
  45. // the list of SpawnGroups till it finds a valid spawn object.
  46. // These override the values set in core/scripts/server/spawn.cs
  47. //-----------------------------------------------------------------------------
  48. // Leave $Game::defaultPlayerClass and $Game::defaultPlayerDataBlock as empty strings ("")
  49. // to spawn a the $Game::defaultCameraClass as the control object.
  50. $Game::defaultPlayerClass = "Player";
  51. $Game::defaultPlayerDataBlock = "DefaultPlayerData";
  52. $Game::defaultPlayerSpawnGroups = "PlayerSpawnPoints PlayerDropPoints";
  53. //-----------------------------------------------------------------------------
  54. // What kind of "camera" is spawned is either controlled directly by the
  55. // SpawnSphere or it defaults back to the values set here. This also controls
  56. // which SimGroups to attempt to select the spawn sphere's from by walking down
  57. // the list of SpawnGroups till it finds a valid spawn object.
  58. // These override the values set in core/scripts/server/spawn.cs
  59. //-----------------------------------------------------------------------------
  60. $Game::defaultCameraClass = "Camera";
  61. $Game::defaultCameraDataBlock = "Observer";
  62. $Game::defaultCameraSpawnGroups = "CameraSpawnPoints PlayerSpawnPoints PlayerDropPoints";
  63. // Set the gameplay parameters
  64. %game.duration = 30 * 60;
  65. %game.endgameScore = 20;
  66. %game.endgamePause = 10;
  67. %game.allowCycling = false; // Is mission cycling allowed?
  68. }
  69. function DeathMatchGame::startGame(%game)
  70. {
  71. //echo (%game @"\c4 -> "@ %game.class @" -> DeathMatchGame::startGame");
  72. parent::startGame(%game);
  73. }
  74. function DeathMatchGame::endGame(%game)
  75. {
  76. //echo (%game @"\c4 -> "@ %game.class @" -> DeathMatchGame::endGame");
  77. parent::endGame(%game);
  78. }
  79. function DeathMatchGame::onGameDurationEnd(%game)
  80. {
  81. //echo (%game @"\c4 -> "@ %game.class @" -> DeathMatchGame::onGameDurationEnd");
  82. parent::onGameDurationEnd(%game);
  83. }
  84. function DeathMatchGame::onClientEnterGame(%game, %client)
  85. {
  86. //echo (%game @"\c4 -> "@ %game.class @" -> DeathMatchGame::onClientEnterGame");
  87. parent::onClientEnterGame(%game, %client);
  88. }
  89. function DeathMatchGame::onClientLeaveGame(%game, %client)
  90. {
  91. //echo (%game @"\c4 -> "@ %game.class @" -> DeathMatchGame::onClientLeaveGame");
  92. parent::onClientLeaveGame(%game, %client);
  93. }