HLWeapon

From Valve Developer Community
Jump to: navigation, search

This is the basic interface for weapons

#include <boost/python.hpp>
namespace bp = boost::python;

BOOST_PYTHON_MODULE(HLWeapon)
{
	bp::class_<CBaseCombatWeapon, bp::bases<BASECOMBATWEAPON_DERIVED_FROM>, boost::noncopyable>("CBaseCombatWeapon", bp::no_init)
		.def("HasAnyAmmo", &CBaseCombatWeapon::HasAnyAmmo)
		.def("HasPrimaryAmmo", &CBaseCombatWeapon::HasPrimaryAmmo)
		.def("HasSecondaryAmmo", &CBaseCombatWeapon::HasSecondaryAmmo)
		.def("UsesPrimaryAmmo", &CBaseCombatWeapon::UsesPrimaryAmmo)
		.def("UsesSecondaryAmmo", &CBaseCombatWeapon::UsesSecondaryAmmo)
		.def("GiveDefaultAmmo", &CBaseCombatWeapon::GiveDefaultAmmo)

		.def("GetViewModel", &CBaseCombatWeapon::GetViewModel)
		.def("GetWorldModel", &CBaseCombatWeapon::GetWorldModel)
		.def("GetAnimPrefix", &CBaseCombatWeapon::GetAnimPrefix)
		.def("GetMaxClip1", &CBaseCombatWeapon::GetMaxClip1)
		.def("GetMaxClip2", &CBaseCombatWeapon::GetMaxClip2)
		.def("GetDefaultClip1", &CBaseCombatWeapon::GetDefaultClip1)
		.def("GetDefaultClip2", &CBaseCombatWeapon::GetDefaultClip2)
		.def("GetWeight", &CBaseCombatWeapon::GetWeight)
		.def("GetWeaponFlags", &CBaseCombatWeapon::GetWeaponFlags)
		.def("GetSlot", &CBaseCombatWeapon::GetSlot)
		.def("GetPosition", &CBaseCombatWeapon::GetPosition)
		.def("GetName", &CBaseCombatWeapon::GetName)
		.def("GetPrintName", &CBaseCombatWeapon::GetPrintName)
		.def("GetShootSound", &CBaseCombatWeapon::GetShootSound)
		.def("UsesClipsForAmmo1", &CBaseCombatWeapon::UsesClipsForAmmo1)
		.def("UsesClipsForAmmo2", &CBaseCombatWeapon::UsesClipsForAmmo2)
		.def("IsMeleeWeapon", &CBaseCombatWeapon::IsMeleeWeapon)

		.def("GetPrimaryAmmoCount", &CBaseCombatWeapon::GetPrimaryAmmoCount)
		.def("SetPrimaryAmmoCount", &CBaseCombatWeapon::SetPrimaryAmmoCount)
		.def("GetSecondaryAmmoCount", &CBaseCombatWeapon::GetSecondaryAmmoCount)
		.def("SetSecondaryAmmoCount", &CBaseCombatWeapon::SetSecondaryAmmoCount)

		.def("GetClip1", &CBaseCombatWeapon::Clip1)
		.def("GetClip2", &CBaseCombatWeapon::Clip2);


	bp::class_<CWeaponHL2MPBase, bp::bases<CBaseCombatWeapon>, boost::noncopyable>("CWeaponHL2MPBase", bp::no_init);
	bp::class_<CBaseHL2MPCombatWeapon, bp::bases<CWeaponHL2MPBase>, boost::noncopyable>("CBaseHL2MPCombatWeapon", bp::no_init);

}