diff --git a/docs/idabot.rst b/docs/idabot.rst index 31864ba8000e44e0002e2c8bcaef839057a34066..2a3b0c0d2f9c1339bb38c7ea32f358afc5f71ae9 100644 --- a/docs/idabot.rst +++ b/docs/idabot.rst @@ -55,6 +55,10 @@ IDABot Returns the players race, useful if you play Race.Random + .. method:: IDABot.send_chat(self, message) + + Sends the string 'message' to the game chat + Attributes: .. autoattribute:: minerals diff --git a/python-api-src/library.cpp b/python-api-src/library.cpp index 5119445973792543ebcfde64533ce62c346e9fba..a07e0f30b1cee5aa53625f6fa067dec1383457a5 100644 --- a/python-api-src/library.cpp +++ b/python-api-src/library.cpp @@ -75,6 +75,7 @@ PYBIND11_MODULE(library, m) .def(py::init()) .def("on_game_start", &IDABot::OnGameStart) .def("on_step", &IDABot::OnStep) + .def("send_chat", &IDABot::SendChat, "Send a message to the game chat", "message"_a) .def("get_all_units", &IDABot::GetAllUnits, "Returns a list of all units") .def("get_my_units", &IDABot::GetMyUnits, "Returns a list of all units beloning to the player") .def("get_player_race", &IDABot::GetPlayerRace) diff --git a/src/IDABot.cpp b/src/IDABot.cpp index c12fe5ab76ceddd8b69575208806c514718c3265..d0908f789cb42ab5675a0028889085a4918d79bd 100644 --- a/src/IDABot.cpp +++ b/src/IDABot.cpp @@ -199,6 +199,12 @@ BuildingPlacer & IDABot::GetBuildingPlacer() return m_buildingPlacer; } + +void IDABot::SendChat(const std::string & message) +{ + Actions()->SendChat(message); +} + const TypeData & IDABot::Data(const UnitType & type) const { return m_techTree.getData(type); diff --git a/src/IDABot.h b/src/IDABot.h index eca954f01a1857bf31747ae128a239b86dc19e88..a1567ac9f75b75b6d5268cb3c4f3e372e8eac23e 100644 --- a/src/IDABot.h +++ b/src/IDABot.h @@ -46,6 +46,8 @@ public: CCPosition GetStartLocation() const; BuildingPlacer & GetBuildingPlacer(); + void SendChat(const std::string & message); + int GetCurrentFrame() const; int GetMinerals() const; int GetCurrentSupply() const;