diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/shared/weapon_ifmbase.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/shared/weapon_ifmbase.cpp')
| -rw-r--r-- | game/shared/weapon_ifmbase.cpp | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/game/shared/weapon_ifmbase.cpp b/game/shared/weapon_ifmbase.cpp new file mode 100644 index 0000000..8051dc3 --- /dev/null +++ b/game/shared/weapon_ifmbase.cpp @@ -0,0 +1,122 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#include "cbase.h" +#include "weapon_ifmbase.h" + +#if defined( CLIENT_DLL ) + + #include "vgui/ISurface.h" + #include "vgui_controls/Controls.h" + #include "hud_crosshair.h" + +#endif + + +//----------------------------------------------------------------------------- +// CWeaponIFMBase tables. +//----------------------------------------------------------------------------- +IMPLEMENT_NETWORKCLASS_ALIASED( WeaponIFMBase, DT_WeaponIFMBase ) + +BEGIN_NETWORK_TABLE( CWeaponIFMBase, DT_WeaponIFMBase ) +END_NETWORK_TABLE() + +BEGIN_PREDICTION_DATA( CWeaponIFMBase ) +END_PREDICTION_DATA() + +LINK_ENTITY_TO_CLASS( weapon_ifm_base, CWeaponIFMBase ); + + +#ifdef GAME_DLL + +BEGIN_DATADESC( CWeaponIFMBase ) + +END_DATADESC() + +#endif + +//----------------------------------------------------------------------------- +// CWeaponIFMBase implementation. +//----------------------------------------------------------------------------- +CWeaponIFMBase::CWeaponIFMBase() +{ + SetPredictionEligible( true ); + AddSolidFlags( FSOLID_TRIGGER ); // Nothing collides with these but it gets touches. +} + +bool CWeaponIFMBase::IsPredicted() const +{ + return true; +} + +#ifdef CLIENT_DLL + +void CWeaponIFMBase::OnDataChanged( DataUpdateType_t type ) +{ + BaseClass::OnDataChanged( type ); + + if ( GetPredictable() && !ShouldPredict() ) + { + ShutdownPredictable(); + } +} + +bool CWeaponIFMBase::ShouldPredict() +{ + if ( GetOwner() && GetOwner() == C_BasePlayer::GetLocalPlayer() ) + return true; + + return BaseClass::ShouldPredict(); +} + + +#else + +void CWeaponIFMBase::Spawn() +{ + BaseClass::Spawn(); + + // Set this here to allow players to shoot dropped weapons + SetCollisionGroup( COLLISION_GROUP_WEAPON ); +} + +#endif + +/* +void CWeaponIFMBase::FallInit( void ) +{ +#ifndef CLIENT_DLL + SetModel( GetWorldModel() ); + VPhysicsDestroyObject(); + + if ( HasSpawnFlags( SF_NORESPAWN ) == false ) + { + SetMoveType( MOVETYPE_NONE ); + SetSolid( SOLID_BBOX ); + AddSolidFlags( FSOLID_TRIGGER ); + + UTIL_DropToFloor( this, MASK_SOLID ); + } + else + { + if ( !VPhysicsInitNormal( SOLID_BBOX, GetSolidFlags() | FSOLID_TRIGGER, false ) ) + { + SetMoveType( MOVETYPE_NONE ); + SetSolid( SOLID_BBOX ); + AddSolidFlags( FSOLID_TRIGGER ); + } + } + + SetPickupTouch(); + + SetThink( &CBaseCombatWeapon::FallThink ); + + SetNextThink( gpGlobals->curtime + 0.1f ); + +#endif +} +*/ |