HammeriteReferences
Core: files, names and extension. Inherits RefCounted
What a map names that lives outside it - a texture, a model, a sound, a scene somebody plays out - and who provided each one when the map was saved (#86).
A property says it names a thing of some KIND (declare_entity_property() and its face twin; a brush property says so on its def, HammeriteBrushPropertyDef.set_reference()). Hammerite knows a few kinds of its own and nothing of what the rest mean: the game answers who provides a name through set_resolver(). A kind nobody answers for counts as the game's own (base()), and is warned of once. record() writes the answers into HammeriteMap.references whenever the map is saved - HammeriteDataFile.write() does it - and check() asks again after it is loaded. What changed in between is reported, never acted on: whether a missing sound is a warning or a reason to refuse the map is the game's call.
Methods
| Returns | Method |
|---|---|
String | base() static |
HammeriteReferenceChange[] | check(map: HammeriteMap) static |
Dictionary[StringName, PackedStringArray] | collect(map: HammeriteMap) static |
StringName | decal() static |
void | declare_brush_property(key: StringName, kind: StringName, list: bool = false) static |
void | declare_entity_property(entity_type: StringName, property: StringName, kind: StringName, list: bool = false) static |
void | declare_face_property(key: StringName, kind: StringName, list: bool = false) static |
StringName | entity_class() static |
StringName | model() static |
Dictionary | provided_by(provider: String, version: String = "") static |
Dictionary | provided_if(present: bool) static |
void | record(map: HammeriteMap) static |
void | reset_resolvers() static |
Dictionary | resolve(kind: StringName, name: String) static |
void | set_resolver(kind: StringName, resolver: Callable) static |
StringName | texture() static |
void | undeclare_brush_property(key: StringName) static |
void | undeclare_entity_property(entity_type: StringName, property: StringName) static |
void | undeclare_face_property(key: StringName) static |
Method descriptions
base()
static func base() -> String
Who provides whatever the game itself ships.
check()
static func check(map: HammeriteMap) -> HammeriteReferenceChange[]
What is different about what map uses since it was saved: a name nothing provides any more, one someone else provides now, or one whose provider has a new version. Every name it uses now is checked, and every one recorded when it was saved, so a name added since, or a map never recorded, is still checked for what is missing.
collect()
static func collect(map: HammeriteMap) -> Dictionary[StringName, PackedStringArray]
Every name map uses, by kind, each once and in order.
decal()
static func decal() -> StringName
A decal texture, looked up in HammeriteTextureLibrary.decals().
declare_brush_property()
static func declare_brush_property(key: StringName, kind: StringName, list: bool = false) -> void
Say that brush property key names a thing of kind on every brush. For a property whose def is not the declaring addon's to change; its own says it with HammeriteBrushPropertyDef.set_reference(). list as in declare_entity_property().
declare_entity_property()
static func declare_entity_property(entity_type: StringName, property: StringName, kind: StringName, list: bool = false) -> void
Say that property of an entity of entity_type - every type, when empty - names a thing of kind. A list holds several names, separated by commas or spaces.
declare_face_property()
static func declare_face_property(key: StringName, kind: StringName, list: bool = false) -> void
Say that key in HammeriteFace.properties names a thing of kind on every face. list as in declare_entity_property().
entity_class()
static func entity_class() -> StringName
The script an entity is made as: its classname.
model()
static func model() -> StringName
A model, by HammeriteModelLibrary name.
provided_by()
static func provided_by(provider: String, version: String = "") -> Dictionary
What a resolver answers for a name provider provides, at version.
provided_if()
static func provided_if(present: bool) -> Dictionary
What a resolver answers for a name the game itself provides when present, and for a missing one otherwise.
record()
static func record(map: HammeriteMap) -> void
Write down who provides everything map uses, as it is now, into HammeriteMap.references. Done by every save (HammeriteDataFile.write()), on the thread that asks for it: the resolvers are the game's, and written for the main thread.
reset_resolvers()
static func reset_resolvers() -> void
Forget every resolver the game set, leaving Hammerite's own.
resolve()
static func resolve(kind: StringName, name: String) -> Dictionary
Who provides name now, as {"provider", "version"}, or empty when nothing does.
set_resolver()
static func set_resolver(kind: StringName, resolver: Callable) -> void
Who provides a name of kind: resolver takes the name and returns a Dictionary - provided_by() someone, provided_if() the game has it, or empty when nothing does. Replaces Hammerite's own answer for its kinds, which only knows whether the game has the thing at all.
texture()
static func texture() -> StringName
A face's texture, by HammeriteTextureLibrary name. Every face's texture is collected without being declared.
undeclare_brush_property()
static func undeclare_brush_property(key: StringName) -> void
Take back what declare_brush_property() said.
undeclare_entity_property()
static func undeclare_entity_property(entity_type: StringName, property: StringName) -> void
Take back what declare_entity_property() said, as a mod being unloaded does.
undeclare_face_property()
static func undeclare_face_property(key: StringName) -> void
Take back what declare_face_property() said.