Struct sc2::Unit
[−]
[src]
pub struct Unit { pub display_type: DisplayType, pub alliance: Alliance, pub tag: Tag, pub unit_type: UnitType, pub owner: i32, pub pos: Point3, pub facing: f32, pub radius: f32, pub build_progress: f32, pub cloak: CloakState, pub detect_range: f32, pub radar_range: f32, pub is_selected: bool, pub is_on_screen: bool, pub is_blip: bool, pub health: f32, pub health_max: f32, pub shield: f32, pub energy: f32, pub mineral_contents: i32, pub vespene_contents: i32, pub is_flying: bool, pub is_burrowed: bool, pub weapon_cooldown: f32, pub orders: Vec<UnitOrder>, pub add_on_tag: Tag, pub passengers: Vec<PassengerUnit>, pub cargo_space_taken: i32, pub cargo_space_max: i32, pub assigned_harvesters: i32, pub ideal_harvesters: i32, pub engaged_target_tag: Tag, pub buffs: Vec<Buff>, pub is_powered: bool, pub is_alive: bool, pub last_seen_game_loop: u32, }
a unit (could be structure, a worker, or military)
Fields
display_type: DisplayType
whether the unit is shown on screen or not
alliance: Alliance
relationship of the unit to this player
tag: Tag
a unique id for the instance of a unit
unit_type: UnitType
the type of unit
owner: i32
which player owns this unit
pos: Point3
position of the unit in the world
facing: f32
direction the unit faces in radians
radius: f32
radius of the unit
build_progress: f32
gives progress under construction (range [0.0, 1.0] where 1.0 is done)
cloak: CloakState
whether the unit is cloaked
detect_range: f32
range of detector for detector units
radar_range: f32
range of radar for radar units
is_selected: bool
whether this unit is currently selected
is_on_screen: bool
whether this unit is visible and within the camera frustum
is_blip: bool
whether this unit is detected by a sensor tower
health: f32
health of the unit (not set for snapshots)
health_max: f32
max health of the unit (not set for snapshots)
shield: f32
shield of the unit (not set for snapshots)
energy: f32
energy of the unit (not set for snapshots)
mineral_contents: i32
amount of minerals if unit is a mineral field (not set for snapshot)
vespene_contents: i32
amount of vespene if unit is a geyser (not set for snapshots)
is_flying: bool
whether the unit is flying (not set for snapshots)
is_burrowed: bool
whether the unit is burrowed (not set for snapshots)
weapon_cooldown: f32
time remaining for a weapon on cooldown (not set for snapshots)
orders: Vec<UnitOrder>
orders on this unit (only valid for this player's units)
add_on_tag: Tag
addon like a tech lab or reactor (only valid for this player's units)
passengers: Vec<PassengerUnit>
passengers in this transport (only valid for this player's units)
cargo_space_taken: i32
number of cargo slots used (only valid for this player's units)
cargo_space_max: i32
max number of cargo slots (only valid for this player's units)
assigned_harvesters: i32
number of harvesters associated with town hall
ideal_harvesters: i32
number of harvesters that can be assigned to a town hall
engaged_target_tag: Tag
target unit of a unit (only valid for this player's units)
buffs: Vec<Buff>
buffs on this unit (only valid for this player's units)
is_powered: bool
whether this unit is powered by a pylon
is_alive: bool
whether this unit is alive or not
last_seen_game_loop: u32
the last time the unit was seen