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_us.h"
  8. #define GRENADE_MODEL "models/Weapons/w_smoke_us.mdl"
  9. LINK_ENTITY_TO_CLASS( grenade_smoke_us, CDODSmokeGrenadeUS );
  10. PRECACHE_WEAPON_REGISTER( grenade_smoke_us );
  11. CDODSmokeGrenadeUS* CDODSmokeGrenadeUS::Create(
  12. const Vector &position,
  13. const QAngle &angles,
  14. const Vector &velocity,
  15. const AngularImpulse &angVelocity,
  16. CBaseCombatCharacter *pOwner )
  17. {
  18. CDODSmokeGrenadeUS *pGrenade = (CDODSmokeGrenadeUS*)CBaseEntity::Create( "grenade_smoke_us", 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 CDODSmokeGrenadeUS::Spawn()
  33. {
  34. SetModel( GRENADE_MODEL );
  35. BaseClass::Spawn();
  36. }
  37. void CDODSmokeGrenadeUS::Precache()
  38. {
  39. PrecacheModel( GRENADE_MODEL );
  40. BaseClass::Precache();
  41. }