vector

class Vector(x, y)

A simple 2d vector class, used to aid in developent and user experience.

static from_other(vector: Union[Vector, PrimitiveVector], type_cast: Callable = <class 'float'>) Vector

Converts a PrimitiveVector into a Vector. Also handles the case where a Vector is already passed in, in which case that instance is simply returned. Otherwise, a new Vector is constructed, populated, and returned.

Parameters:
  • point – The PrimitiveVector

  • type_cast – The internal type to store data as.

Returns:

A new Vector with the same position as point.

to_dict() dict

Convert this vector to a Factorio-parseable dict with “x” and “y” keys.

Returns:

A dict of the format {"x": x, "y": y}.

property x: float | int

The x-coordinate of the point. Returns either a float or an int, depending on the Vector queried.

Getter:

Gets the x-coordinate.

Setter:

Sets the x-coordinate.

Type:

Either float or int.

property y: float

The y-coordinate of the vector. Returns either a float or an int, depending on the Vector queried.

Getter:

Gets the y-coordinate.

Setter:

Sets the y-coordinate.

Type:

Either float or int.