Skip to content
Snippets Groups Projects
Commit 15241610 authored by Daniel de Leng's avatar Daniel de Leng
Browse files

Update documentation in source code to commandcenter

parent f2e24f8a
No related branches found
No related tags found
No related merge requests found
Pipeline #133105 passed
......@@ -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.
)";
......
......@@ -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
......@@ -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.
)";
......
......@@ -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
......
......@@ -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.
......
......@@ -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.
)";
......
......@@ -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")
......
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