siege.worldgen

FillMode

class FillMode
ALL = siege.worldgen.FillMode.ALL
OPEN_ONLY = siege.worldgen.FillMode.OPEN_ONLY
SOLID_ONLY = siege.worldgen.FillMode.SOLID_ONLY

TileDirection

class TileDirection
Bottom = siege.worldgen.TileDirection.Bottom
BottomLeft = siege.worldgen.TileDirection.BottomLeft
BottomRight = siege.worldgen.TileDirection.BottomRight
Left = siege.worldgen.TileDirection.Left
Right = siege.worldgen.TileDirection.Right
Top = siege.worldgen.TileDirection.Top
TopLeft = siege.worldgen.TileDirection.TopLeft
TopRight = siege.worldgen.TileDirection.TopRight

Biome

class Biome
__repr__()

Returns a printable representation of this object.

Return type:str
getActions()

Returns a Python list

Return type:list
getFinalActions()

Returns a Python list

Return type:list
getOccurrences(realmSize)

Returns a Range of ints from 0 to 9999

Parameters:realmSize (RealmSize) – A RealmSize
Return type:RangeUint
getPostActions()

Returns a Python list

Return type:list
getRules()

Returns a Python dictionary

Return type:dict
getStamps(remainingSpace)

Returns a Python list

Parameters:remainingSpace (int) – Has no use
Return type:list
isCompatible(arg2, biome)

True if biome is marked compatible, false otherwise

Parameters:
  • arg2 (Biome) –
  • biome (int) – The next biome to be added.
Return type:

bool

reset(area)

Currently has no effect

Parameters:area (TileRect) – A TileRect
back1
First background layer for parallax scrolling.
back2
Second background layer for parallax scrolling.
back3
Third background layer for parallax scrolling.
back4
Fourth background layer for parallax scrolling.
crystalIcon
The icon used on the travel UI to represent this biome.
frequency
How often this Biome will occur
height
Height of the Biome in stamps
layer
The Layer name
name
The name of the Biome
sky
Name of the sky
width
Width of the Biome in stamps
widthIncrement
Number of tiles in a single stamp for this biome.

BoolStamp

class BoolStamp
__init__(imagePath, allowFlipX, allowFlipY)
Parameters:
  • imagePath (str) –
  • allowFlipX (bool) –
  • allowFlipY (bool) –
canFlipX()

Set to true to allow flipping image on x axis

Return type:bool
canFlipY()

Set to true to allow flipping image on y axis

Return type:bool
get(x, y, size, flipX, flipY)

Returns boolean value at x,y based on size

Parameters:
  • x (int) – X coordinate
  • y (int) – Y coordinate
  • size (TileVector) – TileVector to scale by
  • flipX (bool) – Set to true to flip on X axis
  • flipY (bool) – Set to true to flip on Y axis
Return type:

bool

ColorStamp

class ColorStamp
__init__( imagePath, allowFlipX, allowFlipY]])
Parameters:
  • imagePath (str) –
  • allowFlipX (bool) –
  • allowFlipY]] (bool) –
__setattr__(attr, value)

Changes an attribute of this ColorStamp

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

Set to true to allow flipping image on x axis

Return type:bool
canFlipY()

Set to true to allow flipping image on y axis

Return type:bool
forceFlipX()

Return true if forced flipping is active, false otherwise

Return type:bool
get(x, y, size, flipX, flipY)

Returns color value at x,y based on size

Parameters:
  • x (int) – X coordinate
  • y (int) – Y coordinate
  • size (TileVector) – TileVector to scale by
  • flipX (bool) – Set to true to flip on X axis
  • flipY (bool) – Set to true to flip on Y axis
Return type:

int

getColor(color)

If color is present in ColorMap return color value

Parameters:color (int) – Color
Return type:TileVectorList
getSimple(x, y, flipX, flipY)

Returns color value at x,y

Parameters:
  • x (int) – X coordinate
  • y (int) – Y coordinate
  • flipX (bool) – Set to true to flip on X axis
  • flipY (bool) –
Return type:

int

getSize()

Returns a TileVector of the size of the ColorMap

Return type:TileVector
has(color)

Returns true if color is in this ColorStamp

Parameters:color (int) – Color to search for
Returns:A TileVectorList of the color
Return type:bool
setForceFlipX(flipX)

Changes force flipping behavior

Parameters:flipX (bool) – Set to true to force flip the image on the x axis
image

Terraform

class Terraform
__init__(game, world)
Parameters:
static applySimpleStamp(stamp, position, rules, flipX, flipY, ground, wall, automata)

Change all tiles under area according to the stamp pattern

The dictionary is keyed with StampColor The dictionary’s value is a tuple with (groundId, wallId) or (groundId, wallId, foliageGroundId, foliageWallId) If groundId or wallId is 1, the tile will not be replaced If groundId or wallId is 0, the tile will be deleted If foliageGroundId or foliageWallId is 0, no foliage will be placed:param flipX: Set to true to force flip stamp on x axis

