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.

53 lines
1.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "hud.h"
  8. #include "c_obj_sapper.h"
  9. #include "c_tf_player.h"
  10. #include <igameevents.h>
  11. // memdbgon must be the last include file in a .cpp file!!!
  12. #include "tier0/memdbgon.h"
  13. using namespace vgui;
  14. //-----------------------------------------------------------------------------
  15. // Purpose: Start thinking
  16. //-----------------------------------------------------------------------------
  17. void C_ObjectSapper::OnDataChanged( DataUpdateType_t type )
  18. {
  19. BaseClass::OnDataChanged( type );
  20. if ( type == DATA_UPDATE_CREATED )
  21. {
  22. SetNextClientThink( CLIENT_THINK_ALWAYS );
  23. }
  24. }
  25. //-----------------------------------------------------------------------------
  26. // Purpose: Create the sparking effect if we're built and ready
  27. //-----------------------------------------------------------------------------
  28. void C_ObjectSapper::ClientThink( void )
  29. {
  30. IGameEvent *event = gameeventmanager->CreateEvent( "building_info_changed" );
  31. if ( event )
  32. {
  33. event->SetInt( "building_type", OBJ_ATTACHMENT_SAPPER );
  34. event->SetInt( "object_mode", GetObjectMode() );
  35. gameeventmanager->FireEventClientSide( event );
  36. }
  37. }
  38. float C_ObjectSapper::GetReversesBuildingConstructionSpeed( void )
  39. {
  40. float flReverseSpeed = 0.0f;
  41. CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( GetBuilder(), flReverseSpeed, sapper_degenerates_buildings );
  42. return flReverseSpeed;
  43. }
  44. IMPLEMENT_CLIENTCLASS_DT(C_ObjectSapper, DT_ObjectSapper, CObjectSapper)
  45. END_RECV_TABLE()