Newer
Older
#include "library.h"
namespace py = pybind11;
void define_tech_tree(py::module & m)
{
py::class_<TypeData>(m, "TypeData")
.def_readonly("race", &TypeData::race)
.def_readonly("mineral_cost", &TypeData::mineralCost, "mineral cost of the item")
.def_readonly("gas_cost", &TypeData::gasCost, "gas cost of the item")
.def_readonly("supply_cost", &TypeData::supplyCost, "supply cost of the item")
.def_readonly("build_time", &TypeData::buildTime, "build time of the item in seconds (should be 32 game updates per tick, can someone verify this?)")
.def_readonly("is_unit", &TypeData::isUnit, "is the item a unit")
.def_readonly("is_building", &TypeData::isBuilding, "is the item a building")
.def_readonly("is_worker", &TypeData::isWorker, "is the item a worker")
.def_readonly("is_refinery", &TypeData::isRefinery, "is the item a refinery")
.def_readonly("is_supply_provider", &TypeData::isSupplyProvider, "is the item a supply provider")
.def_readonly("is_resource_depot", &TypeData::isResourceDepot, "is the item a resource depot")
.def_readonly("is_addon", &TypeData::isAddon, "is the item an addon")
.def_readonly("build_ability", &TypeData::buildAbility, "the ability that creates this item")
.def_readonly("warp_ability", &TypeData::warpAbility, "the ability that creates this item via warp-in")
.def_readonly("what_builds", &TypeData::whatBuilds, "any of these units can build the item")
.def_readonly("required_units", &TypeData::requiredUnits, "owning ONE of these is required to make -> List[UnitType]")
.def_readonly("required_upgrades", &TypeData::requiredUpgrades, "having ALL of these is required to make -> List[UPGRADE_ID]")
.def_readonly("required_addons", &TypeData::requiredAddons, "a unit of this type must be present next to the producer -> List[UnitType]")
.doc() = R"(
Allows you to get information about a unit type or upgrade. This is a read-only class.
)";
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:`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
build a certain unit and what builds it. It only has one method, which is
used to look-up unit types properties.
Instead of using TechTree, it's possible to use the functions in UnitType for
structure, etc. In IDABot there is functions for getting data about upgrades.
)";