siege.world

PlayerList

class PlayerList
__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) –

RealmList

class RealmList
__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) –

RealmLoader

class RealmLoader
getLoadedRegions()

Returns a Python list of all currently loaded regions

Return type:list
getSegments(arg2)
Parameters:arg2 (int) –
Return type:SegmentList
isRegionLoaded(arg2)
Parameters:arg2 (int) –
Return type:bool
isSaving()
Return type:bool
loadRegions([callback=None])

Load all regions in this realm and set call back if necessary

Parameters:callback (object) – Function to set as realm loaded callback
saveRegion( [shouldUnload=False, asynchronous)

Saves a region to the file system

Parameters:
  • shouldUnload (int) – Set to true force unloading of region before saving, false otherwise
  • asynchronous (bool) – Set to true to force asynchronous file writing, false otherwise
saveRegions(asynchronous)

Save all regions in this realm to the file system

Parameters:asynchronous (bool) – Set to true to force asynchronous file writing, false otherwise
unloadRegion(region)

Unloads region, saves region and game

Parameters:region (int) – Id of the region to unload
update(arg2)
Parameters:arg2 (int) –
updateRegion(region, handler)

Reloads a region

Parameters:
updateSaving()
onRegionLoad
Event for region loading
onRegionUnload
Event for region unloading

SegmentList

class SegmentList
__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) –

World

class World
__setattr__(attr, value)

Changes an attribute of this World

Parameters:
  • attr (str) – Attribute name
  • value (object) – Value for attribute
addPlayerDataHandlers(name, reader, writer)

Sets player reader and writer functions to parameters

Parameters:
  • name (str) – Text name for functions
  • reader (object) – Reading function
  • writer (object) – Writing function
createRealm(name, size, groundLevel, options)

Creates a new realm in this world

Parameters:
  • name (str) – Text name for the new realm
  • size (TileVector) – Dimensions for the new realm
  • groundLevel (int) – Ground level value for the new realm
  • options (dict) – Python dictionary of options for realm creation
Return type:

Realm

finishSaving()

Finishes any current saving and disables asynchronous saving.

getMousePosition()

Returns mouse pointer coordinates

Return type:Vector
getPlayer()

Returns a single player

Return type:Player
getPlayer(client)

Returns target client from this world

Parameters:client (NetworkId) – Player to search for
Return type:Player
getPlayer(uid)

Returns target player with the matching UID for this world

Parameters:uid (int) – The player’s uid to retrieve.
Return type:Player
getPlayer(entity)

Returns target entity from this world

Parameters:entity (Entity) – Player to search for
Return type:Player
getPlayers()

Return a list of all players in this world

Return type:PlayerList
getPositionFromWorld(arg2)

Gets the screen position from the provided world position.

Parameters:arg2 (Vector) –
Return type:PixelVector
getRealm()

Return the realm single player is in

Return type:Realm
getRealm(uid)

Return target realm in this world

Parameters:uid (int) – Unique identifier for target realm
Return type:Realm
getRealm(name)

Return target realm in this world

Parameters:name (str) – Text name for target realm
Return type:Realm
getRealms()

Return a list of all realms in this world

Return type:RealmList
isActivePlayer(arg2)

Return True if provided player is the main player otherwise false.

Parameters:arg2 (Player) –
Return type:bool
isActivePlayer(arg2)

Return True if provided entity is the main player otherwise false.

Parameters:arg2 (Entity) –
Return type:bool
isInitialized()

Returns True if the world is fully initialized and ready for full use otherwise False.

Return type:bool
loadComplete()

Handle completion of a world load

move(entity, realmUid, layer)

Removes entity from current realm and puts into a new one

Parameters:
  • entity (Entity) – Target entity to move
  • realmUid (int) – Unique identifier for target realm
  • layer (Layer) – Layer to place entity into
move(entity, realm, layer)

Removes entity from current realm and puts into a new one

Parameters:
  • entity (Entity) – Target entity to move
  • realm (Realm) – new realm for entity
  • layer (Layer) – Layer to place entity into
move(player, realm)

Removes player from current realm and puts into a new one

Parameters:
  • player (Player) – Target player to move
  • realm (Realm) – new realm for entity
requestRegion(player, realm, position, callback)

Loads the area around the position for the provided player and once available calls the callback.

Parameters:
  • player (Player) – Player that needs the tile segments
  • realm (Realm) – Target realm to search
  • position (Vector) – Coordinates to load the area around
  • callback (object) – Callback that is called once area is available. Signature takes no additional arguments.
save([asynchronous=True[, isExiting=False]])

Save this world to the file system

