Manager mediator
To enable communication between managers in ares-sc2, the mediator pattern is used internally. If you need to request
information or perform an action from a manager, it is strongly recommended that you do so through the mediator,
which can be accessed via self.mediator
. For example:
Mediator concrete class is the single source of truth and coordinator of communications between the managers.
Source code in src/ares/managers/manager_mediator.py
get_air_avoidance_grid
property
¶
get_air_grid
property
¶
get_air_vs_ground_grid
property
¶
get_all_enemy
property
¶
Get all enemy units.
UnitMemoryManager
Returns:
Name | Type | Description |
---|---|---|
Units |
Units
|
All enemy units. |
get_building_counter
property
¶
Get a dictionary containing the number of each type of building in progress.
BuildingManager.
Returns:
Type | Description |
---|---|
DefaultDict[UnitID, int] :
|
Number of each type of UnitID presently being tracking for building. |
get_building_tracker_dict
property
¶
Get the building tracker dictionary.
Building Manager.
Returns:
Type | Description |
---|---|
Dict[int, Dict[str, Union[Point2, Unit, UnitID, float]]] :
|
Tracks the worker tag to: UnitID of the building to be built Point2 of where the building is to be placed In-game time when the order started Why the building is being built |
get_cached_enemy_army
property
¶
Get the Units object for the enemy army.
UnitCacheManager
Returns:
Name | Type | Description |
---|---|---|
Units |
Units
|
The enemy army. |
get_cached_enemy_workers
property
¶
Get the Units object for the enemy workers.
UnitCacheManager
Returns:
Name | Type | Description |
---|---|---|
Units |
Units
|
The enemy workers. |
get_cached_ground_grid
property
¶
get_climber_grid
property
¶
get_defensive_third
property
¶
Get the third furthest from enemy.
TerrainManager
Returns:
Name | Type | Description |
---|---|---|
Point2 |
Point2
|
Location of the third base furthest from the enemy. |
get_enemy_army_center_mass
property
¶
Get the point containing the largest amount of the enemy army.
UnitCacheManager
Returns:
Name | Type | Description |
---|---|---|
Point2 |
Point2
|
Enemy army center mass location. |
get_enemy_army_dict
property
¶
Get the dictionary of enemy army unit types to the units themselves.
UnitCacheManager
Returns:
Type | Description |
---|---|
DefaultDict[UnitID, Units] :
|
The dictionary of enemy army unit types to the units themselves. |
get_enemy_expansions
property
¶
Get the expansions, as ordered from the enemy's point of view.
TerrainManager
Returns:
Type | Description |
---|---|
List[Tuple[Point2, float]] :
|
List of Tuples where The first element is the location of the base. The second element is the pathing distance from the enemy main base. |
get_enemy_fliers
property
¶
Get enemy flying units.
UnitMemoryManager
Returns:
Name | Type | Description |
---|---|---|
Units |
Units
|
Enemy flying units. |
get_enemy_fourth
property
¶
Get the enemy fourth base.
TerrainManager
Returns:
Name | Type | Description |
---|---|---|
Point2 |
Point2
|
Location of the enemy fourth base. |
get_enemy_ground
property
¶
Get enemy ground units.
UnitMemoryManager
Returns:
Name | Type | Description |
---|---|---|
Units |
Units
|
Enemy ground units. |
get_enemy_nat
property
¶
Get the enemy natural expansion.
TerrainManager
Returns:
Name | Type | Description |
---|---|---|
Point2 |
Point2
|
Location of the enemy natural expansion. |
get_enemy_ramp
property
¶
Get the enemy main base ramp.
TerrainManager
Returns:
Name | Type | Description |
---|---|---|
Ramp |
Ramp
|
sc2 Ramp object for the enemy main base ramp. |
get_enemy_third
property
¶
Get the enemy third base.
TerrainManager
Returns:
Name | Type | Description |
---|---|---|
Point2 |
Point2
|
Location of the enemy third base. |
get_enemy_tree
property
¶
Get the KDTree representing all enemy unit positions.
UnitMemoryManager
Returns:
Name | Type | Description |
---|---|---|
KDTree |
KDTree
|
KDTree representing all enemy unit positions. |
get_flying_enemy_near_bases
property
¶
Get dictionary containing flying enemy near townhalls.
EnemyToBase Manager
Returns:
Type | Description |
---|---|
dict[int, set[int]] :
|
A dictionary where the integer key is a townhall tag. And the value contains a set of ints cotianing enemy tags near this base. |
get_flying_structure_tracker
property
¶
Get the current information stored by FlyingStructureManager.
FlyingStructureManager
Returns:
Type | Description |
---|---|
dict[int, Any] :
|
Key -> structure_tag, Value -> Information about the flight. |
get_forcefield_positions
property
¶
get_ground_avoidance_grid
property
¶
Get the ground avoidance pathing grid.
PathManager
Returns:
Type | Description |
---|---|
np.ndarray :
|
The ground avoidance pathing grid. |
get_ground_enemy_near_bases
property
¶
Get dictionary containing ground enemy near townhalls.
EnemyToBase Manager
Returns:
Type | Description |
---|---|
dict[int, set[int]] :
|
A dictionary where the integer key is a townhall tag. And the value contains a set of ints cotianing enemy tags near this base. |
get_ground_grid
property
¶
Get the ground pathing grid.
PathManager
Returns:
Type | Description |
---|---|
np.ndarray :
|
The ground pathing grid. |
get_ground_to_air_grid
property
¶
Get the ground pathing grid.
PathManager
Returns:
Type | Description |
---|---|
np.ndarray :
|
The ground pathing grid. |
get_initial_pathing_grid
property
¶
Get the pathing grid as it was on the first iteration.
TerrainManager
Returns:
Type | Description |
---|---|
np.ndarray :
|
The pathing grid as it was on the first iteration. |
get_is_free_expansion
property
¶
Check all bases for a free expansion.
TerrainManager
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if there exists a free expansion, False otherwise. |
get_main_air_threats_near_townhall
property
¶
Get the main enemy air force near one of our bases.
EnemyToBase Manager
Returns:
Name | Type | Description |
---|---|---|
Units |
Units
|
The largest enemy air force near our bases. |
get_main_ground_threats_near_townhall
property
¶
Get the main enemy ground force near one of our bases.
EnemyToBase Manager
Returns:
Name | Type | Description |
---|---|---|
Units |
Units
|
The largest enemy ground force near our bases. |
get_map_choke_points
property
¶
All the points on the map that compose choke points.
TerrainManager
Returns:
Type | Description |
---|---|
Set[Point2] :
|
All the points on the map that compose choke points. |
get_map_data_object
property
¶
Get the MapAnalyzer.MapData object being used.
PathManager
Returns:
Name | Type | Description |
---|---|---|
MapData |
MapData
|
The MapAnalyzer.MapData object being used. |
get_mineral_patch_to_list_of_workers
property
¶
Get a dictionary containing mineral tag to worker tags
Resource Manager
Returns:
Name | Type | Description |
---|---|---|
dict |
Dict[int, Set[int]]
|
Dictionary where key is mineral tag, and value is workers assigned here. |
get_mineral_target_dict
property
¶
Get position in front of each mineral.
This position is used for speed mining, and is also useful for making sure worker is moved to the right side of a mineral.
ResourceManager
Returns:
Name | Type | Description |
---|---|---|
dict |
dict[int, Point2]
|
Key -> mineral tag, Value -> Position |
get_num_available_mineral_patches
property
¶
Get the number available mineral fields.
An available mineral field is one that is near a townhall and has fewer than two assigned workers.
ResourceManager
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Number available mineral fields. |
get_ol_spot_near_enemy_nat
property
¶
Get the overlord spot nearest to the enemy natural.
TerrainManager
Returns:
Name | Type | Description |
---|---|---|
Point2 |
Point2
|
Overlord spot near the enemy natural. |
get_ol_spots
property
¶
High ground Overlord hiding spots.
TerrainManager
Returns:
Type | Description |
---|---|
List[Point2] :
|
List of Overlord hiding spots. |
get_old_own_army_dict
property
¶
Get the previous iteration's own_army
dict.
UnitCacheManager
Returns:
Type | Description |
---|---|
DefaultDict[UnitID, Units] :
|
The dictionary of own army unit types to the units themselves. |
get_own_army
property
¶
Get the Units object for our own army.
UnitCacheManager
Returns:
Name | Type | Description |
---|---|---|
Units |
Units
|
Our own army. |
get_own_army_dict
property
¶
Get the dictionary of own army unit types to the units themselves.
UnitCacheManager
Returns:
Type | Description |
---|---|
DefaultDict[UnitID, Units] :
|
The dictionary of own army unit types to the units themselves. |
get_own_expansions
property
¶
Get the expansions.
TerrainManager
Returns:
Type | Description |
---|---|
List[Tuple[Point2, float]] :
|
List of Tuples where The first element is the location of the base. The second element is the pathing distance from our main base. |
get_own_nat
property
¶
Get our natural expansion.
TerrainManager
Returns:
Name | Type | Description |
---|---|---|
Point2 |
Point2
|
Location of our natural expansion. |
get_own_structures_dict
property
¶
Get the dictionary of own structure types to the units themselves.
UnitCacheManager
Returns:
Type | Description |
---|---|
DefaultDict[UnitID, Units] :
|
The dictionary of own structure types to the units themselves. |
get_own_tree
property
¶
Get the KDTree representing all friendly unit positions.
UnitMemoryManager
Returns:
Name | Type | Description |
---|---|---|
KDTree |
Units
|
KDTree representing all friendly unit positions. |
get_positions_blocked_by_burrowed_enemy
property
¶
Build positions that are blocked by a burrowed enemy unit.
TerrainManager
Returns:
Type | Description |
---|---|
List[Point2] :
|
List of build positions that are blocked by a burrowed enemy unit. |
get_priority_ground_avoidance_grid
property
¶
Get the pathing grid containing things ground units should always avoid.
PathManager
Returns:
Type | Description |
---|---|
np.ndarray :
|
The priority ground avoidance pathing grid. |
get_removed_units
property
¶
Get the units removed from memory units.
UnitCacheManager
Returns:
Name | Type | Description |
---|---|---|
Units |
Units
|
The units removed from memory units. |
get_th_tag_with_largest_ground_threat
property
¶
Get the tag of our townhall with the largest enemy ground force nearby.
WARNING: This will remember the townhall tag even if enemy has gone.
Do not use this to detect enemy at a base.
Use get_main_ground_threats_near_townhall
Or get_ground_enemy_near_bases
instead
EnemyToBase Manager
Returns:
Name | Type | Description |
---|---|---|
Units |
int
|
The largest enemy ground force near our bases. |
get_unit_role_dict
property
¶
Get the dictionary of UnitRole
to the set of tags of units with that role.
UnitRoleManager
Returns:
Type | Description |
---|---|
Dict[UnitRole, Set[int]] :
|
Dictionary of |
get_unit_to_ability_dict
property
¶
Get a dictionary containing unit tag, to ability frame cooldowns.
AbilityTrackerManager.
Returns:
Type | Description |
---|---|
Dict[int, Any] :
|
Unit tag to abilities and the next frame they can be casted. |
get_whole_map_array
property
¶
Get the list containing every point on the map.
PathManager
Notes
This does not return Point2s.
Returns:
Type | Description |
---|---|
List[List[int]] :
|
Every point on the map. |
get_whole_map_tree
property
¶
Get the KDTree of all points on the map.
PathManager
Returns:
Name | Type | Description |
---|---|---|
KDTree |
KDTree
|
KDTree of all points on the map. |
get_worker_tag_to_townhall_tag
property
¶
Get a dictionary containing worker tag to townhall tag. Where the townhall is the place where worker returns resources
Resource Manager
Returns:
Name | Type | Description |
---|---|---|
dict |
dict[int, int]
|
Dictionary where key is worker tag, and value is townhall tag. |
get_worker_to_mineral_patch_dict
property
¶
Get a dictionary containing worker tag to mineral patch tag.
Resource Manager
Returns:
Name | Type | Description |
---|---|---|
dict |
dict[int, int]
|
Dictionary where key is worker tag, and value is mineral tag. |
get_worker_to_vespene_dict
property
¶
Get a dictionary containing worker tag to gas building tag.
Resource Manager
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Dictionary where key is worker tag, and value is gas building tag. |
add_managers ¶
Generate manager dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
managers |
List[Manager]
|
List of all Managers capable of handling ManagerRequests. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/ares/managers/manager_mediator.py
assign_role ¶
Assign a unit a role.
UnitRoleManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag |
int
|
Tag of the unit to be assigned. |
required |
role |
UnitRole
|
What role the unit should have. |
required |
remove_from_squad |
bool(default=True)
|
Attempt to remove this unit from squad bookkeeping. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/ares/managers/manager_mediator.py
batch_assign_role ¶
Assign a given role to a List of unit tags.
Nothing more than a for loop, provided for convenience.
UnitRoleManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tags |
Set[int]
|
Tags of the units to assign to a role. |
required |
role |
UnitRole
|
The role the units should be assigned to. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/ares/managers/manager_mediator.py
build_with_specific_worker ¶
Build a structure with a specific worker.
BuildingManager.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
worker |
Unit
|
The chosen worker. |
required |
structure_type |
UnitTypeId
|
What type of structure to build. |
required |
pos |
Point2
|
Where the structure should be placed. |
required |
building_purpose |
BuildingPurpose
|
Why the structure is being placed. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if a position for the building is found and the worker is valid, otherwise False |
Source code in src/ares/managers/manager_mediator.py
building_position_blocked_by_burrowed_unit ¶
See if the building position is blocked by a burrowed unit.
TerrainManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
worker_tag |
int
|
The worker attempting to build the structure. |
required |
position |
Point2
|
Where the structure is attempting to be placed. |
required |
Returns:
Type | Description |
---|---|
Optional[Point2] :
|
The position that's blocked by an enemy unit. |
Source code in src/ares/managers/manager_mediator.py
can_place_structure ¶
Check if structure can be placed at a given position.
Faster cython alternative to python-sc2
await self.can_place()
PlacementManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
position |
Point2
|
The intended building position. |
required |
structure_type |
UnitTypeId
|
Structure type we want to place. |
required |
include_addon |
bool
|
For Terran structures, check addon will place too. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Indicating if structure can be placed at given position. |
Source code in src/ares/managers/manager_mediator.py
can_win_fight ¶
Get the predicted engagement result between two forces.
Combat Sim Manager.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
own_units |
Units
|
Our units involved in the battle. |
required |
enemy_units |
Units
|
The enemy units. |
required |
timing_adjust |
bool
|
Take distance between units into account. |
required |
good_positioning |
bool
|
Assume units are decently split. |
required |
workers_do_no_damage |
bool
|
Don't take workers into account. |
required |
Returns:
Name | Type | Description |
---|---|---|
EngagementResult |
EngagementResult
|
Enum with human-readable engagement result |
Source code in src/ares/managers/manager_mediator.py
clear_role ¶
Clear a unit's role.
UnitRoleManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tag |
int
|
Tag of the unit to clear the role of. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/ares/managers/manager_mediator.py
find_closest_safe_spot ¶
Find the closest point with the lowest cost on a grid.
PathManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
from_pos |
Point2
|
Where the search starts from. |
required |
grid |
ndarray
|
The grid to find the low cost point on. |
required |
radius |
float
|
How far away the safe point can be. |
required |
Returns:
Name | Type | Description |
---|---|---|
Point2 |
Point2
|
The closest location with the lowest cost. |
Source code in src/ares/managers/manager_mediator.py
find_low_priority_path ¶
Find several points in a path.
This way a unit can queue them up all at once for performance reasons.
i.e. running drones from a base or sending an overlord to a new position.
This does not return every point in the path. Instead, it returns points spread along the path.
PathManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start |
Point2
|
Start point of the path. |
required |
target |
Point2
|
Desired end point of the path. |
required |
grid |
ndarray
|
The grid that should be used for pathing. |
required |
Returns:
Type | Description |
---|---|
List[Point2] :
|
List of points composing the path. |
Source code in src/ares/managers/manager_mediator.py
find_lowest_cost_points ¶
Find the point(s) with the lowest cost within radius
from from_pos
.
PathManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
from_pos |
Point2
|
Point to start the search from. |
required |
radius |
float
|
How far away the returned points can be. |
required |
grid |
ndarray
|
Which grid to query for lowest cost points. |
required |
Returns:
Type | Description |
---|---|
List[Point2] :
|
Points with the lowest cost on the grid. |
Source code in src/ares/managers/manager_mediator.py
find_path_next_point ¶
Find the next point in a path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start |
Point2
|
Start point of the path. |
required |
target |
Point2
|
Desired end point of the path. |
required |
grid |
ndarray
|
The grid that should be used for pathing. |
required |
sensitivity |
int
|
Amount of points that should be skipped in the full path between tiles that are returned. |
required |
smoothing |
bool
|
Optional path smoothing where nodes are removed if it's possible to jump ahead some tiles in a straight line with a lower cost. |
required |
sense_danger |
bool
|
Check to see if there are any dangerous tiles near the starting point. If this is True and there are no dangerous tiles near the starting point, the pathing query is skipped and the target is returned. |
required |
danger_distance |
float
|
How far away from the start to look for danger. |
required |
danger_threshold |
float
|
Minimum value for a tile to be considered dangerous. |
required |
Returns:
Name | Type | Description |
---|---|---|
Point2 |
Point2
|
The next point in the path from the start to the target which may be the same as the target if it's safe. |
Source code in src/ares/managers/manager_mediator.py
find_raw_path ¶
Used for finding a full path, mostly for distance checks.
PathManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start |
Point2
|
Start point of the path. |
required |
target |
Point2
|
Desired end point of the path. |
required |
grid |
ndarray
|
The grid that should be used for pathing. |
required |
sensitivity |
int
|
Amount of points that should be skipped in the full path between tiles that are returned. |
required |
Returns:
Type | Description |
---|---|
List[Point2] :
|
List of points composing the path. |
Source code in src/ares/managers/manager_mediator.py
get_all_from_roles_except ¶
Get all units from the given roles except for unit types in excluded.
UnitRoleManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
roles |
Set[UnitRole]
|
Roles to get units from. |
required |
excluded |
Set[UnitTypeId]
|
Unit types that should not be included. |
required |
Returns:
Name | Type | Description |
---|---|---|
Units |
Units
|
Units matching the role that are not of an excluded type. |
Source code in src/ares/managers/manager_mediator.py
get_behind_mineral_positions ¶
Finds 3 spots behind the mineral line
This is useful for building structures out of typical cannon range.
TerrainManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
th_pos |
Point2
|
Position of townhall to find points behind the mineral line of. |
required |
Returns:
Type | Description |
---|---|
List[Point2] :
|
Points behind the mineral line of the designated base. |
Source code in src/ares/managers/manager_mediator.py
get_closest_overlord_spot ¶
Given a position, find the closest high ground overlord spot.
TerrainManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
from_pos |
Point2
|
Position the Overlord spot should be closest to. |
required |
Returns:
Name | Type | Description |
---|---|---|
Point2 |
Point2
|
The closest Overlord hiding spot to the position. |
Source code in src/ares/managers/manager_mediator.py
get_flood_fill_area ¶
Given a point, flood fill outward from it and return the valid points.
This flood fill does not continue through chokes.
TerrainManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_point |
Point2
|
Where to start the flood fill. |
required |
max_dist |
float
|
Only include points closer than this distance to the start point. |
required |
Returns:
Type | Description |
---|---|
Tuple[int, List[Tuple[int, int]]] :
|
First element is the number of valid points. Second element is the list of all valid points. |
Source code in src/ares/managers/manager_mediator.py
get_own_unit_count ¶
Get the dictionary of own structure types to the units themselves.
UnitCacheManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
unit_type_id |
UnitTypeId
|
Unit type to count. |
required |
include_alias |
bool
|
Check aliases. (default=True) |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Total count of this unit including aliases if specified. |
Source code in src/ares/managers/manager_mediator.py
get_position_of_main_squad ¶
Given a unit role, find where the main squad is.
SquadManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
role |
UnitRole
|
Get the squads for this unit role. |
required |
Returns:
Name | Type | Description |
---|---|---|
Point2 |
Point2
|
|
Source code in src/ares/managers/manager_mediator.py
get_squads ¶
Given a unit role, get the updated squads.
SquadManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
role |
UnitRole
|
Get the squads for this unit role. |
required |
squad_radius |
float(default=11.0)
|
The threshold as to which separate squads are formed. |
required |
unit_type |
If specified, only form squads with these unit types WARNING: Will not remove units that have already been assigned to a squad. |
required |
Returns:
Type | Description |
---|---|
List[UnitSquad] :
|
Each squad with this unit role. |
Source code in src/ares/managers/manager_mediator.py
get_units_from_role ¶
Get a Units object containing units with a given role.
If a UnitID or set of UnitIDs are given, it will only return units of those
types, otherwise it will return all units with the role. If restrict_to
is
specified, it will only retrieve units from that object.
UnitRoleManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
role |
UnitRole
|
Role to get units from. |
required |
unit_type |
UnitTypeId
|
Type(s) of units that should be returned. If omitted, all units with the role will be returned. |
required |
restrict_to |
Set[UnitTypeId]
|
If supplied, only take Units with the given role and type if they also exist here. |
required |
Returns:
Name | Type | Description |
---|---|---|
Units |
Units
|
Units with the given role. |
Source code in src/ares/managers/manager_mediator.py
get_units_from_roles ¶
Get the units matching unit_type
from the given roles.
UnitRoleManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
roles |
Set[UnitRole]
|
Roles to get units from. |
required |
unit_type |
UnitTypeId
|
Type(s) of units that should be returned. If omitted, all units with the role will be returned. |
required |
Returns:
Name | Type | Description |
---|---|---|
Units |
Units
|
Units with the given roles. |
Source code in src/ares/managers/manager_mediator.py
get_units_from_tags ¶
Get a list
of Unit
objects corresponding to the given tags.
UnitCacheManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tags |
Set[int]
|
Tags of the units to retrieve. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/ares/managers/manager_mediator.py
get_units_in_range ¶
Get units in range of other units or points.
UnitMemoryManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_points |
List of |
required | |
distances |
How far away from each point to query. Must broadcast to the length of
|
required | |
query_tree |
Which KDTree should be queried. |
required | |
return_as_dict |
Sets whether the returned units in range should be a dictionary or list. |
required |
Returns:
Type | Description |
---|---|
Union[Dict[Union[int, Tuple[float, float]], Units], List[Units]] :
|
Returns the units in range of each start point as a |
Source code in src/ares/managers/manager_mediator.py
is_position_safe ¶
Check if the given position is considered dangerous.
PathManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
grid |
ndarray
|
The grid to evaluate safety on. |
required |
position |
Point2
|
The position to check the safety of. |
required |
weight_safety_limit |
float
|
The maximum value the point can have on the grid to be considered safe. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the position is considered safe, False otherwise. |
Source code in src/ares/managers/manager_mediator.py
manager_request ¶
Function to request information from a manager.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
receiver |
ManagerName
|
Manager receiving the request. |
required |
request |
ManagerRequestType
|
Requested attribute/function call. |
required |
reason |
str
|
Why the request is being made. |
None
|
kwargs |
Keyword arguments (if any) to be passed to the requested function. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
There are too many possible return types to list all of them. |
Source code in src/ares/managers/manager_mediator.py
move_structure ¶
Request a structure to move via flight.
FlyingStructureManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
structure |
Unit
|
Our units involved in the battle. |
required |
target |
Point2
|
The enemy units. |
required |
should_land |
bool
|
Take distance between units into account. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/ares/managers/manager_mediator.py
remove_gas_building ¶
Request for a gas building to be removed from bookkeeping.
Resource Manager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gas_building_tag |
int
|
The tag of the gas building to remove. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/ares/managers/manager_mediator.py
remove_mineral_field ¶
Request for a mineral field to be removed from bookkeeping.
Resource Manager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mineral_field_tag |
int
|
The tag of the patch to remove. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/ares/managers/manager_mediator.py
remove_tag_from_squads ¶
Squad Manager Keyword args: tag: int
Source code in src/ares/managers/manager_mediator.py
remove_worker_from_mineral ¶
Remove worker from internal data structures.
This happens if worker gets assigned to do something else
ResourceManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
worker_tag |
int
|
Tag of the worker to be removed. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/ares/managers/manager_mediator.py
request_building_placement ¶
Request a building placement from the precalculated building formation.
PlacementManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_location |
Point2
|
The general area where the placement should be near. This should be a expansion location. |
required |
structure_type |
UnitTypeId
|
Structure type requested. |
required |
wall |
bool
|
Request a wall structure placement. Will find alternative if no wall placements available. |
required |
find_alternative |
bool, optional (NOT YET IMPLEMENTED)
|
If no placements available at base_location, find alternative at nearby base. |
required |
reserve_placement |
bool
|
Reserve this booking for a while, so another customer doesnt request it. |
required |
within_psionic_matrix |
bool
|
Protoss specific -> calculated position have power? |
required |
closest_to |
Optional[Point2]
|
|
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
Optional[Point2]
|
Indicating if structure can be placed at given position. |
Source code in src/ares/managers/manager_mediator.py
select_worker ¶
Select a worker via the ResourceManager.
This way we can select one assigned to a far mineral patch. Make sure to change the worker role once selected, otherwise it will be selected to mine again. This doesn't select workers from geysers, so make sure to remove workers from gas if low on workers.
ResourceManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_position |
Point2
|
Location to get the closest workers to. |
required |
force_close |
bool
|
Select the available worker closest to |
required |
select_persistent_builder |
bool
|
If True we can select the persistent_builder if it's available. |
required |
only_select_persistent_builder |
bool
|
If True, don't find an alternative worker |
required |
min_health_perc |
float(optional)
|
|
required |
Returns:
Type | Description |
---|---|
Optional[Unit] :
|
Selected worker, if available. |
Source code in src/ares/managers/manager_mediator.py
set_workers_per_gas ¶
Give all units in a role a different role.
ResourceManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
amount |
int
|
Num workers to assign to each gas building |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/ares/managers/manager_mediator.py
switch_roles ¶
Give all units in a role a different role.
UnitRoleManager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
from_role |
UnitRole
|
Role the units currently have. |
required |
to_role |
UnitRole
|
Role to assign to the units. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/ares/managers/manager_mediator.py
update_unit_to_ability_dict ¶
Update tracking to reflect ability usage.
After a unit uses an ability it should call this to update the frame the ability will next be available
AbilityTrackerManager.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ability |
AbilityId
|
The AbilityId that was used. |
required |
unit_tag |
int
|
The tag of the Unit that used the ability |
required |
Returns:
Type | Description |
---|---|
None
|
|