Methods


Registry.createActor(id: string, : any)

Arguments:

id: string
: any

Returns:

1: Actor


Registry.createBorder(id: <T>, : any)

Arguments:

id: <T>
: any

Returns:

1: <T>|Border


Registry.createBullet(id: string, : any)

Arguments:

id: string
: any

Returns:

1: Bullet


Registry.createController(id: string, : any)

Arguments:

id: string
: any

Returns:

1: Event|Object


Registry.createDrawFX(id: string, : any)

Arguments:

id: string
: any

Returns:

1: FXBase


Registry.createEncounter(id: string, : any)

Arguments:

id: string
: any

Returns:

1: Encounter


Registry.createEnemy(id: string, : any)

Arguments:

id: string
: any

Returns:

1: EnemyBattler


Registry.createEvent(id: string, : any)

Arguments:

id: string
: any

Returns:

1: Event|Object


Registry.createItem(id: string, : any)

Arguments:

id: string
: any

Returns:

1: Item


Registry.createMap(id: string, world: World, : any)

Arguments:

id: string
world: World

The World Object manages everything relating to the overworld in Kristal.
A globally available instance of World is stored in Game.world.

: any

Returns:

1: Map


Registry.createObject(id: string, : any)

Arguments:

id: string
: any

Returns:

1: Object


Registry.createPartyMember(id: string, : any)

Arguments:

id: string
: any

Returns:

1: PartyMember


Registry.createRecruit(id: string, : any)

Arguments:

id: string
: any

Returns:

1: Recruit


Registry.createShop(id: string, : any)

Arguments:

id: string
: any

Returns:

1: Shop


Registry.createSpell(id: string, : any)

Arguments:

id: string
: any

Returns:

1: Spell


Registry.createWave(id: string, : any)

Arguments:

id: string
: any

Returns:

1: Wave


Registry.createWorldBullet(id: string, : any)

Arguments:

id: string
: any

Returns:

1: WorldBullet


Registry.getActor(id: string)

Arguments:

id: string

Returns:

1: Actor|nil


Registry.getBattleCutscene(group: string, id: string?)

Arguments:

group: string
id: string?

Returns:

cutscene: function|nil
grouped: boolean|nil


Registry.getBullet(id: string)

Arguments:

id: string

Returns:

1: Bullet|nil


Registry.getController(id: string)

Arguments:

id: string

Returns:

1: Event|Object|nil


Registry.getDrawFX(id: string)

Arguments:

id: string

Returns:

1: FXBase|nil


Registry.getEncounter(id: string)

Arguments:

id: string

Returns:

1: Encounter|nil


Registry.getEnemy(id: string)

Arguments:

id: string

Returns:

1: EnemyBattler|nil


Registry.getEvent(id: string)

Arguments:

id: string

Returns:

1: Event|Object|nil


Registry.getEventScript(group: string, id: string?)

Arguments:

group: string
id: string?

Returns:

cutscene: function|nil
grouped: boolean|nil


Registry.getItem(id: string)

Arguments:

id: string

Returns:

1: Item|nil


Registry.getLegendCutscene(group: string, id: string?)

Arguments:

group: string
id: string?

Returns:

cutscene: function|nil
grouped: boolean|nil


Registry.getMap(id: string)

Arguments:

id: string

Returns:

1: Map|nil


Registry.getMapData(id: string)

Arguments:

id: string

Returns:

1: table|nil


Registry.getObject(id: string)

Arguments:

id: string

Returns:

1: Object|nil


Registry.getPartyMember(id: string)

Arguments:

id: string

Returns:

1: PartyMember|nil


Registry.getRecruit(id: string)

Arguments:

id: string

Returns:

1: Recruit|nil


Registry.getShop(id: string)

Arguments:

id: string

Returns:

1: Shop|nil


Registry.getSpell(id: string)

Arguments:

id: string

Returns:

1: Spell|nil


Registry.getTileset(id: string)

Arguments:

id: string

Returns:

1: Tileset|nil


Registry.getWave(id: string)

Arguments:

id: string

Returns:

1: Wave|nil


Registry.getWorldBullet(id: string)

Arguments:

id: string

Returns:

1: WorldBullet|nil


Registry.getWorldCutscene(group: string, id: string?)

Arguments:

group: string
id: string?

Returns:

cutscene: function|nil
grouped: boolean|nil










































Registry.initialize(preload: boolean?)

Arguments:

preload: boolean?


Registry.iterScripts(base_path: string, exclude_folder: boolean?)

Arguments:

base_path: string
exclude_folder: boolean?

Returns:

1: fun()string?, string?, ...unknown


Registry.registerActor(id: string, class: Actor)

Arguments:

id: string
class: Actor

Actors are a type of data class that represent the visuals of a character - anything that is some type of character, be it the player, an NPC, or an enemy in battle, it will require an actor.
As a data class, actors are stored in scripts/data/actors/, and extend this class. Their filepath starting from here becomes their id, unless an id is specified as an argument to Class().





Registry.registerBorder(id: string, border: Border)

Arguments:

id: string
border: Border


Registry.registerBullet(id: string, class: Bullet)

Arguments:

id: string
class: Bullet

The class that all Battle bullets in Kristal originate from.
Generic bullets can be spawned into a wave with Wave:spawnBullet(texture, x, y)
Files in scripts/battle/bullets will also be loaded as bullets and should Extend this class. Extension bullets can be spawned into a wave with Wave:spawnBullet(id, ...) - their id defaults to their filepath, starting from scripts/battle/bullets. Additional arguments ... are passed into the bullet type's init function.



Registry.registerController(id: string, class: Event|Object)

Arguments:

id: string
class: Event|Object

