StateMemory
State typessource
Can be accessed via global state
Fields
end_spaceship_character
Who pops out the spaceship for a tiamat/hundun win, this is set upon the spaceship door open
sourcefade_delay
integer
Additional delay after fade_timer reaches 0, before moving to the next fading state. Used after Ouroboros, in credits etc. for longer black screens, but also works after FADE.IN.
sourcefade_enabled
boolean
Enables the fade effect on FADE.IN, setting to false makes loading skip FADE.IN state instantly
sourcefade_value
number
Current fade-to-black amount (0.0 = all visible; 1.0 = all black). Manipulated by the loading routine when loading > 0.
sourcejournal_progress_sticker_slots
stickers for notable items and entities in journal progress page
sourcekali_altars_destroyed
integer
Also affects if the player has punish ball, if the punish ball is destroyed it is set to -1
sourcelevel
integer
Current level number, shown in hud and used by some game logic like choosing the next level on transition
sourceloading
Current loading/fade state. Pauses all updates if > FADE.NONE. Writing FADE.OUT or FADE.LOAD will trigger a screen load to screen_next.
money_shop_total
integer
Total amount spent in shops and sold idols during the run
The total money currently available is loop (players[].inventory.money + players[].inventory.collected_money_total) + state.money_shop_total
pause
8bit flags, multiple might be active at the same time 1: Menu: Pauses the level timer and engine. Can't set, controlled by the menu. 2: Fade/Loading: Pauses all timers and engine. 4: Cutscene: Pauses total/level time but not engine. Used by boss cutscenes. 8: Unknown: Pauses total/level time and engine. Does not pause the global counter so set_global_interval still runs. 16: Unknown: Pauses total/level time and engine. Does not pause the global counter so set_global_interval still runs. 32: Ankh: Pauses all timers, engine, but not camera. Used by the ankh cutscene.
sourcescreen_next
Next SCREEN, used to load the right screen when loading. Can be changed in PRE_LOAD_SCREEN to go somewhere else instead. Also see state.loading.
seed
integer
Current seed in seeded mode, just set to a funny value and does nothing in adventure mode
sourcetheme
Current THEME number, used to pick the music and by some game logic like choosing the next level on transition
sourcetime_last_level
integer
Level time of previous level in frames, used by game logic to decide dark levels etc
sourceuser_data
anyproperty
You can store a table (or lua primitive) here and it will store data correctly in online multiplayer, by having a different copy on each state and being copied over when the game does. Doesn't support recursive tables / cyclic references. Metatables will be transferred by reference instead of being copied
sourcewin_state
integer
0 = no win 1 = tiamat win 2 = hundun win 3 = CO win; set this and next doorway leads to victory scene
sourceworld
integer
Current world number, shown in hud and used by some game logic like choosing the next level on transition
sourceMethods
set_correct_ushabti
function StateMemory:set_correct_ushabti(animation_frame: integer)animation_frame:integer