siege.world.realm

CellType

class CellType
Lava = siege.world.realm.CellType.Lava
Water = siege.world.realm.CellType.Water

DistributeResult

class DistributeResult
BREAK = siege.world.realm.DistributeResult.BREAK
CONTINUE = siege.world.realm.DistributeResult.CONTINUE
HIT_SURFACE = siege.world.realm.DistributeResult.HIT_SURFACE
SUCCESS = siege.world.realm.DistributeResult.SUCCESS

Layer

class Layer
Active = siege.world.realm.Layer.Active
BG1 = siege.world.realm.Layer.BG1
BG2 = siege.world.realm.Layer.BG2
BG3 = siege.world.realm.Layer.BG3
BG4 = siege.world.realm.Layer.BG4
Back = siege.world.realm.Layer.Back
Dropped = siege.world.realm.Layer.Dropped
Fore = siege.world.realm.Layer.Fore
Ground = siege.world.realm.Layer.Ground
Item = siege.world.realm.Layer.Item
None = siege.world.realm.Layer.None
Wall = siege.world.realm.Layer.Wall
WallAndGround = siege.world.realm.Layer.WallAndGround

LightSourceType

class LightSourceType
Basic = siege.world.realm.LightSourceType.Basic
Cone = siege.world.realm.LightSourceType.Cone

LightingMode

class LightingMode
Normal = siege.world.realm.LightingMode.Normal
Simple = siege.world.realm.LightingMode.Simple

TileRenderLayer

class TileRenderLayer
Background = siege.world.realm.TileRenderLayer.Background
Foreground = siege.world.realm.TileRenderLayer.Foreground
Midground = siege.world.realm.TileRenderLayer.Midground

UnderwaterSupport

class UnderwaterSupport
Allow = siege.world.realm.UnderwaterSupport.Allow
Disallow = siege.world.realm.UnderwaterSupport.Disallow
Require = siege.world.realm.UnderwaterSupport.Require

ActiveTile

class ActiveTile
__init__(arg2, arg3)
Parameters:
  • arg2 (int) –
  • arg3 (int) –
getId(arg2)

Returns the tile id for this tile’s component. If tile is empty then 0 is returned.

Parameters:arg2 (TileSystem) –
Return type:int
foliageId
The FoliageSystem id index that corresponds to a specific FoliageComponent
frame
The current frame of animation
tileId
The TileSystem id index that corresponds to a specific TileComponent

AutomataCell

class AutomataCell
getMaxQuantity()

Returns max quantity of this cell

Return type:int
isActive()

Return whether or not this cell is marked as active

Return type:bool
isFull()

Returns true if quantity==max quantity, false otherwise

Return type:bool
setActive(active)

Mark cell as active or inactive

Parameters:active (bool) – Set to true for active, false otherwise
update(north, south, east, west)

Must be defined by parent class

Parameters:
  • north (object) –
  • south (object) –
  • east (object) –
  • west (object) –
Return type:

bool

update(arg2, arg3, arg4, arg5)
Parameters:
  • arg2 (object) –
  • arg3 (object) –
  • arg4 (object) –
  • arg5 (object) –
quantity
Quantity count for this cell

WaterCell

class WaterCell
__init__(quantity)
Parameters:quantity (int) –
MAX_QUANTITY = 16

LavaCell

class LavaCell
__init__(quantity)
Parameters:quantity (int) –

BiomeBackground

class BiomeBackground
__setattr__(attr, value)

Changes an attribute of this BiomeBackground

Parameters:
  • attr (str) – Attribute name
  • value (object) – Value for attribute
images
A StringList of paths to image files
loop
Set to true to loop background, false otherwise
offset
Vector for render offset
scroll
Vector for scroll movement

BiomeData

class BiomeData
__init__(biome)
Parameters:biome (Biome) –
__repr__()

A printable representation of this object.

Return type:str
__setattr__(attr, value)

Changes an attribute of this BiomeData

Parameters:
  • attr (str) – Attribute name
  • value (object) – Value for attribute
area
Coordinates of this biome
biome
Biome associated with this :class:`Biome`Data
ratio
Biomes ratio value
uid
Unique identifier

BiomeDataSet

class BiomeDataSet
__contains__(arg2)
Parameters:arg2 (object) –
Return type:bool
__contains__(arg2)
Parameters:arg2 (BiomeData) –
Return type:bool
__delitem__(arg2)
Parameters:arg2 (object) –
__getitem__(arg2)
Parameters:arg2 (object) –
Return type:object
__iter__()
Return type:object
__len__()
Return type:int
__setitem__(arg2, arg3)
Parameters:
  • arg2 (object) –
  • arg3 (object) –
add(arg2)
Parameters:arg2 (BiomeData) –
clear()
has(arg2)
Parameters:arg2 (BiomeData) –
Return type:bool
remove(arg2)
Parameters:arg2 (BiomeData) –

BiomeMap

