HLGameRules

From Valve Developer Community
Jump to: navigation, search

This is the basic interface for hl2 game rules

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

CTeam* pyGetTeam(int index)
{
	return GetGlobalTeam(index);
}

BOOST_PYTHON_MODULE(HLGameRules)
{
	bp::def("GetTeam", pyGetTeam, bp::return_value_policy<bp::reference_existing_object>());

	bp::class_<CTeam, boost::noncopyable>("CTeam", bp::no_init)
		.def("GetRoundsWon", &CTeam::GetRoundsWon)
		.def("SetRoundsWon", &CTeam::SetRoundsWon)
		.def("IncrementRoundsWon", &CTeam::IncrementRoundsWon)
		.def("ResetScores", &CTeam::ResetScores)
		.def("GetScore", &CTeam::GetScore)
		.def("SetScore", &CTeam::SetScore)
		.def("AddScore", &CTeam::AddScore)
		.def("GetNumPlayers", &CTeam::GetNumPlayers)
		.def("GetName", &CTeam::GetName)
		.def("GetTeamNumber", &CTeam::GetTeamNumber);
}