Links
get_dedicated_link(so, link_name)
Get the agent linked to the specified agent.
Note
Dedicated link means there is only one thing linked to 1-1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
link_name
|
str
|
The link name |
required |
Returns:
| Type | Description |
|---|---|
|
int | None: The id of a single agent or None |
has_link(link_name)
Get the objects that have a link item with the given key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
link_name
|
str
|
The key/name of the link |
required |
Returns:
| Type | Description |
|---|---|
|
set[int]: set of ids |
has_link_to(link_source, link_name, link_target)
check if target and source are linked to for the given key
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
link_source
|
Agent | int
|
The agent or id hosting the link |
required |
link_name
|
str
|
The key/name of the inventory item |
required |
Returns:
| Type | Description |
|---|---|
|
set[int]: The set of linked ids |
link(set_holder, link_name, set_to)
Create a link between agents
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
set_holder
|
Agent | int | set[Agent | int]
|
The host (agent, id, or set) of the link |
required |
link_name
|
str
|
The link name |
required |
set_to
|
Agent | set[Agent]
|
The items to link to |
required |
linked_to(link_source, link_name)
Get the set of ids that the source is linked to for the given key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
link_source
|
Agent | int
|
The agent or id to check |
required |
link_name
|
str
|
The key/name of the inventory item |
required |
Returns: set[int]: The set of linked ids
set_dedicated_link(so, link_name, to)
Set the agent linked to
Note
Dedicated link means there is only one thing linked to 1-1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
link_name
|
str
|
The link name |
required |
to
|
Agent | int
|
The single agent or id or None |
required |
unlink(set_holder, link_name, set_to)
Removes the link between things
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
set_holder
|
Agent | int | set[Agent | int]
|
An agent or set of agents (ids or objects) |
required |
link_name
|
str
|
Link name |
required |
set_to
|
Agent | int | set[Agent | int]
|
The agent or set of agents (ids or objects) to add a link to |
required |