HammeriteLayer
Core: the map. Inherits Resource
A named, nestable group of brushes, entities and prefab instances that are shown, ghosted, hidden or locked together - and, optionally, a variant of the map.
Layers live in HammeriteMap.layers, and what is on one names it by its layer_id. The flags here are this layer's own setting; what a layer inside others actually is comes from the is_*_recursively methods. Layer 0 is the map's default layer and always exists. Make one with HammeriteMap.gen_layer() and add it with HammeriteMap.add_layer().
Properties
| Type | Name | Default |
|---|---|---|
int | id | 0 |
int | parent_id | 0 |
String | name | |
bool | visible | true |
bool | ghosted | false |
bool | locked | false |
Color | tint | Color(1, 1, 1, 1) |
bool | variant | false |
Methods
| Returns | Method |
|---|---|
void | set_visible(value: bool) |
bool | is_visible() |
void | set_ghosted(value: bool) |
bool | is_ghosted() |
void | set_locked(value: bool) |
bool | is_locked() |
void | set_tint(value: Color) |
Color | get_tint() |
void | set_parent_id(value: int) |
int | get_parent_id() |
void | set_variant(value: bool) |
bool | is_variant() |
void | request_delete() |
bool | is_locked_recursively(map: HammeriteMap = null) |
bool | is_ghosted_recursively(map: HammeriteMap = null) |
bool | is_visible_recursively(map: HammeriteMap = null) |
Signals
delete_requested
signal delete_requested()
Has the map remove this layer (HammeriteMap.remove_layer()); request_delete() emits it.
name_changed
signal name_changed(new_name: String)
Emitted when name changes.
visibility_changed
signal visibility_changed(visible: bool)
Emitted when visible changes.
ghosted_changed
signal ghosted_changed(ghosted: bool)
Emitted when ghosted changes.
locked_changed
signal locked_changed(locked: bool)
Emitted when locked changes.
tint_changed
signal tint_changed(tint: Color)
Emitted when tint changes.
parent_changed
signal parent_changed(parent_id: int)
Emitted when parent_id changes; not when it is set to the value it had.
variant_changed
signal variant_changed(variant: bool)
Emitted when variant changes; not when it is set to the value it had.
Property descriptions
id
var id: int = 0
Unique within the map, and what brushes, entities and instances name as their layer. 0 is the map's default layer. Set before HammeriteMap.add_layer(); once the layer is in a map a change is refused, since everything on it names the old one.
parent_id
var parent_id: int = 0
The layer this one sits inside, or 0 for the top level. In a map, a parent that is this layer or one inside it is refused with an error, and a change re-applies ghosting and can recompile the world, when it moves something into or out of a variant.
name
var name: String
Shown in the layer list, and how HammeriteMap.find_variant() finds a variant. Separate from Resource.resource_name.
visible
var visible: bool = true
This layer's own visibility in the editor's views; whether it actually shows depends on the layers above it too (is_visible_recursively()).
ghosted
var ghosted: bool = false
Drawn see-through in the editor. Spreads to the layers inside it (is_ghosted_recursively()); the map puts it onto the brushes when it changes (HammeriteMap.apply_layer_ghosting()).
locked
var locked: bool = false
Whether the editor keeps this layer's contents from being edited. Spreads to the layers inside it (is_locked_recursively()). Only the editor reads it: a game's own code may change a locked layer's contents.
tint
var tint: Color = Color(1, 1, 1, 1)
The colour the editor's 2D views draw this layer's brushes in. Not inherited by the layers inside it.
variant
var variant: bool = false
Whether this layer is a variant of the map: what is on it, and on the layers inside it, exists only while it is the active variant or inside the one that is, and each variant is baked on its own.
Method descriptions
set_visible()
func set_visible(value: bool) -> void
Setter for visible; emits visibility_changed if it changed.
is_visible()
func is_visible() -> bool
Getter for visible: this layer's own setting, not is_visible_recursively().
set_ghosted()
func set_ghosted(value: bool) -> void
Setter for ghosted; emits ghosted_changed if it changed.
is_ghosted()
func is_ghosted() -> bool
Getter for ghosted: this layer's own setting, not is_ghosted_recursively().
set_locked()
func set_locked(value: bool) -> void
Setter for locked; emits locked_changed if it changed.
is_locked()
func is_locked() -> bool
Getter for locked: this layer's own setting, not is_locked_recursively().
set_tint()
func set_tint(value: Color) -> void
Setter for tint; emits tint_changed if it changed.
get_tint()
func get_tint() -> Color
Getter for tint.
set_parent_id()
func set_parent_id(value: int) -> void
Setter for parent_id; emits parent_changed if it changed.
get_parent_id()
func get_parent_id() -> int
Getter for parent_id.
set_variant()
func set_variant(value: bool) -> void
Setter for variant; emits variant_changed if it changed.
is_variant()
func is_variant() -> bool
Getter for variant.
request_delete()
func request_delete() -> void
Have the map this layer is in remove it, as HammeriteBrush.request_delete() does a brush.
is_locked_recursively()
func is_locked_recursively(map: HammeriteMap = null) -> bool
Whether this layer is locked, by its own setting or by sitting inside one that is. Its parents are looked up in map, or in the map it has been added to when that is null.
is_ghosted_recursively()
func is_ghosted_recursively(map: HammeriteMap = null) -> bool
Whether this layer is ghosted, by its own setting or by sitting inside one that is. The same shape as is_locked_recursively() and the opposite of is_visible_recursively(): ghosting and locking spread DOWN from a parent - a child of a ghosted layer is ghosted whatever it says about itself - while visibility needs every layer above it to agree.
is_visible_recursively()
func is_visible_recursively(map: HammeriteMap = null) -> bool
Whether this layer shows: it and every layer it sits inside are visible. Its parents are looked up as is_locked_recursively() says.