diff --git a/python-api-src/lib_base_location.cpp b/python-api-src/lib_base_location.cpp index 59b712633f6f5ba968412ca562fcd3ea0aa9f7ee..374dfaa7d59a83dd4dc4c73c87da8f8bd5a4e33d 100644 --- a/python-api-src/lib_base_location.cpp +++ b/python-api-src/lib_base_location.cpp @@ -10,22 +10,22 @@ void define_base_location(py::module & m) //.def_property_readonly("mineral_fields", &BaseLocation::getMinerals, "Alias for minerals in order to differentiate from harvested minerals") // This just did the same thing as minerals (above) removed to avoid confusion .def_property_readonly("is_start_location", &BaseLocation::isStartLocation, "True if the base location is a start location, False otherwise") .def_property_readonly("depot_position", &BaseLocation::getDepotPosition, "A suitable position for building a town hall (Command Center, Hatchery or Nexus), defined as a : class :`library.Point2DI`.") - .def_property_readonly("position", &BaseLocation::getPosition, "The position of the center of the BaseLocation, defined as a :class:`library.Point2D`.") + .def_property_readonly("position", &BaseLocation::getPosition, "The position of the center of the BaseLocation, defined as a :class:`commandcenter.Point2D`.") .def("get_ground_distance", py::overload_cast<const CCPosition &>(&BaseLocation::getGroundDistance, py::const_)) .def("get_ground_distance", py::overload_cast<const CCTilePosition &>(&BaseLocation::getGroundDistance, py::const_), "Returns the ground distance between the provided position and the base location. Note that this uses a BFS approach and may overshoot a bit.") .def("is_occupied_by_player", &BaseLocation::isOccupiedByPlayer, "player constant"_a, "If the baselocation is occupied by the provided player. See :ref:`playerconstants` for more information") .def("is_player_start_location", &BaseLocation::isPlayerStartLocation, "player_constant"_a, "If the baselocation is the start location of the provided player. See :ref:`playerconstants` for more information") - .def("contains_position", &BaseLocation::containsPosition, "If the baselocation contains the provided :class:`library.Point2D` position") + .def("contains_position", &BaseLocation::containsPosition, "If the baselocation contains the provided :class:`commandcenter.Point2D` position") .doc() = R"( Represents a base location on the map. A base location is a location on the map where a player can build a base. It contains information about the resources available at the location, the position of the location, and other information. )"; py::class_<BaseLocationManager>(m, "BaseLocationManager") - .def_property_readonly("base_locations", &BaseLocationManager::getBaseLocations, py::return_value_policy::reference, "A list of all :class:`library.BaseLocation` on the current map") - .def_property_readonly("starting_base_locations", &BaseLocationManager::getStartingBaseLocations, py::return_value_policy::reference, "A list of all :class:`library.BaseLocation` on the current map which a player started at, indexed by Player constant(see :ref:`playerconstants`).") - .def("get_occupied_base_locations", &BaseLocationManager::getOccupiedBaseLocations, py::return_value_policy::reference, "player_constant"_a, "Returns a list of all :class:`library.BaseLocation` that are occupied by the provided :ref:`playerconstants`.") - .def("get_player_starting_base_location", &BaseLocationManager::getPlayerStartingBaseLocation, py::return_value_policy::copy, "player_constant"_a, "Returns the :class:`library.BaseLocation` that provided :ref:`playerconstants` started at.") - .def("get_next_expansion", &BaseLocationManager::getNextExpansion, py::return_value_policy::copy, "player_constant"_a, "Returns the :class:`library.BaseLocation` that is closest to the startlocation of provided :ref:`playerconstants` that is possible to expand to.") + .def_property_readonly("base_locations", &BaseLocationManager::getBaseLocations, py::return_value_policy::reference, "A list of all :class:`commandcenter.BaseLocation` on the current map") + .def_property_readonly("starting_base_locations", &BaseLocationManager::getStartingBaseLocations, py::return_value_policy::reference, "A list of all :class:`commandcenter.BaseLocation` on the current map which a player started at, indexed by Player constant(see :ref:`playerconstants`).") + .def("get_occupied_base_locations", &BaseLocationManager::getOccupiedBaseLocations, py::return_value_policy::reference, "player_constant"_a, "Returns a list of all :class:`commandcenter.BaseLocation` that are occupied by the provided :ref:`playerconstants`.") + .def("get_player_starting_base_location", &BaseLocationManager::getPlayerStartingBaseLocation, py::return_value_policy::copy, "player_constant"_a, "Returns the :class:`commandcenter.BaseLocation` that provided :ref:`playerconstants` started at.") + .def("get_next_expansion", &BaseLocationManager::getNextExpansion, py::return_value_policy::copy, "player_constant"_a, "Returns the :class:`commandcenter.BaseLocation` that is closest to the startlocation of provided :ref:`playerconstants` that is possible to expand to.") .doc() = R"( As the name implies this class helps you manage the base locations on the map. )"; diff --git a/python-api-src/lib_building_placer.cpp b/python-api-src/lib_building_placer.cpp index 0f4155272e6173e8e2d8a993fa55e13ff401f801..8678cb2148b449c543060f07c36c77c64a31fc7a 100644 --- a/python-api-src/lib_building_placer.cpp +++ b/python-api-src/lib_building_placer.cpp @@ -14,7 +14,7 @@ void define_building_placer(py::module & m) .doc() = R"( This class is useful for placing all buildings, except refineries and town halls (Command Centers, Hacheries and Nexus). - If you want to place a town hall, take a look at attribute `depot_location` of :class:`library.BaseLocation`. - If you want to place a refinery, take a look at attribute `geysers` of :class:`library.BaseLocation` and the method build_target of :class:`library.Unit`. + If you want to place a town hall, take a look at attribute `depot_location` of :class:`commandcenter.BaseLocation`. + If you want to place a refinery, take a look at attribute `geysers` of :class:`commandcenter.BaseLocation` and the method build_target of :class:`commandcenter.Unit`. )"; } \ No newline at end of file diff --git a/python-api-src/lib_replay_unit.cpp b/python-api-src/lib_replay_unit.cpp index 7364163e5ae62362c1f6fea28ecd636ca78df321..321e20b7348d626dddaf984d4944370bd19e213b 100644 --- a/python-api-src/lib_replay_unit.cpp +++ b/python-api-src/lib_replay_unit.cpp @@ -6,9 +6,9 @@ void define_replay_unit(py::module & m) { py::class_<ReplayUnit>(m, "ReplayUnit") .def_property_readonly("id", &ReplayUnit::getID, "The ID of the unit") - .def_property_readonly("unit_type", &ReplayUnit::getType, "The :class:`library.UnitType` of the unit") - .def_property_readonly("position", &ReplayUnit::getPosition, "The :class:`library.Point2D` of the unit") - .def_property_readonly("tile_position", &ReplayUnit::getTilePosition, "The :class:`library.Point2DI` of the unit") + .def_property_readonly("unit_type", &ReplayUnit::getType, "The :class:`commandcenter.UnitType` of the unit") + .def_property_readonly("position", &ReplayUnit::getPosition, "The :class:`commandcenter.Point2D` of the unit") + .def_property_readonly("tile_position", &ReplayUnit::getTilePosition, "The :class:`commandcenter.Point2DI` of the unit") .def_property_readonly("hit_points", &ReplayUnit::getHitPoints, "The hit points of the unit") .def_property_readonly("shields", &ReplayUnit::getShields, "The shields of the unit") .def_property_readonly("energy", &ReplayUnit::getEnergy, "The energy of the unit") @@ -40,7 +40,7 @@ void define_replay_unit(py::module & m) .def("__repr__", [](const ReplayUnit & unit) { return "<Unit of type: '" + unit.getType().getName() + "'>"; }) .doc() = R"( The ReplayUnit class is used to represent a unit in a replay of a game. - A ReplayUnit is a :class:`library.Unit` white some limitations. + A ReplayUnit is a :class:`commandcenter.Unit` white some limitations. It provides various properties and methods to access information about the unit, such as its ID, type, position, hit points, energy, and more. It is possible to use ReplayUnit as keys in a dictionary, which might be helpful for bookkeeping. )"; diff --git a/python-api-src/lib_tech_tree.cpp b/python-api-src/lib_tech_tree.cpp index b982844682e7bbb31159836d5c35411ff247cf8a..fba8a42195447e3a3c00bb76bfee20c1deb885c1 100644 --- a/python-api-src/lib_tech_tree.cpp +++ b/python-api-src/lib_tech_tree.cpp @@ -29,7 +29,7 @@ void define_tech_tree(py::module & m) py::class_<TechTree>(m, "TechTree") .def("get_data", py::overload_cast<const UnitType &>(&TechTree::getData, py::const_)) - .def("get_data", py::overload_cast<const CCUpgrade &>(&TechTree::getData, py::const_), "Argument is either an instance of the class :class:`library.UnitType` or an instance of the class :class:`library.CCUpgrade`, depending on what information is wanted.") + .def("get_data", py::overload_cast<const CCUpgrade &>(&TechTree::getData, py::const_), "Argument is either an instance of the class :class:`commandcenter.UnitType` or an instance of the class :class:`commandcenter.CCUpgrade`, depending on what information is wanted.") .def("suppress_warnings", &TechTree::setSuppressWarnings, "Suppress type and upgrade warnings" ,"b"_a) .doc() = R"( This class contains all information about units and what is required to diff --git a/python-api-src/lib_unit.cpp b/python-api-src/lib_unit.cpp index b2b23a5dda386f1a013c9dba4cb85b8e31b9ce87..d64455231d257fa50328a79847849319c0c4d7db 100644 --- a/python-api-src/lib_unit.cpp +++ b/python-api-src/lib_unit.cpp @@ -5,9 +5,9 @@ namespace py = pybind11; void define_unit(py::module & m) { py::class_<Unit>(m, "Unit") - .def_property_readonly("unit_type", &Unit::getType, "The :class:`library.UnitType` of the unit") - .def_property_readonly("position", &Unit::getPosition, "The :class:`library.Point2D` of the unit") - .def_property_readonly("tile_position", &Unit::getTilePosition, "The :class:`library.Point2DI` of the unit") + .def_property_readonly("unit_type", &Unit::getType, "The :class:`commandcenter.UnitType` of the unit") + .def_property_readonly("position", &Unit::getPosition, "The :class:`commandcenter.Point2D` of the unit") + .def_property_readonly("tile_position", &Unit::getTilePosition, "The :class:`commandcenter.Point2DI` of the unit") .def_property_readonly("hit_points", &Unit::getHitPoints, "Health of the unit.") .def_property_readonly("shields", &Unit::getShields, "Shield of the unit.") .def_property_readonly("energy", &Unit::getEnergy, "Energy of the unit.") @@ -53,15 +53,15 @@ void define_unit(py::module & m) .def("ability", py::overload_cast<sc2::AbilityID, const CCPosition &>(&Unit::ability, py::const_)) .def("ability", py::overload_cast<sc2::AbilityID, const Unit &>(&Unit::ability, py::const_), "Call an ability directly, different abilities has different targets. Some target the unit itself (no argument), target a point (Point2D as argument) and some target a Unit (instance of Unit as argument)") .def("move", py::overload_cast<const CCPosition &>(&Unit::move, py::const_)) - .def("move", py::overload_cast<const CCTilePosition &>(&Unit::move, py::const_), "Move the unit to the given point, the point being an instance of either :class:`library.Point2D` or :class:`library.Point2DI`.") + .def("move", py::overload_cast<const CCTilePosition &>(&Unit::move, py::const_), "Move the unit to the given point, the point being an instance of either :class:`commandcenter.Point2D` or :class:`commandcenter.Point2DI`.") .def("right_click", &Unit::rightClick, "Same as right-clicking in the game, for example making workers mine minerals") .def("repair", &Unit::repair, "Right-clicks on the provided unit in order to repair it") .def("build", &Unit::build, "Build unit of type building_type at given position", "building_type"_a, "position"_a) .def("build_target", &Unit::buildTarget, "Build building_type on top of target Unit, useful for building refineries", "building_type"_a, "target"_a) .def("train", &Unit::train, "Train unit of type", "unit_type"_a) .def("morph", &Unit::morph, "Morph into type of unit_type", "unit_type"_a) - .def("research", &Unit::research, "Research the given :class:`library.UPGRADE_ID`", "upgrade_id"_a) - .def("is_constructing", &Unit::isConstructing, "unit_type"_a, "Returns true if the unit is currently constructing another unit of type `unit_type`. Note that `unit_type` needs to be an instance of :class:`library.UnitType`") + .def("research", &Unit::research, "Research the given :class:`commandcenter.UPGRADE_ID`", "upgrade_id"_a) + .def("is_constructing", &Unit::isConstructing, "unit_type"_a, "Returns true if the unit is currently constructing another unit of type `unit_type`. Note that `unit_type` needs to be an instance of :class:`commandcenter.UnitType`") .def("__hash__", [](const Unit & unit) { return std::hash<const sc2::Unit *>{}(unit.getUnitPtr()); }) .def(py::self == py::self) .def("__repr__", [](const Unit & unit) { return "<Unit of type: '" + unit.getType().getName() + "'>"; }) @@ -71,10 +71,10 @@ void define_unit(py::module & m) background is a unit. For example, the minerals and geysers are units as well as all buildings. - For all possible types of units see the enum :class:`library.UNIT_TYPEID`. + For all possible types of units see the enum :class:`commandcenter.UNIT_TYPEID`. Some types of objects are almost the same, for example there are many types of mineral deposits, but all of them are mineable. This is one of the - motivations behind the :class:`library.UnitType` which aims to to make the + motivations behind the :class:`commandcenter.UnitType` which aims to to make the list of types more manageable. The UnitType can be accessed by the :any:`Unit.unit_type` property. diff --git a/python-api-src/lib_unittype.cpp b/python-api-src/lib_unittype.cpp index 346ffc5015f085bf1ad6fe8fdb4ff479d1e94d5c..bdee80eaf1ed6289ebd17247282a51acc50520f6 100644 --- a/python-api-src/lib_unittype.cpp +++ b/python-api-src/lib_unittype.cpp @@ -54,7 +54,7 @@ void define_unittype(py::module & m) .def("__lt__", &UnitType::operator<, py::is_operator()) .def("__eq__", &UnitType::operator==, py::is_operator()) .doc() = R"( - Wrapper for :class:`library.UNIT_TYPEID`. Represents a type of unit in the game. + Wrapper for :class:`commandcenter.UNIT_TYPEID`. Represents a type of unit in the game. NOTE: A lot of functions utilize checks that require the game to be running. Therefore if you get an unexpected segmentation fault, it is likely due to the game not being in a running state. )"; diff --git a/python-api-src/library.cpp b/python-api-src/library.cpp index 1748bcaba315ee092699862c6170b26b8f497f0a..bbb745c311b015517da167c724a66bd5fca92d67 100644 --- a/python-api-src/library.cpp +++ b/python-api-src/library.cpp @@ -134,7 +134,7 @@ PYBIND11_MODULE(commandcenter, m) .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_player_race", &IDABot::GetPlayerRace, "Returns the players race, useful if you play Race.Random") - .def("debug_create_unit", &IDABot::DebugCreateUnit, "This method creates the nr (INT) of units on the position :class:`library.Point2D`, the unit belongs to the Player Constant", "unit_type"_a, "p"_a, "player_id"_a = 0, "count"_a = 1) + .def("debug_create_unit", &IDABot::DebugCreateUnit, "This method creates the nr (INT) of units on the position :class:`commandcenter.Point2D`, the unit belongs to the Player Constant", "unit_type"_a, "p"_a, "player_id"_a = 0, "count"_a = 1) .def("debug_kill_unit", &IDABot::DebugKillUnit, "Kill the unit from debug mode") .def("debug_show_map", &IDABot::DebugShowMap, "Show the entire map through debug mode") .def("debug_fast_build", &IDABot::DebugFastBuild, "Set build time in game to 1 through debug mode") @@ -160,10 +160,10 @@ PYBIND11_MODULE(commandcenter, m) .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("effect_radius", &IDABot::RadiusEffect, "Size of the circle the effect impacts", "effect"_a) - .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("map_tools", &IDABot::Map, "An instance of the class :class:`library.MapTools`") - .def_property_readonly("building_placer", &IDABot::GetBuildingPlacer, "An instance of the class :class:`library.BuildingPlacer`") + .def_property_readonly("base_location_manager", &IDABot::Bases, "An instance of the class :class:`commandcenter.BaseLocationManager`. ") + .def_property_readonly("tech_tree", &IDABot::GetTechTree, "An instance of the class :class:`commandcenter.TechTree`") + .def_property_readonly("map_tools", &IDABot::Map, "An instance of the class :class:`commandcenter.MapTools`") + .def_property_readonly("building_placer", &IDABot::GetBuildingPlacer, "An instance of the class :class:`commandcenter.BuildingPlacer`") .def_property_readonly("start_location", &IDABot::GetStartLocation, "CCPosition representing the start location, note that it is the depot position that is returned.") .def_property_readonly("start_locations", &IDABot::GetStartLocations, "List of CCPositions representing the start locations, note that it is the depot positions and not the center positions") .def_property_readonly("minerals", &IDABot::GetMinerals, "How much minerals we currently have")