class BiomeMap
__contains__(arg2)
Parameters:arg2 (object) –
Return type:bool
__delitem__(arg2)
Parameters:arg2 (object) –
__getitem__(arg2)
Parameters:arg2 (object) –
Return type:object
__iter__()
Return type:object
__len__()
Return type:int
__setitem__(arg2, arg3)
Parameters:
  • arg2 (object) –
  • arg3 (object) –

BiomeTracker

class BiomeTracker
__setattr__(attr, value)

Changes an attribute of this BiomeTracker

Parameters:
  • attr (str) – Attribute name
  • value (object) – Value for attribute
add(biome)

Add a Biome to this :class:`Biome`Tracker

Parameters:biome (BiomeData) – The biome to add
getBiome(position)

Returns a the Biomedata that position is within

Parameters:position (Vector) – The coordinates to target
Return type:BiomeData
getBiomeInfo(name)

Returns a Biome with matching name

Parameters:name (str) – The name of the biome to search for
Return type:Biome
getBiomes(area)

Returns a BiomedataSet full of all biomes that area is within

Parameters:area (Rect) – The coordinates to search
Return type:BiomeDataSet
getRandomUndergroundPosition(depthStart, depthEnd)

Returns a random position from depthStart to depthEnd based on underground threshold

Parameters:
  • depthStart (float) – Minimum depth for position
  • depthEnd (float) – Maximum depth for position
Return type:

TileVector

getRandomUndergroundPosition(startX, endX, depthStart, depthEnd)

Returns a random position underground within the bounds provided.

Parameters:
  • startX (int) – Starting x bounds
  • endX (int) – Ending x bounds
  • depthStart (float) – Minimum depth for position
  • depthEnd (float) – Maximum depth for position
Return type:

TileVector

getUid()

Return a unique Id based on the biome’s unique Ids

Return type:int
hasBiome(uid)

Checks if a biome is in this BiomeTracker

Parameters:uid (int) – Unique Id for a biome
Returns:True if biome found, false otherwise
Return type:bool
initializeUndergroundThreshold()

Sets up all related information for underground threshold after it has been populated

remove(biome)

Remove a biome from this BiomeTracker

Parameters:biome (BiomeData) – The BiomeData to remove
resetBackgrounds(arg2)
Parameters:arg2 (Entity) –
updatePlayer(player[, force=False])

Updates the position based on entity. Also handles transitions from one biome to another

Parameters:
  • player (Entity) – Entity to track
  • force (bool) – Set to true to force a check for biome transitions, false otherwise
biomes
Map of all biomes
currentBiome
The biome the player is in
data
Map of Ids to biome data
thresholdWrg
WeightedRandomGenerator for creating biomes
undergroundThreshold
Threshold for depth of caves
undergroundVolume
Total size of space between threshold and the edge of the realm

CellList

class CellList
__contains__(arg2)
Parameters:arg2 (object) –
Return type:bool
__delitem__(arg2)
Parameters:arg2 (object) –
__getitem__(arg2)
Parameters:arg2 (object) –
Return type:object
__iter__()
Return type:object
__len__()
Return type:int
__setitem__(arg2, arg3)
Parameters:
  • arg2 (object) –
  • arg3 (object) –
append(arg2)
Parameters:arg2 (object) –
extend(arg2)
Parameters:arg2 (object) –

DroppedHandler

class DroppedHandler
create( item, position, velocity, >[, delay=500]])

Adds an item entity to the realm

Parameters:
  • item (InventoryItem) – Item data
  • position (Vector) – Coordinates for new entity
  • velocity (Vector) – Movement vector for new entity
  • > (=0) –
  • delay (int) – Item delay time
Returns:

The entity created

Return type:

Entity

createMany(item, position[, delay=500])

Adds multiple item entities to the realm

Parameters:
Returns:

A list of entities created

Return type:

Entities

FoliageHandler

class FoliageHandler
hasActive()
Return type:bool
simulate()
spreadFoliage(foliage, area, amount[, layer=siege.world.realm.Layer.Ground])
Parameters:
update(arg2)
Parameters:arg2 (int) –
groundLevel

IdTilesMap

class IdTilesMap
__contains__(arg2)
Parameters:arg2 (object) –
Return type:bool
__delitem__(arg2)
Parameters:arg2 (object) –
__getitem__(arg2)
Parameters:arg2 (object) –
Return type:object
__iter__()
Return type:object
__len__()
Return type:int
__setitem__(arg2, arg3)
Parameters:
  • arg2 (object) –
  • arg3 (object) –

LayerBase

class LayerBase
isSpaceAvailable(area)

Function must be overwritten by parent class

Parameters:area (Rect) – Coordinates to search within
Return type:bool
isSpaceAvailable(arg2)
Parameters:arg2 (Rect) –
realmSize
type

BackLayer

class BackLayer
setColor(color)

Changes the transition color

