Archmage.AtlasItem
One item of atlas.json: a config source, the object that holds its data, and its load state.
Inherits: RefCounted
For the code generator. ConfigAtlas creates each item with the object of the config source and the mapping of its key in atlas.json:
"hero": Archmage.AtlasItem.new(hero_table, Archmage.AtlasItem.MAPPING_UNIQUE),Constants
Section titled “Constants”MAPPING_UNIQUE
Section titled “MAPPING_UNIQUE”const MAPPING_UNIQUE = "unique"The key maps to one file: "unique": {"hero": "hero.json"}.
MAPPING_VARIANT
Section titled “MAPPING_VARIANT”const MAPPING_VARIANT = "variant"The key maps to several files, one per variant, of which one is loaded: "variant": {"game": {"/": "game.json", "dev": "game.dev.json"}}.
MAPPING_MANY
Section titled “MAPPING_MANY”const MAPPING_MANY = "many"The key maps to a list of files that are merged in order: "many": {"skill": ["a.json", "b.json"]}.
DEFAULT_VARIANT
Section titled “DEFAULT_VARIANT”const DEFAULT_VARIANT = "/"The variant loaded when Archmage.AtlasOptions.with_variant() selects none for the item.
Properties
Section titled “Properties”var cfg: ObjectThe object that receives the data. It has these methods:
load_json(data: Variant) -> Stringfills the object. The loader calls it once, with the parsed JSON of all files and overrides of the item merged into one value (seeArchmage.AtlasLoader.merge_json()). Godot parses every number as float, so convert integers withint(). Set a field to its default value when its value isnullor missing. It returns""on success. Otherwise, it returns a message for the first invalid value, which starts with the path of the value in the item, such as[3].respawn: invalid duration "abc"; the loader then returnsERR_PARSE_ERROR. Archmage.ParseError builds such a message.apply_keys() -> voidsets the ID of each entry from its key. Only regular tables have it; the loader calls it afterload_jsonwhen the object has it.to_json() -> Variantreturns the content as JSON values forArchmage.canonicalize()andArchmage.dump_atlas(), with the keys of the config files, such ascritRate. It may return nested objects that have their ownto_json(). A reference field is written as its config ID, the zero ID when it references nothing.
mapping
Section titled “mapping”var mapping: StringMAPPING_UNIQUE, MAPPING_VARIANT or MAPPING_MANY.
var key: String = ""The key in atlas.json. The loader sets it.
variant
Section titled “variant”var variant: String = ""The variant that the loader loaded for a MAPPING_VARIANT item; empty for other mappings.
var ready: bool = falseWhether the loader has loaded the item.
Constructor
Section titled “Constructor”Archmage.AtlasItem.new(p_cfg: Object, p_mapping: String)