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 |
|---|---|---|
bool | ghosted | false |
int | id | 0 |
bool | locked | false |
String | name | "" |
int | parent_id | 0 |
Color | tint | Color(1, 1, 1, 1) |
bool | variant | false |
bool | visible | true |
Methods
| Returns | Method |
|---|---|
bool | is_ghosted_recursively(map: HammeriteMap = null) |
bool | is_locked_recursively(map: HammeriteMap = null) |
bool | is_visible_recursively(map: HammeriteMap = null) |
void | request_delete() |
Signals
delete_requested
signal delete_requested()
Has the map remove this layer (HammeriteMap.remove_layer()); request_delete() emits it.
ghosted_changed
signal ghosted_changed(ghosted: bool)
Emitted when ghosted changes.
locked_changed
signal locked_changed(locked: bool)
Emitted when locked changes.
name_changed
signal name_changed(new_name: String)
Emitted when name changes.
parent_changed
signal parent_changed(parent_id: int)
Emitted when parent_id changes; not when it is set to the value it had.
tint_changed
signal tint_changed(tint: Color)
Emitted when tint changes.
variant_changed
signal variant_changed(variant: bool)
Emitted when variant changes; not when it is set to the value it had.
visibility_changed
signal visibility_changed(visible: bool)
Emitted when visible changes.
Property descriptions
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()).
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.
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.
name
var name: String = ""
Shown in the layer list, and how HammeriteMap.find_variant() finds a variant. Separate from Resource.resource_name.
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.
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.
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()).
Method descriptions
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_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_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.
request_delete()
func request_delete() -> void
Have the map this layer is in remove it, as HammeriteBrush.request_delete() does a brush.