Parameters:
  • asynchronous (bool) – Set to true to force asynchronous file writing, false otherwise
  • isExiting (bool) – Flag which should be set to true if the game is exiting immediately after this save.
saveCharacter(arg2, arg3)
Parameters:
setPlayersHomePoint(player, realm, position)

Set players home position and realm

Parameters:
  • player (Player) – Which player to change
  • realm (Realm) – Which realm will be home
  • position (Vector) – Which position will be home
update(frameTime)

Update all player and loaded realms in this world

Parameters:frameTime (int) – Elapsed time this frame
static create(game, name, size[, seed=0[, hasServerSideCharacters=False]])

Creates a new World instance.

Parameters:
  • game (Game) – The game this world belongs in
  • name (str) – Text name for this world
  • size (TileVector) – Dimensions of this world
  • seed (int) – Random number seed for this world
  • hasServerSideCharacters (bool) –
Return type:

World

static get()

Retrieves the current World instance.

Return type:World
static join(game, uid, name, realmInfos[, hasServerSideCharacters=False])

Add all realms from realmInfos to this world

Parameters:
  • game (Game) – The game this world belongs in
  • uid (int) – Unique identifier for this world
  • name (str) – Text name for this world
  • realmInfos (RealmInfoList) – List of realms to add
  • hasServerSideCharacters (bool) – Option to enforce characters to be created and saved on the server side.
Return type:

World

static load(game, path)

Load the world from the provided file at path

Parameters:
  • game (Game) – The game this world belongs in
  • path (object) – Path to save file
Return type:

World

static reset()

Clear all sub systems and realms in this world

CONTENT_FILE_VERSION
DATA_FILE_VERSION
data
(dict) Container for miscellaneous world data.
hasServerSideCharacters
Tracks if characters are saved on the server side
name
Text name of this world
path
Path to save file
player
Player data
playerData
Data for which world and realm players are in
players
PlayerList of all players
playtime
Tracks playtime in seconds
realm
Returns current realm
remnaLevel
Worlds current remna level
time
uid
Unique identifier for this world

WorldInfo

class WorldInfo
load(worldPath)

Reads the world information stored at <path>/info.

Parameters:worldPath (object) – (str) The world path.
packagesAvailable(contentStash)

Returns true if all enabled packages are available in content stash otherwise false.

Parameters:contentStash (ContentStash) –
Return type:bool
save(path, asynchronous)

Saves the world information to disk.

Parameters:
  • path (object) – (Path) The path of the world.
  • asynchronous (bool) –
static saveWorld(world, asynchronous)

Saves the world information to disk.

Parameters:
  • world (World) – The world to save information about.
  • asynchronous (bool) – Whether the save should be asynchronous or not.
FILE_VERSION
hasServerSideCharacters
Tracks if characters are saved on the server side
name
The name of the world.
packages
The packages state for the world.
playtime
The playtime for the world.
realms
(RealmInfoList) List of all RealmInfo saved for the world.
uid
The unique identifier for the world.

WorldPlayerData

class WorldPlayerData
__setattr__(arg2, arg3)
Parameters:
  • arg2 (str) –
  • arg3 (object) –
homePoint
homeRealm
position
realmUid

WorldPlayerDataList

class WorldPlayerDataList
__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) –

WorldTime

class WorldTime
getAmbientColor(hour)

Gets the ambient light color for the provided time.

Parameters:hour (int) – (Int32) The time for the desired color.
Return type:Color
getBackgroundColor(hour)

Gets the background color for the provided time.

Parameters:hour (int) – (Int32) The time’s hour to get the background for.
Return type:Color
getHour()

Gets the current hour. Will return realm set time if defined.

Return type:int
getMinutes()

Gets the current minutes in the hour. Returns 0 if realm has a set time.

Return type:int
getNextHour()

Gets the next hour. Will use realm set time if defined.

Return type:int
handleResize(width, height)

Recreate rendering context for window resize

Parameters:
  • width (int) – New width
  • height (int) – New height
isDaytime()

Returns true if hour > 4 and hour < 19, false otherwise

Return type:bool
isNight()

Returns true if hour <= 4 and hour >= 19, false otherwise

Return type:bool
setSkyImage(path, transitionTime)

Set the sky image to one at path

Parameters:
  • path (str) – Path to image file
  • transitionTime (int) – Time in milliseconds until sky changes
days
Elapsed time in days
hours
Elapsed time hours
minutes
Elapsed time in minutes
seconds
Elapsed time in milliseconds
HOURS_IN_DAY = 24
MINUTES_IN_HOUR = 60
TIME_IN_MINUTE = 1000