Newer
Older
#include "library.h"
namespace py = pybind11;
void define_replay_unit(py::module & m)
{
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
py::class_<UnitInformation>(m, "ReplayUnit")
.def_property_readonly("id", &UnitInformation::getID)
.def_property_readonly("unit_type", &UnitInformation::getType, "The name of the type")
.def_property_readonly("position", &UnitInformation::getPosition, "The :class:`library.Point2D` of the unit")
.def_property_readonly("tile_position", &UnitInformation::getTilePosition, "The :class:`library.Point2DI` of the unit")
.def_property_readonly("hit_points", &UnitInformation::getHitPoints)
.def_property_readonly("shields", &UnitInformation::getShields)
.def_property_readonly("energy", &UnitInformation::getEnergy)
.def_property_readonly("player", &UnitInformation::getPlayer)
.def_property_readonly("build_percentage", &UnitInformation::getBuildPercentage)
.def_property_readonly("weapon_cooldown", &UnitInformation::getWeaponCooldown)
.def_property_readonly("is_completed", &UnitInformation::isCompleted)
.def_property_readonly("is_being_constructed", &UnitInformation::isBeingConstructed)
.def_property_readonly("is_cloaked", &UnitInformation::isCloaked)
.def_property_readonly("is_flying", &UnitInformation::isFlying)
.def_property_readonly("buffs", &UnitInformation::buffs)
.def_property_readonly("is_alive", &UnitInformation::isAlive)
.def_property_readonly("is_powered", &UnitInformation::isPowered)
.def_property_readonly("is_idle", &UnitInformation::isIdle)
.def_property_readonly("is_burrowed", &UnitInformation::isBurrowed)
.def_property_readonly("is_valid", &UnitInformation::isValid)
.def_property_readonly("is_training", &UnitInformation::isTraining)
.def_property_readonly("is_blip", &UnitInformation::isBlip)
.def_property_readonly("target", &UnitInformation::getTarget)
.def_property_readonly("has_target", &UnitInformation::hasTarget)
.def_property_readonly("max_hit_points", &UnitInformation::getMaxHitPoints)
.def_property_readonly("progress", &UnitInformation::getProgress)
.def_property_readonly("current_ability_id", &UnitInformation::getCurrentAbilityID, "The AbilityID of currently used ability")
.def_property_readonly("facing", &UnitInformation::getFacing)
.def_property_readonly("radius", &UnitInformation::getRadius)
.def_property_readonly("is_carrying_minerals", &UnitInformation::isCarryingMinerals)
.def("__hash__", [](const UnitInformation & unit) { return std::hash<const sc2::Unit *>{}(unit.getUnitPtr()); })
.def(py::self == py::self)
.def("__repr__", [](const UnitInformation & unit) { return "<Unit of type: '" + unit.getType() + "'>"; })
;