redeclipse.lighting package

Light manager

class redeclipse.lighting.LightManager(brightness=1.0, saturation=1.0, world_size=128)[source]

Bases: object

A lighting manager for a map

get_light(position, red, green, blue, size_factor=1)[source]

Return a light entity for a position and colour

Parameters:
  • position (tuple(int, int, int)) – The position
  • red (int) – red component
  • green (int) – green component
  • blue (int) – blue component
Returns:

An appropriately configured light entity

Return type:

redeclipse.entities.Light

hue(pos)[source]

Get a hue for a position. Child classes should implement this in more interesting manners. This returns a pure white light by default.

Parameters:pos (tuple(int, int, int)) – The position
Returns:A colour
Return type:tuple(int, int, int)
light(xmap, position, colour_override=None, autocenter=True, size_factor=1)[source]
Parameters:
  • xmap (redeclipse.Map) – A redeclipse map object, the light will be attached to the entity list.
  • position (redeclipse.vector.FineVector or redeclipse.vector.CoarseVector) – The position of the light
  • colour_override (tuple(int, int, int)) – Override whatever colour the light manager comes up with
  • autocenter (boolean) – Automatically add FineVector(4, 4, 4) to the position
class redeclipse.lighting.PositionBasedLightManager(brightness=1.0, saturation=1.0, world_size=128)[source]

Bases: redeclipse.lighting.LightManager

A lighting manager for a map which returns a different colour based on position.

hue(pos)[source]

Get a hue for a position. This returns a coloured light that changes hue gradually over x/y/z

Parameters:pos (tuple(int, int, int)) – The position
Returns:A colour
Return type:tuple(int, int, int)