#About kit.stage
The kit.stage module of LumaKit gives you new galaxies with stars and comets in the domes, a new dome, music per galaxy, warping, stars appearing, the hub replaced, stages built in code.
To use the module, add lumakit to the needs of your mod's luma.json and write:
use kit.stage#How the module works
Galaxies a mod adds, found by name, and warping to a galaxy's scenario. A galaxy a mod defines is recorded under the mod (caller()) and leaves with it. The data (Dome, Unlock, Comet, Star, Galaxy, DomeDef), define_galaxy, define_dome, find, find_dome, go_to, warp (GalaxyId.go), name and hub (its hook on NebulaMods::hubStage); below them, a galaxy listed in its dome with its stars counted (the game's questions answered from the definitions and kit.progress), comet stars (comets_of), music for a galaxy (music), a star appearing (appear_star) and stages built in code (build).
The module's source is lumakit/source/stage.lum.
#Declarations
| Name | Kind | Description |
|---|---|---|
Dome |
Enum | |
Unlock |
Enum | |
Comet |
Enum | |
Star |
Struct | |
Galaxy |
Struct | |
DomeDef |
Struct | |
GalaxyId |
Struct | A galaxy by its stage name. Its functions are also module functions (stage.warp(g, scenario)). |
define_galaxy |
Function | The galaxy recorded for the calling mod (a second of the same name replaces the first); its id. |
define_dome |
Function | A dome recorded for the calling mod (a second of the same name replaces the first). |
find_dome |
Function | A dome a mod defined, by its name; none for any other. |
hub |
Function | The hub the game returns to: stage for the calling mod until it asks for another or ends; the newest caller's holds it. An empty name gives the hub back. |
find |
Function | A galaxy a mod defined, by its stage name; none for any other. |
go_to |
Function | The game moves to galaxy's scenario scenario as it does through a launch star (MR::requestChangeStageInGameMoving). |
warp |
Function | The game moves to the galaxy's scenario scenario as it does through a launch star. |
name |
Function | |
comets_of |
Function | A star's comet (Star.comet) is the comet over its galaxy for that scenario while the mod is on (kit.progress, the game's comet schedule). Called for the calling mod after it defines or redefines a galaxy. |
sound_path |
Function | A sound as svc.audio names it for the kit, which plays the sounds other mods give it: "<id>:<path>", the mod owner gave it (a caller() number); its path alone when that mod is gone. |
music |
Function | s is the music of galaxy (of its scenario scenario, or of all with none) while the calling mod is on: it plays over the game's own when that stage's music starts, and the game's is back in any other stage. |
appear_star |
Function | The star of scenario appears at at in the stage playing now, with the game's own appearing scene. |
star_holder |
Function | The holder the star of scenario appears from in the stage playing now (appear_star made it); none before. |
Builder |
Struct | A builder is a handle: its number while its stage is being built, 0 after. What it is asked for is kept here until the builder function returns. Its functions are also module functions (stage.place(b, ...)). |
place |
Function | An object of the game or of a mod by its name, placed at at (rotation in degrees, up to eight arguments). |
planet |
Function | A planet: a model and the collision the player walks on. |
field |
Function | A gravity field of the stage (kit.gravity's Field). |
build |
Function | The stage name is built by make_stage each time it loads, for the calling mod: its objects, planets and gravity are made when the stage starts, on top of whatever the stage's own files hold. |
#Dome
pub enum Dome { Terrace, Fountain, Kitchen, Bedroom, Engine, Garden, Mod(name: text) }#Unlock
pub enum Unlock { Always, Stars(count: u32), Star(galaxy: text, scenario: u32), Code(check: fn() -> bool) }#Comet
pub enum Comet { Speedy, Daredevil, Cosmic, FastFoe, Purple }#Star
pub struct Star { scenario: u32, title: text, comet: Comet? = none, hidden: bool = false }#Galaxy
pub struct Galaxy { name: text, title: text, dome: Dome, unlock: Unlock = Unlock.Always, stars: list<Star>,
music: sound? = none, icon: draw.Texture? = none }#DomeDef
pub struct DomeDef { name: text, title: text, unlock: Unlock = Unlock.Always }#GalaxyId
pub struct GalaxyId {
name: text
fn warp(self, scenario: u32) { warp(self, scenario) }
}A galaxy by its stage name. Its functions are also module functions (stage.warp(g, scenario)).
#define_galaxy
pub fn define_galaxy(g: Galaxy) -> GalaxyIdThe galaxy recorded for the calling mod (a second of the same name replaces the first); its id.
#define_dome
pub fn define_dome(d: DomeDef)A dome recorded for the calling mod (a second of the same name replaces the first).
#find_dome
pub fn find_dome(name: text) -> DomeDef?A dome a mod defined, by its name; none for any other.
#hub
pub fn hub(stage: text)The hub the game returns to: stage for the calling mod until it asks for another or ends; the newest caller's holds it. An empty name gives the hub back.
#find
pub fn find(name: text) -> GalaxyId?A galaxy a mod defined, by its stage name; none for any other.
#go_to
pub fn go_to(galaxy: text, scenario: u32)The game moves to galaxy's scenario scenario as it does through a launch star (MR::requestChangeStageInGameMoving).
#warp
pub fn warp(g: GalaxyId, scenario: u32)The game moves to the galaxy's scenario scenario as it does through a launch star.
#name
pub fn name(g: GalaxyId) -> text#comets_of
pub fn comets_of(g: GalaxyId)A star's comet (Star.comet) is the comet over its galaxy for that scenario while the mod is on (kit.progress, the game's comet schedule). Called for the calling mod after it defines or redefines a galaxy.
#sound_path
pub fn sound_path(owner: u64, s: sound) -> textA sound as svc.audio names it for the kit, which plays the sounds other mods give it: "<id>:<path>", the mod owner gave it (a caller() number); its path alone when that mod is gone.
#music
pub fn music(galaxy: text, scenario: u32?, s: sound)s is the music of galaxy (of its scenario scenario, or of all with none) while the calling mod is on: it plays over the game's own when that stage's music starts, and the game's is back in any other stage.
#appear_star
pub fn appear_star(at: vec3, scenario: u32)The star of scenario appears at at in the stage playing now, with the game's own appearing scene.
#star_holder
pub fn star_holder(scenario: u32) -> LiveActor?The holder the star of scenario appears from in the stage playing now (appear_star made it); none before.
#Builder
pub struct Builder {
id: u32
fn place(self, kind: text, at: vec3, rotation: vec3 = vec3(0.0, 0.0, 0.0), args: list<int> = []) {
place(self, kind, at, rotation, args)
}
fn planet(self, look: model, collision: model, at: vec3) { planet(self, look, collision, at) }
fn field(self, f: gravity.Field) { field(self, f) }
}A builder is a handle: its number while its stage is being built, 0 after. What it is asked for is kept here until the builder function returns. Its functions are also module functions (stage.place(b, ...)).
#place
pub fn place(b: Builder, kind: text, at: vec3, rotation: vec3 = vec3(0.0, 0.0, 0.0), args: list<int> = [])An object of the game or of a mod by its name, placed at at (rotation in degrees, up to eight arguments).
#planet
pub fn planet(b: Builder, look: model, collision: model, at: vec3)A planet: a model and the collision the player walks on.
#field
pub fn field(b: Builder, f: gravity.Field)A gravity field of the stage (kit.gravity's Field).
#build
pub fn build(name: text, make_stage: fn(Builder))The stage name is built by make_stage each time it loads, for the calling mod: its objects, planets and gravity are made when the stage starts, on top of whatever the stage's own files hold.