location – Locations¶
The location module contains objects for tracking and analyzing locations.
- class bravo.location.Location[source]¶
Bases: object
The position and orientation of an entity.
- classmethod at_block(x, y, z)[source]¶
Pinpoint a location at a certain block.
This constructor is intended to aid in pinpointing locations at a specific block rather than forcing users to do the pixel<->block maths themselves. Admittedly, the maths in question aren’t hard, but there’s no reason to avoid this encapsulation.
- clamp()[source]¶
Force this location to be sane.
Forces the position and orientation to be sane, then fixes up location-specific things, like stance.
Returns: bool indicating whether this location had to be altered
- class bravo.location.Orientation[source]¶
Bases: bravo.location.Orientation
The angles corresponding to the heading of an entity.
Theta and phi are very much like the theta and phi of spherical coordinates, except that phi’s zero is perpendicular to the XZ-plane rather than pointing straight up or straight down.
Orientation is stored in floating-point radians, for simplicity of computation. Unfortunately, no wire protocol speaks radians, so several conversion methods are provided for sanity and convenience.
The from_degs() and to_degs() methods provide integer degrees. This form is called “yaw and pitch” by protocol documentation.
- class bravo.location.Position[source]¶
Bases: bravo.location.Position
The coordinates pointing to an entity.
Positions are always stored as integer absolute pixel coordinates.