Sides system
side_ally_members_set(side)
Get a set of all space objects allied with the side or object, including all members of the same side as the one provided. Args: side (str | int | Agent): The id or key of the side, or the id or object of a spaceobject. Returns: set[int]: A set containing the ids of all allied ships, stations, etc.
side_are_allies(side1, side2)
Check if the specified sides are allies. Args: side1 (str | int): the key or id of the first side side2 (str | int): the key or id of the second side Returns: bool: True if they are allies, otherwise False
side_are_enemies(side1, side2)
Check if the specified sides are enemies. Args: side1 (str | int): the key or id of the first side side2 (str | int): the key or id of the second side Returns: bool: True if they are enemies, otherwise False
side_are_neutral(side1, side2)
Check if the specified sides are neutral (neither enemies nor allies). Args: side1 (str | int): the key or id of the first side side2 (str | int): the key or id of the second side Returns: bool: True if they are neutral, otherwise False
side_are_same_side(side1, side2)
Check if the two objects have the same side. Args: side1 (str | int): the key or id of the first side side2 (str | int): the key or id of the second side Returns: bool: True if the sides are the same.
side_display_name(key)
Get the display name of the side or side of object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str | int
|
The key or id of the side. |
required |
Returns: str: The display name of the side.
side_enemy_members_set(side)
Get a set of all space objects that are enemies of the side or object. Args: side (str | int | Agent): The id or key of the side, or the id or object of a spaceobject. Returns: set[int]: A set containing the ids of all enemy ships, stations, etc.
side_get_description(key_or_id)
Get the side description. Args: key_or_id (str | int | Agent): The side Returns: str: The description of the side.
side_get_display_name(key_or_id)
Get the side display name. Args: key_or_id (str | int | Agent): The side Returns: str: The name of the side.
side_get_relations(side1, side2)
Get the relations value of the two sides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
side1
|
str | int
|
the key or id of the first side |
required |
side2
|
str | int
|
the key or id of the second side |
required |
Returns:
sbs.DIPLOMACY: The relations value, e.g. sbs.DIPLOMACY.ALLIED
* UNKNOWN
* NEUTRAL
* ALLIED
* HOSTILE
side_get_side_color(key_or_id, default='#0F0')
Get the icon color for the specified side.
Args:
key_or_id (str | int | Agent): The Key, ID, or agent of the side
default (str, optional): The color code to use if the side or side's color isn't found. Default is #0F0 (red).
Returns:
str: The hexidecimal color code assigned to the side.
side_get_side_icon_index(key_or_id)
Get the icon index for the specified side. Args: key_or_id (str | int): The key or id of the side to get the icon index for. Returns: int: The index of the icon for the side. If the icon is not found, returns -1.
side_is_color_used(color)
Check if the color is used by any side. Args: color (str): The hexidecmial color code to check for. Returns: bool: True if any side uses the specified color.
side_keys_set()
Get a set containing the keys for all existing sides.
Returns:
| Type | Description |
|---|---|
|
set[str]: A set of keys for all sides. |
side_members_set(side)
Get all objects with the specified side, or all objects of the same side as the provided object. Use this instead of role(side).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
side
|
str | int | Agent
|
The key or name of the side, or the ID of the side, or the side object, or an object with the given side. |
required |
Returns:
| Type | Description |
|---|---|
|
set[int]: Set of ids with the specified side. |
side_set_description(key_or_id, desc)
Set the side description Args: key_or_id (str | int | Agent): The side id or key or object. desc (str): The new description.
side_set_display_name(key_or_id, name)
Set the side's display name and update the side name of all ships on that side. Args: key_or_id (str | int | Agent): The side id or key or object. desc (str): The new description.
side_set_icon_color(key_or_id, color)
Set the icon color for the specified side. This will change the color of ships on the 2d map. Args: key_or_id (str | int): The key or id of the side to set the icon color for. color (str): The hexidecimal color code, or named color, to set the side's icon color to. For example, "#F00" or "#FF0000" or "red" for red, "#0F0" or "#00FF00" or "green" for green, etc.
side_set_object_side(id_or_obj, key)
Set the side of an object, or list or set of objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_or_obj
|
int | Agent | list[int | Agent] | set[int | Agent]
|
The object or objects for which the side should be set. |
required |
key
|
str | int | Agent
|
The key or id of the side, or an object with that side. |
required |
side_set_relations(side1, side2, relation)
Update relations between two sides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
side1
|
str | int
|
key or id of the first side, or an object with that side |
required |
side2
|
str | int
|
key or id of the second side, or an object with that side |
required |
relation
|
DIPLOMACY
|
the new relations between the sides, e.g. |
required |
side_set_ship_allies_and_enemies(ship)
Deprecated as of v1.3.0. To be removed in the future. Generate the ally list and hostile list for the specified ship based on its side. Args: ship (Agent | int): The object for which the ally and hostile lists should be updated.
side_set_side_icon_index(key_or_id, icon_index)
Set the icon index for the specified side. This will change the icon of ships on the 2d map. Args: key_or_id (str | int): The key or id of the side to set the icon index for. icon_index (int): The index of the icon to set for the side.
sides_set()
Get a set containing the ids of all sides (objects with the "side" role).
Returns:
| Type | Description |
|---|---|
|
set[int]: A set of IDs for each side. |
to_side_id(key_or_id_or_object)
Get the id for the given side or side of object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_or_id
|
str | int
|
the key or the Agent of the side, or the id or Agent of a space object. |
required |
Returns:
| Type | Description |
|---|---|
|
int | None: The ID of the side. If the key, name, or id doesn't exist, returns None. |
to_side_object(key_or_id)
Get the object for the given side or side of object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key_or_id
|
str | int
|
the key or the Agent ID of the side, or an Agent or Agent ID belonging to the side. |
required |
Returns:
| Type | Description |
|---|---|
|
Agent|None: The Agent object for the side. If the key, agent, or id doesn't exist, returns None. |