Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Rising liquid that acts as a one-way portal
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #ifndef FUNC_LIQUIDPORTAL_H
  8. #define FUNC_LIQUIDPORTAL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "triggers.h"
  13. class CFunc_LiquidPortal : public CBaseEntity
  14. {
  15. public:
  16. DECLARE_CLASS( CFunc_LiquidPortal, CBaseEntity );
  17. DECLARE_SERVERCLASS();
  18. DECLARE_DATADESC();
  19. CFunc_LiquidPortal( void );
  20. virtual void Spawn( void );
  21. virtual void Activate( void );
  22. virtual void Think( void );
  23. virtual int UpdateTransmitState( void ) // set transmit filter to transmit always
  24. {
  25. return SetTransmitState( FL_EDICT_ALWAYS );
  26. }
  27. virtual int Save( ISave &save );
  28. virtual int Restore( IRestore &restore );
  29. void InputSetLinkedLiquidPortal( inputdata_t &inputdata );
  30. void InputSetFillTime( inputdata_t &inputdata ); //time it takes to fill the portal volume
  31. void InputStartFilling( inputdata_t &inputdata ); //start filling with portal liquid, will teleport entities as they become completely enveloped
  32. //add/remove teleportables to offload the selection process to triggers, each with their own filters
  33. void InputAddActivatorToTeleportList( inputdata_t &inputdata ); //add an activator entity to the list of entities to teleport when filling
  34. void InputRemoveActivatorFromTeleportList( inputdata_t &inputdata ); //remove an activator entity from the list of entities to teleport when filling
  35. void ComputeLinkMatrix( void );
  36. void SetLinkedLiquidPortal( CFunc_LiquidPortal *pLinked );
  37. void TeleportImmersedEntity( CBaseEntity *pEntity );
  38. CNetworkHandle( CFunc_LiquidPortal, m_hLinkedPortal ); //the portal this portal is linked to
  39. VMatrix m_matrixThisToLinked; //the matrix that will transform a point relative to this portal, to a point relative to the linked portal
  40. float m_fFillTime; //how long it takes to fill completely
  41. bool m_bFillInProgress;
  42. CNetworkVar( float, m_fFillStartTime ); // time started filling with portal liquid, will teleport entities as they become completely enveloped
  43. CNetworkVar( float, m_fFillEndTime ); // time that filling should be finished and touching entities teleport
  44. CUtlVector<EHANDLE> m_hTeleportList; //list of entities to teleport when filling
  45. CUtlVector<EHANDLE> m_hLeftToTeleportThisFill; //list of entities that have not yet teleported during this fill, they get teleported out when fully immersed in the liquid
  46. string_t m_strInitialLinkedPortal;
  47. };
  48. #endif //#ifndef FUNC_LIQUIDPORTAL_H