Parameters:color (Color) – Color to use for change
transition(time, paths, offset, scroll, loop, center, move)

Start a transition with new parameters

Parameters:
  • time (int) – Remaining time for transition
  • paths (StringList) – List of paths to image files
  • offset (Vector) – Render offsest
  • scroll (Vector) – Scrolling vector for camera
  • loop (bool) – Set to true for looping images, false otherwise
  • center (Vector) – Position for the center of the view
  • move (Vector) – Vector for camera movement speed

EntityLayer

class EntityLayer
add(entity)

Adds an entity to the EntityLayer

Parameters:entity (Entity) – The entity to add
getAll()

Return an EntitySet containing all entities in this layer

Return type:EntitySet
getNearby(entity)

Returns an EntitySet containing all entities in close proximity to entity

Parameters:entity (Entity) – The entity to search around
Return type:EntitySet
getNearby(rect)

Returns an EntitySet containing all entities in close proximity to rect

Parameters:rect (Rect) – The Coordinates to search around
Return type:EntitySet
getNearby(point, radius)

Returns an EntitySet containing all entities in close proximity to rectangle created by parameters

Parameters:
  • point (Vector) – The center point for the rectangle
  • radius (float) – How far to extend from the radius in each direction
Return type:

EntitySet

has(entity)

Returns true is entity is present in this layer

Parameters:entity (Entity) – Target to search for
Return type:bool
isSpaceAvailable(area)

Returns true if there are no entities near the area, false otherwise

Parameters:area (Rect) – Coordinates to search around
Return type:bool
remove(entity)

Removes the entity from this layer if it is present

Parameters:entity (Entity) – Target entity to remove
remove(entityId)

Removes the entity from this layer if it is present

Parameters:entityId (int) – Id of entity to remove

TileLayer

class TileLayer
clearVertices()

Clears all vertices to ensure a clean rendering of tiles.

copyTo(targetLayer, startPosition, destination)

Copies the contents of this TileLayer to the provided TileLayer. This does not check for overlaps in the source and destination.

Parameters:
  • targetLayer (TileLayer) – The targeted TileLayer to copy to.
  • startPosition (TileVector) – The top left corner to start copying from.
  • destination (TileRect) – The targeted area to copy to. Automatically resized to fit within the bounds of the world.
damageTile(position, damage)

Reduces the durability of a tile by damage

Parameters:
  • position (TileVector) – The tile position to damage
  • damage (int) – The amount to reduce the tile’s durability by
Returns:

True if the tile was destroyed, false otherwise

Return type:

bool

fullDirty()

Mark all regions in realm as changed

getIdMap(area)

Returns a map of ids to TileVectorList containing all tiles inside of the given area

Parameters:area (TileRect) – Coordinates to search within
Return type:IdTilesMap
getTile(arg2, arg3)
Parameters:
  • arg2 (int) –
  • arg3 (int) –
Return type:

ActiveTile

getTile(arg2)
Parameters:arg2 (TileVector) –
Return type:ActiveTile
getTileComponent(arg2, arg3)
Parameters:
  • arg2 (int) –
  • arg3 (int) –
Return type:

TileComponent

getTileComponent(arg2)
Parameters:arg2 (TileVector) –
Return type:TileComponent
getTileId(arg2, arg3)
Parameters:
  • arg2 (int) –
  • arg3 (int) –
Return type:

int

getTileId(arg2)
Parameters:arg2 (TileVector) –
Return type:int
getTileInDirection(position, direction[, solidOnly=False])

If position is valid add direction to position and return the tile underneath

Parameters:
  • position (Vector) – Position to search
  • direction (TileVector) – Vector to add to position
  • solidOnly (bool) – Set to true to stop direction on a solid tile, false otherwise
Returns:

A TileVector from the search position

Return type:

TileVector

getTileList(area, tileId[, amount=4294967295L])

Returns a TileVectorList that contains all tile positions matching the given tileId within the provided area

Parameters:
  • area (TileRect) – Coordinates to search within
  • tileId (int) – Id of tiles to search
  • amount (int) – Maximum number of tiles to return. Defaults to unbounded amount
Return type:

TileVectorList

initialize()

Clears and reinitializes all tile regions for world generation.

isEmpty(position)

Checks if there is no tile at position

Parameters:position (TileVector) – The position to check
Returns:True if tile at position is empty, false otherwise
Return type:bool
isLoaded(arg2, arg3)

Returns True if the specified tile position is loaded otherwise False.

Parameters:
  • arg2 (int) –
  • arg3 (int) –
Return type:

bool

isLoaded(arg2)

Returns True if the specified tile position is loaded otherwise False.

Parameters:arg2 (TileVector) –
Return type:bool
isSolid(position)

Checks if the tile at position is a solid tile

Parameters:position (TileVector) – The position to check
Returns:True if position is not empty and solid, false otherwise
Return type:bool
isSpaceAvailable(area)

Returns true if there are no tile under area, false otherwise

