Creating simple pickup: Difference between revisions
Jump to navigation
Jump to search
(Created page with 'What: I will explain how you can add a simple pickup like you have in the singleplayer Version: Orange Box SDK. ------- First open "hl2mp_player.cpp" and search for "CHL2MP_Pla…') |
No edit summary |
||
Line 37: | Line 37: | ||
</source> | </source> | ||
The code is just taken from the singleplayer. | The code is just taken from the singleplayer. | ||
[[Category:Programming]] |
Revision as of 01:39, 2 May 2010
What: I will explain how you can add a simple pickup like you have in the singleplayer Version: Orange Box SDK.
First open "hl2mp_player.cpp" and search for "CHL2MP_Player::PickupObject".
replace the function:
void CHL2MP_Player::PickupObject( CBaseEntity *pObject, bool bLimitMassAndSize )
{
}
with:
void CHL2MP_Player::PickupObject( CBaseEntity *pObject, bool bLimitMassAndSize )
{
// can't pick up what you're standing on
if ( GetGroundEntity() == pObject )
return;
if ( bLimitMassAndSize == true )
{
if ( CBasePlayer::CanPickupObject( pObject, 35, 128 ) == false )
return;
}
// Can't be picked up if NPCs are on me
if ( pObject->HasNPCsOnIt() )
return;
PlayerPickupObject( this, pObject );
}
The code is just taken from the singleplayer.