Grid Object system
get_open_grid_points(id_or_obj)
Gets a list of open grid locations
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_or_obj
|
agent
|
agent id or object to check |
required |
Returns:
| Name | Type | Description |
|---|---|---|
set |
set[Vec3]
|
a set of Vec3 with x and y set |
grid_clear_detailed_status(id_or_obj)
clears the detailed status string of a grid object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_or_obj
|
Agent | int
|
The agent id of object |
required |
grid_clear_speech_bubble(id_or_obj)
Clear the speech bubble for a grid object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_or_obj
|
Agent | int
|
agent id or object of the grid object |
required |
grid_clear_target(grid_obj_or_set)
Clear the target of a grid object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_obj_or_set
|
Agent | int | set[Agent | int]
|
the id of the object or set |
required |
grid_close_list(grid_obj, the_set, max_dist=None, filter_func=None)
Find and target the closest object matching the criteria
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_obj
|
Agent | int
|
The agent or id |
required |
the_set
|
set[Agent]
|
The items to test. Defaults to None. |
required |
max_dist
|
float
|
max distance. Defaults to None. |
None
|
filter_func
|
Callable
|
additional filer function. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
list[CloseData]
|
list[CloseData]: The gird close data of the closest objects |
grid_closest(grid_obj, target_set=None, max_dist=None, filter_func=None)
Find and target the closest object matching the criteria
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_obj
|
Agent | int
|
The agent or id |
required |
target_set
|
set[Agent]
|
The items to test. Defaults to None. |
None
|
max_dist
|
float
|
max distance. Defaults to None. |
None
|
filter_func
|
Callable
|
additional filer function. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
CloseData |
CloseData
|
The gird close data of the closest object |
grid_delete_objects(ship_id_or_obj)
Delete all grid objects for the given ship. Args: ship_id_or_obj (Agent | int): The agent or id of the ship.
grid_detailed_status(id_or_obj, status, color=None)
sets the detailed status of a grid object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_or_obj
|
Agent | int
|
Agent id or object |
required |
status
|
str
|
The detailed status string |
required |
color
|
str
|
change the color of the detailed status text. None does not change the current value |
None
|
grid_get_grid_current_theme()
Get the current grid theme.
Returns:
dict: The grid theme dictionary
* key (str): The key of the theme data, e.g. name, colors, icons, etc.
* value (any): The value of the theme data.
grid_get_grid_data()
Get the grid data from all the grid_data.json files
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
a dictionary of grid data objects. |
dict
|
|
|
dict
|
|
grid_get_grid_named_theme(name)
Get the grid theme data by name.
Args:
name (str): The name of hte grid theme data.
Returns:
dict: The grid theme dictionary
* key (str): The key of the theme data, e.g. name, colors, icons, etc.
* value (any): The value of the theme data.
grid_get_grid_theme()
Get the grid data from all the grid_data.json files
Returns:
| Name | Type | Description |
|---|---|---|
dict |
a dictionary of grid theme data |
|
|
||
|
grid_get_item_theme_data(roles, name=None)
Get the item theme data for grid objects with the specified roles, for the optionally specified theme.
Args:
roles (str): A comma-separated list of roles to use.
name (str, optional): The name of the grid data theme. Default is None.
Returns:
RetVal: An object containing the icon, scale, color, and damage_color for the grid objects that match the roles.
grid_objects(so_id)
Get a set of agent ids of the grid objects on the specified ship
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
so_id
|
Agent | int
|
agent id or object |
required |
Returns:
| Type | Description |
|---|---|
set[int]
|
set[int]: a set of agent ids |
grid_objects_at(so_id, x, y)
Get a set of agent ids of the grid objects on the specified ship, at the location specified
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
so_id
|
Agent | int
|
agent id or object |
required |
x
|
int
|
The x grid location |
required |
y
|
int
|
The y grid location |
required |
Returns:
| Type | Description |
|---|---|
set[int]
|
set[int]: A set of agent ids |
grid_pos_data(id)
get a set of agent ids of the grid objects on the specified ship, at the location specified
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
so_id
|
agent
|
agent id or object |
required |
x
|
int
|
The x grid location |
required |
y
|
int
|
The y grid location |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
(float, float, float)
|
x, y, path_length |
grid_remove_move_role(event)
Remove the _moving_ role from the grid object if the event has the finished_path sub_tag.
Args:
event (event): The event that caused the removal
grid_set_grid_current_theme(i)
Set the grid theme by index. Args: i (int): The index of the grid theme to use.
grid_set_grid_named_theme(name)
Set the grid theme by name.
Args:
name (str): The name of the grid theme, e.g. cosmos or Retro.
grid_short_status(id_or_obj, status, color=None, seconds=0, minutes=0)
sets the short status (tool tip) and speech bubble text of a grid object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_or_obj
|
Agent | int
|
Agent id or object |
required |
status
|
str
|
The detailed status string |
required |
color
|
str
|
change the color of the detailed status text. None does not change the current value |
None
|
seconds
|
int
|
The seconds for the speech bubble |
0
|
minutes
|
(int): The minutes for the speech bubble |
0
|
grid_speech_bubble(id_or_obj, status, color=None, seconds=0, minutes=0)
Sets the speech bubble text of a grid object. The text will disappear if the seconds/minutes are set
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_or_obj
|
Agent | int
|
Agent id or object |
required |
status
|
str
|
The detailed status string |
required |
color
|
str
|
change the color of the detailed status text. None does not change the current value |
None
|
seconds
|
int
|
The seconds for the speech bubble |
0
|
minutes
|
(int): The minutes for the speech bubble |
0
|
grid_target(grid_obj_or_set, target_id, speed=0.01)
Set a grid object to target the location of another grid object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_obj_or_set
|
Agent | int | set[Agent | int]
|
an id, object or set of agent(s) |
required |
target_id
|
Agent
|
an agent id or object |
required |
speed
|
float
|
the speed to move. Defaults to 0.01. |
0.01
|
grid_target_closest(grid_obj_or_set, target_set=None, max_dist=None, filter_func=None)
Find and target the closest object matching the criteria
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_obj_or_set
|
Agent | int | set[Agent | int]
|
The agent or set |
required |
target_set
|
set[Agent]
|
The items to test. Defaults to None. |
None
|
max_dist
|
float
|
max distance. Defaults to None. |
None
|
filter_func
|
Callable
|
additional filer function. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
GridCloseData |
CloseData
|
The gird close data of the closest object |
grid_target_pos(grid_obj_or_set, x, y, speed=0.01)
Set the grid object go to the target location
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_obj_or_set
|
Agent | int | set[Agent | int]
|
An id, object or set of grid object agent(s) |
required |
x
|
float
|
x location |
required |
y
|
float
|
y location |
required |
speed
|
float
|
The grid object speed. Defaults to 0.01. |
0.01
|