Struct rust_sc2::unit::Unit [−][src]
pub struct Unit { /* fields omitted */ }
Expand description
Unit structure contains some raw data, helper methods for it’s analysis and some methods for actions execution.
Implementations
impl Unit
[src]
impl Unit
[src]pub fn display_type(&self) -> DisplayType
[src]
pub fn display_type(&self) -> DisplayType
[src]How unit is displayed (i.e. visibility of unit).
pub fn type_id(&self) -> UnitTypeId
[src]
pub fn type_id(&self) -> UnitTypeId
[src]The type of unit.
pub fn owner(&self) -> u32
[src]
pub fn owner(&self) -> u32
[src]Player id of the owner. Normally it should match your player_id
for owned units
and enemy_player_id
for opponent’s units.
pub fn position3d(&self) -> Point3
[src]
pub fn position3d(&self) -> Point3
[src]Position in 3D world space.
pub fn facing(&self) -> f32
[src]
pub fn facing(&self) -> f32
[src]Unit rotation angle (i.e. the direction unit is facing).
Value in range [0, 2π)
.
pub fn build_progress(&self) -> f32
[src]
pub fn build_progress(&self) -> f32
[src]The progress of building construction. Value from 0
to 1
.
pub fn is_cloaked(&self) -> bool
[src]
pub fn is_cloaked(&self) -> bool
[src]true
when unit is burrowed or has cloak field turned on.
pub fn is_revealed(&self) -> bool
[src]
pub fn is_revealed(&self) -> bool
[src]true
when unit is detected.
pub fn detect_range(&self) -> f32
[src]
pub fn detect_range(&self) -> f32
[src]Detection range of detector or 0
if unit is not detector.
See also is_detector
.
pub fn radar_range(&self) -> f32
[src]
pub fn radar_range(&self) -> f32
[src]Range of terran’s sensor tower.
pub fn is_selected(&self) -> bool
[src]
pub fn is_selected(&self) -> bool
[src]Unit is selected.
pub fn is_on_screen(&self) -> bool
[src]
pub fn is_on_screen(&self) -> bool
[src]Unit is visible in game window.
pub fn is_powered(&self) -> bool
[src]
pub fn is_powered(&self) -> bool
[src]Protoss structure is powered by pylon.
pub fn attack_upgrade_level(&self) -> u32
[src]
pub fn attack_upgrade_level(&self) -> u32
[src]General attack upgrade level without considering buffs and special upgrades.
pub fn armor_upgrade_level(&self) -> i32
[src]
pub fn armor_upgrade_level(&self) -> i32
[src]General armor upgrade level without considering buffs and special upgrades.
pub fn shield_upgrade_level(&self) -> i32
[src]
pub fn shield_upgrade_level(&self) -> i32
[src]General shield upgrade level without considering buffs and special upgrades.
pub fn health_max(&self) -> Option<u32>
[src]
pub fn health_max(&self) -> Option<u32>
[src]Maximum health of unit.
Note: Not populated for snapshots.
pub fn shield(&self) -> Option<u32>
[src]
pub fn shield(&self) -> Option<u32>
[src]Current shield of protoss unit.
Note: Not populated for snapshots.
pub fn shield_max(&self) -> Option<u32>
[src]
pub fn shield_max(&self) -> Option<u32>
[src]Maximum shield of protoss unit.
Note: Not populated for snapshots.
pub fn energy(&self) -> Option<u32>
[src]
pub fn energy(&self) -> Option<u32>
[src]Current energy of caster unit.
Note: Not populated for snapshots.
pub fn energy_max(&self) -> Option<u32>
[src]
pub fn energy_max(&self) -> Option<u32>
[src]Maximum energy of caster unit.
Note: Not populated for snapshots.
pub fn mineral_contents(&self) -> Option<u32>
[src]
pub fn mineral_contents(&self) -> Option<u32>
[src]Amount of minerals left in mineral field.
Note: Not populated for snapshots.
pub fn vespene_contents(&self) -> Option<u32>
[src]
pub fn vespene_contents(&self) -> Option<u32>
[src]Amount of vespene gas left in vespene geyser.
Note: Not populated for snapshots.
pub fn is_burrowed(&self) -> bool
[src]
pub fn is_burrowed(&self) -> bool
[src]Zerg unit is burrowed.
Note: Not populated for snapshots.
pub fn is_hallucination(&self) -> bool
[src]
pub fn is_hallucination(&self) -> bool
[src]Is hallucination created by protoss sentry.
Note: Not populated for snapshots.
pub fn passengers(&self) -> &[PassengerUnit]
[src]
pub fn passengers(&self) -> &[PassengerUnit]
[src]Units inside transport or bunker.
Note: Not populated for enemies.
pub fn cargo_space_taken(&self) -> Option<u32>
[src]
pub fn cargo_space_taken(&self) -> Option<u32>
[src]Used space of transport or bunker.
Note: Not populated for enemies.
pub fn cargo_space_max(&self) -> Option<u32>
[src]
pub fn cargo_space_max(&self) -> Option<u32>
[src]Maximum space of transport or bunker.
Note: Not populated for enemies.
pub fn assigned_harvesters(&self) -> Option<u32>
[src]
pub fn assigned_harvesters(&self) -> Option<u32>
[src]Current number of workers on gas or base.
Note: Not populated for enemies.
pub fn ideal_harvesters(&self) -> Option<u32>
[src]
pub fn ideal_harvesters(&self) -> Option<u32>
[src]Ideal number of workers on gas or base.
Note: Not populated for enemies.
pub fn weapon_cooldown(&self) -> Option<f32>
[src]
pub fn weapon_cooldown(&self) -> Option<f32>
[src]Frames left until weapon will be ready to shot.
Note: Not populated for enemies.
pub fn engaged_target_tag(&self) -> Option<u64>
[src]
pub fn buff_duration_remain(&self) -> Option<u32>
[src]
pub fn buff_duration_remain(&self) -> Option<u32>
[src]How long a buff or unit is still around (e.g. mule, broodling, chronoboost).
Note: Not populated for enemies.
pub fn buff_duration_max(&self) -> Option<u32>
[src]
pub fn buff_duration_max(&self) -> Option<u32>
[src]How long the maximum duration of buff or unit (e.g. mule, broodling, chronoboost).
Note: Not populated for enemies.
pub fn rally_targets(&self) -> &[RallyTarget]
[src]
pub fn rally_targets(&self) -> &[RallyTarget]
[src]All rally points of structure.
Note: Not populated for enemies.
pub fn is_townhall(&self) -> bool
[src]
pub fn is_townhall(&self) -> bool
[src]Checks if it’s townhall.
pub fn is_mineral(&self) -> bool
[src]
pub fn is_mineral(&self) -> bool
[src]Checks if it’s mineral field.
pub fn is_detector(&self) -> bool
[src]
pub fn is_detector(&self) -> bool
[src]Checks if unit is detector.
pub fn is_almost_ready(&self) -> bool
[src]
pub fn is_almost_ready(&self) -> bool
[src]Building construction is more than 95% complete.
pub fn has_techlab(&self) -> bool
[src]
pub fn has_techlab(&self) -> bool
[src]Terran building’s addon is techlab if any.
pub fn has_reactor(&self) -> bool
[src]
pub fn has_reactor(&self) -> bool
[src]Terran building’s addon is reactor if any.
pub fn is_attacked(&self) -> bool
[src]
pub fn is_attacked(&self) -> bool
[src]Unit was attacked on last step.
pub fn damage_taken(&self) -> u32
[src]
pub fn damage_taken(&self) -> u32
[src]The damage was taken by unit if it was attacked, otherwise it’s 0
.
pub fn abilities(&self) -> Option<FxHashSet<AbilityId>>
[src]
pub fn abilities(&self) -> Option<FxHashSet<AbilityId>>
[src]Abilities available for unit to use.
Ability won’t be available if it’s on cooldown, unit is out of energy or bot doesn’t have enough resources.
pub fn has_ability(&self, ability: AbilityId) -> bool
[src]
pub fn has_ability(&self, ability: AbilityId) -> bool
[src]Checks if ability is available for unit.
Ability won’t be available if it’s on cooldown, unit is out of energy or bot doesn’t have enough resources.
pub fn cargo_left(&self) -> Option<u32>
[src]
pub fn cargo_left(&self) -> Option<u32>
[src]Free space left in transport or bunker.
pub fn footprint_radius(&self) -> Option<f32>
[src]
pub fn footprint_radius(&self) -> Option<f32>
[src]Half of building_size
, but 2.5
for addons.
pub fn building_size(&self) -> Option<usize>
[src]
pub fn building_size(&self) -> Option<usize>
[src]Correct building size in tiles
(e.g. 2
for supply and addons, 3
for barracks, 5
for command center).
pub fn build_time(&self) -> f32
[src]
pub fn build_time(&self) -> f32
[src]How long a unit takes to build.
pub fn cargo_size(&self) -> u32
[src]
pub fn cargo_size(&self) -> u32
[src]Space that unit takes in transports and bunkers.
pub fn sight_range(&self) -> f32
[src]
pub fn sight_range(&self) -> f32
[src]How far unit can see.
pub fn towards_facing(&self, offset: f32) -> Point2
[src]
pub fn towards_facing(&self, offset: f32) -> Point2
[src]Returns point with given offset towards unit face direction.
pub fn is_visible(&self) -> bool
[src]
pub fn is_visible(&self) -> bool
[src]Checks if unit is fully visible.
pub fn is_snapshot(&self) -> bool
[src]
pub fn is_snapshot(&self) -> bool
[src]Checks if unit is snapshot (i.e. hidden in fog of war or on high ground).
pub fn is_placeholder(&self) -> bool
[src]
pub fn is_placeholder(&self) -> bool
[src]Checks if unit is building placeholder.
pub fn is_neutral(&self) -> bool
[src]
pub fn is_neutral(&self) -> bool
[src]Checks if unit is neutral.
pub fn can_be_attacked(&self) -> bool
[src]
pub fn can_be_attacked(&self) -> bool
[src]Checks if unit is detected or not even cloaked.
pub fn is_invisible(&self) -> bool
[src]
pub fn is_invisible(&self) -> bool
[src]Checks if unit is burrowed or cloaked, and not detected (i.e. must be detected to be attacked).
pub fn supply_cost(&self) -> f32
[src]
pub fn supply_cost(&self) -> f32
[src]Returns how much supply this unit uses.
pub fn health_percentage(&self) -> Option<f32>
[src]
pub fn health_percentage(&self) -> Option<f32>
[src]Returns health percentage (current health divided by max health).
Value in range from 0
to 1
.
pub fn shield_percentage(&self) -> Option<f32>
[src]
pub fn shield_percentage(&self) -> Option<f32>
[src]Returns shield percentage (current shield divided by max shield).
Value in range from 0
to 1
.
pub fn energy_percentage(&self) -> Option<f32>
[src]
pub fn energy_percentage(&self) -> Option<f32>
[src]Returns energy percentage (current energy divided by max energy).
Value in range from 0
to 1
.
pub fn hits(&self) -> Option<u32>
[src]
pub fn hits(&self) -> Option<u32>
[src]Returns summed health and shield.
Not populated for snapshots.
pub fn hits_max(&self) -> Option<u32>
[src]
pub fn hits_max(&self) -> Option<u32>
[src]Returns summed max health and max shield.
Not populated for snapshots.
pub fn hits_percentage(&self) -> Option<f32>
[src]
pub fn hits_percentage(&self) -> Option<f32>
[src]Returns percentage of summed health and shield (current hits divided by max hits).
Value in range from 0
to 1
.
Not populated for snapshots.
pub fn speed(&self) -> f32
[src]
pub fn speed(&self) -> f32
[src]Basic speed of the unit without considering buffs and upgrades.
Use real_speed
to get speed including buffs and upgrades.
pub fn real_speed(&self) -> f32
[src]
pub fn real_speed(&self) -> f32
[src]Returns actual speed of the unit calculated including buffs and upgrades.
pub fn distance_per_step(&self) -> f32
[src]
pub fn distance_per_step(&self) -> f32
[src]Distance unit can travel per one step.
pub fn distance_to_weapon_ready(&self) -> f32
[src]
pub fn distance_to_weapon_ready(&self) -> f32
[src]Distance unit can travel until weapons be ready to fire.
pub fn attributes(&self) -> &[Attribute]
[src]
pub fn attributes(&self) -> &[Attribute]
[src]Attributes of unit, dependent on it’s type.
pub fn has_attribute(&self, attribute: Attribute) -> bool
[src]
pub fn has_attribute(&self, attribute: Attribute) -> bool
[src]Checks if unit has given attribute.
pub fn is_armored(&self) -> bool
[src]
pub fn is_armored(&self) -> bool
[src]Checks if unit has Armored
attribute.
pub fn is_biological(&self) -> bool
[src]
pub fn is_biological(&self) -> bool
[src]Checks if unit has Biological
attribute.
pub fn is_mechanical(&self) -> bool
[src]
pub fn is_mechanical(&self) -> bool
[src]Checks if unit has Mechanical
attribute.
pub fn is_robotic(&self) -> bool
[src]
pub fn is_robotic(&self) -> bool
[src]Checks if unit has Robotic
attribute.
pub fn is_psionic(&self) -> bool
[src]
pub fn is_psionic(&self) -> bool
[src]Checks if unit has Psionic
attribute.
pub fn is_massive(&self) -> bool
[src]
pub fn is_massive(&self) -> bool
[src]Checks if unit has Massive
attribute.
pub fn is_structure(&self) -> bool
[src]
pub fn is_structure(&self) -> bool
[src]Checks if unit has Structure
attribute.
pub fn is_summoned(&self) -> bool
[src]
pub fn is_summoned(&self) -> bool
[src]Checks if unit has Summoned
attribute.
pub fn has_any_buff<'a, B: IntoIterator<Item = &'a BuffId>>(
&self,
buffs: B
) -> bool
[src]
pub fn has_any_buff<'a, B: IntoIterator<Item = &'a BuffId>>(
&self,
buffs: B
) -> bool
[src]Checks if unit has any from given buffs.
pub fn is_carrying_minerals(&self) -> bool
[src]
pub fn is_carrying_minerals(&self) -> bool
[src]Checks if worker is carrying minerals.
pub fn is_carrying_vespene(&self) -> bool
[src]
pub fn is_carrying_vespene(&self) -> bool
[src]Checks if worker is carrying vespene gas (Currently not works if worker is carrying gas from rich vespene geyeser, because SC2 API is not providing this information).
pub fn is_carrying_resource(&self) -> bool
[src]
pub fn is_carrying_resource(&self) -> bool
[src]Checks if worker is carrying any resource (Currently not works if worker is carrying gas from rich vespene geyeser, because SC2 API is not providing this information)
pub fn weapons(&self) -> &[Weapon]
[src]
pub fn weapon_target(&self) -> Option<TargetType>
[src]
pub fn weapon_target(&self) -> Option<TargetType>
[src]Targets unit can attack if it has weapon.
pub fn can_attack(&self) -> bool
[src]
pub fn can_attack(&self) -> bool
[src]Checks if unit can attack at all (i.e. has weapons).
pub fn can_attack_both(&self) -> bool
[src]
pub fn can_attack_both(&self) -> bool
[src]Checks if unit can attack both air and ground targets.
pub fn can_attack_ground(&self) -> bool
[src]
pub fn can_attack_ground(&self) -> bool
[src]Checks if unit can attack ground targets.
pub fn can_attack_air(&self) -> bool
[src]
pub fn can_attack_air(&self) -> bool
[src]Checks if unit can attack air targets.
pub fn can_attack_unit(&self, target: &Unit) -> bool
[src]
pub fn can_attack_unit(&self, target: &Unit) -> bool
[src]Checks if unit can attack given target.
pub fn on_cooldown(&self) -> bool
[src]
pub fn on_cooldown(&self) -> bool
[src]Checks if unit’s weapon is on cooldown.
pub fn max_cooldown(&self) -> Option<f32>
[src]
pub fn max_cooldown(&self) -> Option<f32>
[src]Returns max cooldown in frames for unit’s weapon.
pub fn cooldown_percentage(&self) -> Option<f32>
[src]
pub fn cooldown_percentage(&self) -> Option<f32>
[src]Returns weapon cooldown percentage (current cooldown divided by max cooldown).
Value in range from 0
to 1
.
pub fn ground_range(&self) -> f32
[src]
pub fn ground_range(&self) -> f32
[src]Returns ground range of unit’s weapon without considering upgrades.
Use real_ground_range
to get range including upgrades.
pub fn air_range(&self) -> f32
[src]
pub fn air_range(&self) -> f32
[src]Returns air range of unit’s weapon without considering upgrades.
Use real_air_range
to get range including upgrades.
pub fn range_vs(&self, target: &Unit) -> f32
[src]
pub fn range_vs(&self, target: &Unit) -> f32
[src]Returns range of unit’s weapon vs given target if unit can it, otherwise returns 0
.
Doesn’t consider upgrades, use real_range_vs
instead to get range including upgrades.
pub fn real_ground_range(&self) -> f32
[src]
pub fn real_ground_range(&self) -> f32
[src]Returns actual ground range of unit’s weapon including upgrades.
pub fn real_air_range(&self) -> f32
[src]
pub fn real_air_range(&self) -> f32
[src]Returns actual air range of unit’s weapon including upgrades.
pub fn real_range_vs(&self, target: &Unit) -> f32
[src]
pub fn real_range_vs(&self, target: &Unit) -> f32
[src]Returns actual range of unit’s weapon vs given target if unit can attack it, otherwise returs 0
.
Takes upgrades into account.
pub fn ground_dps(&self) -> f32
[src]
pub fn ground_dps(&self) -> f32
[src]Returns ground dps of unit’s weapon without considering upgrades.
Use real_ground_weapon
to get dps including upgrades.
pub fn air_dps(&self) -> f32
[src]
pub fn air_dps(&self) -> f32
[src]Returns air dps of unit’s weapon without considering upgrades.
Use real_air_weapon
to get dps including upgrades.
pub fn dps_vs(&self, target: &Unit) -> f32
[src]
pub fn dps_vs(&self, target: &Unit) -> f32
[src]Returns dps of unit’s weapon vs given target if unit can it, otherwise returns 0
.
Doesn’t consider upgrades, use real_weapon_vs
instead to get dps including upgrades.
pub fn real_weapon(&self, attributes: &[Attribute]) -> (f32, f32)
[src]
pub fn real_weapon(&self, attributes: &[Attribute]) -> (f32, f32)
[src]Returns (dps, range) of first unit’s weapon including bonuses from buffs and upgrades.
If you need to get only real range of unit, use real_ground_range
, real_air_range
or real_range_vs
instead, because they’re generally faster.
pub fn real_ground_weapon(&self, attributes: &[Attribute]) -> (f32, f32)
[src]
pub fn real_ground_weapon(&self, attributes: &[Attribute]) -> (f32, f32)
[src]Returns (dps, range) of unit’s ground weapon including bonuses from buffs and upgrades.
If you need to get only real range of unit, use real_ground_range
instead, because it’s generally faster.
pub fn real_air_weapon(&self, attributes: &[Attribute]) -> (f32, f32)
[src]
pub fn real_air_weapon(&self, attributes: &[Attribute]) -> (f32, f32)
[src]Returns (dps, range) of unit’s air weapon including bonuses from buffs and upgrades.
If you need to get only real range of unit, use real_air_range
instead, because it’s generally faster.
pub fn real_weapon_vs(&self, target: &Unit) -> (f32, f32)
[src]
pub fn real_weapon_vs(&self, target: &Unit) -> (f32, f32)
[src]Returns (dps, range) of unit’s weapon vs given target if unit can attack it, otherwise returs (0, 0)
.
Takes buffs and upgrades into account.
If you need to get only real range of unit, use real_range_vs
instead, because it’s generally faster.
pub fn calculate_weapon_abstract(
&self,
target_type: TargetType,
attributes: &[Attribute]
) -> (f32, f32)
[src]
pub fn calculate_weapon_abstract(
&self,
target_type: TargetType,
attributes: &[Attribute]
) -> (f32, f32)
[src]Returns (dps, range) of unit’s weapon vs given abstract target
if unit can attack it, otherwise returs (0, 0)
.
Abstract target is described by it’s type (air or ground) and attributes (e.g. light, armored, …).
If you need to get only real range of unit, use real_ground_range
, real_air_range
or real_range_vs
instead, because they’re generally faster.
pub fn calculate_weapon_stats(&self, target: CalcTarget<'_>) -> (f32, f32)
[src]
pub fn calculate_weapon_stats(&self, target: CalcTarget<'_>) -> (f32, f32)
[src]Returns (dps, range) of unit’s weapon vs given target (can be unit or abstract)
if unit can attack it, otherwise returs (0, 0)
.
If you need to get only real range of unit, use real_ground_range
, real_air_range
or real_range_vs
instead, because they’re generally faster.
pub fn in_range(&self, target: &Unit, gap: f32) -> bool
[src]
pub fn in_range(&self, target: &Unit, gap: f32) -> bool
[src]Checks if unit is close enough to attack given target.
See also in_real_range
which uses actual range of unit for calculations.
pub fn in_range_of(&self, threat: &Unit, gap: f32) -> bool
[src]
pub fn in_range_of(&self, threat: &Unit, gap: f32) -> bool
[src]Checks if unit is close enough to be attacked by given threat.
This unit.in_range_of(threat, gap)
is equivalent to threat.in_range(unit, gap)
.
See also in_real_range_of
which uses actual range of unit for calculation.
pub fn in_real_range(&self, target: &Unit, gap: f32) -> bool
[src]
pub fn in_real_range(&self, target: &Unit, gap: f32) -> bool
[src]Checks if unit is close enough to attack given target.
Uses actual range from real_range_vs
in it’s calculations.
pub fn in_real_range_of(&self, threat: &Unit, gap: f32) -> bool
[src]
pub fn in_real_range_of(&self, threat: &Unit, gap: f32) -> bool
[src]Checks if unit is close enough to be attacked by given threat.
This unit.in_real_range_of(threat, gap)
is equivalent to threat.in_real_range(unit, gap)
.
Uses actual range from real_range_vs
in it’s calculations.
pub fn in_ability_cast_range<A>(
&self,
ability_id: AbilityId,
target: A,
gap: f32
) -> bool where
A: Into<Point2> + Radius,
[src]
pub fn in_ability_cast_range<A>(
&self,
ability_id: AbilityId,
target: A,
gap: f32
) -> bool where
A: Into<Point2> + Radius,
[src]Checks if unit is close enough to use given ability on target.
pub fn damage_bonus(&self) -> Option<(Attribute, u32)>
[src]
pub fn damage_bonus(&self) -> Option<(Attribute, u32)>
[src]Returns (attribute, bonus damage) for first unit’s weapon if any.
pub fn order(&self) -> Option<(AbilityId, Target, f32)>
[src]
pub fn order(&self) -> Option<(AbilityId, Target, f32)>
[src]Returns (ability, target, progress) of the current unit order or None
if it’s idle.
pub fn target_pos(&self) -> Option<Point2>
[src]
pub fn target_pos(&self) -> Option<Point2>
[src]Returns target point of unit’s order if any.
pub fn target_tag(&self) -> Option<u64>
[src]
pub fn target_tag(&self) -> Option<u64>
[src]Returns target tag of unit’s order if any.
pub fn ordered_ability(&self) -> Option<AbilityId>
[src]
pub fn ordered_ability(&self) -> Option<AbilityId>
[src]Returns ability of first unit’s order.
pub fn is_almost_idle(&self) -> bool
[src]
pub fn is_almost_idle(&self) -> bool
[src]Checks if unit don’t have any orders currently or it’s order is more than 95% complete.
pub fn is_unused(&self) -> bool
[src]
pub fn is_unused(&self) -> bool
[src]Checks if production building with reactor don’t have any orders currently.
pub fn is_almost_unused(&self) -> bool
[src]
pub fn is_almost_unused(&self) -> bool
[src]Checks if production building with reactor don’t have any orders currently or it’s order is more than 95% complete.
pub fn is_using(&self, ability: AbilityId) -> bool
[src]
pub fn is_using(&self, ability: AbilityId) -> bool
[src]Checks if unit is using given ability.
Doesn’t work with enemies.
pub fn is_using_any<A: Container<AbilityId>>(&self, abilities: &A) -> bool
[src]
pub fn is_using_any<A: Container<AbilityId>>(&self, abilities: &A) -> bool
[src]Checks if unit is using any of given abilities.
Doesn’t work with enemies.
pub fn is_attacking(&self) -> bool
[src]
pub fn is_attacking(&self) -> bool
[src]Checks if unit is currently attacking.
Doesn’t work with enemies.
pub fn is_patrolling(&self) -> bool
[src]
pub fn is_patrolling(&self) -> bool
[src]Checks if unit is currently patrolling.
Doesn’t work with enemies.
pub fn is_repairing(&self) -> bool
[src]
pub fn is_repairing(&self) -> bool
[src]Checks if SCV or MULE is currently repairing.
Doesn’t work with enemies.
pub fn is_gathering(&self) -> bool
[src]
pub fn is_gathering(&self) -> bool
[src]Checks if worker is currently gathering resource.
Doesn’t work with enemies.
pub fn is_returning(&self) -> bool
[src]
pub fn is_returning(&self) -> bool
[src]Checks if worker is currently returning resource closest base.
Doesn’t work with enemies.
pub fn is_collecting(&self) -> bool
[src]
pub fn is_collecting(&self) -> bool
[src]Checks if worker is currently gathering or returning resources.
Doesn’t work with enemies.
pub fn is_constructing(&self) -> bool
[src]
pub fn is_constructing(&self) -> bool
[src]Checks if worker is currently constructing a building.
Doesn’t work with enemies.
pub fn is_making_addon(&self) -> bool
[src]
pub fn is_making_addon(&self) -> bool
[src]Checks if terran building is currently making addon.
Doesn’t work with enemies.
pub fn is_making_techlab(&self) -> bool
[src]
pub fn is_making_techlab(&self) -> bool
[src]Checks if terran building is currently building techlab.
Doesn’t work with enemies.
pub fn is_making_reactor(&self) -> bool
[src]
pub fn is_making_reactor(&self) -> bool
[src]Checks if terran building is currently building reactor.
Doesn’t work with enemies.
pub fn is_sleeping(&self) -> bool
[src]
pub fn is_sleeping(&self) -> bool
[src]Checks if unit is doing something important and it’s bad idea to interrupt it, so you can skip evaluating it anyway.
Use with sleep
to skip evaluating units executing durable commands.
pub fn sleep(&self, duration: u32)
[src]
pub fn sleep(&self, duration: u32)
[src]Makes unit ignore all your commands for given amount of frames.
Use with is_sleeping
to skip evaluating units executing durable commands.
pub fn toggle_autocast(&self, ability: AbilityId)
[src]
pub fn toggle_autocast(&self, ability: AbilityId)
[src]Toggles autocast on given ability.
pub fn command(&self, ability: AbilityId, target: Target, queue: bool)
[src]
pub fn command(&self, ability: AbilityId, target: Target, queue: bool)
[src]Orders unit to execute given command.
pub fn use_ability(&self, ability: AbilityId, queue: bool)
[src]
pub fn use_ability(&self, ability: AbilityId, queue: bool)
[src]Orders unit to use given ability (This is equivalent of unit.command(ability, Target::None, queue)
).
pub fn smart(&self, target: Target, queue: bool)
[src]
pub fn smart(&self, target: Target, queue: bool)
[src]Orders unit a Smart
ability (This is equivalent of right click).
pub fn hold_position(&self, queue: bool)
[src]
pub fn hold_position(&self, queue: bool)
[src]Orders unit to hold position.
pub fn return_resource(&self, queue: bool)
[src]
pub fn return_resource(&self, queue: bool)
[src]Orders worker to return resource to closest base.
pub fn repair(&self, target: u64, queue: bool)
[src]
pub fn repair(&self, target: u64, queue: bool)
[src]Orders SCV or MULE to repair given structure or mechanical unit.
pub fn cancel_building(&self, queue: bool)
[src]
pub fn cancel_building(&self, queue: bool)
[src]Orders building which is in progress to cancel construction.
pub fn cancel_queue(&self, queue: bool)
[src]
pub fn cancel_queue(&self, queue: bool)
[src]Orders production building to cancel last unit in train queue.
pub fn build_gas(&self, target: u64, queue: bool)
[src]
pub fn build_gas(&self, target: u64, queue: bool)
[src]Orders worker to build race gas building on given geyser.
pub fn build(&self, unit: UnitTypeId, target: Point2, queue: bool)
[src]
pub fn build(&self, unit: UnitTypeId, target: Point2, queue: bool)
[src]Orders worker to build something on given position.
pub fn train(&self, unit: UnitTypeId, queue: bool)
[src]
pub fn train(&self, unit: UnitTypeId, queue: bool)
[src]Orders production building to train given unit.
This also works for morphing units and building addons.
pub fn research(&self, upgrade: UpgradeId, queue: bool)
[src]
pub fn research(&self, upgrade: UpgradeId, queue: bool)
[src]Orders building to research given upgrade.
pub fn warp_in(&self, unit: UnitTypeId, target: Point2)
[src]
pub fn warp_in(&self, unit: UnitTypeId, target: Point2)
[src]Orders protoss warp gate to warp unit on given position.
Trait Implementations
impl Extend<Unit> for Units
[src]
impl Extend<Unit> for Units
[src]fn extend<T: IntoIterator<Item = Unit>>(&mut self, iter: T)
[src]
fn extend<T: IntoIterator<Item = Unit>>(&mut self, iter: T)
[src]Extends a collection with the contents of an iterator. Read more
fn extend_one(&mut self, item: A)
[src]
fn extend_one(&mut self, item: A)
[src]extend_one
)Extends a collection with exactly one element.
fn extend_reserve(&mut self, additional: usize)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl FromIterator<Unit> for Units
[src]
impl FromIterator<Unit> for Units
[src]fn from_iter<I: IntoIterator<Item = Unit>>(iter: I) -> Self
[src]
fn from_iter<I: IntoIterator<Item = Unit>>(iter: I) -> Self
[src]Creates a value from an iterator. Read more
Auto Trait Implementations
impl !RefUnwindSafe for Unit
impl !Send for Unit
impl !Sync for Unit
impl Unpin for Unit
impl !UnwindSafe for Unit
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Distance for T where
T: Into<Point2>,
[src]
impl<T> Distance for T where
T: Into<Point2>,
[src]fn distance_squared<P: Into<Point2>>(self, other: P) -> f32
[src]
fn distance_squared<P: Into<Point2>>(self, other: P) -> f32
[src]Calculates squared euclidean distance from self
to other
.
fn distance<P: Into<Point2>>(self, other: P) -> f32
[src]
fn distance<P: Into<Point2>>(self, other: P) -> f32
[src]Calculates euclidean distance from self
to other
.
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,