elma package¶
Submodules¶
elma.constants module¶
elma.models module¶
- class elma.models.Event¶
Bases: object
Abstract base representation of a single replay event.
- time¶
float
The time at which the event occurs, given in 625/273ths of a second.
- class elma.models.Frame¶
Bases: object
Represent a single replay frame. .. attribute:: position
Point
The position of the kuski in this frame in level coordinates.
- left_wheel_position¶
Point
The position of the bike’s left wheel in this frame relative to the position of the kuski.
- right_wheel_position¶
Point
The position of the bike’s right wheel in this frame relative to the position of the kuski.
- head_position¶
point
The position of the kuski’s head in this frame relative to the position of the kuski.
- rotation¶
int
The rotation of the kuski in 10000ths of a radian.
- left_wheel_rotation¶
int
The rotation of the bike’s left wheel in 249/2/pi-ths of a radian.
- right_wheel_rotation¶
int
The rotation of the bike’s right wheel in 249/2/pi-ths of a radian.
- is_gasing¶
boolean
Whether or not the bike is gasing in this frame.
- is_turned_right¶
boolean
Whether or not the bike is turned right in this frame.
- spring_sound_effect_volume¶
int
The spring sound effect volume for this frame.
- class elma.models.GroundTouchAEvent¶
Bases: elma.models.Event
Represent a single replay ground touch A event.
- class elma.models.GroundTouchBEvent¶
Bases: elma.models.Event
Represent a single replay ground touch B event.
- class elma.models.LeftVoltEvent¶
Bases: elma.models.Event
Represent a single replay left volt event.
- class elma.models.Level¶
Bases: object
Represent an Elastomania level.
- polygons¶
list
A list of Polygons in the level.
- objects¶
list
A list of Objects in the level.
- pictures¶
list
A list of Pictures in the level.
- level_id¶
int
A unique unsigned 32bit integer level identifier.
- name¶
string
The name of level, which should be no longer than 50 characters long.
- lgr¶
string
The name of the LGR used for this level, which should be no longer than 10 characters long.
- ground_texture¶
string
The name of the ground texture used for this level, which should be no longer than 10 characters long.
- sky_texture¶
string
The name of the sky texture used for this level, which should be no longer than 10 characters long.
- class elma.models.Obj(point, type, gravity=0, animation_number=1)¶
Bases: object
Represent an Elastomania level object, which can be one of: flower, food, killer, start.
- point¶
Point
The 2D Point that represents the position of the object. type (int): The type of the object, which should be one of: Obj.FLOWER, Obj.FOOD, Obj.Killer, Obj.START.
- gravity¶
int
The gravity of the object, if the object is a food object. It should be one of: Obj.GRAVITY_NORMAL, Obj.GRAVITY_UP, Obj.GRAVITY_DOWN, Obj.GRAVITY_LEFT, Obj,GRAVITY_RIGHT.
- animation_number¶
int
The animation number of the object.
- FLOWER = 1¶
- FOOD = 2¶
- GRAVITY_DOWN = 2¶
- GRAVITY_LEFT = 3¶
- GRAVITY_NORMAL = 0¶
- GRAVITY_RIGHT = 4¶
- GRAVITY_UP = 1¶
- KILLER = 3¶
- START = 4¶
- class elma.models.ObjectTouchEvent¶
Bases: elma.models.Event
Represent a single replay object touch event.
- class elma.models.Picture(point, picture_name='', texture_name='', mask_name='', distance=500, clipping=0)¶
Bases: object
Represents an Elastomania level picture.
- point¶
Point
The 2D Point that represents the position of the object.
- picture_name¶
string
The name of the picture resource to use, without .PCX, e.g. ‘BARREL’.
- picture_name
string
The name of the texture resource to use, without .PCX, e.g. ‘STONE1’.
- mask_name¶
string
The name of the texture resource to use, without .PCX, e.g. ‘MASKHOR’.
- distance¶
int
The z-ordering distance of the picture. Should be in the range 1-999.
- clipping¶
int
The clipping of the picture. Should be one of: Picture.CLIPPING_U, Picture.CLIPPING_G, Picture.CLIPPING_S.
- CLIPPING_G = 1¶
- CLIPPING_S = 2¶
- CLIPPING_U = 0¶
- class elma.models.Point(x, y)¶
Bases: object
Represent a single 2D point.
- x¶
float
The x-coordinate of the point.
- y¶
float
The y-coordinate of the point.
- class elma.models.Polygon(points, grass=False)¶
Bases: object
Represents an Elastomania level polygon.
- points¶
list
A list of Points defining the polygon contour.
- grass¶
boolean
A boolean deciding wether or the polygon is a grass polygon.
- class elma.models.Replay¶
Bases: object
Represent an Elastomania replay.
- is_multi¶
boolean
Whether or not the replay is a multiplayer replay.
- is_flagtag¶
boolean
Whether or not the replay is a flagtag replay.
- level_id¶
int
The unique identifier of the level this replay is from.
- level_name¶
string
The name of the level this replay is from.
- frames¶
list
The frames of this replay.
- events¶
list
The events of this replay.
- get_exact_duration_in_seconds()¶
Calculates the exact replay duration in seconds.
- class elma.models.RightVoltEvent¶
Bases: elma.models.Event
Represent a single replay right volt event.
- class elma.models.TurnEvent¶
Bases: elma.models.Event
Represent a single replay turn event.
elma.packing module¶
- elma.packing.pack_level(item)¶
Pack a level-related item to its binary representation readable by Elastomania.
- elma.packing.pack_replay(item)¶
Pack a replay-related item to its binary representation readable by Elastomania.
- elma.packing.unpack_level(data)¶
Unpack a level-related item from its binary representation readable by Elastomania.
- elma.packing.unpack_replay(data)¶
Unpack a replay-related item from its binary representation readable by Elastomania.
elma.utils module¶
- elma.utils.null_padded(string, length)¶
Force a string to a given length by right-padding it with zero-bytes, clipping the initial string if neccessary.