HLPlayer

From Valve Developer Community
Revision as of 02:34, 4 September 2009 by Lodle (talk | contribs)
Jump to navigation Jump to search

This is the basic interface for hl2 players

BOOST_PYTHON_MODULE(HLPlayer)
{
	//because CommitSuicide is overloaded we must tell it which one to use
	void (CBasePlayer::*CommitSuicideFP)(bool, bool) = &CBasePlayer::CommitSuicide;

	class_<CBasePlayer, bases<CBaseEntity> , boost::noncopyable>("CBasePlayer", no_init)
		.def("DeathCount", &CBasePlayer::DeathCount)
		.def("ArmorValue", &CBasePlayer::ArmorValue)
		.def("ResetDeathCount", &CBasePlayer::ResetDeathCount)
		.def("CommitSuicide", CommitSuicideFP)
		.def("GetPlayerName", &CBasePlayer::GetPlayerName)
		.def("GetHealth", &CBasePlayer::GetHealth);

	class_<CHL2_Player, bases<CBasePlayer>, boost::noncopyable >("CHL2_Player", no_init)
		.def("Weapon_Switch", &CHL2_Player::Weapon_Switch);
}