Events are used as the base class for objects in the Overworld (in most cases) Custom events should be defined in scripts/world/events and extend from this class. They will receive an id based on their filepath from this location. Custom events only ever recieve a data argument in their init() function that contains all of the data about the object in the map. Included in the data table is the properties table, which contains every property in the object's Custom Properties in Tiled. Events can be placed in maps by placing a shape on any objects layer and setting its name to the id of the event that should be created.



Registry.registerEncounter(id: string, class: Encounter)

Arguments:

id: string
class: Encounter

Encounters detail the setup of unique battles in Kristal, from the enemies that appear to the environment and special mechanics.
Encounter files should be placed inside scripts/battle/encounters/.



Registry.registerEnemy(id: string, class: EnemyBattler)

Arguments:

id: string
class: EnemyBattler

EnemyBattlers are a type of Battler that represent enemies, defining all their properties and behaviours.
Every enemy defined in a mod should be located in its own file in scripts/battle/enemies/, and should extend this class.
Each enemy is assigned an id that defaults to their filepath starting from scripts/battle/enemies, unless an id is specified as an argument to Class().
Enemies are added to battles in the encounter, with Encounter:addEnemy(enemy, x, y, ...), where enemy is their unique id, and all enemies for the current battle reside in Game.battle.enemies

Recruit data is separate to enemies, see Recruit for how to set up a corresponding recruit.



Registry.registerEvent(id: string, class: Event|Object)

Arguments:

id: string
class: Event|Object

Events are used as the base class for objects in the Overworld (in most cases) Custom events should be defined in scripts/world/events and extend from this class. They will receive an id based on their filepath from this location. Custom events only ever recieve a data argument in their init() function that contains all of the data about the object in the map. Included in the data table is the properties table, which contains every property in the object's Custom Properties in Tiled. Events can be placed in maps by placing a shape on any objects layer and setting its name to the id of the event that should be created.





Registry.registerGlobal(id: string, value: any, no_warning: boolean?)

Arguments:

id: string
value: any
no_warning: boolean?


Registry.registerItem(id: string, class: Item)

Arguments:

id: string
class: Item

The Item class represents all types of item in Kristal.
Items are data files contained in scripts/data/items that should extend this class or one of its extensions (see below), and their filepath starting at this location becomes their id, unless an id for them is specified as the second argument to Class().
There are extensions of item that provide additional functionality when extended from: HealItem and TensionItem
Items that are Light World equipment should extend LightEquipItem instead of this class (it provides all of the same fields and functions as Item).
Items can be given to the player directly in the code through Inventory:addItem().





Registry.registerMap(id: string, class: Map)

Arguments:

id: string
class: Map

Stores and manages the currently loaded map.
If a map in scrips/world/maps is defined as a folder, map data can be placed in data.lua, and a file named map.lua can be used to define a custom Map object for that map.



Registry.registerMapData(id: string, data: table)

Arguments:

id: string
data: table


Registry.registerPartyMember(id: string, class: PartyMember)

Arguments:

id: string
class: PartyMember

The PartyMember class is a type of data class that stores information about a member of the party.
PartyMembers are stored in scripts/data/party, and extend this class. Their filepath starting from here becomes their id, unless an id is specified as an argument to Class().



Registry.registerRecruit(id: string, class: Recruit)

Arguments:

id: string
class: Recruit

Recruits are data files that define the properties of recruitable enemies.
Recruits are stored in scripts/data/recruits, and extend this class. Their filepath starting from here becomes their id, unless an id is specified as an argument to Class().
A recruit is linked to one enemy with the same id as it.



Registry.registerShop(id: string, class: Shop)

Arguments:

id: string
class: Shop

The class which all Shops in Kristal use.
Shop files should be located in scripts/shops, and will use their filepath relative to this location as an id by default.
Either World:shopTransition() or a Transition event with the property shop defined can be used to enter shops.



Registry.registerSpell(id: string, class: Spell)

Arguments:

id: string
class: Spell

Spells are data files that extend this Spell class to define a castable spell.
Spells are stored in scripts/data/spells, and their filepath starting at this location becomes their id, unless an id for them is specified as the second argument to Class(). Spells are learned by PartyMembers, and they can be given a spell by calling PartyMember:addSpell() (likewise, PartyMember:removeSpell() removes a spell).



Registry.registerTileset(id: string, class: Tileset)

Arguments:

id: string
class: Tileset


Registry.registerWave(id: string, class: Wave)

Arguments:

id: string
class: Wave

Waves are the bullet patterns that enemies use in battle.
Waves are defined in files in scripts/battle/waves/ and should extend this class.
Each wave is assigned an id that defaults to their filepath starting from scripts/battle/waves, unless an id is specified as an argument to Class().
Wave ids can be placed into an EnemyBattlers waves table, or Waves returned from EnemyBattler:selectWave() or Encounter:getNextWaves() to to be used in battle.
Multiple waves can run in a single defending turn, but if multiple attackers select the same wave only one instance is created; see Wave:getAttackers() for determining how many enemies are using a particular wave.



Registry.registerWorldBullet(id: string, class: WorldBullet)

Arguments:

id: string
class: WorldBullet

The class that all World bullets in Kristal originate from.
Generic bullets can be spawned into the world with Game.world:spawnBullet(texture, x, y)
Files in scripts/world/bullets will also be loaded as world bullets and should Extend this class. Extension bullets can be spawned into the world with Game.world:spawnBullet(id, ...) - their id defaults to their filepath, starting from scripts/world/bullets. Additional arguments ... are passed into the bullet type's init function.








Fields
















Registry.map_data: table<string, table>

TODO: Document map data
















Undocumented