Toolkit_Spawners.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /******************************************************************************
  19. *
  20. * FILE
  21. * Toolkit_Spawners.cpp
  22. *
  23. * DESCRIPTION
  24. * Designer Toolkit for Mission Construction - Spawners Subset
  25. *
  26. * PROGRAMMER
  27. * Design Team
  28. *
  29. * VERSION INFO
  30. * $Author: Byon_g $
  31. * $Revision: 4 $
  32. * $Modtime: 10/23/00 5:20p $
  33. * $Archive: /Commando/Code/Scripts/Toolkit_Spawners.cpp $
  34. *
  35. ******************************************************************************/
  36. #include "toolkit.h"
  37. DECLARE_SCRIPT(M00_Spawner_Controller_RMV, "Spawner_ID:int, Custom_Type_To_Enable:int, Custom_Type_To_Trigger:int, On_When_Created=0:int")
  38. {
  39. int id, enable, trigger;
  40. bool start_on;
  41. void Created(GameObject * obj)
  42. {
  43. id = Get_Int_Parameter("Spawner_ID");
  44. enable = Get_Int_Parameter("Custom_Type_To_Enable");
  45. trigger = Get_Int_Parameter("Custom_Type_To_Trigger");
  46. start_on = (Get_Int_Parameter("On_When_Created") == 1) ? true : false;
  47. if (Commands->Find_Object(id) != NULL)
  48. Commands->Enable_Spawner(id, start_on);
  49. }
  50. void Custom(GameObject * obj, int type, int param, GameObject * sender)
  51. {
  52. if (type == enable)
  53. {
  54. bool toggle = (param == 1) ? true : false;
  55. if (Commands->Find_Object(id) != NULL)
  56. Commands->Enable_Spawner(id, toggle);
  57. }
  58. if (type == trigger)
  59. {
  60. // bool force = (param == 1) ? true : false;
  61. if (Commands->Find_Object(id) != NULL)
  62. Commands->Trigger_Spawner(id);
  63. }
  64. }
  65. };