param stamp:Pattern to use
type stamp:ColorStamp
param position:Target for change
type position:TileVector
param rules:Python dictionary of rules for changes
type rules:dict
param flipX:
type flipX:bool
param flipY:Set to true to force flip stamp on y axis
type flipY:bool
param ground:Ground layer to be changed
type ground:TileLayer
param wall:Wall layer to be changed
type wall:TileLayer
param automata:An instance of AutomataManager
type automata:AutomataManager
static fillGrassFoliage(realm, layerType, foliage, area)

Cover the provided area with the grass foliage. Only applied to compatible tiles that have an exposed side.

Parameters:
static fillTiles(layer, area, tileId, fillMode)

Change all tiles under area to tiles of tileId

Parameters:
  • layer (TileLayer) – Layer to change tiles in
  • area (TileRect) – Coordinates to change
  • tileId (int) – Id to change to tiles to
  • fillMode (FillMode) – Set to ALL to change any tiles. Set to OPEN_ONLY to change only open tiles. Set to SOLID_ONLY to change only solid tiles.
static overlapsSurface(startX, y, width, threshold, realmSize)

Returns true if surface overlaps threshold tolerance, false otherwise

Parameters:
  • startX (int) – Starting x coordinate of surface
  • y (int) – Y coordinate of surface
  • width (int) – Width of surface
  • threshold (list) – List of values from a populateAreaEmptyThreshold call
  • realmSize (RealmSize) –
Return type:

bool

static placeFoliage(arg1, area, layer, fillMode, stamp)

Change all foliage under area according to the stamp pattern

Parameters:
  • arg1 (int) –
  • area (TileRect) – Coordinates to change
  • layer (TileLayer) – Layer to change tiles in
  • fillMode (FillMode) – Set to ALL to change any tiles. Set to OPEN_ONLY to change only open tiles. Set to SOLID_ONLY to change only solid tiles.
  • stamp (BoolStamp) – Pattern image to follow
static placeTiles(arg1, area, layer, fillMode, stamp)

Change all tiles under area according to the stamp pattern

Parameters:
  • arg1 (int) –
  • area (TileRect) – Coordinates to change
  • layer (TileLayer) – Layer to change tiles in
  • fillMode (FillMode) – Set to ALL to change any tiles. Set to OPEN_ONLY to change only open tiles. Set to SOLID_ONLY to change only solid tiles.
  • stamp (BoolStamp) – Pattern image to follow
static populateAreaEmptyThreshold(layer, area, tolerance, threshold)

After calling Threshold stores a dictionary of x values mapped to their y values added to the threshold

Parameters:
  • layer (TileLayer) – What layer area is inside
  • area (TileRect) – Dimensions to change
  • tolerance (int) – How deep to dig
  • threshold (list) –
static populateMapAutomataData(realm, data)

Populate a realm using automata, storing values in data

Parameters:
  • realm (Realm) – Which realm to target
  • data (list) – Where to store results
static populateMapData(realm, data, colors)

Fill a list of color data from target realm

Parameters:
  • realm (Realm) – Which realm to target
  • data (list) – Python list to fill with data
  • colors (dict) – Python dictionary of colors
static replaceTiles(realm, layerType, area, tiles)

Goes through area and replaces tiles according to tile mapping with dithering.

Parameters:
  • realm (Realm) – Realm that will be changed.
  • layerType (Layer) – Layer that will be changed (Layer.Ground, Layer.Wall, or Layer.WallAndGround).
  • area (TileRect) – Area of layer to replace tiles within.
  • tiles (dict) – (dict) Mapping of existing tile ids to new tile ids.
static replaceTilesDither(realm, layerType, area, direction, startPosition, endPosition, tiles)

Goes through area and replaces tiles according to tile mapping.

Parameters:
  • realm (Realm) – Realm that will be changed.
  • layerType (Layer) – Layer that will be changed (Layer.Ground, Layer.Wall, or Layer.WallAndGround).
  • area (TileRect) – Area of layer to replace tiles within.
  • direction (TileDirection) – (Tile:class:`Direction`) Direction of source moving from this origin.
  • startPosition (int) –
  • endPosition (int) –
  • tiles (dict) – (dict) Mapping of existing tile ids to new tile ids.
static stampGrassFoliage(realm, layerType, foliage, foliageSupport, area, stamp)

Cover the provided area with the grass foliage. Only applied to compatible tiles that have an exposed side.

Parameters:
  • realm (Realm) – Realm that will be changed.
  • layerType (Layer) – Layer that will be changed (Layer.Ground, Layer.Wall).
  • foliage (FoliageComponent) – The grass foliage to fill this area with.
  • foliageSupport (int) – The support foliage content id.
  • area (TileRect) – Area of layer to replace tiles within.
  • stamp (BoolStamp) – Pattern image to follow