MobNexusContain.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: MobNexusContain.h ////////////////////////////////////////////////////////////////////////
  24. // Author: Mark Lorenzen, August 2002
  25. // Desc: Contain module for mob units. Acts as proxy for UI and AI
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __MOBNEXUSCONTAIN_H_
  29. #define __MOBNEXUSCONTAIN_H_
  30. // USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
  31. #include "GameLogic/Module/OpenContain.h"
  32. //-------------------------------------------------------------------------------------------------
  33. class MobNexusContainModuleData : public OpenContainModuleData
  34. {
  35. public:
  36. struct InitialPayload
  37. {
  38. AsciiString name;
  39. Int count;
  40. };
  41. Int m_slotCapacity; ///< max units that can be inside us
  42. Real m_exitPitchRate;
  43. Bool m_scatterNearbyOnExit;
  44. Bool m_orientLikeContainerOnExit;
  45. Bool m_keepContainerVelocityOnExit;
  46. AsciiString m_exitBone;
  47. InitialPayload m_initialPayload;
  48. Real m_healthRegen;
  49. MobNexusContainModuleData();
  50. static void buildFieldParse(MultiIniFieldParse& p);
  51. static void parseInitialPayload( INI* ini, void *instance, void *store, const void* /*userData*/ );
  52. };
  53. //-------------------------------------------------------------------------------------------------
  54. class MobNexusContain : public OpenContain,
  55. public TransportPassengerInterface // lorenzen add a MobMemberInterface
  56. {
  57. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( MobNexusContain, "MobNexusContain" )
  58. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( MobNexusContain, MobNexusContainModuleData )
  59. public:
  60. MobNexusContain( Thing *thing, const ModuleData* moduleData );
  61. // virtual destructor prototype provided by memory pool declaration
  62. // lorenzen add a MobMemberInterface
  63. // lorenzen add a MobMemberInterface
  64. // lorenzen add a MobMemberInterface
  65. virtual TransportPassengerInterface* getTransportPassengerInterface() { return this; }// lorenzen add a MobMemberInterface
  66. // lorenzen add a MobMemberInterface
  67. // lorenzen add a MobMemberInterface
  68. // lorenzen add a MobMemberInterface
  69. virtual Bool isValidContainerFor( const Object* obj, Bool checkCapacity) const;
  70. virtual void onContaining( Object *obj, Bool wasSelected ); ///< object now contains 'obj'
  71. virtual void onRemoving( Object *obj ); ///< object no longer contains 'obj'
  72. virtual UpdateSleepTime update(); ///< called once per frame
  73. virtual Int getContainMax( void ) const;
  74. virtual void onObjectCreated();
  75. virtual Int getExtraSlotsInUse( void ) { return m_extraSlotsInUse; }
  76. virtual ExitDoorType reserveDoorForExit( const ThingTemplate* objType, Object *specificObject ); ///< All types can answer if they are free to exit or not, and you can ask about a specific guy or just exit anything in general
  77. virtual void unreserveDoorForExit( ExitDoorType exitDoor );
  78. virtual Bool tryToEvacuate( Bool exposeStealthedUnits ); ///< Will try to kick everybody out with game checks, and will return whether anyone made it
  79. protected:
  80. private:
  81. Int m_extraSlotsInUse;
  82. };
  83. #endif // __MOBNEXUSCONTAIN_H_