Skip to content

The space_objects module

Overview

API: Space Objects

broad_test(x1, z1, x2, z2, broad_type=65520)

returns a set of ids that are in the target rect

Parameters:

Name Type Description Default
x1(float)

x location (left)

required
z1(float)

z location (top)

required
x2(float)

x location (right)

required
z2(float)

z location (bottom)

required
broad_type int

-1=All, 0=player, 1=Active, 2=Passive. Defaults to -1.

65520

Returns:

Name Type Description
set

A set of ids

broad_test_around(id_or_obj, width, depth, broad_type=65520)

returns a set of ids that are around the specified object in the target rect

Parameters:

Name Type Description Default
id_obj(agent)

The ID or object of an agent

required
w(float)

width

required
d(float)

depth

required
broad_type int

-1=All, 0=player, 1=Active, 2=Passive. Defaults to -1.

65520

Returns:

Name Type Description
set

A set of ids

clear_target(chasers, throttle=0)

clear the target on an agent or set of agents

Parameters:

Name Type Description Default
chasers set | int | CloseData | SpawnData

an agent or set of agents

required

closest(the_ship, the_set, max_dist=None, filter_func=None)

get the close data that matches the test set, max_dist and optional filter function

Parameters:

Name Type Description Default
the_ship agent

The agent ID or object

required
the_set agent set

The set of objects to test against

required
max_dist float

The maximum distance to check. Defaults to None.

None
filter_func func

An additional function to test with. Defaults to None.

None

Returns:

Name Type Description
CloseData CloseData

The close object close data to get the distance

closest_list(source, the_set, max_dist=None, filter_func=None)

get the list of close data that matches the test set, max_dist and optional filter function

Parameters:

Name Type Description Default
source agent

The agent object or id of the agent

required
the_set agents set

a set of ids to check against

required
max_dist float

The maximum distance to include. Defaults to None.

None
filter_func function

an additional function to check against. Defaults to None.

None

Returns:

Type Description
list[CloseData]

list[CloseData]: The list of close objects With close data to get the distance

closest_object(the_ship, the_set, max_dist=None, filter_func=None)

get the close data that matches the test set, max_dist and optional filter function

Parameters:

Name Type Description Default
the_ship agent

The agent ID or object

required
the_set agent set

The set of objects to test against

required
max_dist float

The maximum distance to check. Defaults to None.

None
filter_func func

An additional function to test with. Defaults to None.

None

Returns:

Name Type Description
agent Agent

Return the closest agents or None

get_engineering_value(id_or_obj, name, default=None)

gets an engineering value by name

Parameters:

Name Type Description Default
id_or_obj agent

An agent id or object

required
name str

The value to get

required
default float

What to return if not found. Defaults to None.

None

Returns:

Name Type Description
float

A value or the default

get_pos(id_or_obj)

get the position of an agent

Parameters:

Name Type Description Default
id_or_obj agent id | agent

The agent to set position on

required

Returns:

Name Type Description
Vec3

description

remove_objects_box(x, y, z, w, h, d, abits=15, roles=None)

Removes items from an area

Parameters:

Name Type Description Default
x,y,z (float, float, float)

the start point/origin

required
radius float

the radius

required

remove_objects_sphere(x, y, z, radius, abits=15, roles=None)

Removes items from an area

Parameters:

Name Type Description Default
x,y,z (float, float, float)

the start point/origin

required
radius float

the radius

required

set_engineering_value(id_or_obj, name, value)

sets an engineering value by name

Parameters:

Name Type Description Default
id_or_obj agent

An agent id or object

required
name str

The value to get

required
value float

The value

required

set_pos(id_or_obj, x, y=None, z=None)

set the position of an agent or set of agents

Parameters:

Name Type Description Default
id_or_obj agent|set of agent

an agent or set of agent IDs or objects

required
x float | Cec3

The x location or a vector

required
y float

y location. Defaults to None.

None
z float

z location. Defaults to None.

None

target(set_or_object, target_id, shoot=True, throttle=1.0, stop_dist=None)

set Target a target for an agent/set of agents

Parameters:

Name Type Description Default
set_or_object (agent, set)

the agent or set of object to set the target on

required
target_id agent

agent id or object to target

required
shoot bool

whether to also lock weapons on target. Defaults to True.

True
throttle float

The speed to travel at. Defaults to 1.0.

1.0

target_pos(chasers, x, y, z, throttle=1.0, target_id=None, stop_dist=None)

Set the target position of an agent or set of agents

Parameters:

Name Type Description Default
chasers agent id | agent set

the agents to set

required
x float

x location

required
y float

y location

required
z float

z location

required
throttle float

The speed to go. Defaults to 1.0.

1.0
target_id id

What to shoot

None
stop_dist float

The distance to stop

None

target_shoot(chasers, target_id=None)

Set the target id only Args: chasers (agent id | agent set): the agents to set target_id (id, optional): What to shoot