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.

52 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "dod_smokegrenade_ger.h"
  8. #define GRENADE_MODEL "models/Weapons/w_smoke_ger.mdl"
  9. LINK_ENTITY_TO_CLASS( grenade_smoke_ger, CDODSmokeGrenadeGER );
  10. PRECACHE_WEAPON_REGISTER( grenade_smoke_ger );
  11. CDODSmokeGrenadeGER* CDODSmokeGrenadeGER::Create(
  12. const Vector &position,
  13. const QAngle &angles,
  14. const Vector &velocity,
  15. const AngularImpulse &angVelocity,
  16. CBaseCombatCharacter *pOwner )
  17. {
  18. CDODSmokeGrenadeGER *pGrenade = (CDODSmokeGrenadeGER*)CBaseEntity::Create( "grenade_smoke_ger", position, angles, pOwner );
  19. Assert( pGrenade );
  20. if( !pGrenade )
  21. return NULL;
  22. IPhysicsObject *pPhysicsObject = pGrenade->VPhysicsGetObject();
  23. if ( pPhysicsObject )
  24. {
  25. pPhysicsObject->AddVelocity( &velocity, &angVelocity );
  26. }
  27. // Who threw this grenade
  28. pGrenade->SetThrower( pOwner );
  29. pGrenade->ChangeTeam( pOwner->GetTeamNumber() );
  30. return pGrenade;
  31. }
  32. void CDODSmokeGrenadeGER::Spawn()
  33. {
  34. SetModel( GRENADE_MODEL );
  35. BaseClass::Spawn();
  36. }
  37. void CDODSmokeGrenadeGER::Precache()
  38. {
  39. PrecacheModel( GRENADE_MODEL );
  40. BaseClass::Precache();
  41. }