Skip to content
Snippets Groups Projects
Commit 7f5eb81c authored by Rojikku98's avatar Rojikku98
Browse files

Added on_game_end and asve replay

parent a632c71a
No related branches found
No related tags found
No related merge requests found
Pipeline #64283 passed
...@@ -83,6 +83,7 @@ PYBIND11_MODULE(library, m) ...@@ -83,6 +83,7 @@ PYBIND11_MODULE(library, m)
.def(py::init()) .def(py::init())
.def("on_game_start", &IDABot::OnGameStart) .def("on_game_start", &IDABot::OnGameStart)
.def("on_step", &IDABot::OnStep) .def("on_step", &IDABot::OnStep)
.def("on_game_end", &IDABot::OnGameEnd)
.def("send_chat", &IDABot::SendChat, "Sends the string 'message' to the game chat", "message"_a) .def("send_chat", &IDABot::SendChat, "Sends the string 'message' to the game chat", "message"_a)
.def("get_all_units", &IDABot::GetAllUnits, "Returns a list of all visible units, including minerals and geysers") .def("get_all_units", &IDABot::GetAllUnits, "Returns a list of all visible units, including minerals and geysers")
.def("get_my_units", &IDABot::GetMyUnits, "Returns a list of all your units") .def("get_my_units", &IDABot::GetMyUnits, "Returns a list of all your units")
...@@ -113,6 +114,7 @@ PYBIND11_MODULE(library, m) ...@@ -113,6 +114,7 @@ PYBIND11_MODULE(library, m)
.def("upgrade_gas_cost", &IDABot::UpgradeGasCost, "Vespene/gas cost of researching the upgrade", "upgrade"_a) .def("upgrade_gas_cost", &IDABot::UpgradeGasCost, "Vespene/gas cost of researching the upgrade", "upgrade"_a)
.def("upgrade_research_time", &IDABot::UpgradeResearchTime, "Time in GameLoops to research this upgrade", "upgrade"_a) .def("upgrade_research_time", &IDABot::UpgradeResearchTime, "Time in GameLoops to research this upgrade", "upgrade"_a)
.def("effect_radius", &IDABot::RadiusEffect, "Size of the circle the effect impacts", "effect"_a) .def("effect_radius", &IDABot::RadiusEffect, "Size of the circle the effect impacts", "effect"_a)
.def("save_replay", &IDABot::SaveReplay, "Saves the game as a replay", "path"_a)
.def_property_readonly("base_location_manager", &IDABot::Bases, "An instance of the class :class:`library.BaseLocationManager`") .def_property_readonly("base_location_manager", &IDABot::Bases, "An instance of the class :class:`library.BaseLocationManager`")
.def_property_readonly("tech_tree", &IDABot::GetTechTree, "An instance of the class :class:`library.TechTree`") .def_property_readonly("tech_tree", &IDABot::GetTechTree, "An instance of the class :class:`library.TechTree`")
.def_property_readonly("map_tools", &IDABot::Map, "An instance of the class :class:`library.MapTools`") .def_property_readonly("map_tools", &IDABot::Map, "An instance of the class :class:`library.MapTools`")
......
...@@ -60,6 +60,15 @@ public: ...@@ -60,6 +60,15 @@ public:
OnStep OnStep
); );
} }
void OnGameEnd() override
{
PYBIND11_OVERLOAD_NAME(
void,
IDABot,
"on_game_end",
OnGameEnd
);
}
}; };
......
...@@ -403,4 +403,8 @@ const sc2::GameResult IDABot::GetPlayerResults() const { ...@@ -403,4 +403,8 @@ const sc2::GameResult IDABot::GetPlayerResults() const {
} }
std::cout << "The player can not be found" << std::endl; std::cout << "The player can not be found" << std::endl;
return sc2::GameResult::Undecided; return sc2::GameResult::Undecided;
}
bool IDABot::SaveReplay(const std::string& path) {
return this->Control()->SaveReplay(path);
} }
\ No newline at end of file
...@@ -97,6 +97,8 @@ public: ...@@ -97,6 +97,8 @@ public:
const sc2::GameResult GetPlayerResults() const; const sc2::GameResult GetPlayerResults() const;
bool SaveReplay(const std::string & path);
// Not needed, just convenience functions // Not needed, just convenience functions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment