Skip to content

LayerApi

Offers methods for adding/ removing user layers.

Description

The LayerApi offers methods for adding and removing user layers. It's important to note the internal methods used are not officially supported by Dungeondraft and the Api will likely be superseded by Dungeondraft core Api in the future.

Methods

void add_layer ( int layer, String name )
void add_layers ( Dictionary layers )
Dictionary get_layers ( Level level )
Dictionary get_user_layers ( Level level )
void remove_layer ( int layer )
void remove_layers ( Array layers )
void rename_layer ( int layer, String name )

Constants

Dictionary LOCKED_LAYERS {-500: "Terrain",-300: "Caves",-200: "Floor",0: "Water",500: "Portals",600: "Walls",800: "Roofs"}

Method Descriptions

void add_layer ( int layer, String name ):
Shorthand for adding a single layer via add_layers.

void add_layers ( Dictionary layers ):
Adds the layers provided in layers where the keys are the z_index and the values are the layer names. When specifiying level the layers will only be added to that specific Level.

void remove_layer ( int layer ):
Shorthand for removing a single layer via remove_layers.

void remove_layers ( Array layers ):
Removes the layers provided in layers by their z_index. When specifiying level the layers will only be removed from that specific Level.

void rename_layer ( int layer, String name ):
Renames layer layer to name. When specifiying level the layer will only be renamed in that specific Level.

Dictionary get_layers ( Level level ):
Gets all layers in level.

Dictionary get_user_layers ( Level level ):
Gets all user (= non-locked) layers in level.