Parameters:area (Rect) – Coordinates to search within
Return type:bool
overlaps( rect, solidOnly, includeTouching[, ignoreTiles=<siege.util.Uint32Set)

Returns all tiles under the area rect

Parameters:
  • rect (Rect) – The coordinates to search under
  • solidOnly (bool) – Set to true to skip non solid tiles, set false otherwise
  • includeTouching (bool) – Set to true to include tiles touching border tiles, set false otherwise
  • ignoreTiles (Uint32Set) – (Uint32Set) The tileIds to skip during the search
Return type:

TileVectorList

setFoliage(arg2, arg3)
Parameters:
setTile(position, tileId)

Changes the tile type at position to the type specified by tileId

Parameters:
  • position (TileVector) – The position of the tile to change
  • tileId (int) – Id of the new type of tile

LayerManager

class LayerManager
__getitem__(layer)

Returns the LayerBase of type layer. If layer is not in manager it will return an empty LayerBase.

Parameters:layer (Layer) – Layer to search for
Return type:LayerBase
__setattr__(attr, value)

Changes an attribute of this LayerManager

Parameters:
  • attr (str) – Attribute name
  • value (object) – Value for attribute
canChangeTile(layer, position, tileId)

Returns true if tile at the position can be changed to a new tile of tileId

Parameters:
  • layer (Layer) – Layer to search
  • position (TileVector) – Position of tile
  • tileId (int) – Id of the new tile
Returns:

True if change can occur, false otherwise

Return type:

bool

distanceFromTile(entity, position)

Returns the distance from the center of entity to the center of the ground tile at position

Parameters:
  • entity (Entity) – The entity used for the calculation
  • position (Vector) – The tile position for the calculation
Returns:

FLT_MAX if position is invalid, otherwise returns distance

Return type:

float

getOrdered()

Returns all layers stored in this LayerManager, in sorted order.

Return type:Layers
isSpaceAvailable(layer, area)

Returns the value from a call to isSpaceAvailable on target layer

Parameters:
  • layer (Layer) – Layer to use
  • area (Rect) – Coordinates to search within
Return type:

bool

setTile(layer, tilePos, tileId[, forced=False])

Returns true if tile at the position is successfully changed to a new tile of tileId

Parameters:
  • layer (Layer) – Layer to search
  • tilePos (TileVector) – Position of tile
  • tileId (int) – Id of the new tile
  • forced (bool) – Set forced to true to disable canceling
Returns:

True if change can occur, false otherwise

Return type:

bool

setTile(layer, tilePos, tileId, forced)

Returns true if tile at the position is successfully changed to a new tile of tileId

Parameters:
  • layer (Layer) – Layer to search
  • tilePos (TileVector) – Position of tile
  • tileId (int) – Id of the new tile
  • forced (bool) – Set forced to true to disable canceling
Returns:

True if change can occur, false otherwise

Return type:

bool

Layers

class Layers
__contains__(arg2)
Parameters:arg2 (object) –
Return type:bool
__delitem__(arg2)
Parameters:arg2 (object) –
__getitem__(arg2)
Parameters:arg2 (object) –
Return type:object
__iter__()
Return type:object
__len__()
Return type:int
__setitem__(arg2, arg3)
Parameters:
  • arg2 (object) –
  • arg3 (object) –
append(arg2)
Parameters:arg2 (object) –
extend(arg2)
Parameters:arg2 (object) –

LightSource

class LightSource
angle
(float) The angle (in degrees) the light spreads out from the direction on each side.
brightness
The brightness of the light’s color.
center
The positional offset of the light source to the attached entity.
color
The color of the light source
decay
The rate at which the light dissipates.
direction
(float) The direction (in degrees) this light is pointing at.
enabled
Whether this light is on or not.
intensity
The intensity of the light source. Ranging from pure darkness (0) to pure light (128).
name
(str) Name of light source used to identify it within the LightComponent.
onVisible
(callable) Called when the light source is visible and being simulated. Signature is void(frameTime).
onVisibleFrequency
(RangeUint) The rate that the onVisible callback is invoked.
position
The world coordinates of this light source.
size
The size of the light source.
type
(LightType) The type of light.

LightSourceData

class LightSourceData
angle
(float) The angle (in degrees) the light spreads out from the direction on each side.
brightness
(float) The brightness of the light’s color. Default is 1.0.
center
(Vector) The positional offset of the light source to the attached entity.
color
The color of this light source.
decay
(float) The rate at which the light dissipates.
direction
(float) The direction (in degrees) this light is pointing at.
enabled
(bool) Whether the light starts enabled (on) or not (off).
intensity
The intensity of the light source. Ranging from pure darkness (0) to pure light (128).
lightType
(LightType) The type of light.
name
(str) Name of light source used to identify it within the LightComponent.
onVisible
(callable) Called when the light source is visible and being simulated. Signature is void(frameTime).
onVisibleFrequency
(RangeUint) The rate that the onVisible callback is invoked.
size
The size of the light source.

LightSourceDataList

class LightSourceDataList
__contains__(arg2)
Parameters:arg2 (object) –
Return type:bool
__delitem__(arg2)
Parameters:arg2 (object) –
__getitem__(arg2)
Parameters:arg2 (object) –
Return type:object
__iter__()
Return type:object
__len__()
Return type:int
__setitem__(arg2, arg3)
Parameters:
  • arg2 (object) –
  • arg3 (object) –
append(arg2)
Parameters:arg2 (object) –
extend(arg2)
Parameters:arg2 (object) –

LightSourceMap

class LightSourceMap
__contains__(arg2)
Parameters:arg2 (object) –
Return type:bool
__delitem__(arg2)
Parameters:arg2 (object) –
__getitem__(arg2)
Parameters:arg2 (object) –
Return type:object
__iter__()
Return type:object
__len__()
Return type:int
__setitem__(arg2, arg3)
Parameters:
  • arg2 (object) –
  • arg3 (object) –

MapConflictRegion

class MapConflictRegion
hostilityLevel
icon
levels
uid

MapConflictRegionList

class MapConflictRegionList
__contains__(arg2)
Parameters:arg2 (object) –
Return type:bool
__delitem__(arg2)
Parameters:arg2 (object) –
__getitem__(arg2)
Parameters:arg2 (object) –
Return type:object
__iter__()
Return type:object
__len__()
Return type:int
__setitem__(arg2, arg3)
Parameters:
  • arg2 (object) –
  • arg3 (object) –
append(arg2)
Parameters:arg2 (object) –
extend(arg2)
Parameters:arg2 (object) –

MapMarker

class MapMarker
entity
entityId
icon
name
position
sprite
updatePosition

PhysicsCollision

class PhysicsCollision
__setattr__(attr, value)

Changes an attribute of this PhysicsCollision

Parameters:
  • attr (str) – Attribute name
  • value (object) – Value for attribute
component
PhysicsComponent of the collision
shouldCollide
Marked true if collision should happen, false otherwise
slope
Slope value of collision

PhysicsComponentList

class PhysicsComponentList
__contains__(arg2)
Parameters:arg2 (object) –
Return type:bool
__delitem__(arg2)
Parameters:arg2 (object) –
__getitem__(arg2)
Parameters:arg2 (object) –
Return type:object
__iter__()
Return type:object
__len__()
Return type:int
__setitem__(arg2, arg3)
Parameters:
  • arg2 (object) –
  • arg3 (object) –
append(arg2)
Parameters:arg2 (object) –
extend(arg2)
Parameters:arg2 (object) –

PhysicsHandler

class PhysicsHandler
__setattr__(attr, value)

Changes an attribute of this PhysicsHandler

Parameters:
  • attr (str) – Attribute name
  • value (object) – Value for attribute
add(entity)

Adds entity to this PhysicsHandler

Parameters:entity (Entity) – Entity to add
getCollisionX(entityId, body)

Checks for collisions on the x axis of a body

Parameters:
  • entityId (int) – Id for entity that has the body
  • body (PhysicsComponent) – Physics body to test against:returns: Collision data from results
Return type:

PhysicsCollision

getCollisionX(entityId, body, area, direction, bodyWidth)

Checks for collisions on the x axis of a body in area

Parameters:
  • entityId (int) – Id for entity that has the body
  • body (PhysicsComponent) – Physics body to test against:param area: Coordinates to test within
  • area (Rect) –
  • direction (Direction) – Which way is the body Moving
  • bodyWidth (float) – Width of body
Returns:

Collision data from results

Return type:

PhysicsCollision

getCollisionY(entityId, component)

Checks for collisions on the y axis of a body

Parameters:
  • entityId (int) – Id for entity that has the body
  • component (PhysicsComponent) –
Return type:

PhysicsCollision

getCollisionY(entityId, body, area, direction, bodyWidth)

Checks for collisions on the y axis of a body in area

Parameters:
  • entityId (int) – Id for entity that has the body
  • body (PhysicsComponent) – Physics body to test against:param area: Coordinates to test within
  • area (Rect) –
  • direction (Direction) – Which way is the body Moving
  • bodyWidth (float) – Width of body
Returns:

Collision data from resutls

Return type:

PhysicsCollision

getTouching(body, direction)

Return a list of all physic bodies that touch body moved in direction

Parameters:
Return type:

PhysicsComponentList

isOnSlope(entity)

Checks if entity is on a slope

Parameters:entity (Entity) –
Returns:True if entity is colliding with a slope, false otherwise
Return type:bool
remove(entity)

Removes entity to this PhysicsHandler

Parameters:entity (Entity) – Entity to remove
separateSlope(physics, collision)

Adjust a physics body according to a collision with a slope

Parameters:
separateX(body1, body2)

Seperate two overlapping bodies on the x axis

Parameters:
Returns:

True if bodies no longer overlap on the x axis, false otherwise

Return type:

bool

separateY(body1, body2)

Seperate two overlapping bodies on the y axis

Parameters:
Returns:

True if bodies no longer overlap on the y axis, false otherwise

Return type:

bool

wakeNearby(area)

Awake all sleeping entities within area

Parameters:area (Rect) – Coordinates to search within

PlacementHandler

class PlacementHandler
__init__(game, realm)
Parameters:
calculatePosition(arg2, mousePos, entity)

Finds nearest valid new position based on mouse position, entity positions, and level structure

Parameters:
  • arg2 (Vector) –
  • mousePos (Entity) – Position of the mouse cursor
  • entity (bool) – The entity to use in the calculation
Returns:

Empty Vector if no valid positions, else new position

Return type:

Vector

checkPosition(arg2, result, neighbor, entity, x, y)

Checks the results of calculatePosition on entity and neighbor added to x,y.

Parameters:
  • arg2 (Vector) –
  • result (TileVector) – Result of caclulatePosition if SUCCESS is returned
  • neighbor (Entity) – Target TilePosition
  • entity (UnderwaterSupport) – The entity to use in the calculation
  • x (int) – Change in tile x coordinate
  • y (int) – Change in tile y coordinate
Returns:

HIT_SURFACE if a solid tile is found. CONTINUE is open space is found. SUCCESS if there is space

Return type:

DistributeResult

createPlacement(position, entity, isFlipped)

Convert an entity into a placed item

Parameters:
  • position (Vector) – Where to place new entity
  • entity (Entity) – Original entity to convert
  • isFlipped (bool) – Set to true to force flip render on x axis, false otherwise
Return type:

Entity

destroyPlacement(entity)

Create a new dropped entity and destroy current one

Parameters:entity (Entity) – Entity to convert
Returns:The new dropped entity
Return type:Entity
findSpace(arg2, content, realmArea, axisType)

Returns vector to available space near content in direction of axisType

Parameters:
Return type:

Vector

remove(entity)

Remove destroy method from an entity

Parameters:entity (Entity) – Entity to remove
onCreate
onDestroy

Realm

class Realm
__setattr__(attr, value)

Changes an attribute of this Realm

Parameters:
  • attr (str) – Attribute name
  • value (object) – Value for attribute
add(entity)

Adds an entity to this realm

Parameters:entity (Entity) – The entity to add
add(arg2, player)

Adds an player to this realm

Parameters:
  • arg2 (Player) –
  • player (bool) – The player to add
canPlaceItem(player, position)

Checks if the provided location is valid for the player to place an item at.

Parameters:
  • player (Player) – (Player) The player attempting to place the item.
  • position (Vector) – (Vector) The target position.
Return type:

bool

canPlaceTile(player, item, targetLayer, position)

Checks if the provided location is valid for the player to place a tile at.

Parameters:
  • player (Player) – (Player) The player attempting to place the tile.
  • item (Entity) – (Entity) The tile entity that the player is trying to use.
  • targetLayer (Layer) – (LayerType) The targeted layer.
  • position (Vector) – (Vector) The target position.
Return type:

bool

clear()

Removes all layers from this realm

getClosestPlayer(position)

Returns the closest player to position

Parameters:position (Vector) – Coordinates to search near
Return type:object
getCollectable(player, position)
Parameters:
Return type:

Entity

getHarvestable(player, position)
Parameters:
Return type:

Entity

getInteracted(player, position[, eventName='interact'])

Returns an entity that player can interact with at position

Parameters:
  • player (Player) – The player to use for the calculation
  • position (Vector) – The coordinates to search
  • eventName (str) –
Return type:

Entity

getInteracted(player, position, events)

Returns an entity that player can interact with at position

Parameters:
  • player (Player) – The player to use for the calculation
  • position (Vector) – The coordinates to search
  • events (StringList) – (StringList) The list of events to check for.
Return type:

Entity

getTargeted(player, position[, filter=None])

Returns an entity that can be targeted at position based on filter rules

Parameters:
  • player (Player) – The player to use for the calculation
  • position (Vector) – Coordinates to search
  • filter (object) –
Return type:

Entity

getValidPositionForEntity(entity, area[, onGround=True])

Attempts to find a valid position for the entity to be placed. Returns Vector(0, 0) if no position is found.

Parameters:
  • entity (Entity) – (Entity) The entity to search for.
  • area (TileRect) – (TileRect) The area to search within.
  • onGround (bool) – (bool) If set true then it ensures the entity is placed on top of a solid tile.
Return type:

Vector

isActive()

Returns true if there are any players in this realm, false otherwise

Return type:bool
remove(entity)

Removes an entity from this realm

Parameters:entity (Entity) – The entity to remove
remove(player)

Removes a player from this realm

Parameters:player (Player) – The player to remove
save(stream)

Save this realm to a stream

Parameters:stream (DataStream) – Where to write to
tearDown()
update(frameTime)

Update all sub systems in this realm

Parameters:frameTime (int) – elapsed time this frame
static create(arg1, arg2, arg3, game, uid, name, realmSize, groundLevel)

Creates a new realm according to parameters and returns it

Parameters:
  • arg1 (Game) –
  • arg2 (int) –
  • arg3 (str) –
  • game (object) – Which game the realm will be in
  • uid (RealmSize) – Unique identifier for this realm
  • name (WorldTime) – Text name for this realm
  • realmSize (int) – The size of this realm
  • groundLevel (dict) – The ground level value for this realm
Return type:

Realm

static load(game, path, time, stream)

Loads in a realm from a stream and returns it

Parameters:
  • game (Game) – Which game the realm will be in
  • path (object) – Path to realm save file
  • time (WorldTime) – Time from the world
  • stream (DataStream) – Where to read from
Return type:

Realm

automata
AutomataManager for this realm
biomeTracker
BiomeTracker for this realm
dropped
DroppedHandler for this realm
foliage
FoliageHandler for this realm
groundLevel
Position for ground level
layers
LayerManager for this realm
lighting
LightHandler for this realm
loader
RealmLoader for this realm
loopWidth
X coordinate for world wrap around
map
RealmMap for this realm
name
Text name for this realm
onCreateRemnaSpring
onPlayerEnter
onPlayerLeave
options
Python dictionary of options
path
Path to realm save file
physics
PhysicsHandler for this realm
placement
PlacementHandler for this realm
players
Players in this realm
remnaSpringRegions
remnaSpringTimer
size
Size of this realm
startArea
Start area value
startCrystal
Start crystal value
surfaceLevel
Position for surface level
uid
Unique identifier for this realm

RealmArea

class RealmArea
__init__(area[, onSurface=False[, isUnderground=False[, allowLooping=True]]])
Parameters:
  • area (Rect) –
  • onSurface (bool) –
  • isUnderground (bool) –
  • allowLooping (bool) –
__setattr__(attr, value)

Changes an attribute of this RealmArea

Parameters:
  • attr (str) – Attribute name
  • value (object) – Value for attribute
randomDistribute(biometracker, callback, max)

Randomly use callback function over this RealmArea

Parameters:
  • biometracker (BiomeTracker) – Level data to effect
  • callback (object) – Function to call randomly
  • max (int) – Maximum times to call callback
area
Coordinates of this RealmArea
isUnderground
Set to true is underground, false otherwise
onSurface
Set to true if on surface, false otherwise

RealmInfo

class RealmInfo
__setattr__(attr, value)

Changes an attribute of this BiomeBackground

Parameters:
  • attr (str) – Attribute name
  • value (object) – Value for attribute
unpack(stream)

Reads data from a stream

Parameters:stream (DataStream) – Where to read from
static pack(realm, stream)

Writes data from realm to the stream

Parameters:
groundLevel
Position for groundLevel
name
The name of this RealmInfo
options
Dictionary of options for this RealmInfo
path
The path to the realm on disk
regions
Number of vertical regions inside the realm.
size
Coordinates for this RealmInfo size
startArea
Coordinates for the start area
uid
The unique identifier for this RealmInfo

RealmInfoList

class RealmInfoList
__contains__(arg2)
Parameters:arg2 (object) –
Return type:bool
__delitem__(arg2)
Parameters:arg2 (object) –
__getitem__(arg2)
Parameters:arg2 (object) –
Return type:object
__iter__()
Return type:object
__len__()
Return type:int
__setitem__(arg2, arg3)
Parameters:
  • arg2 (object) –
  • arg3 (object) –
append(arg2)
Parameters:arg2 (object) –
extend(arg2)
Parameters:arg2 (object) –

RealmMap

class RealmMap
addMarker(arg2, arg3, arg4, arg5)
Parameters:
  • arg2 (str) –
  • arg3 (Entity) –
  • arg4 (str) –
  • arg5 (bool) –
addMarker(arg2, arg3, arg4, arg5)
Parameters:
  • arg2 (str) –
  • arg3 (str) –
  • arg4 (str) –
  • arg5 (Vector) –
getMarkerAtPosition(arg2)
Parameters:arg2 (Vector) –
Return type:MapMarker
moveFullscreen(arg2, arg3)
Parameters:
  • arg2 (float) –
  • arg3 (float) –
removeMarker(arg2, arg3)
Parameters:
  • arg2 (str) –
  • arg3 (Entity) –
removeMarker(arg2, arg3)
Parameters:
  • arg2 (str) –
  • arg3 (str) –
setOriginToPosition(arg2)
Parameters:arg2 (Vector) –
updateMarkerPosition(arg2, arg3, arg4)
Parameters:
  • arg2 (str) –
  • arg3 (str) –
  • arg4 (Vector) –
zoomIn()
Return type:bool
zoomOut()
Return type:bool
conflictRegions
isVisible
origin
position

RealmSize

class RealmSize
__init__(arg2, arg3)
Parameters:
getRegionId(arg2)

Gets the regionId for a given Vector position

Parameters:arg2 (Vector) –
Return type:int
getRegionId(arg2)

Gets the regionId for a given TileVector position

Parameters:arg2 (TileVector) –
Return type:int
getRegionTilePosition(arg2)

Gets the tile position of the region given a region id.

Parameters:arg2 (int) –
Return type:TileVector
getSegmentId(arg2)

Gets the segmentId for a given Vector position

Parameters:arg2 (Vector) –
Return type:int
getSegmentId(arg2)

Gets the segmentId for a given TileVector position

Parameters:arg2 (TileVector) –
Return type:int
getSegmentTilePosition(arg2)

Gets the tile position of the segment given a segment id.

Parameters:arg2 (int) –
Return type:TileVector
getValidRegionId(arg2)

Gets the valid region id by looping it around the world seam.

Parameters:arg2 (int) –
Return type:int
isTileValid(arg2, arg3)

Checks if the given tile coordinates are within the bounds of the realm

Parameters:
  • arg2 (int) –
  • arg3 (int) –
Return type:

bool

isValid(arg2)

Checks if a given tile position is within the bounds of the realm

Parameters:arg2 (TileVector) –
Return type:bool
chunkCount
Number of segments in the current realm
chunkHeight
Height of the realm in segments
chunkWidth
Width of the realm in segments
halfHeight
Half the height of realm in pixels
halfWidth
Half the width of realm in pixels
height
Height of realm in pixels
loopTileWidth
Loop tile width of world
loopWidth
Loop width of world
regionCount
Number of regions in the current realm
regionHeight
Height of the realm in regions
regionWidth
Width of the realm in regions
segmentCount
Number of segments in the current realm
segmentHeight
Height of the realm in segments
segmentWidth
Width of the realm in segments
size
Size of realm in pixels
subtileCount
Number of subtiles in the realm
subtileHeight
Height of realm in subtiles
subtileWidth
Width of realm in subtiles
tileCount
Number of tiles in the realm
tileHeight
Height of realm in tiles
tileWidth
Width of realm in tiles
width
Width of realm in pixels

TileList

class TileList
__contains__(arg2)
Parameters:arg2 (object) –
Return type:bool
__delitem__(arg2)
Parameters:arg2 (object) –
__getitem__(arg2)
Parameters:arg2 (object) –
Return type:object
__iter__()
Return type:object
__len__()
Return type:int
__setitem__(arg2, arg3)
Parameters:
  • arg2 (object) –
  • arg3 (object) –
append(arg2)
Parameters:arg2 (object) –
extend(arg2)
Parameters:arg2 (object) –

AutomataManager

class AutomataManager
__setattr__(attr, value)

Changes an attribute of this BiomeBackground

Parameters:
  • attr (str) – Attribute name
  • value (object) – Value for attribute
activateCells(area)

Mark all cells within area as active

Parameters:area (Rect) – Coordinates to search
activateCells(area)

Mark all cells within area as active

Parameters:area (PixelRect) – Coordinates to search
clearNode(x, y)

Remove cell and sub cells from simulation

Parameters:
  • x (int) – X coordinate for search
  • y (int) – Y coordinate for search
findCells(area, cellType, requiresFull)

Return a list of cells that are within area

Parameters:
  • area (Rect) – Coordinates to search
  • cellType (CellType) – The Cell::Type the cell must be to match
  • requiresFull (bool) – If true the cell must be full to match
Return type:

TileVectorSet

findCells(area, cellType, requiresFull)

Return a list of cells that are within area

Parameters:
  • area (PixelRect) – Coordinates to search
  • cellType (CellType) – The Cell::Type the cell must be to match
  • requiresFull (bool) – If true the cell must be full to match
Return type:

TileVectorSet

getActiveCount()

Return the number of active cells

Return type:int
getCell(position)

Return the first matching cell from this simulation

Parameters:position (Vector) – The coordinates for the search
Returns:Matching cell if found or an empty AutomataCell if not found
Return type:AutomataCell
getCells(area)

Return a list of cells that are within area

Parameters:area (Rect) – Coordinates to search
Return type:CellList
getCells(area)

Return a list of cells that are within area

Parameters:area (PixelRect) – Coordinates to search
Return type:CellList
isSettled()

Returns true if active count is 0

Return type:bool
setCell(x, y, cell)

Adds a cell to the simulation and activates it

Parameters:
  • x (int) – X coordinate of cell
  • y (int) – Y coordinate of cell
  • cell (AutomataCell) – Cell to add
setCell(position, cell)

Adds a cell to the simulation and activates it

Parameters:
simulate()

Run one step of simulation

activeCells
skippedCells
FILE_VERSION = 2

Subsystem)

Subsystem)

Subsystem)

Subsystem)