diff --git a/docs/index.html b/docs/index.html index b267dfc24..69f63ad49 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1828,269 +1828,1585 @@
OL_DEBUG=1
in the same environment where the game is running to keep the Overlunky terminal open for better debug prints. This could be cmd
or even the system environment variables if playing on Steam. Playlunky will also print the messages to terminal (even from Overlunky) if ran with the -console
switch.OL_DEBUG=1
in the same environment where the game is running to keep the Overlunky terminal open for better debug prints. This could be cmd
or even the system environment variables if playing on Steam. Playlunky will also print the messages to terminal (even from Overlunky) if ran with the -console
switch.If you use a text editor/IDE that has a Lua linter available you can download spel2.lua, place it in a folder of your choice and specify that folder as a "external function library". For example VSCode with the Lua Extension offers this feature. This will allow you to get auto-completion of API functions along with linting
+The following Lua libraries and their functions are available. You can read more about them in the Lua documentation. We're using Lua 5.4 with the Sol C++ binding.
+To save data in your mod it makes a lot of sense to use json
to encode a table into a string and decode strings to table. For example this code that saves table and loads it back:
local some_mod_data_that_should_be_saved = {{
+ kills = 0,
+ unlocked = false
+}}
+set_callback(function(save_ctx)
+ local save_data_str = json.encode(some_mod_data_that_should_be_saved)
+ save_ctx:save(save_data_str)
+end, ON.SAVE)
+
+set_callback(function(load_ctx)
+ local load_data_str = load_ctx:load()
+ if load_data_str ~= "" then
+ some_mod_data_that_should_be_saved = json.decode(load_data_str)
+ end
+end, ON.LOAD)
+
This module is a great substitute for tostring
because it can convert any type to a string and thus helps a lot with debugging. Use for example like this:
local look_ma_no_tostring = {
+ number = 15,
+ nested_table = {
+ array = {
+ 1,
+ 2,
+ 4
+ }
+ }
+}
+message(inspect(look_ma_no_tostring))
+--[[prints:
+{
+ number = 15,
+ nested_table = {
+ array = { 1, 2, 4 }
+ }
+}
+]]
+
This allows you to make strings without having to do a lot of tostring
and ..
by placing your variables directly inside of the string. Use F
in front of your string and wrap variables you want to print in {}
, for example like this:
for _, player in players do
+ local royal_title = nil
+ if player:is_female() then
+ royal_title = 'Queen'
+ else
+ royal_title = 'King'
+ end
+ local name = F'{player:get_name()} aka {royal_title} {player:get_short_name()}'
+ message(name)
+end
+
Setting meta.unsafe = true
enables the rest of the standard Lua libraries like io
and os
, loading dlls with require and package.loadlib
. Using unsafe scripts requires users to enable the option in the overlunky.ini file which is found in the Spelunky 2 installation directory.
You can load modules with require "mymod"
or require "mydir.mymod"
, just put mymod.lua
in the same directory the script is, or in mydir/
to keep things organized.
Check the Lua tutorial or examples how to actually make modules.
+ +You can also import other loaded script mods to your own mod if they have exports
.
Used to clarify what kind of values can be passed and returned from a function, even if the underlying type is really just an integer or a string. This should help to avoid bugs where one would for example just pass a random integer to a function expecting a callback id.
+ +Name | +Type | +
---|---|
CallbackId | +int; | +
Flags | +int; | +
uColor | +int; | +
SHORT_TILE_CODE | +int; | +
STRINGID | +int; | +
FEAT | +int; | +
These variables are always there to use.
+meta.name = "Awesome Mod"
+meta.version = "1.0"
+meta.author = "You"
+meta.description = [[
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut at nulla porttitor, lobortis magna at, tempus dolor. Cras non ligula tellus. Duis tincidunt sodales velit et ornare. Mauris eu sapien finibus dolor dictum malesuada in non elit.
+
+ Aenean luctus leo ut diam ornare viverra. Nunc condimentum interdum elit, quis porttitor quam finibus ac. Nam mattis, lectus commodo placerat tristique, justo justo congue dui, sed sodales nunc sem ut neque.
+]]
+-- set this to enable unsafe mode
+--meta.unsafe = true
+
+-- rest of your mod goes here
+
+
++ +Search script examples for meta
+
Table of strings where you should set some script metadata shown in the UI and used by other scripts to find your script.
+if state.time_level > 300 and state.theme == THEME.DWELLING then
+ toast("Congratulations for lasting 5 seconds in Dwelling")
+end
+
+
++ +Search script examples for state
+
A bunch of game state variables. Your ticket to almost anything that is not an Entity.
+if game_manager.game_props.game_has_focus == false then
+ message("Come back soon!")
+end
+
+
++ +Search script examples for game_manager
+
The GameManager gives access to a couple of Screens as well as the pause and journal UI elements
+message = "Currently playing: "
+for _, p in pairs(online.online_players) do
+ if p.ready_state ~= 0 then
+ message = message .. p.player_name .. " "
+ end
+end
+print(message)
+
+
++ +Search script examples for online
+
The Online object has information about the online lobby and its players
+-- Make the player invisible, use only in single player only mods
+
+players[1].flags = set_flag(players[1].flags, 1)
+
+
++ +Search script examples for players
+
An array of Player of the current players. This is just a list of existing Player entities in order, i.e., players[1]
is not guaranteed to be P1 if they have been gibbed for example. See get_player.
++Print best time from savegame
+
prinspect(savegame.time_best)
+
++ +Search script examples for savegame
+
Provides access to the save data, updated as soon as something changes (i.e. before it's written to savegame.sav.) Use save_progress to save to savegame.sav.
+register_option_bool("bomb_bag", "BombBag", "Spawn bomb bag at the start of every level", false)
+
+set_callback(function()
+ if options.bomb_bag then
+ -- Spawn the bomb bag at player location thanks to the LAYER.PLAYER1
+ spawn_entity_snapped_to_floor(ENT_TYPE.ITEM_PICKUP_BOMBBAG, 0, 0, LAYER.PLAYER1)
+ end
+end, ON.LEVEL)
+
+
++ +Search script examples for options
+
Table of options set in the UI, added with the register_option_functions, but nil
before any options are registered. You can also write your own options in here or override values defined in the register functions/UI before or after they are registered. Check the examples for many different use cases and saving options to disk.
--Make it so there is 50% chance that the Ankh will be destroyed
+
+set_callback(function ()
+ -- more or less 50% chance
+ if prng:random(2) == 1 then
+ -- get all Ankh's in a level
+ ankhs = get_entities_by(ENT_TYPE.ITEM_PICKUP_ANKH, MASK.ITEM, LAYER.BOTH)
+ for _, uid in pairs(ankhs) do
+ get_entity(uid):destroy()
+ end
+ end
+end, ON.LEVEL)
+
+
++ +Search script examples for prng
+
The global prng state, calling any function on it will advance the prng state, thus desynchronizing clients if it does not happen on both clients.
+The game functions like spawn
use level coordinates. Draw functions use normalized screen coordinates from -1.0 .. 1.0
where 0.0, 0.0
is the center of the screen.
++Create three explosions and then clear the interval
+
local count = 0 -- this upvalues to the interval
+set_interval(function()
+ count = count + 1
+ spawn(ENT_TYPE.FX_EXPLOSION, 0, 0, LAYER.FRONT, 0, 0)
+ if count >= 3 then
+ -- calling this without parameters clears the callback that's calling it
+ clear_callback()
+ end
+end, 60)
+
++Search script examples for clear_callback
+
Clear previously added callback id
or call without arguments inside any callback to clear that callback after it returns.
++Search script examples for clear_screen_callback
+
Clears a callback that is specific to a screen.
+++Search script examples for clear_vanilla_sound_callback
+
Clears a previously set callback
+++Search script examples for set_callback
+
Returns unique id for the callback to be used in clear_callback. +Add global callback function to be called on an event.
+++Search script examples for set_global_interval
+
Returns unique id for the callback to be used in clear_callback. You can also return false
from your function to clear the callback.
+Add global callback function to be called every frames
engine frames. This timer is never paused or cleared.
++Search script examples for set_global_timeout
+
Returns unique id for the callback to be used in clear_callback.
+Add global callback function to be called after frames
engine frames. This timer is never paused or cleared.
++Create three explosions and then clear the interval
+
local count = 0 -- this upvalues to the interval
+set_interval(function()
+ count = count + 1
+ spawn(ENT_TYPE.FX_EXPLOSION, 0, 0, LAYER.FRONT, 0, 0)
+ if count >= 3 then
+ -- calling this without parameters clears the fallback that's calling it
+ clear_callback()
+ end
+end, 60)
+
++Search script examples for set_interval
+
Returns unique id for the callback to be used in clear_callback. You can also return false
from your function to clear the callback.
+Add per level callback function to be called every frames
engine frames
+Ex. frames = 100 - will call the function on 100th frame from this point. This might differ in the exact timing of first frame depending as in what part of the frame you call this function
+or even be one frame off if called right before the time_level variable is updated
+If you require precise timing, choose the start of your interval in one of those safe callbacks:
+The SCREEN callbacks: from ON.LOGO to ON.ONLINE_LOBBY or custom callbacks ON.FRAME, ON.SCREEN, ON.START, ON.LOADING, ON.RESET, ON.POST_UPDATE
+Timer is paused on pause and cleared on level transition.
++Search script examples for set_on_player_instagib
+
Returns unique id for the callback to be used in clear_callback or nil
if uid is not valid.
+Sets a callback that is called right when an player/hired hand is crushed/insta-gibbed, return true
to skip the game's crush handling.
+The game's instagib function will be forcibly executed (regardless of whatever you return in the callback) when the entity's health is zero.
+This is so that when the entity dies (from other causes), the death screen still gets shown.
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is bool on_player_instagib(Entity self)
++Search script examples for set_post_entity_spawn
+
Add a callback for a spawn of specific entity types or mask. Set mask
to MASK.ANY
to ignore that.
+This is run right after the entity is spawned but before and particular properties are changed, e.g. owner or velocity.
+
The callback signature is nil post_entity_spawn(Entity ent, SPAWN_TYPE spawn_flags)
++Search script examples for set_post_render_screen
+
Returns unique id for the callback to be used in clear_screen_callback or nil
if screen_id is not valid.
+Sets a callback that is called right after the screen is drawn.
+
The callback signature is nil render_screen(Screen self, VanillaRenderContext render_ctx)
++Search script examples for set_pre_entity_spawn
+
Add a callback for a spawn of specific entity types or mask. Set mask
to MASK.ANY
to ignore that.
+This is run before the entity is spawned, spawn your own entity and return its uid to replace the intended spawn.
+In many cases replacing the intended entity won't have the indended effect or will even break the game, so use only if you really know what you're doing.
+
The callback signature is optional
++Search script examples for set_pre_render_screen
+
Returns unique id for the callback to be used in clear_screen_callback or nil
if screen_id is not valid.
+Sets a callback that is called right before the screen is drawn, return true
to skip the default rendering.
+
The callback signature is bool render_screen(Screen self, VanillaRenderContext render_ctx)
++Search script examples for set_timeout
+
Returns unique id for the callback to be used in clear_callback.
+Add per level callback function to be called after frames
engine frames. Timer is paused on pause and cleared on level transition.
++Search script examples for set_vanilla_sound_callback
+
Returns unique id for the callback to be used in clear_vanilla_sound_callback.
+Sets a callback for a vanilla sound which lets you hook creation or playing events of that sound
+Callbacks are executed on another thread, so avoid touching any global state, only the local Lua state is protected
+If you set such a callback and then play the same sound yourself you have to wait until receiving the STARTED event before changing any properties on the sound. Otherwise you may cause a deadlock.
+
The callback signature is nil on_vanilla_sound(PlayingSound sound)
++Search script examples for dump_network
+
Hook the sendto and recvfrom functions and start dumping network data to terminal
+++Search script examples for get_address
+
Get the address for a pattern name
+++Search script examples for get_rva
+
Get the rva for a pattern name
+++Search script examples for raise
+
Raise a signal and probably crash the game
+activate_sparktraps_hack(true);
+
+-- set random speed, direction and distance for the spark
+set_post_entity_spawn(function(ent)
+
+ direction = 1
+ if prng:random_chance(2, PRNG_CLASS.ENTITY_VARIATION) then
+ direction = -1
+ end
+
+ ent.speed = prng:random_float(PRNG_CLASS.ENTITY_VARIATION) * 0.1 * direction
+ ent.distance = prng:random_float(PRNG_CLASS.ENTITY_VARIATION) * 10
+
+end, SPAWN_TYPE.ANY, 0, ENT_TYPE.ITEM_SPARK)
+
++Search script examples for activate_sparktraps_hack
+
Activate custom variables for speed and distance in the ITEM_SPARK
+note: because those the variables are custom and game does not initiate them, you need to do it yourself for each spark, recommending set_post_entity_spawn
+default game values are: speed = -0.015, distance = 3.0
++Search script examples for apply_entity_db
+
Apply changes made in get_type() to entity instance by uid.
+++Search script examples for attach_ball_and_chain
+
Spawns and attaches ball and chain to uid
, the initial position of the ball is at the entity position plus off_x
, off_y
++Search script examples for attach_entity
+
Attaches attachee
to overlay
, similar to setting get_entity(attachee).overlay = get_entity(overlay)
.
+However this function offsets attachee
(so you don't have to) and inserts it into overlay
's inventory.
++Search script examples for carry
+
Make mount_uid
carry rider_uid
on their back. Only use this with actual mounts and living things.
++Search script examples for change_waddler_drop
+
Change ENT_TYPE's spawned when Waddler dies, by default there are 3:
+{ITEM_PICKUP_COMPASS, ITEM_CHEST, ITEM_KEY}
+Max 255 types.
+Use empty table as argument to reset to the game default
++Search script examples for drop
+
Drop an entity by uid
+++Search script examples for enter_door
+
Calls the enter door function, position doesn't matter, can also enter closed doors (like COG, EW) without unlocking them
+++Search script examples for entity_get_items_by
+
Gets uids of entities attached to given entity uid. Use entity_type
and mask
(MASK) to filter, set them to 0 to return all attached entities.
++Search script examples for entity_has_item_type
+
Check if the entity uid
has some ENT_TYPE entity_type
in their inventory, can also use table of entity_types
++Search script examples for entity_has_item_uid
+
Check if the entity uid
has some specific item_uid
by uid in their inventory
++Search script examples for entity_remove_item
+
Remove item by uid from entity
+++Search script examples for filter_entities
+
Returns a list of all uids in entities
for which predicate(get_entity(uid))
returns true
++Search script examples for flip_entity
+
Flip entity around by uid. All new entities face right by default.
+++Search script examples for force_olmec_phase_0
+
Forces Olmec to stay on phase 0 (stomping)
+++Search script examples for get_door_target
+
Get door target world
, level
, theme
++Search script examples for get_entities_at
+
Get uids of matching entities inside some radius (ENT_TYPE, MASK). Set entity_type
or mask
to 0
to ignore that, can also use table of entity_types
+Recommended to always set the mask, even if you look for one entity type
-- find all cavemen and give them bombs
+-- using a type and mask in get_entities_by speeds up the search, cause the api knows which bucket to search in
+for i,uid in ipairs(get_entities_by(ENT_TYPE.MONS_CAVEMAN, MASK.MONSTER, LAYER.BOTH)) do
+ local x, y, l = get_position(uid)
+ spawn_entity_snapped_to_floor(ENT_TYPE.ITEM_BOMB, x, y, l)
+end
+
+
++Search script examples for get_entities_by
+
Get uids of entities by some conditions (ENT_TYPE, MASK). Set entity_type
or mask
to 0
to ignore that, can also use table of entity_types.
+Recommended to always set the mask, even if you look for one entity type
local types = {ENT_TYPE.MONS_SNAKE, ENT_TYPE.MONS_BAT}
+set_callback(function()
+ local uids = get_entities_by_type(ENT_TYPE.MONS_SNAKE, ENT_TYPE.MONS_BAT)
+ -- is not the same thing as this, but also works
+ local uids2 = get_entities_by_type(types)
+ print(tostring(#uids).." == "..tostring(#uids2))
+end, ON.LEVEL)
+
+
++Search script examples for get_entities_by_type
+
Get uids of entities matching id. This function is variadic, meaning it accepts any number of id's. +You can even pass a table! +This function can be slower than the get_entities_by with the mask parameter filled
+++Search script examples for get_entities_overlapping_hitbox
+
Get uids of matching entities overlapping with the given hitbox. Set entity_type
or mask
to 0
to ignore that, can also use table of entity_types
++Search script examples for get_entity
+
Get the Entity behind an uid, converted to the correct type. To see what type you will get, consult the entity hierarchy list
+++Search script examples for get_entity_name
+
Get localized name of an entity, pass fallback_strategy
as true
to fall back to the ENT_TYPE.
enum name
+if the entity has no localized name
++Search script examples for get_entity_type
+
Get the ENT_TYPE... of the entity by uid
+++Search script examples for get_grid_entity_at
+
Gets a grid entity, such as floor or spikes, at the given position and layer.
+++Search script examples for get_local_players
+
Get the thread-local version of players
+++Search script examples for get_player
+
Returns Player (or PlayerGhost if get_player(1, true)
) with this player slot
++Search script examples for get_playerghost
+
Returns PlayerGhost with this player slot 1..4
+++Search script examples for get_type
+
Get the EntityDB behind an ENT_TYPE...
+++Search script examples for kill_entity
+
Kills an entity by uid. destroy_corpse
defaults to true
, if you are killing for example a caveman and want the corpse to stay make sure to pass false
.
++Search script examples for lock_door_at
+
Try to lock the exit at coordinates
+++Search script examples for modify_ankh_health_gain
+
Change how much health the ankh gives you after death, with every beat (the heart beat effect) it will add beat_add_health
to your health,
+beat_add_health
has to be divisor of health
and can't be 0, otherwise the function does nothing. Set health
to 0 to return to the game defaults
+If you set health
above the game max health it will be forced down to the game max
++Search script examples for modify_sparktraps
+
Changes characteristics of (all) sparktraps: speed, rotation direction and distance from center +Speed: expressed as the amount that should be added to the angle every frame (use a negative number to go in the other direction) +Distance from center: if you go above 3.0 the game might crash because a spark may go out of bounds!
+++Search script examples for move_entity
+
Teleport entity to coordinates with optional velocity
+++Search script examples for move_grid_entity
+
Teleport grid entity, the destination should be whole number, this ensures that the collisions will work properly
+-- spawn and equip a jetpack on the player
+pick_up(players[1].uid, spawn(ENT_TYPE.ITEM_JETPACK, 0, 0, LAYER.PLAYER, 0, 0))
+
+
++Search script examples for pick_up
+
Pick up another entity by uid. Make sure you're not already holding something, or weird stuff will happen.
+++Search script examples for poison_entity
+
Poisons entity, to cure poison set Movable.poison_tick_timer
to -1
++Search script examples for replace_drop
+
Changes a particular drop, e.g. what Van Horsing throws at you (use e.g. replace_drop(DROP.VAN_HORSING_DIAMOND, ENT_TYPE.ITEM_PLASMACANNON))
+Use 0
as type to reset this drop to default, use -1
as drop_id to reset all to default
++Search script examples for set_boss_door_control_enabled
+
Allows you to disable the control over the door for Hundun and Tiamat +This will also prevent game crashing when there is no exit door when they are in level
+++Search script examples for set_contents
+
Set the contents of Coffin, Present, Pot, Container +Check the entity hierarchy list for what the exact ENT_TYPE's can this function affect
+++Search script examples for set_cursepot_ghost_enabled
+
Determines whether the ghost appears when breaking the ghost pot
+++Search script examples for set_door
+
Short for set_door_target.
+++Search script examples for set_door_target
+
Make an ENT_TYPE.FLOOR_DOOR_EXIT go to world w
, level l
, theme t
++Search script examples for set_drop_chance
+
Alters the drop chance for the provided monster-item combination (use e.g. set_drop_chance(DROPCHANCE.MOLE_MATTOCK, 10) for a 1 in 10 chance)
+Use -1
as dropchance_id to reset all to default
++Search script examples for set_explosion_mask
+
Sets which entities are affected by a bomb explosion. Default = MASK.PLAYER | MASK.MOUNT | MASK.MONSTER | MASK.ITEM | MASK.ACTIVEFLOOR | MASK.FLOOR
+++Search script examples for set_kapala_blood_threshold
+
Sets the amount of blood drops in the Kapala needed to trigger a health increase (default = 7).
+++Search script examples for set_kapala_hud_icon
+
Sets the hud icon for the Kapala (0-6 ; -1 for default behaviour). +If you set a Kapala treshold greater than 7, make sure to set the hud icon in the range 0-6, or other icons will appear in the hud!
+++Search script examples for set_max_rope_length
+
Sets the maximum length of a thrown rope (anchor segment not included). Unfortunately, setting this higher than default (6) creates visual glitches in the rope, even though it is fully functional.
+++Search script examples for set_olmec_cutscene_enabled
+
++Search script examples for set_olmec_phase_y_level
+
Sets the Y-level at which Olmec changes phases
+++Search script examples for set_time_ghost_enabled
+
Determines whether the time ghost appears, including the showing of the ghost toast
+++Search script examples for set_time_jelly_enabled
+
Determines whether the time jelly appears in cosmic ocean
+++Search script examples for unequip_backitem
+
Unequips the currently worn backitem
+++Search script examples for unlock_door_at
+
Try to unlock the exit at coordinates
+++Search script examples for waddler_count_entity
+
Returns how many of a specific entity type Waddler has stored
+++Search script examples for waddler_entity_type_in_slot
+
Gets the entity type of the item in the provided slot
+++Search script examples for waddler_get_entity_meta
+
Gets the 16-bit meta-value associated with the entity type in the associated slot
+++Search script examples for waddler_remove_entity
+
Removes an entity type from Waddler's storage. Second param determines how many of the item to remove (default = remove all)
+++Search script examples for waddler_set_entity_meta
+
Sets the 16-bit meta-value associated with the entity type in the associated slot
+++Search script examples for waddler_store_entity
+
Store an entity type in Waddler's storage. Returns the slot number the item was stored in or -1 when storage is full and the item couldn't be stored.
+++Search script examples for worn_backitem
+
Returns the uid of the currently worn backitem, or -1 if wearing nothing
+++Search script examples for change_feat
+
Helper function to set the title and description strings for a FEAT with change_string, as well as the hidden state.
+++Search script examples for get_feat
+
Check if the user has performed a feat (Real Steam achievement or a hooked one). Returns: bool unlocked, bool hidden, string name, string description
++Search script examples for get_feat_hidden
+
Get the visibility of a feat
+++Search script examples for set_feat_hidden
+
Set the visibility of a feat
+++Search script examples for clr_flag
+
Clears the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
+++Search script examples for flip_flag
+
Flips the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
+++Search script examples for get_entity_flags
+
Get the flags
field from entity by uid
++Search script examples for get_entity_flags2
+
Get the more_flags
field from entity by uid
++Search script examples for get_level_flags
+
Get state.level_flags
++Search script examples for set_entity_flags
+
Set the flags
field from entity by uid
++Search script examples for set_entity_flags2
+
Set the more_flags
field from entity by uid
++Search script examples for set_flag
+
Set the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
+++Search script examples for set_level_flags
+
Set state.level_flags
++Search script examples for test_flag
+
Returns true if the nth bit is set in the number.
+++Search script examples for activate_crush_elevator_hack
+
Activate custom variables for speed and y coordinate limit for crushing elevator
+note: because those variables are custom and game does not initiate them, you need to do it yourself for each CrushElevator entity, recommending set_post_entity_spawn
+default game values are: speed = 0.0125, y_limit = 98.5
++Search script examples for activate_hundun_hack
+
Activate custom variables for y coordinate limit for hundun and spawn of it's heads
+note: because those variables are custom and game does not initiate them, you need to do it yourself for each Hundun entity, recommending set_post_entity_spawn
+default game value are: y_limit = 98.5, rising_speed_x = 0, rising_speed_y = 0.0125, bird_head_spawn_y = 55, snake_head_spawn_y = 71
++Search script examples for change_poison_timer
+
Change the amount of frames after the damage from poison is applied
+++Search script examples for clear_cache
+
Clear cache for a file path or the whole directory
+++Search script examples for clr_mask
+
Clears a bitmask in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
+++Search script examples for create_image
+
Create image from file. Returns a tuple containing id, width and height. +Depending on the image size, this can take a moment, preferably don't create them dynamically, rather create all you need in global scope so it will load them as soon as the game starts
+++Search script examples for create_image_crop
+
Create image from file, cropped to the geometry provided. Returns a tuple containing id, width and height. +Depending on the image size, this can take a moment, preferably don't create them dynamically, rather create all you need in global scope so it will load them as soon as the game starts
+++Search script examples for disable_floor_embeds
+
Disable all crust item spawns, returns whether they were already disabled before the call
+++Search script examples for flip_mask
+
Flips the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
+++Search script examples for force_journal
+
Force the journal to open on a chapter and entry# when pressing the journal button. Only use even entry numbers. Set chapter to JOURNALUI_PAGE_SHOWN.JOURNAL
to reset. (This forces the journal toggle to always read from game_manager.save_related.journal_popup_ui.entry_to_show
etc.)
++Search script examples for get_adventure_seed
+
Get the current adventure seed pair
+++Search script examples for get_character_heart_color
+
Same as Player.get_heart_color
++Search script examples for get_frame
+
Get the current global frame count since the game was started. You can use this to make some timers yourself, the engine runs at 60fps.
+++Search script examples for get_id
+
Get your sanitized script id to be used in import.
+++Search script examples for get_level_config
+
Gets the value for the specified config
+++Search script examples for get_local_prng
+
Get the thread-local version of prng
+++Search script examples for get_local_state
+
Get the thread-local version of state
+++Search script examples for get_ms
+
Get the current timestamp in milliseconds since the Unix Epoch.
+++Search script examples for get_setting
+
Gets the specified setting, values might need to be interpreted differently per setting
+++Search script examples for god
+
Enable/disable godmode for players.
+++Search script examples for god_companions
+
Enable/disable godmode for companions.
+++Search script examples for grow_chainandblocks
+
Grow chains from ENT_TYPE_FLOOR_CHAIN_CEILING
and chain with blocks on it from ENT_TYPE_FLOOR_CHAINANDBLOCKS_CEILING
, it starts looking for the ceilings from the top left corner of a level.
+To limit it use the parameters, so x = 10 will only grow chains from ceilings with x < 10, with y = 10 it's ceilings that have y > (level bound top - 10)
++Search script examples for grow_poles
+
Grow pole from GROWABLE_CLIMBING_POLE
entities in a level, area
default is whole level, destroy_broken
default is false
++Search script examples for grow_vines
+
Grow vines from GROWABLE_VINE
and VINE_TREE_TOP
entities in a level, area
default is whole level, destroy_broken
default is false
++Search script examples for http_get
+
Send a synchronous HTTP GET request and return response as a string or nil on an error
+++Search script examples for http_get_async
+
Send an asynchronous HTTP GET request and run the callback when done. If there is an error, response will be nil and vice versa. +The callback signature is nil on_data(string response, string error)
+++Search script examples for import
+
Load another script by id "author/name" and import its exports
table. Returns:
table
if the script has exportsnil
if the script was found but has no exportsfalse
if the script was not found but optional is set to trueIf you use a text editor/IDE that has a Lua linter available you can download spel2.lua, place it in a folder of your choice and specify that folder as a "external function library". For example VSCode with the Lua Extension offers this feature. This will allow you to get auto-completion of API functions along with linting
-The following Lua libraries and their functions are available. You can read more about them in the Lua documentation. We're using Lua 5.4 with the Sol C++ binding.
-To save data in your mod it makes a lot of sense to use json
to encode a table into a string and decode strings to table. For example this code that saves table and loads it back:
local some_mod_data_that_should_be_saved = {{
- kills = 0,
- unlocked = false
-}}
-set_callback(function(save_ctx)
- local save_data_str = json.encode(some_mod_data_that_should_be_saved)
- save_ctx:save(save_data_str)
-end, ON.SAVE)
+intersection
+
+Search script examples for intersection
+
+Vec2 intersection(const Vec2 A, const Vec2 B, const Vec2 C, const Vec2 D)
+Find intersection point of two lines [A, B] and [C, D], returns INFINITY if the lines don't intersect each other [parallel]
+is_character_female
+
+Search script examples for is_character_female
+
+bool is_character_female(ENT_TYPE type_id)
+Same as Player.is_female
+list_char_mods
+
+Search script examples for list_char_mods
+
+nil list_char_mods()
+List all char.png files recursively from Mods/Packs. Returns table of file paths.
+list_dir
+
+Search script examples for list_dir
+
+nil list_dir(string dir)
+List files in directory relative to the script root. Returns table of file/directory names or nil if not found.
+load_death_screen
+
+Search script examples for load_death_screen
+
+nil load_death_screen()
+Immediately ends the run with the death screen, also calls the save_progress
+load_screen
+
+Search script examples for load_screen
+
+nil load_screen()
+Immediately load a screen based on state.screen_next and stuff
+lowbias32
+
+Search script examples for lowbias32
+
+int lowbias32(int x)
+Some random hash function
+lowbias32_r
+
+Search script examples for lowbias32_r
+
+int lowbias32_r(int x)
+Reverse of some random hash function
+pause
+
+Search script examples for pause
+
+nil pause(bool p)
+Pause/unpause the game.
+This is just short for state.pause == 32
, but that produces an audio bug
+I suggest state.pause == 2
, but that won't run any callback, state.pause == 16
will do the same but set_global_interval will still work
+register_console_command
+
+Search script examples for register_console_command
+
+nil register_console_command(string name, function cmd)
+Adds a command that can be used in the console.
+rgba
+
+Search script examples for rgba
+
+uColor rgba(int r, int g, int b, int a)
+Converts a color to int to be used in drawing functions. Use values from 0..255
.
+save_progress
+
+Search script examples for save_progress
+
+bool save_progress()
+Saves the game to savegame.sav, unless game saves are blocked in the settings. Also runs the ON.SAVE callback. Fails and returns false, if you're trying to save too often (2s).
+save_script
+
+Search script examples for save_script
+
+bool save_script()
+Runs the ON.SAVE callback. Fails and returns false, if you're trying to save too often (2s).
+script_enabled
+
+Search script examples for script_enabled
+
+bool script_enabled(string id, string version = "")
+Check if another script is enabled by id "author/name". You should probably check this after all the other scripts have had a chance to load.
+seed_prng
+
+Search script examples for seed_prng
+
+nil seed_prng(int seed)
+Seed the game prng.
+set_adventure_seed
+
+Search script examples for set_adventure_seed
+
+nil set_adventure_seed(int first, int second)
+Set the current adventure seed pair
+set_character_heart_color
+
+Search script examples for set_character_heart_color
+
+nil set_character_heart_color(ENT_TYPE type_id, Color color)
+Same as Player.set_heart_color
+set_ending_unlock
-- change character unlocked by endings to pilot
+set_ending_unlock(ENT_TYPE.CHAR_PILOT)
+
+-- change texture of the actual savior in endings to pilot
+set_callback(function()
+ set_post_entity_spawn(function(ent)
+ if state.screen == SCREEN.WIN then
+ ent:set_texture(TEXTURE.DATA_TEXTURES_CHAR_PINK_0)
+ end
+ clear_callback()
+ end, SPAWN_TYPE.SYSTEMIC, MASK.PLAYER)
+end, ON.WIN)
+
+
+
+Search script examples for set_ending_unlock
+
+nil set_ending_unlock(ENT_TYPE type)
+Force the character unlocked in either ending to ENT_TYPE. Set to 0 to reset to the default guys. Does not affect the texture of the actual savior. (See example)
+set_journal_enabled
+
+Search script examples for set_journal_enabled
+
+nil set_journal_enabled(bool b)
+Enables or disables the journal
+set_level_config
+
+Search script examples for set_level_config
+
+nil set_level_config(LEVEL_CONFIG config, int value)
+Set the value for the specified config
+set_mask
+
+Search script examples for set_mask
+
+Flags set_mask(Flags flags, Flags mask)
+Set a bitmask in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
+set_seed
+
+Search script examples for set_seed
+
+nil set_seed(int seed)
+Set seed and reset run.
+set_setting
-- set some visual settings needed by your mod
+-- doing this here will reapply these after visiting the options, which would reset them to real values
+
+set_callback(function()
+ if state.screen_next == SCREEN.LEVEL then
+ -- use the secret tiny hud size
+ set_setting(GAME_SETTING.HUD_SIZE, 3)
+ -- force opaque textboxes
+ set_setting(GAME_SETTING.TEXTBOX_OPACITY, 0)
+ end
+end, ON.PRE_LOAD_SCREEN)
+
+
+
+Search script examples for set_setting
+
+bool set_setting(GAME_SETTING setting, int value)
+Sets the specified setting temporarily. These values are not saved and might reset to the users real settings if they visit the options menu. (Check example.) All settings are available in unsafe mode and only a smaller subset SAFE_SETTING by default for Hud and other visuals. Returns false, if setting failed.
+set_storage_layer
-- Sets the right layer when using the vanilla tile code if waddler is still happy,
+-- otherwise spawns the floor to the left of this tile.
+-- Manually spawning FLOOR_STORAGE pre-tilecode doesn't seem to work as expected,
+-- so we destroy it post-tilecode.
+set_post_tile_code_callback(function(x, y, layer)
+ if not test_flag(state.quest_flags, 10) then
+ -- Just set the layer and let the vanilla tilecode handle the floor
+ set_storage_layer(layer)
+ else
+ local floor = get_entity(get_grid_entity_at(x, y, layer))
+ if floor then
+ floor:destroy()
+ end
+ if get_grid_entity_at(x - 1, y, layer) ~= -1 then
+ local left = get_entity(get_grid_entity_at(x - 1, y, layer))
+ spawn_grid_entity(left.type.id, x, y, layer)
+ end
+ end
+end, "storage_floor")
-set_callback(function(load_ctx)
- local load_data_str = load_ctx:load()
- if load_data_str ~= "" then
- some_mod_data_that_should_be_saved = json.decode(load_data_str)
+-- This fixes a bug in the game that breaks storage on transition.
+-- The old storage_uid is not cleared after every level for some reason.
+set_callback(function()
+ state.storage_uid = -1
+end, ON.TRANSITION)
+
+-- Having a waddler is completely optional for storage,
+-- but this makes a nice waddler room if he still likes you.
+define_tile_code("waddler")
+set_pre_tile_code_callback(function(x, y, layer)
+ if not test_flag(state.quest_flags, 10) then
+ local uid = spawn_roomowner(ENT_TYPE.MONS_STORAGEGUY, x + 0.5, y, layer, ROOM_TEMPLATE.WADDLER)
+ set_on_kill(uid, function()
+ -- Disable current level storage if you kill waddler
+ state.storage_uid = -1
+ end)
end
-end, ON.LOAD)
-
inspect
-This module is a great substitute for tostring
because it can convert any type to a string and thus helps a lot with debugging. Use for example like this:
-local look_ma_no_tostring = {
- number = 15,
- nested_table = {
- array = {
- 1,
- 2,
- 4
- }
- }
+ return true
+end, "waddler")
+
+
+
+Search script examples for set_storage_layer
+
+nil set_storage_layer(LAYER layer)
+Set layer to search for storage items on
+set_tiamat_cutscene_enabled
+
+Search script examples for set_tiamat_cutscene_enabled
+
+nil set_tiamat_cutscene_enabled(bool enable)
+Tiamat cutscene is also responsible for locking the exit door
+So you may need to close it yourself if you still want to be required to kill Tiamat
+show_journal
+
+Search script examples for show_journal
+
+nil show_journal(JOURNALUI_PAGE_SHOWN chapter, int page)
+Open the journal on a chapter and page. The main Journal spread is pages 0..1, so most chapters start at 2. Use even page numbers only.
+test_mask
+
+Search script examples for test_mask
+
+bool test_mask(Flags flags, Flags mask)
+Returns true if a bitmask is set in the number.
+toggle_journal
+
+Search script examples for toggle_journal
+
+nil toggle_journal()
+Open or close the journal as if pressing the journal button. Will respect visible journal popups and force_journal.
+two_lines_angle
+
+Search script examples for two_lines_angle
+
+float two_lines_angle(Vec2 A, Vec2 common, Vec2 B)
+Mesures angle between two lines with one common point
+float two_lines_angle(Vec2 line1_A, Vec2 line1_B, Vec2 line2_A, Vec2 line2_B)
+Gets line1_A, intersection point and line2_B and calls the 3 parameter version of this function
+update_liquid_collision_at
+
+Search script examples for update_liquid_collision_at
+
+nil update_liquid_collision_at(float x, float y, bool add)
+Updates the floor collisions used by the liquids, set add to false to remove tile of collision, set to true to add one
+warp
+
+Search script examples for warp
+
+nil warp(int w, int l, int t)
+Warp to a level immediately.
+Input functions
get_io
+
+Search script examples for get_io
+
+ImGuiIO get_io()
+Returns: ImGuiIO for raw keyboard, mouse and xinput gamepad stuff.
+
+
+- Note: The clicked/pressed actions only make sense in
ON.GUIFRAME
.
+- Note: Lua starts indexing at 1, you need
keysdown[string.byte('A') + 1]
to find the A key.
+- Note: Overlunky/etc will eat all keys it is currently configured to use, your script will only get leftovers.
+- Note: Gamepad is basically XINPUT_GAMEPAD but variables are renamed and values are normalized to -1.0..1.0 range.
+
+mouse_position
+
+Search script examples for mouse_position
+
+tuple<float, float> mouse_position()
+Current mouse cursor position in screen coordinates.
+return_input
+
+Search script examples for return_input
+
+nil return_input(int uid)
+Return input previously stolen with steal_input
+send_input
+
+Search script examples for send_input
+
+nil send_input(int uid, INPUTS buttons)
+Send input to entity, has to be previously stolen with steal_input
+steal_input
+
+Search script examples for steal_input
+
+nil steal_input(int uid)
+Steal input from a Player, HiredHand or PlayerGhost
+Lighting functions
create_illumination
+
+Search script examples for create_illumination
+
+Illumination create_illumination(Color color, float size, float x, float y)
Illumination create_illumination(Color color, float size, int uid)
+Creates a new Illumination. Don't forget to continuously call refresh_illumination, otherwise your light emitter fades out! Check out the illumination.lua script for an example
+refresh_illumination
+
+Search script examples for refresh_illumination
+
+nil refresh_illumination(Illumination illumination)
+Refreshes an Illumination, keeps it from fading out
+Message functions
cancel_speechbubble
+
+Search script examples for cancel_speechbubble
+
+nil cancel_speechbubble()
cancel_toast
+
+Search script examples for cancel_toast
+
+nil cancel_toast()
console_prinspect
+
+Search script examples for console_prinspect
+
+nil console_prinspect(variadic_args objects)
+Prinspect to ingame console.
+console_print
+
+Search script examples for console_print
+
+nil console_print(string message)
+Print a log message to ingame console.
+log_print
+
+Search script examples for log_print
+
+nil log_print(string message)
+Log to spelunky.log
+lua_print
+
+Search script examples for lua_print
+
+nil lua_print()
+Standard lua print function, prints directly to the terminal but not to the game
+message
+
+Search script examples for message
+
+nil message(string message)
+Same as print
+messpect
+
+Search script examples for messpect
+
+nil messpect(variadic_args objects)
+Same as prinspect
+prinspect
prinspect(state.level, state.level_next)
+local some_stuff_in_a_table = {
+ some = state.time_total,
+ stuff = state.world
}
-message(inspect(look_ma_no_tostring))
---[[prints:
-{
- number = 15,
- nested_table = {
- array = { 1, 2, 4 }
- }
-}
-]]
-
format
-This allows you to make strings without having to do a lot of tostring
and ..
by placing your variables directly inside of the string. Use F
in front of your string and wrap variables you want to print in {}
, for example like this:
-for _, player in players do
- local royal_title = nil
- if player:is_female() then
- royal_title = 'Queen'
- else
- royal_title = 'King'
+prinspect(some_stuff_in_a_table)
+
+
+
+Search script examples for prinspect
+
+nil prinspect(variadic_args objects)
+Prints any type of object by first funneling it through inspect
, no need for a manual tostring
or inspect
.
+print
+
+Search script examples for print
+
+nil print(string message)
+Print a log message on screen.
+printf
+
+Search script examples for printf
+
+nil printf()
+Short for print(string.format(...))
+say
+
+Search script examples for say
+
+nil say(int entity_uid, string message, int sound_type, bool top)
+Show a message coming from an entity
+speechbubble_visible
+
+Search script examples for speechbubble_visible
+
+bool speechbubble_visible()
toast
+
+Search script examples for toast
+
+nil toast(string message)
+Show a message that looks like a level feeling.
+toast_visible
+
+Search script examples for toast_visible
+
+bool toast_visible()
Movable Behavior functions
make_custom_behavior
+
+Search script examples for make_custom_behavior
+
+CustomMovableBehavior make_custom_behavior(string_view behavior_name, int state_id, VanillaMovableBehavior base_behavior)
+Make a CustomMovableBehavior
, if base_behavior
is nil
you will have to set all of the
+behavior functions. If a behavior with behavior_name
already exists for your script it will
+be returned instead.
+Network functions
udp_listen
+
+Search script examples for udp_listen
+
+UdpServer udp_listen(string host, in_port_t port, function cb)
+Start an UDP server on specified address and run callback when data arrives. Return a string from the callback to reply. Requires unsafe mode.
+The server will be closed once the handle is released.
+udp_send
+
+Search script examples for udp_send
+
+nil udp_send(string host, in_port_t port, string msg)
+Send data to specified UDP address. Requires unsafe mode.
+Option functions
register_option_bool
register_option_bool("bomb_bag", "BombBag", "Spawn bomb bag at the start of every level", false)
+
+set_callback(function()
+ if options.bomb_bag then
+ -- Spawn the bomb bag at player location thanks to the LAYER.PLAYER1
+ spawn_entity_snapped_to_floor(ENT_TYPE.ITEM_PICKUP_BOMBBAG, 0, 0, LAYER.PLAYER1)
end
- local name = F'{player:get_name()} aka {royal_title} {player:get_short_name()}'
- message(name)
-end
-
Unsafe mode
-Setting meta.unsafe = true
enables the rest of the standard Lua libraries like io
and os
, loading dlls with require and package.loadlib
. Using unsafe scripts requires users to enable the option in the overlunky.ini file which is found in the Spelunky 2 installation directory.
-Modules
-You can load modules with require "mymod"
or require "mydir.mymod"
, just put mymod.lua
in the same directory the script is, or in mydir/
to keep things organized.
+end, ON.LEVEL)
-Check the Lua tutorial or examples how to actually make modules.
+
++Search script examples for register_option_bool
+
Add a boolean option that the user can change in the UI. Read with options.name
, value
is the default.
++Search script examples for register_option_button
+
Add a button that the user can click in the UI. Sets the timestamp of last click on value and runs the callback function.
+++Search script examples for register_option_callback
+
Add custom options using the window drawing functions. Everything drawn in the callback will be rendered in the options window and the return value saved to options[name]
or overwriting the whole options
table if using and empty name.
+value
is the default value, and pretty important because anything defined in the callback function will only be defined after the options are rendered. See the example for details.
+
The callback signature is optional
++Search script examples for register_option_combo
+
Add a combobox option that the user can change in the UI. Read the int index of the selection with options.name
. Separate opts
with \0
,
+with a double \0\0
at the end. value
is the default index 1..n.
++Search script examples for register_option_float
+
Add a float option that the user can change in the UI. Read with options.name
, value
is the default. Keep in mind these are just soft
+limits, you can override them in the UI with double click.
++Search script examples for register_option_int
+
Add an integer option that the user can change in the UI. Read with options.name
, value
is the default. Keep in mind these are just soft
+limits, you can override them in the UI with double click.
++Search script examples for register_option_string
+
Add a string option that the user can change in the UI. Read with options.name
, value
is the default.
++Search script examples for unregister_option
+
Removes an option by name. To make complicated conditionally visible options you should probably just use register_option_callback though.
+++Search script examples for advance_screen_particles
+
Advances the state of the screen particle emitter (simulates the next positions, ... of all the particles in the emitter). Only used with screen particle emitters. See the particles.lua
example script for more details.
++Search script examples for extinguish_particles
+
Extinguish a particle emitter (use the return value of generate_world_particles
or generate_screen_particles
as the parameter in this function)
++Search script examples for generate_screen_particles
+
Generate particles of the specified type at a certain screen coordinate (use e.g. local emitter = generate_screen_particles(PARTICLEEMITTER.CHARSELECTOR_TORCHFLAME_FLAMES, 0.0, 0.0)
). See the particles.lua
example script for more details.
++Search script examples for generate_world_particles
+
Generate particles of the specified type around the specified entity uid (use e.g. local emitter = generate_world_particles(PARTICLEEMITTER.PETTING_PET, players[1].uid)
). You can then decouple the emitter from the entity with emitter.entity_uid = -1
and freely move it around. See the particles.lua
example script for more details.
++Search script examples for get_particle_type
+
Get the ParticleDB details of the specified ID
+++Search script examples for render_screen_particles
+
Renders the particles to the screen. Only used with screen particle emitters. See the particles.lua
example script for more details.
activate_tiamat_position_hack(true);
-You can also import other loaded script mods to your own mod if they have exports
.
-Aliases
-Used to clarify what kind of values can be passed and returned from a function, even if the underlying type is really just an integer or a string. This should help to avoid bugs where one would for example just pass a random integer to a function expecting a callback id.
+set_post_entity_spawn(function(ent)
-
-
-Name
-Type
-
-
-
-CallbackId
-int;
-
-
-Flags
-int;
-
-
-uColor
-int;
-
-
-SHORT_TILE_CODE
-int;
-
-
-STRINGID
-int;
-
-
-FEAT
-int;
-
-
-Global variables
-These variables are always there to use.
-meta
meta.name = "Awesome Mod"
-meta.version = "1.0"
-meta.author = "You"
-meta.description = [[
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut at nulla porttitor, lobortis magna at, tempus dolor. Cras non ligula tellus. Duis tincidunt sodales velit et ornare. Mauris eu sapien finibus dolor dictum malesuada in non elit.
+ -- make them same as in the game, but relative to the tiamat entity
+ ent.attack_x = ent.x - 1
+ ent.attack_y = ent.y + 2
- Aenean luctus leo ut diam ornare viverra. Nunc condimentum interdum elit, quis porttitor quam finibus ac. Nam mattis, lectus commodo placerat tristique, justo justo congue dui, sed sodales nunc sem ut neque.
-]]
--- set this to enable unsafe mode
---meta.unsafe = true
+end, SPAWN_TYPE.ANY, 0, ENT_TYPE.MONS_TIAMAT)
+
+
+Search script examples for activate_tiamat_position_hack
+
+nil activate_tiamat_position_hack(bool activate)
+Activate custom variables for position used for detecting the player (normally hardcoded)
+note: because those variables are custom and game does not initiate them, you need to do it yourself for each Tiamat entity, recommending set_post_entity_spawn
+default game values are: attack_x = 17.5 attack_y = 62.5
+distance
+
+Search script examples for distance
+
+float distance(int uid_a, int uid_b)
+Calculate the tile distance of two entities by uid
+draw_text_size
-- draw text
+set_callback(function(draw_ctx)
+ -- get a random color
+ local color = math.random(0, 0xffffffff)
+ -- zoom the font size based on frame
+ local size = (get_frame() % 199)+1
+ local text = 'Awesome!'
+ -- calculate size of text
+ local w, h = draw_text_size(size, text)
+ -- draw to the center of screen
+ draw_ctx:draw_text(0-w/2, 0-h/2, size, text, color)
+end, ON.GUIFRAME)
--- rest of your mod goes here
+
+
+Search script examples for draw_text_size
+
+tuple<float, float> draw_text_size(float size, string text)
+Calculate the bounding box of text, so you can center it etc. Returns width
, height
in screen distance.
+fix_liquid_out_of_bounds
-- call this in ON.FRAME if needed in your custom level
+set_callback(fix_liquid_out_of_bounds, ON.FRAME)
-
array<mixed> meta
+
++Search script examples for fix_liquid_out_of_bounds
+
Removes all liquid that is about to go out of bounds, which crashes the game.
+++Search script examples for game_position
+
Get the game coordinates at the screen position (x
, y
)
++Search script examples for get_aabb_bounds
+
Same as get_bounds but returns AABB struct instead of loose floats
+-- Draw the level boundaries
+set_callback(function(draw_ctx)
+ local xmin, ymax, xmax, ymin = get_bounds()
+ local sx, sy = screen_position(xmin, ymax) -- top left
+ local sx2, sy2 = screen_position(xmax, ymin) -- bottom right
+ draw_ctx:draw_rect(sx, sy, sx2, sy2, 4, 0, rgba(255, 255, 255, 255))
+end, ON.GUIFRAME)
+
+
++Search script examples for get_bounds
+
Basically gets the absolute coordinates of the area inside the unbreakable bedrock walls, from wall to wall. Every solid entity should be +inside these boundaries. The order is: left x, top y, right x, bottom y
+++Search script examples for get_camera_position
+
Gets the current camera position in the level
+++Search script examples for get_hitbox
+
Gets the hitbox of an entity, use extrude
to make the hitbox bigger/smaller in all directions and offset
to offset the hitbox in a given direction
++Search script examples for get_hud_position
+
Approximate bounding box of the player hud element for player index 1..4 based on user settings and player count
+-- -Search script examples for meta
+Search script examples for get_image_size
Table of strings where you should set some script metadata shown in the UI and used by other scripts to find your script.
-if state.time_level > 300 and state.theme == THEME.DWELLING then
- toast("Congratulations for lasting 5 seconds in Dwelling")
-end
-
-
Get image size from file. Returns a tuple containing width and height.
+-- -Search script examples for state
+Search script examples for get_position
A bunch of game state variables. Your ticket to almost anything that is not an Entity.
-if game_manager.game_props.game_has_focus == false then
- message("Come back soon!")
-end
-
-
Get position x, y, layer
of entity by uid. Use this, don't use Entity.x/y
because those are sometimes just the offset to the entity
+you're standing on, not real level coordinates.
-- -Search script examples for game_manager
+Search script examples for get_render_hitbox
The GameManager gives access to a couple of Screens as well as the pause and journal UI elements
-message = "Currently playing: "
-for _, p in pairs(online.online_players) do
- if p.ready_state ~= 0 then
- message = message .. p.player_name .. " "
- end
-end
-print(message)
-
-
Same as get_hitbox
but based on get_render_position
-- -Search script examples for online
+Search script examples for get_render_position
The Online object has information about the online lobby and its players
--- Make the player invisible, use only in single player only mods
-
-players[1].flags = set_flag(players[1].flags, 1)
-
-
Get interpolated render position x, y, layer
of entity by uid. This gives smooth hitboxes for 144Hz master race etc...
-- -Search script examples for players
+Search script examples for get_velocity
An array of Player of the current players. This is just a list of existing Player entities in order, i.e., players[1]
is not guaranteed to be P1 if they have been gibbed for example. See get_player.
Get velocity vx, vy
of an entity by uid. Use this, don't use Entity.velocityx/velocityy
because those are relative to Entity.overlay
.
--Print best time from savegame
+Search script examples for get_window_size
prinspect(savegame.time_best)
-
Gets the resolution (width and height) of the screen
+-- -Search script examples for savegame
+Search script examples for get_zoom_level
Provides access to the save data, updated as soon as something changes (i.e. before it's written to savegame.sav.) Use save_progress to save to savegame.sav.
-register_option_bool("bomb_bag", "BombBag", "Spawn bomb bag at the start of every level", false)
-
-set_callback(function()
- if options.bomb_bag then
- -- Spawn the bomb bag at player location thanks to the LAYER.PLAYER1
- spawn_entity_snapped_to_floor(ENT_TYPE.ITEM_PICKUP_BOMBBAG, 0, 0, LAYER.PLAYER1)
- end
-end, ON.LEVEL)
-
-
Get the current set zoom level
+-+Search script examples for options
+Search script examples for position_is_valid
Check if position satifies the given POS_TYPE flags, to be used in a custom is_valid function procedural for spawns.
+++Search script examples for screen_aabb
+
Convert an AABB
to a screen AABB
that can be directly passed to draw functions
++Search script examples for screen_distance
+
Translate a distance of x
tiles to screen distance to be be used in drawing functions
++Search script examples for screen_position
+
Translate an entity position to screen position to be used in drawing functions
+++Search script examples for set_camp_camera_bounds_enabled
+
Enables or disables the default position based camp camera bounds, to set them manually yourself
+++Search script examples for zoom
+
Set the zoom level used in levels and shops. 13.5 is the default.
+++Search script examples for define_room_template
+
Define a new room template to use with set_room_template
++Search script examples for get_room_index
+
Transform a position to a room index to be used in get_room_template
and PostRoomGenerationContext.set_room_template
++Search script examples for get_room_pos
+
Transform a room index into the top left corner position in the room
+++Search script examples for get_room_template
+
Get the room template given a certain index, returns nil
if coordinates are out of bounds
++Search script examples for get_room_template_name
+
For debugging only, get the name of a room template, returns 'invalid'
if room template is not defined
++Search script examples for is_machine_room_origin
+
Get whether a room is the origin of a machine room
+++Search script examples for is_room_flipped
+
Get whether a room is flipped at the given index, returns false
if coordinates are out of bounds
++Search script examples for set_room_template_size
+
Set the size of room template in tiles, the template must be of type ROOM_TEMPLATE_TYPE.MACHINE_ROOM
.
-- spawns waddler selling pets
+-- all the aggro etc mechanics from a normal shop still apply
+local x, y, l = get_position(get_player(1).uid)
+local owner = spawn_roomowner(ENT_TYPE.MONS_STORAGEGUY, x+1, y, l, ROOM_TEMPLATE.SHOP)
+add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_DOG, x-1, y, l), owner)
+add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_CAT, x-2, y, l), owner)
+add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_HAMSTER, x-3, y, l), owner)
-Table of options set in the UI, added with the register_option_functions, but nil
before any options are registered. You can also write your own options in here or override values defined in the register functions/UI before or after they are registered. Check the examples for many different use cases and saving options to disk.
-prng
--Make it so there is 50% chance that the Ankh will be destroyed
-
-set_callback(function ()
- -- more or less 50% chance
- if prng:random(2) == 1 then
- -- get all Ankh's in a level
- ankhs = get_entities_by(ENT_TYPE.ITEM_PICKUP_ANKH, MASK.ITEM, LAYER.BOTH)
- for _, uid in pairs(ankhs) do
- get_entity(uid):destroy()
- end
- end
-end, ON.LEVEL)
+-- use in a tile code to add shops to custom levels
+-- this may spawn some shop related decorations too
+define_tile_code("pet_shop_boys")
+set_pre_tile_code_callback(function(x, y, layer)
+ local owner = spawn_roomowner(ENT_TYPE.MONS_YANG, x, y, layer, ROOM_TEMPLATE.SHOP)
+ -- another dude for the meme, this has nothing to do with the shop
+ spawn_on_floor(ENT_TYPE.MONS_BODYGUARD, x+1, y, layer)
+ add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_HAMSTER, x+2, y, layer), owner)
+ return true
+end, "pet_shop_boys")
-
PRNG prng
+
-- -Search script examples for prng
+Search script examples for spawn_roomowner
The global prng state, calling any function on it will advance the prng state, thus desynchronizing clients if it does not happen on both clients.
-The game functions like spawn
use level coordinates. Draw functions use normalized screen coordinates from -1.0 .. 1.0
where 0.0, 0.0
is the center of the screen.
Spawn a RoomOwner (or a few other like CavemanShopkeeper) in the coordinates and make them own the room, optionally changing the room template. Returns the RoomOwner uid.
+--Create three explosions and then clear the interval
+Search script examples for add_item_to_shop
local count = 0 -- this upvalues to the interval
-set_interval(function()
- count = count + 1
- spawn(ENT_TYPE.FX_EXPLOSION, 0, 0, LAYER.FRONT, 0, 0)
- if count >= 3 then
- -- calling this without parameters clears the callback that's calling it
- clear_callback()
- end
-end, 60)
+nil add_item_to_shop(int item_uid, int shop_owner_uid)
+Adds entity as shop item, has to be of Purchasable type, check the entity hierarchy list to find all the Purchasable entity types.
+Adding other entities will result in not obtainable items or game crash
+change_diceshop_prizes
+
+Search script examples for change_diceshop_prizes
+
+nil change_diceshop_prizes(array<ENT_TYPE> ent_types)
+Change ENT_TYPE's spawned in dice shops (Madame Tusk as well), by default there are 25:
+{ITEM_PICKUP_BOMBBAG, ITEM_PICKUP_BOMBBOX, ITEM_PICKUP_ROPEPILE, ITEM_PICKUP_COMPASS, ITEM_PICKUP_PASTE, ITEM_PICKUP_PARACHUTE, ITEM_PURCHASABLE_CAPE, ITEM_PICKUP_SPECTACLES, ITEM_PICKUP_CLIMBINGGLOVES, ITEM_PICKUP_PITCHERSMITT,
+ENT_TYPE_ITEM_PICKUP_SPIKESHOES, ENT_TYPE_ITEM_PICKUP_SPRINGSHOES, ITEM_MACHETE, ITEM_BOOMERANG, ITEM_CROSSBOW, ITEM_SHOTGUN, ITEM_FREEZERAY, ITEM_WEBGUN, ITEM_CAMERA, ITEM_MATTOCK, ITEM_PURCHASABLE_JETPACK, ITEM_PURCHASABLE_HOVERPACK,
+ITEM_TELEPORTER, ITEM_PURCHASABLE_TELEPORTER_BACKPACK, ITEM_PURCHASABLE_POWERPACK}
+Min 6, Max 255, if you want less then 6 you need to write some of them more then once (they will have higher "spawn chance").
+If you use this function in the level with diceshop in it, you have to update item_ids
in the ITEM_DICE_PRIZE_DISPENSER.
+Use empty table as argument to reset to the game default
+is_inside_active_shop_room
+
+Search script examples for is_inside_active_shop_room
+
+bool is_inside_active_shop_room(float x, float y, LAYER layer)
+Checks whether a coordinate is inside a room containing an active shop. This function checks whether the shopkeeper is still alive.
+is_inside_shop_zone
+
+Search script examples for is_inside_shop_zone
+
+bool is_inside_shop_zone(float x, float y, LAYER layer)
+Checks whether a coordinate is inside a shop zone, the rectangle where the camera zooms in a bit. Does not check if the shop is still active!
+spawn_shopkeeper
-- spawns a shopkeeper selling a shotgun next to you
+-- converts the current room to a ROOM_TEMPLATE.SHOP with shop music and zoom effect
+local x, y, l = get_position(get_player(1).uid)
+local owner = spawn_shopkeeper(x+1, y, l)
+add_item_to_shop(spawn_on_floor(ENT_TYPE.ITEM_SHOTGUN, x-1, y, l), owner)
+
+-- spawns a shopkeeper selling a puppy next to you
+-- also converts the room to a shop, but after the shopkeeper is spawned
+-- this enables the safe zone for moving items, but disables shop music and zoom for whatever reason
+local x, y, l = get_position(get_player(1).uid)
+local owner = spawn_shopkeeper(x+1, y, l, ROOM_TEMPLATE.SIDE)
+add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_DOG, x-1, y, l), owner)
+local ctx = PostRoomGenerationContext:new()
+local rx, ry = get_room_index(x, y)
+ctx:set_room_template(rx, ry, l, ROOM_TEMPLATE.SHOP)
+
-Search script examples for clear_callback
+Search script examples for spawn_shopkeeper
-nil clear_callback(optional<CallbackId> id)
-Clear previously added callback id
or call without arguments inside any callback to clear that callback after it returns.
-clear_screen_callback
+int spawn_shopkeeper(float x, float y, LAYER layer, ROOM_TEMPLATE room_template = ROOM_TEMPLATE.SHOP)
+Spawn a Shopkeeper in the coordinates and make the room their shop. Returns the Shopkeeper uid. Also see spawn_roomowner.
+Sound functions
create_sound
-Search script examples for clear_screen_callback
+Search script examples for create_sound
-nil clear_screen_callback(int screen_id, CallbackId cb_id)
-Clears a callback that is specific to a screen.
-clear_vanilla_sound_callback
+optional<CustomSound> create_sound(string path)
+Loads a sound from disk relative to this script, ownership might be shared with other code that loads the same file. Returns nil if file can't be found
+get_sound
-Search script examples for clear_vanilla_sound_callback
+Search script examples for get_sound
-nil clear_vanilla_sound_callback(CallbackId id)
-Clears a previously set callback
-set_callback
+optional<CustomSound> get_sound(string path_or_vanilla_sound)
+Gets an existing sound, either if a file at the same path was already loaded or if it is already loaded by the game
+play_sound
-Search script examples for set_callback
+Search script examples for play_sound
-CallbackId set_callback(function cb, ON event)
-Returns unique id for the callback to be used in clear_callback.
-Add global callback function to be called on an event.
-set_global_interval
+SoundMeta play_sound(VANILLA_SOUND sound, int source_uid)
Spawn functions
change_altar_damage_spawns
-Search script examples for set_global_interval
+Search script examples for change_altar_damage_spawns
-CallbackId set_global_interval(function cb, int frames)
-Returns unique id for the callback to be used in clear_callback. You can also return false
from your function to clear the callback.
-Add global callback function to be called every frames
engine frames. This timer is never paused or cleared.
-set_global_timeout
+nil change_altar_damage_spawns(array<ENT_TYPE> ent_types)
+Change ENT_TYPE's spawned when you damage the altar, by default there are 6:
+{MONS_BAT, MONS_BEE, MONS_SPIDER, MONS_JIANGSHI, MONS_FEMALE_JIANGSHI, MONS_VAMPIRE}
+Max 255 types.
+Use empty table as argument to reset to the game default
+change_sunchallenge_spawns
-Search script examples for set_global_timeout
+Search script examples for change_sunchallenge_spawns
-CallbackId set_global_timeout(function cb, int frames)
-Returns unique id for the callback to be used in clear_callback.
-Add global callback function to be called after frames
engine frames. This timer is never paused or cleared.
-set_interval
+nil change_sunchallenge_spawns(array<ENT_TYPE> ent_types)
+Change ENT_TYPE's spawned by FLOOR_SUNCHALLENGE_GENERATOR
, by default there are 4:
+{MONS_WITCHDOCTOR, MONS_VAMPIRE, MONS_SORCERESS, MONS_NECROMANCER}
+Because of the game logic number of entity types has to be a power of 2: (1, 2, 4, 8, 16, 32), if you want say 30 types, you need to write two entities two times (they will have higher "spawn chance").
+Use empty table as argument to reset to the game default
+default_spawn_is_valid
-Create three explosions and then clear the interval
+Search script examples for default_spawn_is_valid
-local count = 0 -- this upvalues to the interval
-set_interval(function()
- count = count + 1
- spawn(ENT_TYPE.FX_EXPLOSION, 0, 0, LAYER.FRONT, 0, 0)
- if count >= 3 then
- -- calling this without parameters clears the fallback that's calling it
- clear_callback()
- end
-end, 60)
-
+bool default_spawn_is_valid(float x, float y, LAYER layer)
+Default function in spawn definitions to check whether a spawn is valid or not
+define_extra_spawn
-Search script examples for set_interval
+Search script examples for define_extra_spawn
-CallbackId set_interval(function cb, int frames)
-Returns unique id for the callback to be used in clear_callback. You can also return false
from your function to clear the callback.
-Add per level callback function to be called every frames
engine frames
-Ex. frames = 100 - will call the function on 100th frame from this point. This might differ in the exact timing of first frame depending as in what part of the frame you call this function
-or even be one frame off if called right before the time_level variable is updated
-If you require precise timing, choose the start of your interval in one of those safe callbacks:
-The SCREEN callbacks: from ON.LOGO to ON.ONLINE_LOBBY or custom callbacks ON.FRAME, ON.SCREEN, ON.START, ON.LOADING, ON.RESET, ON.POST_UPDATE
-Timer is paused on pause and cleared on level transition.
-set_on_player_instagib
+int define_extra_spawn(function do_spawn, function is_valid, int num_spawns_frontlayer, int num_spawns_backlayer)
+Define a new extra spawn, these are semi-guaranteed level gen spawns with a fixed upper bound.
+The function nil do_spawn(float x, float y, LAYER layer)
contains your code to spawn the thing, whatever it is.
+The function bool is_valid(float x, float y, LAYER layer)
determines whether the spawn is legal in the given position and layer.
+Use for example when you can spawn only on the ceiling, under water or inside a shop.
+Set is_valid
to nil
in order to use the default rule (aka. on top of floor and not obstructed).
+To change the number of spawns use PostRoomGenerationContext:set_num_extra_spawns
during ON.POST_ROOM_GENERATION
+No name is attached to the extra spawn since it is not modified from level files, instead every call to this function will return a new uniqe id.
+define_procedural_spawn
-Search script examples for set_on_player_instagib
+Search script examples for define_procedural_spawn
-optional<CallbackId> set_on_player_instagib(int uid, function fun)
-Returns unique id for the callback to be used in clear_callback or nil
if uid is not valid.
-Sets a callback that is called right when an player/hired hand is crushed/insta-gibbed, return true
to skip the game's crush handling.
-The game's instagib function will be forcibly executed (regardless of whatever you return in the callback) when the entity's health is zero.
-This is so that when the entity dies (from other causes), the death screen still gets shown.
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is bool on_player_instagib(Entity self)
-set_post_entity_spawn
+PROCEDURAL_CHANCE define_procedural_spawn(string procedural_spawn, function do_spawn, function is_valid)
+Define a new procedural spawn, the function nil do_spawn(float x, float y, LAYER layer)
contains your code to spawn the thing, whatever it is.
+The function bool is_valid(float x, float y, LAYER layer)
determines whether the spawn is legal in the given position and layer.
+Use for example when you can spawn only on the ceiling, under water or inside a shop.
+Set is_valid
to nil
in order to use the default rule (aka. on top of floor and not obstructed).
+If a user disables your script but still uses your level mod nothing will be spawned in place of your procedural spawn.
+door
-Search script examples for set_post_entity_spawn
+Search script examples for door
-CallbackId set_post_entity_spawn(function cb, SPAWN_TYPE flags, int mask, variadic_args entity_types)
-Add a callback for a spawn of specific entity types or mask. Set mask
to MASK.ANY
to ignore that.
-This is run right after the entity is spawned but before and particular properties are changed, e.g. owner or velocity.
-
The callback signature is nil post_entity_spawn(Entity ent, SPAWN_TYPE spawn_flags)
-set_post_render_screen
+int door(float x, float y, LAYER layer, int w, int l, int t)
+Short for spawn_door.
+get_missing_extra_spawns
-Search script examples for set_post_render_screen
+Search script examples for get_missing_extra_spawns
-optional<CallbackId> set_post_render_screen(int screen_id, function fun)
-Returns unique id for the callback to be used in clear_screen_callback or nil
if screen_id is not valid.
-Sets a callback that is called right after the screen is drawn.
-
The callback signature is nil render_screen(Screen self, VanillaRenderContext render_ctx)
-set_pre_entity_spawn
+tuple<int, int> get_missing_extra_spawns(int extra_spawn_chance_id)
+Use to query whether any of the requested spawns could not be made, usually because there were not enough valid spaces in the level.
+Returns missing spawns in the front layer and missing spawns in the back layer in that order.
+The value only makes sense after level generation is complete, aka after ON.POST_LEVEL_GENERATION
has run.
+get_procedural_spawn_chance
-Search script examples for set_pre_entity_spawn
+Search script examples for get_procedural_spawn_chance
-CallbackId set_pre_entity_spawn(function cb, SPAWN_TYPE flags, int mask, variadic_args entity_types)
-Add a callback for a spawn of specific entity types or mask. Set mask
to MASK.ANY
to ignore that.
-This is run before the entity is spawned, spawn your own entity and return its uid to replace the intended spawn.
-In many cases replacing the intended entity won't have the indended effect or will even break the game, so use only if you really know what you're doing.
-
The callback signature is optional pre_entity_spawn(ENT_TYPE entity_type, float x, float y, int layer, Entity overlay_entity, SPAWN_TYPE spawn_flags)
-set_pre_render_screen
+int get_procedural_spawn_chance(PROCEDURAL_CHANCE chance_id)
+Get the inverse chance of a procedural spawn for the current level.
+A return value of 0 does not mean the chance is infinite, it means the chance is zero.
+layer_door
-Search script examples for set_pre_render_screen
+Search script examples for layer_door
-optional<CallbackId> set_pre_render_screen(int screen_id, function fun)
-Returns unique id for the callback to be used in clear_screen_callback or nil
if screen_id is not valid.
-Sets a callback that is called right before the screen is drawn, return true
to skip the default rendering.
-
The callback signature is bool render_screen(Screen self, VanillaRenderContext render_ctx)
-set_timeout
+nil layer_door(float x, float y)
+Short for spawn_layer_door.
+set_ghost_spawn_times
-Search script examples for set_timeout
+Search script examples for set_ghost_spawn_times
-CallbackId set_timeout(function cb, int frames)
-Returns unique id for the callback to be used in clear_callback.
-Add per level callback function to be called after frames
engine frames. Timer is paused on pause and cleared on level transition.
-set_vanilla_sound_callback
+nil set_ghost_spawn_times(int normal = 10800, int cursed = 9000)
+Determines when the ghost appears, either when the player is cursed or not
+spawn
-- spawn a jetpack next to the player
+spawn(ENT_TYPE.ITEM_JETPACK, 1, 0, LAYER.PLAYER, 0, 0)
+
+
-Search script examples for set_vanilla_sound_callback
+Search script examples for spawn
-CallbackId set_vanilla_sound_callback(VANILLA_SOUND name, VANILLA_SOUND_CALLBACK_TYPE types, function cb)
-Returns unique id for the callback to be used in clear_vanilla_sound_callback.
-Sets a callback for a vanilla sound which lets you hook creation or playing events of that sound
-Callbacks are executed on another thread, so avoid touching any global state, only the local Lua state is protected
-If you set such a callback and then play the same sound yourself you have to wait until receiving the STARTED event before changing any properties on the sound. Otherwise you may cause a deadlock.
-
The callback signature is nil on_vanilla_sound(PlayingSound sound)
-Debug functions
dump_network
+int spawn(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
+Short for spawn_entity.
+spawn_apep
-Search script examples for dump_network
+Search script examples for spawn_apep
-nil dump_network()
-Hook the sendto and recvfrom functions and start dumping network data to terminal
-get_address
+int spawn_apep(float x, float y, LAYER layer, bool right)
+Spawns apep with the choice if it going left or right, if you want the game to choose use regular spawn functions with ENT_TYPE.MONS_APEP_HEAD
+spawn_companion
-Search script examples for get_address
+Search script examples for spawn_companion
-size_t get_address(string_view address_name)
-Get the address for a pattern name
-get_rva
+int spawn_companion(ENT_TYPE companion_type, float x, float y, LAYER layer)
+Spawn a companion (hired hand, player character, eggplant child)
+spawn_critical
-Search script examples for get_rva
+Search script examples for spawn_critical
-size_t get_rva(string_view address_name)
-Get the rva for a pattern name
-raise
+int spawn_critical(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
+Short for spawn_entity_nonreplaceable.
+spawn_door
-Search script examples for raise
+Search script examples for spawn_door
-nil raise()
-Raise a signal and probably crash the game
-Entity functions
activate_sparktraps_hack
activate_sparktraps_hack(true);
-
--- set random speed, direction and distance for the spark
-set_post_entity_spawn(function(ent)
-
- direction = 1
- if prng:random_chance(2, PRNG_CLASS.ENTITY_VARIATION) then
- direction = -1
- end
+int spawn_door(float x, float y, LAYER layer, int w, int l, int t)
+Spawn a door to another world, level and theme and return the uid of spawned entity.
+Uses level coordinates with LAYER.FRONT and LAYER.BACK, but player-relative coordinates with LAYER.PLAYERn
+spawn_entity
-- spawn megajelly on top of player using absolute coordinates on level start
+set_callback(function()
+ local x, y, layer = get_position(players[1].uid)
+ spawn_entity(ENT_TYPE.MONS_MEGAJELLYFISH, x, y+3, layer, 0, 0)
+end, ON.LEVEL)
- ent.speed = prng:random_float(PRNG_CLASS.ENTITY_VARIATION) * 0.1 * direction
- ent.distance = prng:random_float(PRNG_CLASS.ENTITY_VARIATION) * 10
+-- spawn clover next to player using player-relative coordinates
+set_callback(function()
+ spawn(ENT_TYPE.ITEM_PICKUP_CLOVER, 1, 0, LAYER.PLAYER1, 0, 0)
+end, ON.LEVEL)
-end, SPAWN_TYPE.ANY, 0, ENT_TYPE.ITEM_SPARK)
-Search script examples for activate_sparktraps_hack
+Search script examples for spawn_entity
+
+int spawn_entity(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
+Spawn an entity in position with some velocity and return the uid of spawned entity.
+Uses level coordinates with LAYER.FRONT and LAYER.BACK, but player-relative coordinates with LAYER.PLAYER(n), where (n) is a player number (1-4).
+spawn_entity_nonreplaceable
+
+Search script examples for spawn_entity_nonreplaceable
+
+int spawn_entity_nonreplaceable(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
+Same as spawn_entity
but does not trigger any pre-entity-spawn callbacks, so it will not be replaced by another script
+spawn_entity_over
+
+Search script examples for spawn_entity_over
+
+int spawn_entity_over(ENT_TYPE entity_type, int over_uid, float x, float y)
+Spawn an entity of entity_type
attached to some other entity over_uid
, in offset x
, y
+spawn_entity_snapped_to_floor
+
+Search script examples for spawn_entity_snapped_to_floor
+
+int spawn_entity_snapped_to_floor(ENT_TYPE entity_type, float x, float y, LAYER layer)
+Spawns an entity directly on the floor below the tile at the given position.
+Use this to avoid the little fall that some entities do when spawned during level gen callbacks.
+spawn_grid_entity
+
+Search script examples for spawn_grid_entity
-nil activate_sparktraps_hack(bool activate)
-Activate custom variables for speed and distance in the ITEM_SPARK
-note: because those the variables are custom and game does not initiate them, you need to do it yourself for each spark, recommending set_post_entity_spawn
-default game values are: speed = -0.015, distance = 3.0
-apply_entity_db
+int spawn_grid_entity(ENT_TYPE entity_type, float x, float y, LAYER layer)
+Spawn a grid entity, such as floor or traps, that snaps to the grid.
+spawn_layer_door
-Search script examples for apply_entity_db
+Search script examples for spawn_layer_door
-nil apply_entity_db(int uid)
-Apply changes made in get_type() to entity instance by uid.
-attach_ball_and_chain
+nil spawn_layer_door(float x, float y)
+Spawn a door to backlayer.
+spawn_liquid
-Search script examples for attach_ball_and_chain
+Search script examples for spawn_liquid
-int attach_ball_and_chain(int uid, float off_x, float off_y)
-Spawns and attaches ball and chain to uid
, the initial position of the ball is at the entity position plus off_x
, off_y
-attach_entity
+nil spawn_liquid(ENT_TYPE entity_type, float x, float y)
nil spawn_liquid(ENT_TYPE entity_type, float x, float y, float velocityx, float velocityy, int liquid_flags, int amount, float blobs_separation)
+Spawn liquids, always spawns in the front layer, will have fun effects if entity_type
is not a liquid (only the short version, without velocity etc.).
+Don't overuse this, you are still restricted by the liquid pool sizes and thus might crash the game.
+liquid_flags
- not much known about, 2 - will probably crash the game, 3 - pause_physics, 6-12 is probably agitation, surface_tension etc. set to 0 to ignore
+amount
- it will spawn amount x amount (so 1 = 1, 2 = 4, 3 = 6 etc.), blobs_separation
is optional
+spawn_mushroom
-Search script examples for attach_entity
+Search script examples for spawn_mushroom
-nil attach_entity(int overlay_uid, int attachee_uid)
-Attaches attachee
to overlay
, similar to setting get_entity(attachee).overlay = get_entity(overlay)
.
-However this function offsets attachee
(so you don't have to) and inserts it into overlay
's inventory.
-carry
+int spawn_mushroom(float x, float y, LAYER l)
int spawn_mushroom(float x, float y, LAYER l, int height)
+Spawns and grows mushroom, height relates to the trunk, without it, it will roll the game default 3-5 height
+Regardless, if there is not enough space, it will spawn shorter one or if there is no space even for the smallest one, it will just not spawn at all
+Returns uid of the base or -1 if it wasn't able to spawn
+spawn_on_floor
-Search script examples for carry
+Search script examples for spawn_on_floor
-nil carry(int mount_uid, int rider_uid)
-Make mount_uid
carry rider_uid
on their back. Only use this with actual mounts and living things.
-change_waddler_drop
+int spawn_on_floor(ENT_TYPE entity_type, float x, float y, LAYER layer)
+Short for spawn_entity_snapped_to_floor.
+spawn_over
-Search script examples for change_waddler_drop
+Search script examples for spawn_over
-nil change_waddler_drop(array<ENT_TYPE> ent_types)
-Change ENT_TYPE's spawned when Waddler dies, by default there are 3:
-{ITEM_PICKUP_COMPASS, ITEM_CHEST, ITEM_KEY}
-Max 255 types.
-Use empty table as argument to reset to the game default
-drop
+int spawn_over(ENT_TYPE entity_type, int over_uid, float x, float y)
+Short for spawn_entity_over
+spawn_player
-Search script examples for drop
+Search script examples for spawn_player
-nil drop(int who_uid, int what_uid)
-Drop an entity by uid
-enter_door
+nil spawn_player(int player_slot, float x, float y)
+Spawn a player in given location, if player of that slot already exist it will spawn clone, the game may crash as this is very unexpected situation
+If you want to respawn a player that is a ghost, set in his Inventory health
to above 0, and time_of_death
to 0 and call this function, the ghost entity will be removed automatically
+spawn_playerghost
-Search script examples for enter_door
+Search script examples for spawn_playerghost
-nil enter_door(int player_uid, int door_uid)
-Calls the enter door function, position doesn't matter, can also enter closed doors (like COG, EW) without unlocking them
-entity_get_items_by
+int spawn_playerghost(ENT_TYPE char_type, float x, float y, LAYER layer)
+Spawn the PlayerGhost entity, it will not move and not be connected to any player, you can then use steal_input and send_input to controll it
+or change it's player_inputs
to the input
of real player so he can control it directly
+spawn_tree
-Search script examples for entity_get_items_by
+Search script examples for spawn_tree
-array<int> entity_get_items_by(int uid, array<ENT_TYPE> entity_types, int mask)
array<int> entity_get_items_by(int uid, ENT_TYPE entity_type, int mask)
-Gets uids of entities attached to given entity uid. Use entity_type
and mask
(MASK) to filter, set them to 0 to return all attached entities.
-entity_has_item_type
+int spawn_tree(float x, float y, LAYER layer)
int spawn_tree(float x, float y, LAYER layer, int height)
+Spawns and grows a tree
+spawn_unrolled_player_rope
-Search script examples for entity_has_item_type
+Search script examples for spawn_unrolled_player_rope
-bool entity_has_item_type(int uid, array<ENT_TYPE> entity_types)
bool entity_has_item_type(int uid, ENT_TYPE entity_type)
-Check if the entity uid
has some ENT_TYPE entity_type
in their inventory, can also use table of entity_types
-entity_has_item_uid
+int spawn_unrolled_player_rope(float x, float y, LAYER layer, TEXTURE texture)
int spawn_unrolled_player_rope(float x, float y, LAYER layer, TEXTURE texture, int max_length)
+Spawns an already unrolled rope as if created by player
+String functions
add_custom_name
-Search script examples for entity_has_item_uid
+Search script examples for add_custom_name
-bool entity_has_item_uid(int uid, int item_uid)
-Check if the entity uid
has some specific item_uid
by uid in their inventory
-entity_remove_item
+nil add_custom_name(int uid, string name)
+Adds custom name to the item by uid used in the shops
+This is better alternative to add_string
but instead of changing the name for entity type, it changes it for this particular entity
+add_string
-Search script examples for entity_remove_item
+Search script examples for add_string
-nil entity_remove_item(int uid, int item_uid)
-Remove item by uid from entity
-filter_entities
+STRINGID add_string(string str)
+Add custom string, currently can only be used for names of shop items (Entitydb->description)
+Returns STRINGID of the new string
+change_string
-Search script examples for filter_entities
+Search script examples for change_string
-array<int> filter_entities(array entities, function predicate)
-Returns a list of all uids in entities
for which predicate(get_entity(uid))
returns true
-flip_entity
+nil change_string(STRINGID id, string str)
+Change string at the given id (don't use stringid diretcly for vanilla string, use hash_to_stringid
first)
+This edits custom string and in game strings but changing the language in settings will reset game strings
+clear_custom_name
-Search script examples for flip_entity
+Search script examples for clear_custom_name
-nil flip_entity(int uid)
-Flip entity around by uid. All new entities face right by default.
-force_olmec_phase_0
+nil clear_custom_name(int uid)
+Clears the name set with add_custom_name
+enum_get_mask_names
-Search script examples for force_olmec_phase_0
+Search script examples for enum_get_mask_names
-nil force_olmec_phase_0(bool b)
-Forces Olmec to stay on phase 0 (stomping)
-get_door_target
+table<string> enum_get_mask_names(table enum, int value)
+Return the matching names for a bitmask in an enum table of masks
+enum_get_name
-Search script examples for get_door_target
+Search script examples for enum_get_name
-tuple<int, int, int> get_door_target(int uid)
-Get door target world
, level
, theme
-get_entities_at
+string enum_get_name(table enum, int value)
+Return the name of the first matching number in an enum table
+enum_get_names
-Search script examples for get_entities_at
+Search script examples for enum_get_names
-array<int> get_entities_at(array<ENT_TYPE> entity_types, int mask, float x, float y, LAYER layer, float radius)
array<int> get_entities_at(ENT_TYPE entity_type, int mask, float x, float y, LAYER layer, float radius)
-Get uids of matching entities inside some radius (ENT_TYPE, MASK). Set entity_type
or mask
to 0
to ignore that, can also use table of entity_types
-Recommended to always set the mask, even if you look for one entity type
-get_entities_by
-- find all cavemen and give them bombs
--- using a type and mask in get_entities_by speeds up the search, cause the api knows which bucket to search in
-for i,uid in ipairs(get_entities_by(ENT_TYPE.MONS_CAVEMAN, MASK.MONSTER, LAYER.BOTH)) do
- local x, y, l = get_position(uid)
- spawn_entity_snapped_to_floor(ENT_TYPE.ITEM_BOMB, x, y, l)
-end
-
-
+table<string> enum_get_names(table enum, int value)
+Return all the names of a number in an enum table
+get_character_name
-Search script examples for get_entities_by
+Search script examples for get_character_name
-array<int> get_entities_by(array<ENT_TYPE> entity_types, int mask, LAYER layer)
array<int> get_entities_by(ENT_TYPE entity_type, int mask, LAYER layer)
-Get uids of entities by some conditions (ENT_TYPE, MASK). Set entity_type
or mask
to 0
to ignore that, can also use table of entity_types.
-Recommended to always set the mask, even if you look for one entity type
-get_entities_by_type
local types = {ENT_TYPE.MONS_SNAKE, ENT_TYPE.MONS_BAT}
-set_callback(function()
- local uids = get_entities_by_type(ENT_TYPE.MONS_SNAKE, ENT_TYPE.MONS_BAT)
- -- is not the same thing as this, but also works
- local uids2 = get_entities_by_type(types)
- print(tostring(#uids).." == "..tostring(#uids2))
-end, ON.LEVEL)
-
-
+string get_character_name(ENT_TYPE type_id)
+Same as Player.get_name
+get_character_short_name
-Search script examples for get_entities_by_type
+Search script examples for get_character_short_name
-array<int> get_entities_by_type(int, int...)
-Get uids of entities matching id. This function is variadic, meaning it accepts any number of id's.
-You can even pass a table!
-This function can be slower than the get_entities_by with the mask parameter filled
-get_entities_overlapping_hitbox
+string get_character_short_name(ENT_TYPE type_id)
+Same as Player.get_short_name
+get_string
-Search script examples for get_entities_overlapping_hitbox
+Search script examples for get_string
-array<int> get_entities_overlapping_hitbox(array<ENT_TYPE> entity_types, int mask, AABB hitbox, LAYER layer)
array<int> get_entities_overlapping_hitbox(ENT_TYPE entity_type, int mask, AABB hitbox, LAYER layer)
-Get uids of matching entities overlapping with the given hitbox. Set entity_type
or mask
to 0
to ignore that, can also use table of entity_types
-get_entity
+const string get_string(STRINGID string_id)
+Get string behind STRINGID, don't use stringid diretcly for vanilla string, use hash_to_stringid first
+Will return the string of currently choosen language
+hash_to_stringid
-Search script examples for get_entity
+Search script examples for hash_to_stringid
-Entity get_entity(int uid)
-Get the Entity behind an uid, converted to the correct type. To see what type you will get, consult the entity hierarchy list
-get_entity_name
+STRINGID hash_to_stringid(int hash)
+Convert the hash to stringid
+Check strings00_hashed.str for the hash values, or extract assets with modlunky and check those.
+set_level_string
-- set the level string shown in hud, journal and game over
+-- also change the one used in transitions for consistency
+set_callback(function()
+ if state.screen_next == SCREEN.LEVEL then
+ local level_str = "test" .. tostring(state.level_count)
+ set_level_string(level_str)
+ change_string(hash_to_stringid(0xda7c0c5b), F"{level_str} COMPLETED!")
+ end
+end, ON.PRE_LOAD_SCREEN)
+
+
-Search script examples for get_entity_name
+Search script examples for set_level_string
-string get_entity_name(ENT_TYPE type, optional fallback_strategy)
-Get localized name of an entity, pass fallback_strategy
as true
to fall back to the ENT_TYPE.
enum name
-if the entity has no localized name
-get_entity_type
+nil set_level_string(string str)
+Set the level number shown in the hud and journal to any string. This is reset to the default "%d-%d" automatically just before PRE_LOAD_SCREEN to a level or main menu, so use in PRE_LOAD_SCREEN, POST_LEVEL_GENERATION or similar for each level.
+Use "%d-%d" to reset to default manually. Does not affect the "...COMPLETED!" message in transitions or lines in "Dear Journal", you need to edit them separately with change_string.
+Texture functions
define_texture
-Search script examples for get_entity_type
+Search script examples for define_texture
-ENT_TYPE get_entity_type(int uid)
-Get the ENT_TYPE... of the entity by uid
-get_grid_entity_at
+TEXTURE define_texture(TextureDefinition texture_data)
+Defines a new texture that can be used in Entity::set_texture
+If a texture with the same definition already exists the texture will be reloaded from disk.
+get_texture
-Search script examples for get_grid_entity_at
+Search script examples for get_texture
-int get_grid_entity_at(float x, float y, LAYER layer)
-Gets a grid entity, such as floor or spikes, at the given position and layer.
-get_local_players
+optional<TEXTURE> get_texture(TextureDefinition texture_data)
+Gets a texture with the same definition as the given, if none exists returns nil
+get_texture_definition
-Search script examples for get_local_players
+Search script examples for get_texture_definition
-nil get_local_players()
-Get the thread-local version of players
-get_player
+TextureDefinition get_texture_definition(TEXTURE texture_id)
+Gets a TextureDefinition
for equivalent to the one used to define the texture with id
+reload_texture
-Search script examples for get_player
+Search script examples for reload_texture
-Player get_player(int slot, bool or_ghost = false)
-Returns Player (or PlayerGhost if get_player(1, true)
) with this player slot
-get_playerghost
+nil reload_texture(string texture_path)
+Reloads a texture from disk, use this only as a development tool for example in the console
+Note that define_texture will also reload the texture if it already exists
+replace_texture
-Search script examples for get_playerghost
+Search script examples for replace_texture
-PlayerGhost get_playerghost(int slot)
-Returns PlayerGhost with this player slot 1..4
-get_type
+bool replace_texture(TEXTURE vanilla_id, TEXTURE custom_id)
+Replace a vanilla texture definition with a custom texture definition and reload the texture.
+replace_texture_and_heart_color
-Search script examples for get_type
+Search script examples for replace_texture_and_heart_color
-EntityDB get_type(int id)
-Get the EntityDB behind an ENT_TYPE...
-kill_entity
+bool replace_texture_and_heart_color(TEXTURE vanilla_id, TEXTURE custom_id)
+Replace a vanilla texture definition with a custom texture definition and reload the texture. Set corresponding character heart color to the pixel in the center of the player indicator arrow in that texture. (448,1472)
+reset_lut
-Search script examples for kill_entity
+Search script examples for reset_lut
-nil kill_entity(int uid, optional destroy_corpse = nullopt)
-Kills an entity by uid. destroy_corpse
defaults to true
, if you are killing for example a caveman and want the corpse to stay make sure to pass false
.
-lock_door_at
+nil reset_lut(LAYER layer)
+Same as set_lut(nil, layer)
+reset_texture
-Search script examples for lock_door_at
+Search script examples for reset_texture
-nil lock_door_at(float x, float y)
-Try to lock the exit at coordinates
-modify_ankh_health_gain
+nil reset_texture(TEXTURE vanilla_id)
+Reset a replaced vanilla texture to the original and reload the texture.
+set_lut
-Search script examples for modify_ankh_health_gain
+Search script examples for set_lut
-nil modify_ankh_health_gain(int max_health, int beat_add_health)
-Change how much health the ankh gives you after death, with every beat (the heart beat effect) it will add beat_add_health
to your health,
-beat_add_health
has to be divisor of health
and can't be 0, otherwise the function does nothing. Set health
to 0 to return to the game defaults
-If you set health
above the game max health it will be forced down to the game max
-modify_sparktraps
+nil set_lut(optional<TEXTURE> texture_id, LAYER layer)
+Force the LUT texture for the given layer (or both) until it is reset.
+Pass nil
in the first parameter to reset
+Theme functions
force_co_subtheme
-Search script examples for modify_sparktraps
+Search script examples for force_co_subtheme
-nil modify_sparktraps(float angle_increment = 0.015, float distance = 3.0)
-Changes characteristics of (all) sparktraps: speed, rotation direction and distance from center
-Speed: expressed as the amount that should be added to the angle every frame (use a negative number to go in the other direction)
-Distance from center: if you go above 3.0 the game might crash because a spark may go out of bounds!
-move_entity
+nil force_co_subtheme(COSUBTHEME subtheme)
+Forces the theme of the next cosmic ocean level(s) (use e.g. force_co_subtheme(COSUBTHEME.JUNGLE)
. Use COSUBTHEME.RESET to reset to default random behaviour)
+force_custom_subtheme
-Search script examples for move_entity
+Search script examples for force_custom_subtheme
-nil move_entity(int uid, float x, float y, float vx, float vy)
nil move_entity(int uid, float x, float y, float vx, float vy, LAYER layer)
-Teleport entity to coordinates with optional velocity
-move_grid_entity
+nil force_custom_subtheme(customtheme)
+Force current subtheme used in the CO theme. You can pass a CustomTheme, ThemeInfo or THEME. Not to be confused with force_co_subtheme.
+force_custom_theme
-Search script examples for move_grid_entity
+Search script examples for force_custom_theme
-nil move_grid_entity(int uid, float x, float y, LAYER layer)
-Teleport grid entity, the destination should be whole number, this ensures that the collisions will work properly
-pick_up
-- spawn and equip a jetpack on the player
-pick_up(players[1].uid, spawn(ENT_TYPE.ITEM_JETPACK, 0, 0, LAYER.PLAYER, 0, 0))
-
-
+nil force_custom_theme(customtheme)
+Force a theme in PRE_LOAD_LEVEL_FILES, POST_ROOM_GENERATION or PRE_LEVEL_GENERATION to change different aspects of the levelgen. You can pass a CustomTheme, ThemeInfo or THEME.
+get_co_subtheme
-Search script examples for pick_up
+Search script examples for get_co_subtheme
-nil pick_up(int who_uid, int what_uid)
-Pick up another entity by uid. Make sure you're not already holding something, or weird stuff will happen.
-poison_entity
+COSUBTHEME get_co_subtheme()
+Gets the sub theme of the current cosmic ocean level, returns COSUBTHEME.NONE if the current level is not a CO level.
+Tile code functions
define_tile_code
-Search script examples for poison_entity
+Search script examples for define_tile_code
-nil poison_entity(int entity_uid)
-Poisons entity, to cure poison set Movable.poison_tick_timer
to -1
-replace_drop
+TILE_CODE define_tile_code(string tile_code)
+Define a new tile code, to make this tile code do anything you have to use either set_pre_tile_code_callback or set_post_tile_code_callback.
+If a user disables your script but still uses your level mod nothing will be spawned in place of your tile code.
+get_short_tile_code
-Search script examples for replace_drop
+Search script examples for get_short_tile_code
-nil replace_drop(int drop_id, ENT_TYPE new_drop_entity_type)
-Changes a particular drop, e.g. what Van Horsing throws at you (use e.g. replace_drop(DROP.VAN_HORSING_DIAMOND, ENT_TYPE.ITEM_PLASMACANNON))
-Use 0
as type to reset this drop to default, use -1
as drop_id to reset all to default
-set_boss_door_control_enabled
+optional<int> get_short_tile_code(ShortTileCodeDef short_tile_code_def)
+Gets a short tile code based on definition, returns nil
if it can't be found
+get_short_tile_code_definition
-Search script examples for set_boss_door_control_enabled
+Search script examples for get_short_tile_code_definition
-nil set_boss_door_control_enabled(bool enable)
-Allows you to disable the control over the door for Hundun and Tiamat
-This will also prevent game crashing when there is no exit door when they are in level
-set_contents
+optional<ShortTileCodeDef> get_short_tile_code_definition(SHORT_TILE_CODE short_tile_code)
+Gets the definition of a short tile code (if available), will vary depending on which file is loaded
+set_post_tile_code_callback
-Search script examples for set_contents
+Search script examples for set_post_tile_code_callback
-nil set_contents(int uid, ENT_TYPE item_entity_type)
-Set the contents of Coffin, Present, Pot, Container
-Check the entity hierarchy list for what the exact ENT_TYPE's can this function affect
-set_cursepot_ghost_enabled
+CallbackId set_post_tile_code_callback(function cb, string tile_code)
+Add a callback for a specific tile code that is called after the game handles the tile code.
+Use this to affect what the game or other scripts spawned in this position.
+This is received even if a previous pre-tile-code-callback has returned true
+
The callback signature is nil post_tile_code(float x, float y, int layer, ROOM_TEMPLATE room_template)
+set_pre_tile_code_callback
-Search script examples for set_cursepot_ghost_enabled
+Search script examples for set_pre_tile_code_callback
-nil set_cursepot_ghost_enabled(bool enable)
-Determines whether the ghost appears when breaking the ghost pot
-set_door
+CallbackId set_pre_tile_code_callback(function cb, string tile_code)
+Add a callback for a specific tile code that is called before the game handles the tile code.
+Return true in order to stop the game or scripts loaded after this script from handling this tile code.
+For example, when returning true in this callback set for "floor"
then no floor will spawn in the game (unless you spawn it yourself)
+
The callback signature is bool pre_tile_code(float x, float y, int layer, ROOM_TEMPLATE room_template)
+Deprecated functions
+
+on_frame
+Use set_callback(function, ON.FRAME)
instead
+on_camp
+Use set_callback(function, ON.CAMP)
instead
+on_level
+Use set_callback(function, ON.LEVEL)
instead
+on_start
+Use set_callback(function, ON.START)
instead
+on_transition
+Use set_callback(function, ON.TRANSITION)
instead
+on_death
+Use set_callback(function, ON.DEATH)
instead
+on_win
+Use set_callback(function, ON.WIN)
instead
+on_screen
+Use set_callback(function, ON.SCREEN)
instead
+on_guiframe
+Use set_callback(function, ON.GUIFRAME)
instead
+load_script
-Search script examples for set_door
+Search script examples for load_script
-nil set_door(int uid, int w, int l, int t)
-Short for set_door_target.
-set_door_target
+
+nil load_script()
+Same as import().
+read_prng
-Search script examples for set_door_target
+Search script examples for read_prng
-nil set_door_target(int uid, int w, int l, int t)
-Make an ENT_TYPE.FLOOR_DOOR_EXIT go to world w
, level l
, theme t
-set_drop_chance
+
+array<int> read_prng()
+Read the game prng state. Use prng:get_pair() instead.
+force_dark_level
-- forces any level to be dark, even bosses
+set_callback(function()
+ state.level_flags = set_flag(state.level_flags, 18)
+end, ON.POST_ROOM_GENERATION)
+
+
-Search script examples for set_drop_chance
+Search script examples for force_dark_level
-nil set_drop_chance(int dropchance_id, int new_drop_chance)
-Alters the drop chance for the provided monster-item combination (use e.g. set_drop_chance(DROPCHANCE.MOLE_MATTOCK, 10) for a 1 in 10 chance)
-Use -1
as dropchance_id to reset all to default
-set_explosion_mask
+
+nil force_dark_level(bool g)
+Set level flag 18 on post room generation instead, to properly force every level to dark
+get_entities
-Search script examples for set_explosion_mask
+Search script examples for get_entities
-nil set_explosion_mask(int mask)
-Sets which entities are affected by a bomb explosion. Default = MASK.PLAYER | MASK.MOUNT | MASK.MONSTER | MASK.ITEM | MASK.ACTIVEFLOOR | MASK.FLOOR
-set_kapala_blood_threshold
+array<int> get_entities()
+Use get_entities_by(0, MASK.ANY, LAYER.BOTH)
instead
+get_entities_by_mask
-Search script examples for set_kapala_blood_threshold
+Search script examples for get_entities_by_mask
-nil set_kapala_blood_threshold(int threshold)
-Sets the amount of blood drops in the Kapala needed to trigger a health increase (default = 7).
-set_kapala_hud_icon
+array<int> get_entities_by_mask(int mask)
+Use get_entities_by(0, mask, LAYER.BOTH)
instead
+get_entities_by_layer
-Search script examples for set_kapala_hud_icon
+Search script examples for get_entities_by_layer
-nil set_kapala_hud_icon(int icon_index)
-Sets the hud icon for the Kapala (0-6 ; -1 for default behaviour).
-If you set a Kapala treshold greater than 7, make sure to set the hud icon in the range 0-6, or other icons will appear in the hud!
-set_max_rope_length
+array<int> get_entities_by_layer(LAYER layer)
+Use get_entities_by(0, MASK.ANY, layer)
instead
+get_entities_overlapping
-Search script examples for set_max_rope_length
+Search script examples for get_entities_overlapping
-nil set_max_rope_length(int length)
-Sets the maximum length of a thrown rope (anchor segment not included). Unfortunately, setting this higher than default (6) creates visual glitches in the rope, even though it is fully functional.
-set_olmec_cutscene_enabled
+array<int> get_entities_overlapping(array<ENT_TYPE> entity_types, int mask, float sx, float sy, float sx2, float sy2, LAYER layer)
array<int> get_entities_overlapping(ENT_TYPE entity_type, int mask, float sx, float sy, float sx2, float sy2, LAYER layer)
+Use get_entities_overlapping_hitbox
instead
+get_entity_ai_state
-Search script examples for set_olmec_cutscene_enabled
+Search script examples for get_entity_ai_state
-nil set_olmec_cutscene_enabled(bool enable)
set_olmec_phase_y_level
+int get_entity_ai_state(int uid)
+As the name is misleading. use entity move_state
field instead
+set_arrowtrap_projectile
-Search script examples for set_olmec_phase_y_level
+Search script examples for set_arrowtrap_projectile
-nil set_olmec_phase_y_level(int phase, float y)
-Sets the Y-level at which Olmec changes phases
-set_time_ghost_enabled
+nil set_arrowtrap_projectile(ENT_TYPE regular_entity_type, ENT_TYPE poison_entity_type)
+Use replace_drop(DROP.ARROWTRAP_WOODENARROW, new_arrow_type) and replace_drop(DROP.POISONEDARROWTRAP_WOODENARROW, new_arrow_type) instead
+set_blood_multiplication
-Search script examples for set_time_ghost_enabled
+Search script examples for set_blood_multiplication
-nil set_time_ghost_enabled(bool b)
-Determines whether the time ghost appears, including the showing of the ghost toast
-set_time_jelly_enabled
+nil set_blood_multiplication(int default_multiplier, int vladscape_multiplier)
+This function never worked properly as too many places in the game individually check for vlads cape and calculate the blood multiplication
+default_multiplier
doesn't do anything due to some changes in last game updates, vladscape_multiplier
only changes the multiplier to some entities death's blood spit
+set_camera_position
-Search script examples for set_time_jelly_enabled
+Search script examples for set_camera_position
-nil set_time_jelly_enabled(bool b)
-Determines whether the time jelly appears in cosmic ocean
-unequip_backitem
+nil set_camera_position(float cx, float cy)
+this doesn't actually work at all. See State -> Camera the for proper camera handling
+setflag
+
+Search script examples for setflag
+
+
+nil setflag()
+clrflag
-Search script examples for unequip_backitem
+Search script examples for clrflag
-nil unequip_backitem(int who_uid)
-Unequips the currently worn backitem
-unlock_door_at
+
+nil clrflag()
+testflag
-Search script examples for unlock_door_at
+Search script examples for testflag
-nil unlock_door_at(float x, float y)
-Try to unlock the exit at coordinates
-waddler_count_entity
+
+nil testflag()
+read_input
-Search script examples for waddler_count_entity
+Search script examples for read_input
-int waddler_count_entity(ENT_TYPE entity_type)
-Returns how many of a specific entity type Waddler has stored
-waddler_entity_type_in_slot
+
+INPUTS read_input(int uid)
+Use players[1].input.buttons_gameplay
for only the inputs during the game, or .buttons
for all the inputs, even during the pause menu
+Of course, you can get the Player by other mean, it doesn't need to be the players
table
+You can only read inputs from actual players, HH don't have any inputs
+read_stolen_input
-Search script examples for waddler_entity_type_in_slot
+Search script examples for read_stolen_input
-int waddler_entity_type_in_slot(int slot)
-Gets the entity type of the item in the provided slot
-waddler_get_entity_meta
+
+INPUTS read_stolen_input(int uid)
+Read input that has been previously stolen with steal_input
+Use state.player_inputs.player_slots[player_slot].buttons_gameplay
for only the inputs during the game, or .buttons
for all the inputs, even during the pause menu
+clear_entity_callback
-Search script examples for waddler_get_entity_meta
+Search script examples for clear_entity_callback
-int waddler_get_entity_meta(int slot)
-Gets the 16-bit meta-value associated with the entity type in the associated slot
-waddler_remove_entity
+
+nil clear_entity_callback(int uid, CallbackId cb_id)
+Use entity.clear_virtual
instead.
+Clears a callback that is specific to an entity.
+set_pre_statemachine
-Search script examples for waddler_remove_entity
+Search script examples for set_pre_statemachine
-nil waddler_remove_entity(ENT_TYPE entity_type, int amount_to_remove = 99)
-Removes an entity type from Waddler's storage. Second param determines how many of the item to remove (default = remove all)
-waddler_set_entity_meta
+
+optional<CallbackId> set_pre_statemachine(int uid, function fun)
+Use entity:set_pre_update_state_machine
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+uid
has to be the uid of a Movable
or else stuff will break.
+Sets a callback that is called right before the statemachine, return true
to skip the statemachine update.
+Use this only when no other approach works, this call can be expensive if overused.
+Check here to see whether you can use this callback on the entity type you intend to.
+
The callback signature is bool statemachine(Entity self)
+set_post_statemachine
-Search script examples for waddler_set_entity_meta
+Search script examples for set_post_statemachine
-nil waddler_set_entity_meta(int slot, int meta)
-Sets the 16-bit meta-value associated with the entity type in the associated slot
-waddler_store_entity
+
+optional<CallbackId> set_post_statemachine(int uid, function fun)
+Use entity:set_post_update_state_machine
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+uid
has to be the uid of a Movable
or else stuff will break.
+Sets a callback that is called right after the statemachine, so you can override any values the satemachine might have set (e.g. animation_frame
).
+Use this only when no other approach works, this call can be expensive if overused.
+Check here to see whether you can use this callback on the entity type you intend to.
+
The callback signature is nil statemachine(Entity self)
+set_on_destroy
-Search script examples for waddler_store_entity
+Search script examples for set_on_destroy
-int waddler_store_entity(ENT_TYPE entity_type)
-Store an entity type in Waddler's storage. Returns the slot number the item was stored in or -1 when storage is full and the item couldn't be stored.
-worn_backitem
+
+optional<CallbackId> set_on_destroy(int uid, function fun)
+Use entity:set_pre_destroy
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right when an entity is destroyed, e.g. as if by Entity.destroy()
before the game applies any side effects.
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is nil on_destroy(Entity self)
+set_on_kill
-Search script examples for worn_backitem
+Search script examples for set_on_kill
-int worn_backitem(int who_uid)
-Returns the uid of the currently worn backitem, or -1 if wearing nothing
-Feat functions
change_feat
+
+optional<CallbackId> set_on_kill(int uid, function fun)
+Use entity:set_pre_kill
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right when an entity is eradicated, before the game applies any side effects.
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is nil on_kill(Entity self, Entity killer)
+set_on_damage
-Search script examples for change_feat
+Search script examples for set_on_damage
-nil change_feat(FEAT feat, bool hidden, string name, string description)
-Helper function to set the title and description strings for a FEAT with change_string, as well as the hidden state.
-get_feat
+
+optional<CallbackId> set_on_damage(int uid, function fun)
+Use entity:set_pre_damage
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right before an entity is damaged, return true
to skip the game's damage handling.
+Note that damage_dealer can be nil ! (long fall, ...)
+DO NOT CALL self:damage()
in the callback !
+Use this only when no other approach works, this call can be expensive if overused.
+The entity has to be of a Movable type.
+
The callback signature is bool on_damage(Entity self, Entity damage_dealer, int damage_amount, float vel_x, float vel_y, int stun_amount, int iframes)
+set_pre_floor_update
-Search script examples for get_feat
+Search script examples for set_pre_floor_update
-tuple<bool, bool, const string, const string> get_feat(FEAT feat)
-Check if the user has performed a feat (Real Steam achievement or a hooked one). Returns: bool unlocked, bool hidden, string name, string description
-get_feat_hidden
+
+optional<CallbackId> set_pre_floor_update(int uid, function fun)
+Use entity:set_pre_floor_update
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right before a floor is updated (by killed neighbor), return true
to skip the game's neighbor update handling.
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is bool pre_floor_update(Entity self)
+set_post_floor_update
-- Use FLOOR_GENERIC with textures from different themes that update correctly when destroyed.
+-- This lets you use the custom tile code 'floor_generic_tidepool'
+-- in the level editor to spawn tidepool floor in dwelling for example...
+define_tile_code("floor_generic_tidepool")
+set_pre_tile_code_callback(function(x, y, layer)
+ local uid = spawn_grid_entity(ENT_TYPE.FLOOR_GENERIC, x, y, layer)
+ set_post_floor_update(uid, function(me)
+ me:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TIDEPOOL_0)
+ for i,v in ipairs(entity_get_items_by(me.uid, ENT_TYPE.DECORATION_GENERIC, MASK.DECORATION)) do
+ local deco = get_entity(v)
+ deco:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TIDEPOOL_0)
+ end
+ end)
+ return true
+end, "floor_generic_tidepool")
+
+
+-- Fix quicksand decorations when not in temple
+set_post_entity_spawn(function(ent)
+ ent:set_post_floor_update(function(me)
+ me:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TEMPLE_0)
+ for i,v in ipairs(entity_get_items_by(me.uid, ENT_TYPE.DECORATION_GENERIC, MASK.DECORATION)) do
+ local deco = get_entity(v)
+ deco:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TEMPLE_0)
+ end
+ end)
+end, SPAWN_TYPE.ANY, MASK.FLOOR, ENT_TYPE.FLOOR_QUICKSAND)
+
+
-Search script examples for get_feat_hidden
+Search script examples for set_post_floor_update
-bool get_feat_hidden(FEAT feat)
-Get the visibility of a feat
-set_feat_hidden
+
+optional<CallbackId> set_post_floor_update(int uid, function fun)
+Use entity:set_post_floor_update
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right after a floor is updated (by killed neighbor).
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is nil post_floor_update(Entity self)
+set_on_open
-Search script examples for set_feat_hidden
+Search script examples for set_on_open
-nil set_feat_hidden(FEAT feat, bool hidden)
-Set the visibility of a feat
-Flag functions
clr_flag
+
+optional<CallbackId> set_on_open(int uid, function fun)
+Use entity:set_pre_trigger_action
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right when a container is opened by the player (up+whip)
+Use this only when no other approach works, this call can be expensive if overused.
+Check here to see whether you can use this callback on the entity type you intend to.
+
The callback signature is nil on_open(Entity entity_self, Entity opener)
+set_pre_collision1
-Search script examples for clr_flag
+Search script examples for set_pre_collision1
-Flags clr_flag(Flags flags, int bit)
-Clears the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
-flip_flag
+
+optional<CallbackId> set_pre_collision1(int uid, function fun)
+Use entity:set_pre_collision1
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right before the collision 1 event, return true
to skip the game's collision handling.
+Use this only when no other approach works, this call can be expensive if overused.
+Check here to see whether you can use this callback on the entity type you intend to.
+
The callback signature is bool pre_collision1(Entity entity_self, Entity collision_entity)
+set_pre_collision2
-Search script examples for flip_flag
+Search script examples for set_pre_collision2
-Flags flip_flag(Flags flags, int bit)
-Flips the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
-get_entity_flags
+
+optional<CallbackId> set_pre_collision2(int uid, function fun)
+Use entity:set_pre_collision2
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right before the collision 2 event, return true
to skip the game's collision handling.
+Use this only when no other approach works, this call can be expensive if overused.
+Check here to see whether you can use this callback on the entity type you intend to.
+
The callback signature is bool pre_collision12(Entity self, Entity collision_entity)
+set_pre_render
-Search script examples for get_entity_flags
+Search script examples for set_pre_render
-int get_entity_flags(int uid)
-Get the flags
field from entity by uid
-get_entity_flags2
+
+optional<CallbackId> set_pre_render(int uid, function fun)
+Use entity.rendering_info:set_pre_render
in combination with render_info:get_entity
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right after the entity is rendered.
+Return true
to skip the original rendering function and all later pre_render callbacks.
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is bool render(VanillaRenderContext render_ctx, Entity self)
+set_post_render
-Search script examples for get_entity_flags2
+Search script examples for set_post_render
-int get_entity_flags2(int uid)
-Get the more_flags
field from entity by uid
-get_level_flags
+
+optional<CallbackId> set_post_render(int uid, function fun)
+Use entity.rendering_info:set_post_render
in combination with render_info:get_entity
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right after the entity is rendered.
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is nil post_render(VanillaRenderContext render_ctx, Entity self)
+generate_particles
-Search script examples for get_level_flags
+Search script examples for generate_particles
-int get_level_flags()
-Get state.level_flags
-set_entity_flags
+ParticleEmitterInfo generate_particles(int particle_emitter_id, int uid)
+Use generate_world_particles
+draw_line
-Search script examples for set_entity_flags
+Search script examples for draw_line
-nil set_entity_flags(int uid, int flags)
-Set the flags
field from entity by uid
-set_entity_flags2
+
+nil draw_line(float x1, float y1, float x2, float y2, float thickness, uColor color)
+Use GuiDrawContext.draw_line
instead
+draw_rect
-Search script examples for set_entity_flags2
+Search script examples for draw_rect
-nil set_entity_flags2(int uid, int flags)
-Set the more_flags
field from entity by uid
-set_flag
+
+nil draw_rect(float x1, float y1, float x2, float y2, float thickness, float rounding, uColor color)
+Use GuiDrawContext.draw_rect
instead
+draw_rect_filled
-Search script examples for set_flag
+Search script examples for draw_rect_filled
-Flags set_flag(Flags flags, int bit)
-Set the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
-set_level_flags
+
+nil draw_rect_filled(float x1, float y1, float x2, float y2, float rounding, uColor color)
+Use GuiDrawContext.draw_rect_filled
instead
+draw_circle
-Search script examples for set_level_flags
+Search script examples for draw_circle
-nil set_level_flags(int flags)
-Set state.level_flags
-test_flag
+
+nil draw_circle(float x, float y, float radius, float thickness, uColor color)
+Use GuiDrawContext.draw_circle
instead
+draw_circle_filled
-Search script examples for test_flag
+Search script examples for draw_circle_filled
-bool test_flag(Flags flags, int bit)
-Returns true if the nth bit is set in the number.
-Generic functions
activate_crush_elevator_hack
+
+nil draw_circle_filled(float x, float y, float radius, uColor color)
+Use GuiDrawContext.draw_circle_filled
instead
+draw_text
-Search script examples for activate_crush_elevator_hack
+Search script examples for draw_text
-nil activate_crush_elevator_hack(bool activate)
-Activate custom variables for speed and y coordinate limit for crushing elevator
-note: because those variables are custom and game does not initiate them, you need to do it yourself for each CrushElevator entity, recommending set_post_entity_spawn
-default game values are: speed = 0.0125, y_limit = 98.5
-activate_hundun_hack
+
+nil draw_text(float x, float y, float size, string text, uColor color)
+Use GuiDrawContext.draw_text
instead
+draw_image
-Search script examples for activate_hundun_hack
+Search script examples for draw_image
-nil activate_hundun_hack(bool activate)
-Activate custom variables for y coordinate limit for hundun and spawn of it's heads
-note: because those variables are custom and game does not initiate them, you need to do it yourself for each Hundun entity, recommending set_post_entity_spawn
-default game value are: y_limit = 98.5, rising_speed_x = 0, rising_speed_y = 0.0125, bird_head_spawn_y = 55, snake_head_spawn_y = 71
-change_poison_timer
+
+nil draw_image(IMAGE image, float x1, float y1, float x2, float y2, float uvx1, float uvy1, float uvx2, float uvy2, uColor color)
+Use GuiDrawContext.draw_image
instead
+draw_image_rotated
-Search script examples for change_poison_timer
+Search script examples for draw_image_rotated
-nil change_poison_timer(int frames)
-Change the amount of frames after the damage from poison is applied
-clear_cache
+
+nil draw_image_rotated(IMAGE image, float x1, float y1, float x2, float y2, float uvx1, float uvy1, float uvx2, float uvy2, uColor color, float angle, float px, float py)
+Use GuiDrawContext.draw_image_rotated
instead
+window
-Search script examples for clear_cache
+Search script examples for window
-nil clear_cache()
-Clear cache for a file path or the whole directory
-clr_mask
+
+nil window(string title, float x, float y, float w, float h, bool movable, function callback)
+Use GuiDrawContext.window
instead
+win_text
-Search script examples for clr_mask
+Search script examples for win_text
-Flags clr_mask(Flags flags, Flags mask)
-Clears a bitmask in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
-create_image
+
+nil win_text(string text)
+Use GuiDrawContext.win_text
instead
+win_separator
-Search script examples for create_image
+Search script examples for win_separator
-tuple<IMAGE, int, int> create_image(string path)
-Create image from file. Returns a tuple containing id, width and height.
-Depending on the image size, this can take a moment, preferably don't create them dynamically, rather create all you need in global scope so it will load them as soon as the game starts
-create_image_crop
+
+nil win_separator()
+Use GuiDrawContext.win_separator
instead
+win_inline
-Search script examples for create_image_crop
+Search script examples for win_inline
-tuple<IMAGE, int, int> create_image_crop(string path, int x, int y, int w, int h)
-Create image from file, cropped to the geometry provided. Returns a tuple containing id, width and height.
-Depending on the image size, this can take a moment, preferably don't create them dynamically, rather create all you need in global scope so it will load them as soon as the game starts
-disable_floor_embeds
+
+nil win_inline()
+Use GuiDrawContext.win_inline
instead
+win_sameline
-Search script examples for disable_floor_embeds
+Search script examples for win_sameline
-bool disable_floor_embeds(bool disable)
-Disable all crust item spawns, returns whether they were already disabled before the call
-flip_mask
+
+nil win_sameline(float offset, float spacing)
+Use GuiDrawContext.win_sameline
instead
+win_button
-Search script examples for flip_mask
+Search script examples for win_button
-Flags flip_mask(Flags flags, Flags mask)
-Flips the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
-force_journal
+
+bool win_button(string text)
+Use GuiDrawContext.win_button
instead
+win_input_text
-Search script examples for force_journal
+Search script examples for win_input_text
-nil force_journal(int chapter, int entry)
-Force the journal to open on a chapter and entry# when pressing the journal button. Only use even entry numbers. Set chapter to JOURNALUI_PAGE_SHOWN.JOURNAL
to reset. (This forces the journal toggle to always read from game_manager.save_related.journal_popup_ui.entry_to_show
etc.)
-get_adventure_seed
+
+string win_input_text(string label, string value)
+Use GuiDrawContext.win_input_text
instead
+win_input_int
-Search script examples for get_adventure_seed
+Search script examples for win_input_int
-tuple<int, int> get_adventure_seed()
-Get the current adventure seed pair
-get_character_heart_color
+
+int win_input_int(string label, int value)
+Use GuiDrawContext.win_input_int
instead
+win_input_float
-Search script examples for get_character_heart_color
+Search script examples for win_input_float
-Color get_character_heart_color(ENT_TYPE type_id)
-Same as Player.get_heart_color
-get_frame
+
+float win_input_float(string label, float value)
+Use GuiDrawContext.win_input_float
instead
+win_slider_int
-Search script examples for get_frame
+Search script examples for win_slider_int
-int get_frame()
-Get the current global frame count since the game was started. You can use this to make some timers yourself, the engine runs at 60fps.
-get_id
+
+int win_slider_int(string label, int value, int min, int max)
+Use GuiDrawContext.win_slider_int
instead
+win_drag_int
-Search script examples for get_id
+Search script examples for win_drag_int
-string get_id()
-Get your sanitized script id to be used in import.
-get_level_config
+
+int win_drag_int(string label, int value, int min, int max)
+Use GuiDrawContext.win_drag_int
instead
+win_slider_float
-Search script examples for get_level_config
+Search script examples for win_slider_float
-int get_level_config(LEVEL_CONFIG config)
-Gets the value for the specified config
-get_local_prng
+
+float win_slider_float(string label, float value, float min, float max)
+Use GuiDrawContext.win_slider_float
instead
+win_drag_float
-Search script examples for get_local_prng
+Search script examples for win_drag_float
-nil get_local_prng()
-Get the thread-local version of prng
-get_local_state
+
+float win_drag_float(string label, float value, float min, float max)
+Use GuiDrawContext.win_drag_float
instead
+win_check
-Search script examples for get_local_state
+Search script examples for win_check
-nil get_local_state()
-Get the thread-local version of state
-get_ms
+
+bool win_check(string label, bool value)
+Use GuiDrawContext.win_check
instead
+win_combo
-Search script examples for get_ms
+Search script examples for win_combo
-nil get_ms()
-Get the current timestamp in milliseconds since the Unix Epoch.
-get_setting
+
+int win_combo(string label, int selected, string opts)
+Use GuiDrawContext.win_combo
instead
+win_pushid
-Search script examples for get_setting
+Search script examples for win_pushid
-optional<int> get_setting(GAME_SETTING setting)
-Gets the specified setting, values might need to be interpreted differently per setting
-god
+
+nil win_pushid(int id)
+Use GuiDrawContext.win_pushid
instead
+win_popid
-Search script examples for god
+Search script examples for win_popid
-nil god(bool g)
-Enable/disable godmode for players.
-god_companions
+
+nil win_popid()
+Use GuiDrawContext.win_popid
instead
+win_image
-Search script examples for god_companions
+Search script examples for win_image
-nil god_companions(bool g)
-Enable/disable godmode for companions.
-grow_chainandblocks
+
+nil win_image(IMAGE image, float width, float height)
+Use GuiDrawContext.win_image
instead
+Non-Entity types
Arena types
ArenaConfigArenas
+Used in ArenaState
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+dwelling_1
+
+
+
+bool
+dwelling_2
+
+
+
+bool
+dwelling_3
+
+
+
+bool
+dwelling_4
+
+
+
+bool
+dwelling_5
+
+
+
+bool
+jungle_1
+
+
+
+bool
+jungle_2
+
+
+
+bool
+jungle_3
+
+
+
+bool
+jungle_4
+
+
+
+bool
+jungle_5
+
+
+
+bool
+volcana_1
+
+
+
+bool
+volcana_2
+
+
+
+bool
+volcana_3
+
+
+
+bool
+volcana_4
+
+
+
+bool
+volcana_5
+
+
+
+bool
+tidepool_1
+
+
+
+bool
+tidepool_2
+
+
+
+bool
+tidepool_3
+
+
+
+bool
+tidepool_4
+
+
+
+bool
+tidepool_5
+
+
+
+bool
+temple_1
+
+
+
+bool
+temple_2
+
+
+
+bool
+temple_3
+
+
+
+bool
+temple_4
+
+
+
+bool
+temple_5
+
+
+
+bool
+icecaves_1
+
+
+
+bool
+icecaves_2
+
+
+
+bool
+icecaves_3
+
+
+
+bool
+icecaves_4
+
+
+
+bool
+icecaves_5
+
+
+
+bool
+neobabylon_1
+
+
+
+bool
+neobabylon_2
+
+
+
+bool
+neobabylon_3
+
+
+
+bool
+neobabylon_4
+
+
+
+bool
+neobabylon_5
+
+
+
+bool
+sunkencity_1
+
+
+
+bool
+sunkencity_2
+
+
+
+bool
+sunkencity_3
+
+
+
+bool
+sunkencity_4
+
+
+
+bool
+sunkencity_5
+
+
+
+ArenaConfigEquippedItems
+Used in ArenaState
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+paste
+
+
+
+bool
+climbing_gloves
+
+
+
+bool
+pitchers_mitt
+
+
+
+bool
+spike_shoes
+
+
+
+bool
+spring_shoes
+
+
+
+bool
+parachute
+
+
+
+bool
+kapala
+
+
+
+bool
+scepter
+
+
+
+ArenaConfigItems
+Used in ArenaState
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+rock
+
+
+
+bool
+pot
+
+
+
+bool
+bombbag
+
+
+
+bool
+bombbox
+
+
+
+bool
+ropepile
+
+
+
+bool
+pickup_12bag
+
+
+
+bool
+pickup_24bag
+
+
+
+bool
+cooked_turkey
+
+
+
+bool
+royal_jelly
+
+
+
+bool
+torch
+
+
+
+bool
+boomerang
+
+
+
+bool
+machete
+
+
+
+bool
+mattock
+
+
+
+bool
+crossbow
+
+
+
+bool
+webgun
+
+
+
+bool
+freezeray
+
+
+
+bool
+shotgun
+
+
+
+bool
+camera
+
+
+
+bool
+plasma_cannon
+
+
+
+bool
+wooden_shield
+
+
+
+bool
+metal_shield
+
+
+
+bool
+teleporter
+
+
+
+bool
+mine
+
+
+
+bool
+snaptrap
+
+
+
+bool
+paste
+
+
+
+bool
+climbing_gloves
+
+
+
+bool
+pitchers_mitt
+
+
+
+bool
+spike_shoes
+
+
+
+bool
+spring_shoes
+
+
+
+bool
+parachute
+
+
+
+bool
+cape
+
+
+
+bool
+vlads_cape
+
+
+
+bool
+jetpack
+
+
+
+bool
+hoverpack
+
+
+
+bool
+telepack
+
+
+
+bool
+powerpack
+
+
+
+bool
+excalibur
+
+
+
+bool
+scepter
+
+
+
+bool
+kapala
+
+
+
+bool
+true_crown
+
+
+
+ArenaState
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+int
+current_arena
+
+
+
+array<int, 4>
+player_teams
+
+
+
+int
+format
+
+
+
+int
+ruleset
+
+
+
+array<int, 4>
+player_lives
+
+
+
+array<int, 4>
+player_totalwins
+
+
+
+array<bool, 4>
+player_won
+
+
+
+int
+timer
+The menu selection for timer, default values 0..20 where 0 == 30 seconds, 19 == 10 minutes and 20 == infinite. Can go higher, although this will glitch the menu text. Actual time (seconds) = (state.arena.timer + 1) x 30
+
+
+int
+timer_ending
+
+
+
+int
+wins
+
+
+
+int
+lives
+
+
+
+int
+time_to_win
+
+
+
+array<int, 4>
+player_idolheld_countdown
+
+
+
+int
+health
+
+
+
+int
+bombs
+
+
+
+int
+ropes
+
+
+
+int
+stun_time
+
+
+
+int
+mount
+
+
+
+int
+arena_select
+
+
+
+ArenaConfigArenas
+arenas
+
+
+
+int
+dark_level_chance
+
+
+
+int
+crate_frequency
+
+
+
+ArenaConfigItems
+items_enabled
+
+
+
+ArenaConfigItems
+items_in_crate
+
+
+
+int
+held_item
+
+
+
+int
+equipped_backitem
+
+
+
+ArenaConfigEquippedItems
+equipped_items
+
+
+
+int
+whip_damage
+
+
+
+bool
+final_ghost
+
+
+
+int
+breath_cooldown
+
+
+
+bool
+punish_ball
+
+
+
+Callback context types
GuiDrawContext
-- Draw the level boundaries
+set_callback(function(draw_ctx)
+ local xmin, ymax, xmax, ymin = get_bounds()
+ local sx, sy = screen_position(xmin, ymax) -- top left
+ local sx2, sy2 = screen_position(xmax, ymin) -- bottom right
+ draw_ctx:draw_rect(sx, sy, sx2, sy2, 4, 0, rgba(255, 255, 255, 255))
+end, ON.GUIFRAME)
+
+
+Used in register_option_callback and set_callback with ON.GUIFRAME
+
+
+
+Type
+Name
+Description
+
+
+
+nil
+draw_line(float x1, float y1, float x2, float y2, float thickness, uColor color)
+Draws a line on screen
+
+
+nil
+draw_rect(float left, float top, float right, float bottom, float thickness, float rounding, uColor color)
+Draws a rectangle on screen from top-left to bottom-right.
+
+
+nil
+draw_rect(AABB rect, float thickness, float rounding, uColor color)
+Draws a rectangle on screen from top-left to bottom-right.
+
+
+nil
+draw_rect_filled(float left, float top, float right, float bottom, float rounding, uColor color)
+Draws a filled rectangle on screen from top-left to bottom-right.
+
+
+nil
+draw_rect_filled(AABB rect, float rounding, uColor color)
+Draws a filled rectangle on screen from top-left to bottom-right.
+
+
+nil
+draw_triangle(Vec2 p1, Vec2 p2, Vec2 p3, float thickness, uColor color)
+Draws a triangle on screen.
+
+
+nil
+draw_triangle_filled(Vec2 p1, Vec2 p2, Vec2 p3, uColor color)
+Draws a filled triangle on screen.
+
+
+nil
+draw_poly(array points, float thickness, uColor color)
+Draws a polyline on screen.
+
+
+nil
+draw_poly_filled(array points, uColor color)
+Draws a filled convex polyline on screen.
+
+
+nil
+draw_bezier_cubic(Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float thickness, uColor color)
+Draws a cubic bezier curve on screen.
+
+
+nil
+draw_bezier_quadratic(Vec2 p1, Vec2 p2, Vec2 p3, float thickness, uColor color)
+Draws a quadratic bezier curve on screen.
+
+
+nil
+draw_circle(float x, float y, float radius, float thickness, uColor color)
+Draws a circle on screen
+
+
+nil
+draw_circle_filled(float x, float y, float radius, uColor color)
+Draws a filled circle on screen
+
+
+nil
+draw_text(float x, float y, float size, string text, uColor color)
+Draws text in screen coordinates x
, y
, anchored top-left. Text size 0 uses the default 18.
+
+
+nil
+draw_image(IMAGE image, float left, float top, float right, float bottom, float uvx1, float uvy1, float uvx2, float uvy2, uColor color)
+Draws an image on screen from top-left to bottom-right. Use UV coordinates 0, 0, 1, 1
to just draw the whole image.
+
+
+nil
+draw_image(IMAGE image, AABB rect, AABB uv_rect, uColor color)
+Draws an image on screen from top-left to bottom-right. Use UV coordinates 0, 0, 1, 1
to just draw the whole image.
+
+
+nil
+draw_image_rotated(IMAGE image, float left, float top, float right, float bottom, float uvx1, float uvy1, float uvx2, float uvy2, uColor color, float angle, float px, float py)
+Same as draw_image
but rotates the image by angle in radians around the pivot offset from the center of the rect (meaning px=py=0
rotates around the center)
+
+
+nil
+draw_image_rotated(IMAGE image, AABB rect, AABB uv_rect, uColor color, float angle, float px, float py)
+Same as draw_image
but rotates the image by angle in radians around the pivot offset from the center of the rect (meaning px=py=0
rotates around the center)
+
+
+nil
+draw_layer(DRAW_LAYER layer)
+Draw on top of UI windows, including platform windows that may be outside the game area, or only in current widget window. Defaults to main viewport background.
+
+
+bool
+window(string title, float x, float y, float w, float h, bool movable, function callback)
+Create a new widget window. Put all win_ widgets inside the callback function. The window functions are just wrappers for the
ImGui widgets, so read more about them there. Use screen position and distance, or 0, 0, 0, 0
to
autosize in center. Use just a ##Label
as title to hide titlebar.
Important: Keep all your labels unique! If you need inputs with the same label, add ##SomeUniqueLabel
after the text, or use pushid to
give things unique ids. ImGui doesn't know what you clicked if all your buttons have the same text...
Returns false if the window was closed from the X.
The callback signature is nil win(GuiDrawContext ctx, Vec2 pos, Vec2 size)
+
+
+nil
+win_text(string text)
+Add some text to window, automatically wrapped
+
+
+nil
+win_separator()
+Add a separator line to window
+
+
+nil
+win_separator_text(string text)
+Add a separator text line to window
+
+
+nil
+win_inline()
+Add next thing on the same line. This is same as win_sameline(0, -1)
+
+
+nil
+win_sameline(float offset, float spacing)
+Add next thing on the same line, with an offset
+
+
+bool
+win_button(string text)
+Add a button
+
+
+string
+win_input_text(string label, string value)
+Add a text field
+
+
+int
+win_input_int(string label, int value)
+Add an integer field
+
+
+float
+win_input_float(string label, float value)
+Add a float field
+
+
+int
+win_slider_int(string label, int value, int min, int max)
+Add an integer slider
+
+
+int
+win_drag_int(string label, int value, int min, int max)
+Add an integer dragfield
+
+
+float
+win_slider_float(string label, float value, float min, float max)
+Add an float slider
+
+
+float
+win_drag_float(string label, float value, float min, float max)
+Add an float dragfield
+
+
+bool
+win_check(string label, bool value)
+Add a checkbox
+
+
+int
+win_combo(string label, int selected, string opts)
+Add a combo box
+
+
+nil
+win_pushid(int id)
+Add unique identifier to the stack, to distinguish identical inputs from each other. Put before the input.
+
+
+nil
+win_pushid(string id)
+Add unique identifier to the stack, to distinguish identical inputs from each other. Put before the input.
+
+
+nil
+win_popid()
+Pop unique identifier from the stack. Put after the input.
+
+
+nil
+win_image(IMAGE image, float width, float height)
+Draw image to window.
+
+
+bool
+win_imagebutton(string label, IMAGE image, float width, float height, float uvx1, float uvy1, float uvx2, float uvy2)
+Draw imagebutton to window.
+
+
+nil
+win_section(string title, function callback)
+Add a collapsing accordion section, put contents in the callback function.
+
+
+nil
+win_indent(float width)
+Indent contents, or unindent if negative
+
+
+nil
+win_width(float width)
+Sets next item width (width>1: width in pixels, width<0: to the right of window, -1<width<1: fractional, multiply by available window width)
+
+
+LoadContext
+Context received in ON.LOAD
+Used to load from save_{}.dat into a string
+
+
+
+Type
+Name
+Description
+
+
+
+string
+load()
+
+
+
+PostRoomGenerationContext
+Context received in ON.POST_ROOM_GENERATION.
+Used to change the room templates in the level and other shenanigans that affect level gen.
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+set_room_template(int x, int y, LAYER layer, ROOM_TEMPLATE room_template)
+Set the room template at the given index and layer, returns false
if the index is outside of the level.
+
+
+bool
+mark_as_machine_room_origin(int x, int y, LAYER layer)
+Marks the room as the origin of a machine room, should be the top-left corner of the machine room
Run this after setting the room template for the room, otherwise the machine room will not spawn correctly
+
+
+bool
+mark_as_set_room(int x, int y, LAYER layer)
+Marks the room as a set-room, a corresponding setroomy-x
template must be loaded, else the game will crash
+
+
+bool
+unmark_as_set_room(int x, int y, LAYER layer)
+Unmarks the room as a set-room
+
+
+bool
+set_shop_type(int x, int y, LAYER layer, int shop_type)
+Set the shop type for a specific room, does nothing if the room is not a shop
+
+
+bool
+set_procedural_spawn_chance(PROCEDURAL_CHANCE chance_id, int inverse_chance)
+Force a spawn chance for this level, has the same restrictions as specifying the spawn chance in the .lvl file.
Note that the actual chance to spawn is 1/inverse_chance
and that is also slightly skewed because of technical reasons.
Returns false
if the given chance is not defined.
+
+
+nil
+set_num_extra_spawns(int extra_spawn_id, int num_spawns_front_layer, int num_spawns_back_layer)
+Change the amount of extra spawns for the given extra_spawn_id
.
+
+
+optional<SHORT_TILE_CODE>
+define_short_tile_code(ShortTileCodeDef short_tile_code_def)
+Defines a new short tile code, automatically picks an unused character or returns a used one in case of an exact match
Returns nil
if all possible short tile codes are already in use
+
+
+nil
+change_short_tile_code(SHORT_TILE_CODE short_tile_code, ShortTileCodeDef short_tile_code_def)
+Overrides a specific short tile code, this means it will change for the whole level
+
+
+PreHandleRoomTilesContext
+Context received in ON.PRE_HANDLE_ROOM_TILES.
+Used to change the room data as well as add a backlayer room if none is set yet.
+
+
+
+Type
+Name
+Description
+
+
+
+optional<SHORT_TILE_CODE>
+get_short_tile_code(int tx, int ty, LAYER layer)
+Gets the tile code at the specified tile coordinate
Valid coordinates are 0 <= tx < CONST.ROOM_WIDTH
, 0 <= ty < CONST.ROOM_HEIGHT
and layer
in {LAYER.FRONT, LAYER.BACK}
Also returns nil
if layer == LAYER.BACK
and the room does not have a back layer
+
+
+bool
+set_short_tile_code(int tx, int ty, LAYER layer, SHORT_TILE_CODE short_tile_code)
+Sets the tile code at the specified tile coordinate
Valid coordinates are 0 <= tx < CONST.ROOM_WIDTH
, 0 <= ty < CONST.ROOM_HEIGHT
and layer
in {LAYER.FRONT, LAYER.BACK, LAYER.BOTH}
Also returns false
if layer == LAYER.BACK
and the room does not have a back layer
+
+
+array<tuple<int, int, LAYER>>
+find_all_short_tile_codes(LAYER layer, SHORT_TILE_CODE short_tile_code)
+Finds all places a short tile code is used in the room, layer
must be in {LAYER.FRONT, LAYER.BACK, LAYER.BOTH}
Returns an empty list if layer == LAYER.BACK
and the room does not have a back layer
+
+
+bool
+replace_short_tile_code(LAYER layer, SHORT_TILE_CODE short_tile_code, SHORT_TILE_CODE replacement_short_tile_code)
+Replaces all instances of short_tile_code
in the given layer with replacement_short_tile_code
, layer
must be in {LAYER.FRONT, LAYER.BACK, LAYER.BOTH}
Returns false
if layer == LAYER.BACK
and the room does not have a back layer
+
+
+bool
+has_back_layer()
+Check whether the room has a back layer
+
+
+nil
+add_empty_back_layer()
+Add a back layer filled with all 0
if there is no back layer yet
Does nothing if there already is a backlayer
+
+
+nil
+add_copied_back_layer()
+Add a back layer that is a copy of the front layer
Does nothing if there already is a backlayer
+
+
+PreLoadLevelFilesContext
+Context received in ON.PRE_LOAD_LEVEL_FILES, used for forcing specific .lvl
files to load.
+
+
+
+Type
+Name
+Description
+
+
+
+nil
+override_level_files(array levels)
+Block all loading .lvl
files and instead load the specified .lvl
files. This includes generic.lvl
so if you need it specify it here.
All .lvl
files are loaded relative to Data/Levels
, but they can be completely custom .lvl
files that ship with your mod so long as they are in said folder.
Use at your own risk, some themes/levels expect a certain level file to be loaded.
+
+
+nil
+add_level_files(array levels)
+Load additional levels files other than the ones that would usually be loaded. Stacks with override_level_files
if that was called first.
All .lvl
files are loaded relative to Data/Levels
, but they can be completely custom .lvl
files that ship with your mod so long as they are in said folder.
+
+
+SaveContext
+Context received in ON.SAVE
+Used to save a string to some form of save_{}.dat
+Future calls to this will override the save
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+save(string data)
+
+
+
+VanillaRenderContext
+Used in set_callback ON.RENDER_ callbacks, set_post_render, set_post_render_screen, set_pre_render, set_pre_render_screen
+
+
+
+Type
+Name
+Description
+
+
+
+nil
+draw_text(const string& text, float x, float y, float scale_x, float scale_y, Color color, VANILLA_TEXT_ALIGNMENT alignment, VANILLA_FONT_STYLE fontstyle)
+Draw text using the built-in renderer
Use in combination with ON.RENDER_✱ events. See vanilla_rendering.lua in the example scripts.
+
+
+nil
+draw_text(const TextRenderingInfo tri, Color color)
+
+
+
+tuple<float, float>
+draw_text_size(const string& text, float scale_x, float scale_y, int fontstyle)
+Measure the provided text using the built-in renderer
If you can, consider creating your own TextRenderingInfo instead
You can then use :text_size()
and draw_text
with that one object
draw_text_size
works by creating new TextRenderingInfo just to call :text_size()
, which is not very optimal
+
+
+nil
+draw_screen_texture(TEXTURE texture_id, int row, int column, float left, float top, float right, float bottom, Color color)
+Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_texture(TEXTURE texture_id, int row, int column, const AABB& rect, Color color)
+Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_texture(TEXTURE texture_id, int row, int column, const AABB& rect, Color color, float angle, float px, float py)
+Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer with angle, px/py is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_texture(TEXTURE texture_id, int row, int column, const Quad& dest, Color color)
+Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_texture(TEXTURE texture_id, const Quad& source, const Quad& dest, Color color)
+Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer. source
- the coordinates in the texture, dest
- the coordinates on the screen
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_texture(TEXTURE texture_id, TextureRenderingInfo tri, Color color)
+Draw a texture in screen coordinates using TextureRenderingInfo
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+set_corner_finish(CORNER_FINISH c)
+Set the prefered way of drawing corners for the non filled shapes
+
+
+nil
+draw_screen_line(const Vec2& A, const Vec2& B, float thickness, Color color)
+Draws a line on screen using the built-in renderer from point A
to point B
.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_rect(const AABB& rect, float thickness, Color color, optional angle, optional px, optional py)
+Draw rectangle in screen coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc. (corner from the AABB, not the visible one from adding the thickness
)
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_rect_filled(const AABB& rect, Color color, optional angle, optional px, optional py)
+Draw filled rectangle in screen coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_triangle(const Triangle& triangle, float thickness, Color color)
+Draw triangle in screen coordinates using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_triangle_filled(const Triangle& triangle, Color color)
+Draw filled triangle in screen coordinates using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_poly(array points, float thickness, Color color, bool closed)
+Draw a polyline on screen from points using the built-in renderer
Draws from the first to the last point, use closed
to connect first and last as well
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_poly(const Quad& points, float thickness, Color color, bool closed)
+Draw quadrilateral in screen coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_poly_filled(array points, Color color)
+Draw a convex polygon on screen from points using the built-in renderer
Can probably draw almost any polygon, but the convex one is guaranteed to look correct
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_poly_filled(const Quad& points, Color color)
+Draw filled quadrilateral in screen coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_world_texture(TEXTURE texture_id, int row, int column, float left, float top, float right, float bottom, Color color)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a Quad instead
+
+
+nil
+draw_world_texture(TEXTURE texture_id, int row, int column, const AABB& dest, Color color)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a Quad instead
+
+
+nil
+draw_world_texture(TEXTURE texture_id, int row, int column, const AABB& dest, Color color, float angle, float px, float py)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer with angle, px/py is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a Quad instead
+
+
+nil
+draw_world_texture(TEXTURE texture_id, int row, int column, const Quad& dest, Color color, WORLD_SHADER shader)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
The shader
parameter controls how to render the texture
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_texture(TEXTURE texture_id, int row, int column, const Quad& dest, Color color)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_texture(TEXTURE texture_id, const Quad& source, const Quad& dest, Color color, WORLD_SHADER shader)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer. source
- the coordinates in the texture, dest
- the coordinates on the screen
The shader
parameter controls how to render the texture
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_texture(TEXTURE texture_id, const Quad& source, const Quad& dest, Color color)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer. source
- the coordinates in the texture, dest
- the coordinates on the screen
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_line(const Vec2& A, const Vec2& B, float thickness, Color color)
+Draws a line in world coordinates using the built-in renderer from point A
to point B
.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_rect(const AABB& rect, float thickness, Color color, optional angle, optional px, optional py)
+Draw rectangle in world coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc. (corner from the AABB, not the visible one from adding the thickness
)
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_rect_filled(const AABB& rect, Color color, optional angle, optional px, optional py)
+Draw rectangle in world coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_triangle(const Triangle& triangle, float thickness, Color color)
+Draw triangle in world coordinates using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_triangle_filled(const Triangle& triangle, Color color)
+Draw filled triangle in world coordinates using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_poly(array points, float thickness, Color color, bool closed)
+Draw a polyline in world coordinates from points using the built-in renderer
Draws from the first to the last point, use closed
to connect first and last as well
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_poly(const Quad& points, float thickness, Color color, bool closed)
+Draw quadrilateral in world coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_poly_filled(array points, Color color)
+Draw a convex polygon in world coordinates from points using the built-in renderer
Can probably draw almost any polygon, but the convex one is guaranteed to look correct
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_poly_filled(const Quad& points, Color color)
+Draw filled quadrilateral in world coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+AABB
+bounding_box
+
+
+
+
+render_draw_depth
+
+
+
+Entity related types
Ai
+Used in Player
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+target
+
+
+
+int
+target_uid
+
+
+
+int
+timer
+
+
+
+int
+state
+AI state (patrol, sleep, attack, aggro...)
+
+
+int
+last_state
+
+
+
+int
+trust
+Levels completed with, 0..3
+
+
+int
+whipped
+Number of times whipped by player
+
+
+int
+walk_pause_timer
+positive: walking, negative: wating/idle
+
+
+Animation
+Used in EntityDB
+
+
+
+Type
+Name
+Description
+
+
+
+int
+id
+
+
+
+int
+first_tile
+
+
+
+int
+num_tiles
+
+
+
+int
+interval
+
+
+
+REPEAT_TYPE
+repeat_mode
+
+
+
+EntityDB
-Search script examples for grow_chainandblocks
+When cloning an entity type, remember to save it in the script for as long as you need it. Otherwise the memory will be freed immediately, which eventually leads to a crash when used or overwritten by other stuff:
-bool grow_chainandblocks()
bool grow_chainandblocks(int x, int y)
-Grow chains from ENT_TYPE_FLOOR_CHAIN_CEILING
and chain with blocks on it from ENT_TYPE_FLOOR_CHAINANDBLOCKS_CEILING
, it starts looking for the ceilings from the top left corner of a level.
-To limit it use the parameters, so x = 10 will only grow chains from ceilings with x < 10, with y = 10 it's ceilings that have y > (level bound top - 10)
-grow_poles
+-- Create a special fast snake type with weird animation
+special_snake = EntityDB:new(ENT_TYPE.MONS_SNAKE)
+special_snake.max_speed = 1
+special_snake.acceleration = 2
+special_snake.animations[2].num_tiles = 1
+
+set_post_entity_spawn(function(snake)
+ -- 50% chance to make snakes special
+ if prng:random_chance(2, PRNG_CLASS.PROCEDURAL_SPAWNS) then
+ -- Assign custom type
+ snake.type = special_snake
+ -- This is only really needed if types are changed during the level
+ snake.current_animation = special_snake.animations[2]
+ end
+end, SPAWN_TYPE.ANY, MASK.MONSTER, ENT_TYPE.MONS_SNAKE)
+
-Search script examples for grow_poles
+You can also use Entity.user_data to store the custom type:
-nil grow_poles(LAYER l, int max_lengh)
nil grow_poles(LAYER l, int max_lengh, AABB area, bool destroy_broken)
-Grow pole from GROWABLE_CLIMBING_POLE
entities in a level, area
default is whole level, destroy_broken
default is false
-grow_vines
+-- Custom player who is buffed a bit every level
+set_callback(function()
+ -- Doing this to include HH
+ for i,v in ipairs(get_entities_by_mask(MASK.PLAYER)) do
+ local player = get_entity(v)
+
+ -- Create new custom type on the first level, based on the original type
+ if not player.user_data then
+ player.user_data = {}
+ player.user_data.type = EntityDB:new(player.type.id)
+ end
+
+ -- Set the player entity type to the custom type every level
+ player.type = player.user_data.type
+
+ -- Buff the player every subsequent level
+ if state.level_count > 0 then
+ player.type.max_speed = player.type.max_speed * 1.1
+ player.type.acceleration = player.type.acceleration * 1.1
+ player.type.jump = player.type.jump * 1.1
+ end
+ end
+end, ON.POST_LEVEL_GENERATION)
+
-Search script examples for grow_vines
+Illegal bad example, don't do this:
-nil grow_vines(LAYER l, int max_lengh)
nil grow_vines(LAYER l, int max_lengh, AABB area, bool destroy_broken)
-Grow vines from GROWABLE_VINE
and VINE_TREE_TOP
entities in a level, area
default is whole level, destroy_broken
default is false
-http_get
+set_callback(function()
+ -- Nobody owns the new type and the memory is freed immediately, eventually leading to a crash
+ players[1].type = EntityDB:new(players[1].type)
+ players[1].type.max_speed = 2
+end, ON.POST_LEVEL_GENERATION)
+
+Used in Entity and get_type
+Stores static common data for an ENT_TYPE. You can also clone entity types with the copy constructor to create new custom entities with different common properties. This tool can be helpful when messing with the animations. The default values are also listed in entities.json.
+
+
+
+Type
+Name
+Description
+
+
+
+EntityDB
+new(EntityDB other)
+
+
+
+EntityDB
+new(ENT_TYPE)
+
+
+
+ENT_TYPE
+id
+
+
+
+int
+search_flags
+MASK
+
+
+float
+width
+
+
+
+float
+height
+
+
+
+float
+offsetx
+
+
+
+float
+offsety
+
+
+
+float
+hitboxx
+
+
+
+float
+hitboxy
+
+
+
+int
+draw_depth
+
+
+
+int
+collision2_mask
+MASK, will only call collision2 when colliding with entities that match this mask.
+
+
+int
+collision_mask
+MASK used for collision with floors.
+
+
+float
+friction
+
+
+
+float
+elasticity
+
+
+
+float
+weight
+
+
+
+float
+acceleration
+
+
+
+float
+max_speed
+
+
+
+float
+sprint_factor
+
+
+
+float
+jump
+
+
+
+float
+glow_red
+
+
+
+float
+glow_green
+
+
+
+float
+glow_blue
+
+
+
+float
+glow_alpha
+
+
+
+int
+damage
+
+
+
+int
+life
+
+
+
+int
+sacrifice_value
+Favor for sacrificing alive. Halved when dead (health == 0).
+
+
+int
+blood_content
+
+
+
+int
+texture
+
+
+
+map<int, Animation>
+animations
+
+
+
+int
+properties_flags
+
+
+
+int
+default_flags
+
+
+
+int
+default_more_flags
+
+
+
+bool
+leaves_corpse_behind
+
+
+
+int
+sound_killed_by_player
+
+
+
+int
+sound_killed_by_other
+
+
+
+STRINGID
+description
+
+
+
+int
+tilex
+
+
+
+int
+tiley
+
+
+
+HudInventory
+
+
+Type
+Name
+Description
+
+
+
+bool
+enabled
+
+
+
+int
+health
+
+
+
+int
+bombs
+
+
+
+int
+ropes
+
+
+
+bool
+ankh
+
+
+
+bool
+kapala
+
+
+
+int
+kapala_blood
+
+
+
+bool
+poison
+
+
+
+bool
+curse
+
+
+
+bool
+elixir
+
+
+
+ENT_TYPE
+crown
+Powerup type or 0
+
+
+int
+item_count
+Amount of generic pickup items at the bottom. Set to 0 to not draw them.
+
+
+Inventory
+Used in Player, PlayerGhost and Items
+
+
+
+Type
+Name
+Description
+
+
+
+int
+money
+Sum of the money collected in current level
+
+
+int
+bombs
+
+
+
+int
+ropes
+
+
+
+int
+player_slot
+
+
+
+int
+poison_tick_timer
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+bool
+cursed
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+bool
+elixir_buff
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+int
+health
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+int
+kapala_blood_amount
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+int
+time_of_death
+Is set to state.time_total when player dies in coop (to determinate who should be first to re-spawn from coffin)
+
+
+ENT_TYPE
+held_item
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+int
+held_item_metadata
+Metadata of the held item (health, is cursed etc.)
Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+ENT_TYPE
+mount_type
+Used to transfer information to transition/next level (player rading a mout). Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+int
+mount_metadata
+Metadata of the mount (health, is cursed etc.)
Used to transfer information to transition/next level (player rading a mout). Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+int
+kills_level
+
+
+
+int
+kills_total
+
+
+
+int
+collected_money_total
+Total money collected during previous levels (so excluding the current one)
+
+
+int
+collected_money_count
+Count/size for the collected_money
arrays
+
+
+array<ENT_TYPE, 512>
+collected_money
+Types of gold/gems collected during this level, used later to display during the transition
+
+
+array<int, 512>
+collected_money_values
+Values of gold/gems collected during this level, used later to display during the transition
+
+
+array<ENT_TYPE, 256>
+killed_enemies
+Types of enemies killed during this level, used later to display during the transition
+
+
+int
+companion_count
+Number of companions, it will determinate how many companions will be transfered to next level
Increments when player acquires new companion, decrements when one of them dies
+
+
+array<ENT_TYPE, 8>
+companions
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<ENT_TYPE, 8>
+companion_held_items
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<int, 8>
+companion_held_item_metadatas
+Metadata of items held by companions (health, is cursed etc.)
Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<int, 8>
+companion_trust
+(0..3) Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<int, 8>
+companion_health
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<int, 8>
+companion_poison_tick_timers
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<bool, 8>
+is_companion_cursed
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<ENT_TYPE, 30>
+acquired_powerups
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+Generic types
AABB
+Axis-Aligned-Bounding-Box, represents for example a hitbox of an entity or the size of a gui element
+
+
+
+Type
+Name
+Description
+
+
+
+AABB
+new()
+Create a new axis aligned bounding box - defaults to all zeroes
+
+
+AABB
+new(AABB)
+Copy an axis aligned bounding box
+
+
+AABB
+new(Vec2 top_left, Vec2 bottom_right)
+
+
+
+AABB
+new(float left_, float top_, float right_, float bottom_)
+Create a new axis aligned bounding box by specifying its values
+
+
+float
+left
+
+
+
+float
+bottom
+
+
+
+float
+right
+
+
+
+float
+top
+
+
+
+bool
+overlaps_with(const AABB& other)
+
+
+
+AABB&
+abs()
+Fixes the AABB if any of the sides have negative length
+
+
+AABB&
+extrude(float amount)
+Grows or shrinks the AABB by the given amount in all directions.
If amount < 0
and abs(amount) > right/top - left/bottom
the respective dimension of the AABB will become 0
.
+
+
+AABB&
+extrude(float amount_x, float amount_y)
+Grows or shrinks the AABB by the given amount in each direction.
If amount_x/y < 0
and abs(amount_x/y) > right/top - left/bottom
the respective dimension of the AABB will become 0
.
+
+
+AABB&
+offset(float off_x, float off_y)
+Offsets the AABB by the given offset.
+
+
+float
+area()
+Compute area of the AABB, can be zero if one dimension is zero or negative if one dimension is inverted.
+
+
+tuple<float, float>
+center()
+Short for (aabb.left + aabb.right) / 2.0f, (aabb.top + aabb.bottom) / 2.0f
.
+
+
+float
+width()
+Short for aabb.right - aabb.left
.
+
+
+float
+height()
+Short for aabb.top - aabb.bottom
.
+
+
+bool
+is_point_inside(const Vec2 p)
+Checks if point lies between left/right and top/bottom
+
+
+bool
+is_point_inside(float x, float y)
+
+
+
+tuple<float, float, float, float>
+split()
+
+
+
+BackgroundMusic
+Used in GameManager
+
+
+
+Type
+Name
+Description
+
+
+
+BackgroundSound
+game_startup
+
+
+
+BackgroundSound
+main_backgroundtrack
+
+
+
+BackgroundSound
+basecamp
+
+
+
+BackgroundSound
+win_scene
+
+
+
+BackgroundSound
+arena
+
+
+
+BackgroundSound
+arena_intro_and_win
+
+
+
+BackgroundSound
+level_gameplay
+
+
+
+BackgroundSound
+dark_level
+
+
+
+BackgroundSound
+level_transition
+
+
+
+BackgroundSound
+backlayer
+
+
+
+BackgroundSound
+shop
+
+
+
+BackgroundSound
+angered_shopkeeper
+
+
+
+BackgroundSound
+inside_sunken_city_pipe
+
+
+
+BackgroundSound
+pause_menu
+
+
+
+BackgroundSound
+death_transition
+
+
+
+Color
-- make a semi transparent red color and print it in different formats
+local color = Color:red()
+color.a = 0.5
+local r, g, b, a = color:get_rgba()
+prinspect(r, g, b, a) -- 255, 0, 0, 128
+prinspect(color.r, color.g, color.b, color.a) -- 1.0, 0.0, 0.0, 0.5
+prinspect(string.format("%x"), color:get_ucolor()) -- 800000ff
+
+
+
+
+Type
+Name
+Description
+
+
+
+Color
+new()
+Create a new color - defaults to black
+
+
+Color
+new(Color)
+
+
+
+Color
+new(float r_, float g_, float b_, float a_)
+Create a new color by specifying its values
+
+
+float
+r
+
+
+
+float
+g
+
+
+
+float
+b
+
+
+
+float
+a
+
+
+
+Color
+white()
+
+
+
+Color
+silver()
+
+
+
+Color
+gray()
+
+
+
+Color
+black()
+
+
+
+Color
+red()
+
+
+
+Color
+maroon()
+
+
+
+Color
+yellow()
+
+
+
+Color
+olive()
+
+
+
+Color
+lime()
+
+
+
+Color
+green()
+
+
+
+Color
+aqua()
+
+
+
+Color
+teal()
+
+
+
+Color
+blue()
+
+
+
+Color
+navy()
+
+
+
+Color
+fuchsia()
+
+
+
+Color
+purple()
+
+
+
+tuple<int, int, int, int>
+get_rgba()
+Returns RGBA colors in 0..255 range
+
+
+Color&
+set_rgba(int red, int green, int blue, int alpha)
+Changes color based on given RGBA colors in 0..255 range
+
+
+uColor
+get_ucolor()
+Returns the uColor
used in GuiDrawContext
drawing functions
+
+
+Color&
+set_ucolor(const uColor color)
+Changes color based on given uColor
+
+
+Hud
set_callback(function(ctx, hud)
+ -- draw on screen bottom but keep neat animations
+ if hud.y > 0 then hud.y = -hud.y end
+ -- spoof some values
+ hud.data.inventory[1].health = prng:random_int(1, 99, 0)
+ -- hide generic pickup items
+ hud.data.inventory[1].item_count = 0
+ -- hide money element
+ hud.data.money.opacity = 0
+ -- get real current opacity of p1 inventory element
+ prinspect(hud.data.players[1].opacity * hud.data.opacity * hud.opacity)
+end, ON.RENDER_PRE_HUD)
+
+
+
+
+Type
+Name
+Description
+
+
+
+float
+y
+
+
+
+float
+opacity
+
+
+
+HudData
+data
+
+
+
+HudData
+
+
+Type
+Name
+Description
+
+
+
+array<HudInventory, MAX_PLAYERS>
+inventory
+
+
+
+bool
+udjat
+
+
+
+int
+money_total
+
+
+
+int
+money_counter
+
+
+
+int
+time_total
+
+
+
+int
+time_level
+
+
+
+int
+world_num
+
+
+
+int
+level_num
+
+
+
+int
+seed
+
+
+
+float
+opacity
+
+
+
+array<HudPlayer, MAX_PLAYERS>
+players
+
+
+
+HudMoney
+money
+
+
+
+HudElement
+timer
+
+
+
+HudElement
+level
+
+
+
+HudElement
+
+
+Type
+Name
+Description
+
+
+
+bool
+dim
+Hide background and dim if using the auto adjust setting.
+
+
+float
+opacity
+Background will be drawn if this is not 0.5
+
+
+int
+time_dim
+Level time when element should dim again after hilighted, INT_MAX if dimmed on auto adjust. 0 on opaque.
+
+
+HudMoney
+Derived from HudElement
+
+
+
+Type
+Name
+Description
+
+
+
+int
+total
+
+
+
+int
+counter
+
+
+
+int
+timer
+
+
+
+HudPlayer
+Derived from HudElement
+
+
+
+Type
+Name
+Description
+
+
+
+int
+health
+
+
+
+int
+bombs
+
+
+
+int
+ropes
+
+
+
+ItemOwnerDetails
+Used in RoomOwnersInfo
+
+
+
+Type
+Name
+Description
+
+
+
+ENT_TYPE
+owner_type
+
+
+
+int
+owner_uid
+
+
+
+Letter
+
+
+Type
+Name
+Description
+
+
+
+Triangle
+bottom
+
+
+
+Triangle
+top
+
+
+
+Quad
+get_quad()
+Get the Quad of a letter (easier to work with compared to the two triangles)
This assumes that the triangles are in the correct 'touching each other' position
if the positions were altered the results may not end up as expected
+
+
+nil
+set_quad(Quad quad)
+Inverse of the get_quad
+
+
+Vec2
+center()
+Get's approximated center of a letter by finding the highest and lowest values, then finding the center of a rectangle build from those values
+
+
+MagmamanSpawnPosition
+Used in LogicList
+
+
+
+Type
+Name
+Description
+
+
+
+MagmamanSpawnPosition
+new(int x_, int y_)
+
+
+
+int
+x
+
+
+
+int
+y
+
+
+
+int
+timer
+
+
+
+MovableBehavior
+Opaque handle to a movable behavior used in some Movable functions
+
+
+
+Type
+Name
+Description
+
+
+
+int
+get_state_id()
+
+
+
+int
+get_state_id()
+Get the state_id
of a behavior, this is the id that needs to be returned from a behavior's
get_next_state_id
to enter this state, given that the behavior is added to the movable.
+
+
+PRNG
+PRNG (short for Pseudo-Random-Number-Generator) holds 10 128bit wide buffers of memory that are mutated on every generation of a random number.
+The game uses specific buffers for specific scenarios, for example the third buffer is used every time particles are spawned to determine a random velocity.
+The used buffer is determined by PRNG_CLASS. If you want to make a mod that does not affect level generation but still uses the prng then you want to stay away from specific buffers.
+If you don't care what part of the game you affect just use prng.random
.
+
+
+
+Type
+Name
+Description
+
+
+
+nil
+seed(int seed)
+Same as seed_prng
+
+
+float
+random_float(PRNG_CLASS type)
+Generate a random floating point number in the range [0, 1)
+
+
+bool
+random_chance(int inverse_chance, PRNG_CLASS type)
+Returns true with a chance of 1/inverse_chance
+
+
+optional<int>
+random_index(int i, PRNG_CLASS type)
+Generate a integer number in the range [1, i]
or nil
if i < 1
+
+
+optional<int>
+random_int(int min, int max, PRNG_CLASS type)
+Generate a integer number in the range [min, max]
or nil
if max < min
+
+
+float
+random()
+Drop-in replacement for math.random()
+
+
+optional<int>
+random(int i)
+Drop-in replacement for math.random(i)
+
+
+optional<int>
+random(int min, int max)
+Drop-in replacement for math.random(min, max)
+
+
+tuple<int, int>
+get_pair(PRNG_CLASS type)
+
+
+
+nil
+set_pair(PRNG_CLASS type, int first, int second)
+
+
+
+Quad
+
+
+Type
+Name
+Description
+
+
+
+Quad
+new()
+
+
+
+Quad
+new(Quad)
+
+
+
+Quad
+new(Vec2 bottom_left_, Vec2 bottom_right_, Vec2 top_right_, Vec2 top_left_)
+
+
+
+Quad
+new(float _bottom_left_x, float _bottom_left_y, float _bottom_right_x, float _bottom_right_y, float _top_right_x, float _top_right_y, float _top_left_x, float _top_left_y)
+
+
+
+Quad
+new(AABB aabb)
+
+
+
+float
+bottom_left_x
+
+
+
+float
+bottom_left_y
+
+
+
+float
+bottom_right_x
+
+
+
+float
+bottom_right_y
+
+
+
+float
+top_right_x
+
+
+
+float
+top_right_y
+
+
+
+float
+top_left_x
+
+
+
+float
+top_left_y
+
+
+
+AABB
+get_AABB()
+Returns the max/min values of the Quad
+
+
+Quad&
+offset(float off_x, float off_y)
+
+
+
+Quad&
+rotate(float angle, float px, float py)
+Rotates a Quad by an angle, px/py are not offsets, use :get_AABB():center()
to get approximated center for simetrical quadrangle
+
+
+Quad&
+flip_horizontally()
+
+
+
+Quad&
+flip_vertically()
+
+
+
+bool
+is_point_inside(Vec2 p, optional epsilon)
+Check if point lies inside of triangle
Because of the imprecise nature of floating point values, the epsilon
value is needed to compare the floats, the default value is 0.00001
+
+
+bool
+is_point_inside(float x, float y, optional epsilon)
+
+
+
+tuple<Vec2, Vec2, Vec2, Vec2>
+split()
+Returns the corners in order: bottom_left, bottom_right, top_right, top_left
+
+
+RenderInfo
-Search script examples for http_get
+For using a custom normal map:
-optional<string> http_get(string url)
-Send a synchronous HTTP GET request and return response as a string or nil on an error
-http_get_async
+set_post_entity_spawn(function(ent)
+ -- Doesn't really make sense with this texture, you can use your custom normal texture id here
+ ent.rendering_info:set_normal_map_texture(TEXTURE.DATA_TEXTURES_FLOORSTYLED_GOLD_NORMAL_0)
+ ent.rendering_info.shader = 30 -- Make sure to set the shader to one that uses normal map
+end, SPAWN_TYPE.LEVEL_GEN, MASK.FLOOR, ENT_TYPE.FLOORSTYLED_MINEWOOD)
+
-Search script examples for http_get_async
+Note: if using set_texture_num, make sure to have used set_second_texture/set_third_texture before, since not doing so can lead to crashes
-HttpRequest http_get_async(string url, function on_data)
-Send an asynchronous HTTP GET request and run the callback when done. If there is an error, response will be nil and vice versa.
-The callback signature is nil on_data(string response, string error)
-import
+
+Some information used to render the entity, can not be changed, used in Entity
+
+
+
+Type
+Name
+Description
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+WORLD_SHADER
+shader
+
+
+
+Quad
+source
+
+
+
+Quad
+destination
+
+
+
+float
+tilew
+
+
+
+float
+tileh
+
+
+
+bool
+facing_left
+
+
+
+bool
+render_inactive
+
+
+
+int
+texture_num
+
+
+
+class Entity
+get_entity()
+
+
+
+bool
+set_normal_map_texture(TEXTURE texture_id)
+Sets second_texture to the texture specified, then sets third_texture to SHINE_0 and texture_num to 3. You still have to change shader to 30 to render with normal map (same as COG normal maps)
+
+
+optional<TEXTURE>
+get_second_texture
+
+
+
+optional<TEXTURE>
+get_third_texture
+
+
+
+bool
+set_second_texture(TEXTURE texture_id)
+
+
+
+bool
+set_third_texture(TEXTURE texture_id)
+
+
+
+bool
+set_texture_num(int texture_id)
+Set the number of textures that may be used, need to have them set before for it to work
+
+
+CallbackId
+set_pre_virtual(RENDER_INFO_OVERRIDE entry, function fun)
+Hooks before the virtual function at index entry
.
+
+
+CallbackId
+set_post_virtual(RENDER_INFO_OVERRIDE entry, function fun)
+Hooks after the virtual function at index entry
.
+
+
+nil
+clear_virtual(CallbackId callback_id)
+Clears the hook given by callback_id
, alternatively use clear_callback()
inside the hook.
+
+
+CallbackId
+set_pre_dtor(function fun)
+Hooks before the virtual function.
The callback signature is nil dtor(RenderInfo self)
+
+
+CallbackId
+set_post_dtor(function fun)
+Hooks after the virtual function.
The callback signature is nil dtor(RenderInfo self)
+
+
+CallbackId
+set_pre_render(function fun)
+Hooks before the virtual function.
The callback signature is bool render(RenderInfo self, float float, VanillaRenderContext vanilla_render_context)
+
+
+CallbackId
+set_post_render(function fun)
+Hooks after the virtual function.
The callback signature is nil render(RenderInfo self, float float, VanillaRenderContext vanilla_render_context)
+
+
+RoomOwnerDetails
+Used in RoomOwnersInfo
+
+
+
+Type
+Name
+Description
+
+
+
+int
+layer
+
+
+
+int
+room_index
+
+
+
+int
+owner_uid
+
+
+
+RoomOwnersInfo
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+custom_map<int, ItemOwnerDetails>
+owned_items
+key/index is the uid of an item
+
+
+array<RoomOwnerDetails>
+owned_rooms
+
+
+
+ShortTileCodeDef
+Used in get_short_tile_code, get_short_tile_code_definition and PostRoomGenerationContext
+
+
+
+Type
+Name
+Description
+
+
+
+TILE_CODE
+tile_code
+Tile code that is used by default when this short tile code is encountered. Defaults to 0.
+
+
+int
+chance
+Chance in percent to pick tile_code
over alt_tile_code
, ignored if chance == 0
. Defaults to 100.
+
+
+TILE_CODE
+alt_tile_code
+Alternative tile code, ignored if chance == 100
. Defaults to 0.
+
+
+Triangle
+
+
+Type
+Name
+Description
+
+
+
+Triangle
+new()
+
+
+
+Triangle
+new(Triangle)
+
+
+
+Triangle
+new(Vec2 _a, Vec2 _b, Vec2 _c)
+
+
+
+Triangle
+new(float ax, float ay, float bx, float by, float cx, float cy)
+
+
+
+Vec2
+A
+
+
+
+Vec2
+B
+
+
+
+Vec2
+C
+
+
+
+Triangle&
+offset(const Vec2& off)
+
+
+
+Triangle&
+offset(float x, float y)
+
+
+
+Triangle&
+rotate(float angle, float px, float py)
+Rotate triangle by an angle, the px/py are just coordinates, not offset from the center
+
+
+Vec2
+center()
+Also known as centroid
+
+
+tuple<float, float, float>
+get_angles()
+Returns ABC, BCA, CAB angles in radians
+
+
+Triangle&
+scale(float scale)
+
+
+
+float
+area()
+
+
+
+bool
+is_point_inside(Vec2 p, optional epsilon)
+Check if point lies inside of triangle
Because of the imprecise nature of floating point values, the epsilon
value is needed to compare the floats, the default value is 0.0001
+
+
+bool
+is_point_inside(float x, float y, optional epsilon)
+
+
+
+tuple<Vec2, Vec2, Vec2>
+split()
+Returns the corner points
+
+
+Vec2
+Simple object to hold pair of coordinates
+
+
+
+Type
+Name
+Description
+
+
+
+Vec2
+new()
+
+
+
+Vec2
+new(Vec2)
+
+
+
+Vec2
+new(float x_, float y_)
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+Vec2&
+rotate(float angle, float px, float py)
+
+
+
+float
+distance_to(const Vec2 other)
+Just simple pythagoras theorem
+
+
+tuple<float, float>
+split()
+
+
+
+Input types
Gamepad
+Used in ImGuiIO
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+enabled
+
+
+
+GAMEPAD
+buttons
+
+
+
+float
+lt
+
+
+
+float
+rt
+
+
+
+float
+lx
+
+
+
+float
+ly
+
+
+
+float
+rx
+
+
+
+float
+ry
+
+
+
+ImGuiIO
+Used in get_io
+
+
+
+Type
+Name
+Description
+
+
+
+Vec2
+displaysize
+
+
+
+float
+framerate
+
+
+
+bool
+wantkeyboard
+
+
+
+bool
+keysdown[ImGuiKey_COUNT]
+
+
+
+
+keydown
+bool keydown(int keycode)
bool keydown(char key)
+
+
+
+keypressed
+bool keypressed(int keycode, bool repeat = false)
bool keypressed(char key, bool repeat = false)
+
+
+
+keyreleased
+bool keyreleased(int keycode)
bool keyreleased(char key)
+
+
+bool
+keyctrl
+
+
+
+bool
+keyshift
+
+
+
+bool
+keyalt
+
+
+
+bool
+keysuper
+
+
+
+bool
+wantmouse
+
+
+
+Vec2
+mousepos
+
+
+
+bool
+mousedown[5]
+
+
+
+bool
+mouseclicked[5]
+
+
+
+bool
+mousedoubleclicked[5]
+
+
+
+float
+mousewheel
+
+
+
+Gamepad
+gamepad
+
+
+
+
+gamepads
+Gamepad gamepads(int index)
This is the XInput index 1..4, might not be the same as the player slot.
+
+
+bool
+showcursor
+
+
+
+InputMapping
+Used in PlayerSlot
+
+
+
+Type
+Name
+Description
+
+
+
+int
+jump
+
+
+
+int
+attack
+
+
+
+int
+bomb
+
+
+
+int
+rope
+
+
+
+int
+walk_run
+
+
+
+int
+use_door_buy
+
+
+
+int
+pause_menu
+
+
+
+int
+journal
+
+
+
+int
+left
+
+
+
+int
+right
+
+
+
+int
+up
+
+
+
+int
+down
+
+
+
+PlayerInputs
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+array<PlayerSlot, MAX_PLAYERS>
+player_slots
+
+
+
+PlayerSlot
+player_slot_1
+
+
+
+PlayerSlot
+player_slot_2
+
+
+
+PlayerSlot
+player_slot_3
+
+
+
+PlayerSlot
+player_slot_4
+
+
+
+array<PlayerSlotSettings, MAX_PLAYERS>
+player_settings
+
+
+
+PlayerSlotSettings
+player_slot_1_settings
+
+
+
+PlayerSlotSettings
+player_slot_2_settings
+
+
+
+PlayerSlotSettings
+player_slot_3_settings
+
+
+
+PlayerSlotSettings
+player_slot_4_settings
+
+
+
+Journal types
JournalPage
+Used in set_callback with ON.RENDER_POST_JOURNAL_PAGE
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+background
+
+
+
+int
+page_number
+
+
+
+bool
+is_right_side_page()
+background.x < 0
+
+
+JOURNAL_PAGE_TYPE
+get_type()
+
+
+
+JournalPageBestiary
+Derived from JournalPage JournalPageDiscoverable
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+monster_background
+
+
+
+TextureRenderingInfo
+monster_icon
+
+
+
+TextureRenderingInfo
+defeated_killedby_black_bars
+
+
+
+TextRenderingInfo
+defeated_text_info
+
+
+
+TextRenderingInfo
+defeated_value_text_info
+
+
+
+TextRenderingInfo
+killedby_text_info
+
+
+
+TextRenderingInfo
+killedby_value_text_info
+
+
+
+JournalPageDeathCause
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+TextRenderingInfo
+death_cause_text_info
+
+
+
+JournalPageDeathMenu
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+int
+selected_menu_index
+
+
+
+TextRenderingInfo
+game_over_text_info
+
+
+
+TextRenderingInfo
+level_text_info
+
+
+
+TextRenderingInfo
+level_value_text_info
+
+
+
+TextRenderingInfo
+money_text_info
+
+
+
+TextRenderingInfo
+money_value_text_info
+
+
+
+TextRenderingInfo
+time_text_info
+
+
+
+TextRenderingInfo
+time_value_text_info
+
+
+
+JournalPageDiscoverable
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+show_main_image
+
+
+
+TextRenderingInfo
+title_text_info
+
+
+
+TextRenderingInfo
+entry_text_info
+
+
+
+TextRenderingInfo
+chapter_title_text_info
+
+
+
+JournalPageFeats
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+TextRenderingInfo
+chapter_title_text_info
+
+
+
+TextureRenderingInfo
+feat_icons
+
+
+
+JournalPageItems
+Derived from JournalPage JournalPageDiscoverable
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+item_icon
+
+
+
+TextureRenderingInfo
+item_background
+
+
+
+JournalPageJournalMenu
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+int
+selected_menu_index
+
+
+
+TextRenderingInfo
+journal_text_info
+
+
+
+TextureRenderingInfo
+completion_badge
+
+
+
+JournalPageLastGamePlayed
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+main_image
+
+
+
+TextRenderingInfo
+last_game_played_text_info
+
+
+
+TextRenderingInfo
+level_text_info
+
+
+
+TextRenderingInfo
+level_value_text_info
+
+
+
+TextRenderingInfo
+money_text_info
+
+
+
+TextRenderingInfo
+money_value_text_info
+
+
+
+TextRenderingInfo
+time_text_info
+
+
+
+TextRenderingInfo
+time_value_text_info
+
+
+
+int
+sticker_count
+
+
+
+array<TextureRenderingInfo, 20>
+stickers
+
+
+
+JournalPagePeople
+Derived from JournalPage JournalPageDiscoverable
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+character_background
+
+
+
+TextureRenderingInfo
+character_icon
+
+
+
+TextureRenderingInfo
+character_drawing
+
+
+
+JournalPagePlaces
+Derived from JournalPage JournalPageDiscoverable
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+main_image
+
+
+
+JournalPagePlayerProfile
+Derived from JournalPage
+
+JournalPageProgress
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+coffeestain_top
+
+
+
+JournalPageRecap
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+JournalPageStory
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+JournalPageTraps
+Derived from JournalPage JournalPageDiscoverable
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+trap_icon
+
+
+
+TextureRenderingInfo
+trap_background
+
+
+
+Levelgen types
DoorCoords
+Deprecated
+ kept for backward compatibility, don't use, check LevelGenSystem.exit_doors
+
+
+
+Type
+Name
+Description
+
+
+
+float
+door1_x
+
+
+
+float
+door1_y
+
+
+
+float
+door2_x
+door2 only valid when there are two in the level, like Volcana drill, Olmec, ...
+
+
+float
+door2_y
+
+
+
+LevelGenSystem
+Data relating to level generation, changing anything in here from ON.LEVEL or later will likely have no effect, used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+ShopType
+shop_type
+
+
+
+ShopType
+backlayer_shop_type
+
+
+
+int
+shop_music
+
+
+
+int
+backlayer_shop_music
+
+
+
+float
+spawn_x
+
+
+
+float
+spawn_y
+
+
+
+int
+spawn_room_x
+
+
+
+int
+spawn_room_y
+
+
+
+custom_array<Vec2>
+exit_doors
+
+
+
+ThemeInfo
+themes[18]
+
+
+
+Lighting types
Illumination
+Generic obcject for lights in the game, you can make your own with create_illumination
+Used in StateMemory, Player, PlayerGhost, BurningRopeEffect ...
+
+
+
+Type
+Name
+Description
+
+
+
+array<LightParams, 4>
+lights
+Table of light1, light2, ... etc.
+
+
+LightParams
+light1
+
+
+
+LightParams
+light2
+
+
+
+LightParams
+light3
+
+
+
+LightParams
+light4
+It's rendered on objects around, not as an actual bright spot
+
+
+float
+brightness
+
+
+
+float
+brightness_multiplier
+
+
+
+float
+light_pos_x
+
+
+
+float
+light_pos_y
+
+
+
+float
+offset_x
+
+
+
+float
+offset_y
+
+
+
+float
+distortion
+
+
+
+int
+entity_uid
+
+
+
+int
+flags
+see flags.hpp illumination_flags
+
+
+int
+type_flags
+Only one can be set: 1 - Follow camera, 2 - Follow Entity, 3 - Rectangle, full brightness
Rectangle always uses light1, even when it's disabled in flags
+
+
+bool
+enabled
+
+
+
+int
+layer
+
+
+
+LightParams
+Used in Illumination
+
+
+
+Type
+Name
+Description
+
+
+
+float
+red
+
+
+
+float
+green
+
+
+
+float
+blue
+
+
+
+float
+size
+
+
+
+Liquid types
LiquidPhysics
+Use LIQUID_POOL enum for the index
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+array<LiquidPool, 5>
+pools
+
+
+
+LiquidPhysicsEngine
+Used in LiquidPool
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+pause
+
+
+
+float
+gravity
+
+
+
+float
+cohesion
+
+
+
+float
+elasticity
+
+
+
+float
+size
+
+
+
+float
+weight
+
+
+
+int
+count
+
+
+
+LiquidPhysicsParams
+Used in LiquidPool
+
+
+
+Type
+Name
+Description
+
+
+
+float
+gravity
+
+
+
+float
+cohesion
+
+
+
+float
+elasticity
+
+
+
+LiquidPool
+Used in LiquidPhysics
+
+
+
+Type
+Name
+Description
+
+
+
+LiquidPhysicsParams
+default
+
+
+
+LiquidPhysicsEngine
+engine
+
+
+
+Logic types
Logic
+Used in LogicList
+
+
+
+Type
+Name
+Description
+
+
+
+int
+logic_index
+
+
+
+LogicDiceShop
+Used in LogicList
+Derived from Logic
+
+
+
+Type
+Name
+Description
+
+
+
+int
+bet_machine
+
+
+
+int
+die1
+
+
+
+int
+die2
+
+
+
+int
+die_1_value
+
+
+
+int
+die_2_value
+
+
+
+int
+prize_dispenser
+
+
+
+int
+prize
+
+
+
+int
+forcefield
+
+
+
+bool
+bet_active
+
+
+
+bool
+forcefield_deactivated
+
+
+
+bool
+boss_angry
+
+
+
+int
+result_announcement_timer
+
+
+
+int
+won_prizes_count
+
+
+
+int
+balance
+
+
+
+LogicList
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+LogicOlmecCutscene
+olmec_cutscene
+
+
+
+LogicTiamatCutscene
+tiamat_cutscene
+
+
+
+LogicMagmamanSpawn
+magmaman_spawn
+
+
+
+LogicDiceShop
+diceshop
+
+
+
+LogicOlmecCutscene
+Used in LogicList
+Derived from Logic
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+olmec
+
+
+
+Entity
+player
+
+
+
+Entity
+cinematic_anchor
+
+
+
+int
+timer
+
+
+
+LogicTiamatCutscene
+Used in LogicList
+Derived from Logic
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+tiamat
+
+
+
+Entity
+player
+
+
+
+Entity
+cinematic_anchor
+
+
+
+int
+timer
+
+
+
+LogicVolcana
+Derived from Logic
+
+
+
+Type
+Name
+Description
+
+
+
+custom_array<MagmamanSpawnPosition>
+magmaman_positions
+
+
+
+Online types
Online
+Can be accessed via global online
+
+
+
+Type
+Name
+Description
+
+
+
+array<OnlinePlayer, 4>
+online_players
+
+
+
+OnlinePlayer
+local_player
+
+
+
+OnlineLobby
+lobby
+
+
+
+OnlineLobby
+Used in Online
+
+
+
+Type
+Name
+Description
+
+
+
+int
+code
+
+
+
+int
+local_player_slot
+
+
+
+string
+get_code()
+Gets the string equivalent of the code
+
+
+OnlinePlayer
+Used in Online
+
+
+
+Type
+Name
+Description
+
+
+
+int
+ready_state
+
+
+
+int
+character
+
+
+
+string
+player_name
+
+
+
+Particle types
Particle
+Used in ParticleEmitterInfo
+
+
+
+Type
+Name
+Description
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+float
+velocityx
+
+
+
+float
+velocityy
+
+
+
+uColor
+color
+
+
+
+float
+width
+
+
+
+float
+height
+
+
+
+int
+lifetime
+
+
+
+int
+max_lifetime
+
+
+
+ParticleDB
+Used in ParticleDB, get_particle_type
+
+
+
+Type
+Name
+Description
+
+
+
+int
+id
+
+
+
+int
+spawn_count_min
+
+
+
+int
+spawn_count
+
+
+
+int
+lifespan_min
+
+
+
+int
+lifespan
+
+
+
+int
+sheet_id
+
+
+
+int
+animation_sequence_length
+
+
+
+float
+spawn_interval
+
+
+
+float
+shrink_growth_factor
+
+
+
+float
+rotation_speed
+
+
+
+float
+opacity
+
+
+
+float
+hor_scattering
+
+
+
+float
+ver_scattering
+
+
+
+float
+scale_x_min
+
+
+
+float
+scale_x
+
+
+
+float
+scale_y_min
+
+
+
+float
+scale_y
+
+
+
+float
+hor_deflection_1
+
+
+
+float
+ver_deflection_1
+
+
+
+float
+hor_deflection_2
+
+
+
+float
+ver_deflection_2
+
+
+
+float
+hor_velocity
+
+
+
+float
+ver_velocity
+
+
+
+int
+red
+
+
+
+int
+green
+
+
+
+int
+blue
+
+
+
+bool
+permanent
+
+
+
+bool
+invisible
+
+
+
+int
+get_texture()
+
+
+
+bool
+set_texture(int texture_id)
+
+
+
+ParticleEmitterInfo
+Generic type for creating particles in the game, you can make your own with generate_world_particles or generate_screen_particles
+Used in ScreenCharacterSelect, ScreenTitle, CursedEffect, OnFireEffect, PoisonedEffect ...
+
+
+
+Type
+Name
+Description
+
+
+
+ParticleDB
+particle_type
+
+
+
+int
+particle_count
+
+
+
+int
+particle_count_back_layer
+
+
+
+int
+entity_uid
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+float
+offset_x
+
+
+
+float
+offset_y
+
+
+
+array<Particle>
+emitted_particles
+
+
+
+array<Particle>
+emitted_particles_back_layer
+
+
+
+Savegame types
Constellation
+
+
+Type
+Name
+Description
+
+
+
+int
+star_count
+
+
+
+array<ConstellationStar, 45>
+stars
+
+
+
+float
+scale
+
+
+
+int
+line_count
+
+
+
+array<ConstellationLine, 90>
+lines
+
+
+
+float
+line_red_intensity
+
+
+
+ConstellationLine
+
+
+Type
+Name
+Description
+
+
+
+int
+from
+
+
+
+int
+to
+
+
+
+ConstellationStar
+
+
+Type
+Name
+Description
+
+
+
+int
+type
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+float
+size
+
+
+
+float
+red
+
+
+
+float
+green
+
+
+
+float
+blue
+
+
+
+float
+alpha
+
+
+
+float
+halo_red
+
+
+
+float
+halo_green
+
+
+
+float
+halo_blue
+
+
+
+float
+halo_alpha
+
+
+
+bool
+canis_ring
+
+
+
+bool
+fidelis_ring
+
+
+
+SaveData
+
+
+Type
+Name
+Description
+
+
+
+array<bool, 16>
+places
+
+
+
+array<bool, 78>
+bestiary
+
+
+
+array<bool, 38>
+people
+
+
+
+array<bool, 54>
+items
+
+
+
+array<bool, 24>
+traps
+
+
+
+string
+last_daily
+
+
+
+int
+characters
+20bit bitmask of unlocked characters
+
+
+int
+tutorial_state
+Tutorial state 0..4. Changes the camp layout, camera and lighting. (0=nothing, 1=journal got, 2=key spawned, 3=door unlocked, 4=complete)
+
+
+int
+shortcuts
+Terra quest state 0..10 (0=not met ... 10=complete)
+
+
+array<int, 78>
+bestiary_killed
+
+
+
+array<int, 78>
+bestiary_killed_by
+
+
+
+array<int, 38>
+people_killed
+
+
+
+array<int, 38>
+people_killed_by
+
+
+
+int
+plays
+
+
+
+int
+deaths
+
+
+
+int
+wins_normal
+
+
+
+int
+wins_hard
+
+
+
+int
+wins_special
+
+
+
+int
+score_total
+
+
+
+int
+score_top
+
+
+
+int
+deepest_area
+
+
+
+int
+deepest_level
+
+
+
+int
+time_best
+
+
+
+int
+time_total
+
+
+
+int
+time_tutorial
+
+
+
+array<int, 20>
+character_deaths
+
+
+
+array<int, 3>
+pets_rescued
+
+
+
+bool
+completed_normal
+
+
+
+bool
+completed_ironman
+
+
+
+bool
+completed_hard
+
+
+
+bool
+profile_seen
+
+
+
+bool
+seeded_unlocked
+
+
+
+int
+world_last
+
+
+
+int
+level_last
+
+
+
+int
+theme_last
+
+
+
+int
+score_last
+
+
+
+int
+time_last
+
+
+
+array<ENT_TYPE, 20>
+stickers
+
+
+
+array<int, 4>
+players
+
+
+
+Constellation
+constellation
+
+
+
+Screen types
FlyingThing
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+texture_info
+
+
+
+ENT_TYPE
+entity_type
+
+
+
+float
+spritesheet_column
+
+
+
+float
+spritesheet_row
+
+
+
+float
+spritesheet_animation_length
+
+
+
+float
+velocity_x
+
+
+
+float
+amplitude
+
+
+
+float
+frequency
+
+
+
+float
+sinewave_angle
+
+
+
+JournalPopupUI
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+wiggling_page_icon
+
+
+
+TextureRenderingInfo
+black_background
+
+
+
+TextureRenderingInfo
+button_icon
+
+
+
+float
+wiggling_page_angle
+
+
+
+int
+chapter_to_show
+
+
+
+int
+entry_to_show
+
+
+
+int
+timer
+
+
+
+float
+slide_position
+
+
+
+JournalUI
+
+
+Type
+Name
+Description
+
+
+
+int
+state
+
+
+
+JOURNALUI_PAGE_SHOWN
+chapter_shown
+
+
+
+int
+current_page
+
+
+
+int
+flipping_to_page
+
+
+
+int
+max_page_count
+
+
+
+TextureRenderingInfo
+book_background
+
+
+
+TextureRenderingInfo
+arrow_left
+
+
+
+TextureRenderingInfo
+arrow_right
+
+
+
+TextureRenderingInfo
+unknown23
+
+
+
+TextureRenderingInfo
+entire_book
+
+
+
+int
+page_timer
+
+
+
+int
+fade_timer
+
+
+
+int
+opacity
+
+
+
+custom_array<JournalPage>
+pages
+Stores pages loaded into memeory. It's not cleared after the journal is closed or when you go back to the main (menu) page.
Use :get_type()
to chcek page type and cast it correctly (see ON.RENDER_POST_DRAW_DEPTH)
+
+
+PauseUI
+
+
+Type
+Name
+Description
+
+
+
+float
+menu_slidein_progress
+
+
+
+TextureRenderingInfo
+blurred_background
+
+
+
+TextureRenderingInfo
+woodpanel_left
+
+
+
+TextureRenderingInfo
+woodpanel_middle
+
+
+
+TextureRenderingInfo
+woodpanel_right
+
+
+
+TextureRenderingInfo
+woodpanel_top
+
+
+
+TextureRenderingInfo
+scroll
+
+
+
+TextureRenderingInfo
+confirmation_panel
+
+
+
+int
+previously_selected_menu_index
+
+
+
+int
+visibility
+
+
+
+SaveRelated
+
+
+Type
+Name
+Description
+
+
+
+JournalPopupUI
+journal_popup_ui
+
+
+
+Screen
+
+
+Type
+Name
+Description
+
+
+
+float
+render_timer
+
+
+
+ScreenArenaIntro
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+players
+
+
+
+TextureRenderingInfo
+background_colors
+
+
+
+TextureRenderingInfo
+vertical_lines
+
+
+
+TextureRenderingInfo
+vertical_line_electricity_effect
+
+
+
+TextureRenderingInfo
+unknown_all_forced
+
+
+
+TextureRenderingInfo
+left_scroll
+
+
+
+TextureRenderingInfo
+right_scroll
+
+
+
+float
+scroll_unfurl_timer
+
+
+
+bool
+waiting
+
+
+
+float
+names_opacity
+
+
+
+float
+line_electricity_effect_timer
+
+
+
+int
+state
+
+
+
+int
+countdown
+
+
+
+ScreenArenaItems
+Derived from Screen
+
+ScreenArenaLevel
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+get_ready
+
+
+
+TextureRenderingInfo
+get_ready_gray_background
+
+
+
+TextureRenderingInfo
+get_ready_outline
+
+
+
+ScreenArenaMenu
+Derived from Screen
+
+ScreenArenaScore
+Derived from Screen
+
+ScreenArenaStagesSelect
+Derived from Screen
+
+ScreenCamp
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+int
+buttons
+
+
+
+ScreenCharacterSelect
+Derived from Screen
+
+ScreenConstellation
-- forces any level transition to immediately go to constellation ending with custom text
+set_callback(function()
+ if state.screen_next == SCREEN.TRANSITION then
+ if state.level_count == 0 then state.level_count = 1 end -- no /0
+ state.win_state = WIN_STATE.COSMIC_OCEAN_WIN
+ state.screen_next = SCREEN.CONSTELLATION
+ state.world_next = 8
+ state.level_next = 99
+ state.theme_next = THEME.COSMIC_OCEAN
+ state.level_gen.themes[THEME.COSMIC_OCEAN].sub_theme = state.level_gen.themes[state.theme]
+ state:force_current_theme(THEME.COSMIC_OCEAN)
+ set_global_interval(function()
+ if state.screen_constellation.sequence_state == 2 then
+ state.screen_constellation.constellation_text = "Lol u stars now"
+ clear_callback()
+ end
+ end, 1)
+ end
+ end, ON.PRE_LOAD_SCREEN)
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+sequence_state
+
+
+
+int
+animation_timer
+
+
+
+float
+constellation_text_opacity
+
+
+
+float
+constellation_text
+
+
+
+ScreenCredits
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+bg_music_info
+
+
+
+ScreenDeath
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+ScreenIntro
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+unknown4
+
+
+
+float
+darkness
+
+
+
+bool
+active
+ends the intro immediately if set to false
+
+
+bool
+skip_prologue
+skips prologue and goes straight to the title screen after the intro
+
+
+ScreenLeaderboards
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+ScreenLevel
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+int
+buttons
+
+
+
+ScreenLogo
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+logo_mossmouth
+
+
+
+TextureRenderingInfo
+logo_blitworks
+
+
+
+TextureRenderingInfo
+logo_fmod
+
+
+
+ScreenMenu
+Derived from Screen
+
+ScreenOnlineLoading
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+ouroboros
+
+
+
+float
+ouroboros_angle
+
+
+
+ScreenOnlineLobby
+Derived from Screen
+
+ScreenOptions
+Derived from Screen
+
+ScreenPlayerProfile
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+ScreenPrologue
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+STRINGID
+line1
+
+
+
+STRINGID
+line2
+
+
+
+STRINGID
+line3
+
+
+
+float
+line1_alpha
+
+
+
+float
+line2_alpha
+
+
+
+float
+line3_alpha
+
+
+
+ScreenRecap
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+ScreenScores
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+int
+animation_state
+
+
+
+TextureRenderingInfo
+woodpanel1
+
+
+
+TextureRenderingInfo
+woodpanel2
+
+
+
+TextureRenderingInfo
+woodpanel3
+
+
+
+TextureRenderingInfo
+woodpanel_cutout
+
+
+
+TextureRenderingInfo
+dollarsign
+
+
+
+TextureRenderingInfo
+hourglass
+
+
+
+int
+animation_timer
+
+
+
+float
+woodpanel_slidedown_timer
+
+
+
+ScreenSeedInput
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+float
+bottom_woodpanel_slideup_timer
+
+
+
+float
+bottom_woodpanel_y
+
+
+
+TextureRenderingInfo
+bottom_woodpanel
+
+
+
+STRINGID
+buttons_text_id
+
+
+
+float
+topleft_woodpanel_esc_slidein_timer
+
+
+
+STRINGID
+scroll_text_id
+
+
+
+STRINGID
+start_text_id
+
+
+
+TextureRenderingInfo
+main_woodpanel_left_border
+
+
+
+TextureRenderingInfo
+main_woodpanel_center
+
+
+
+TextureRenderingInfo
+main_woodpanel_right_border
+
+
+
+TextureRenderingInfo
+seed_letter_cutouts
+
+
+
+TextureRenderingInfo
+topleft_woodpanel_esc
+
+
+
+TextureRenderingInfo
+start_sidepanel
+
+
+
+float
+start_sidepanel_slidein_timer
+
+
+
+ScreenTeamSelect
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+ana_carrying_torch
+
+
+
+TextureRenderingInfo
+scroll_bottom_left
+
+
+
+TextureRenderingInfo
+scrollend_bottom_left
+
+
+
+TextureRenderingInfo
+four_ropes
+
+
+
+TextureRenderingInfo
+unknown4
+
+
+
+TextureRenderingInfo
+four_characters
+
+
+
+TextureRenderingInfo
+left_arrow
+
+
+
+TextureRenderingInfo
+right_arrow
+
+
+
+TextureRenderingInfo
+start_panel
+
+
+
+float
+start_panel_slide_timer
+
+
+
+float
+pulsating_arrows_timer
+
+
+
+int
+selected_player
+
+
+
+int
+buttons
+
+
+
+bool
+ready
+
+
+
+ScreenTitle
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+logo_spelunky2
+
+
+
+TextureRenderingInfo
+ana
+
+
+
+TextureRenderingInfo
+ana_right_eyeball_torch_reflection
+
+
+
+TextureRenderingInfo
+ana_left_eyeball_torch_reflection
+
+
+
+ParticleEmitterInfo
+particle_torchflame_smoke
+
+
+
+ParticleEmitterInfo
+particle_torchflame_backflames
+
+
+
+ParticleEmitterInfo
+particle_torchflame_flames
+
+
+
+ParticleEmitterInfo
+particle_torchflame_backflames_animated
+
+
+
+ParticleEmitterInfo
+particle_torchflame_flames_animated
+
+
+
+ParticleEmitterInfo
+particle_torchflame_ash
+
+
+
+SoundMeta
+music
+
+
+
+SoundMeta
+torch_sound
+
+
+
+ScreenTransition
+Derived from Screen
+
+ScreenWin
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+int
+sequence_timer
+
+
+
+int
+frame_timer
+
+
+
+int
+animation_state
+
+
+
+Entity
+rescuing_ship_entity
+
+
+
+ScreenZoomAnimation
+
+
+Type
+Name
+Description
+
+
+
+float
+zoom_target
+
+
+
+Sound types
BackgroundSound
+Derived from SoundMeta
+
+
+
+Type
+Name
+Description
+
+
+
+CustomSound
+Handle to a loaded sound, can be used to play the sound and receive a PlayingSound
for more control
+It is up to you to not release this as long as any sounds returned by CustomSound:play()
are still playing
+
+
+
+Type
+Name
+Description
+
+
+
+PlayingSound
+play()
+
+
+
+PlayingSound
+play(bool paused)
+
+
+
+PlayingSound
+play(bool paused, SOUND_TYPE sound_type)
+
+
+
+map<VANILLA_SOUND_PARAM, string>
+get_parameters()
+
+
+
+PlayingSound
+Handle to a playing sound, start the sound paused to make sure you can apply changes before playing it
+You can just discard this handle if you do not need extended control anymore
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+is_playing()
+
+
+
+bool
+stop()
+
+
+
+bool
+set_pause(bool pause)
+
+
+
+bool
+set_mute(bool mute)
+
+
+
+bool
+set_pitch(float pitch)
+
+
+
+bool
+set_pan(float pan)
+
+
+
+bool
+set_volume(float volume)
+
+
+
+bool
+set_looping(SOUND_LOOP_MODE loop_mode)
+
+
+
+bool
+set_callback(SoundCallbackFunction callback)
+
+
+
+map<VANILLA_SOUND_PARAM, string>
+get_parameters()
+
+
+
+optional<float>
+get_parameter(VANILLA_SOUND_PARAM parameter_index)
+
+
+
+bool
+set_parameter(VANILLA_SOUND_PARAM parameter_index, float value)
+
+
+
+SoundMeta
+
+
+Type
+Name
+Description
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+array<float, 38>
+left_channel
+
+
+
+array<float, 38>
+right_channel
+
+
+
+bool
+start_over
+when false, current track starts from the beginning, is immediately set back to true
+
+
+bool
+playing
+set to false to turn off
+
+
+State types
Camera
+
+
+Type
+Name
+Description
+
+
+
+float
+bounds_left
+
+
+
+float
+bounds_right
+
+
+
+float
+bounds_bottom
+
+
+
+float
+bounds_top
+
+
+
+float
+calculated_focus_x
+
+
+
+float
+calculated_focus_y
+
+
+
+float
+adjusted_focus_x
+
+
+
+float
+adjusted_focus_y
+
+
+
+float
+focus_offset_x
+
+
+
+float
+focus_offset_y
+
+
+
+float
+focus_x
+
+
+
+float
+focus_y
+
+
+
+float
+vertical_pan
+
+
+
+int
+shake_countdown_start
+
+
+
+int
+shake_countdown
+
+
+
+float
+shake_amplitude
+
+
+
+float
+shake_multiplier_x
+
+
+
+float
+shake_multiplier_y
+
+
+
+bool
+uniform_shake
+
+
+
+int
+focused_entity_uid
+
+
+
+float
+inertia
+
+
+
+GameManager
+Can be accessed via global game_manager
+
+
+
+Type
+Name
+Description
+
+
+
+BackgroundMusic
+music
+
+
+
+GameProps
+game_props
+
+
+
+ScreenLogo
+screen_logo
+
+
+
+ScreenIntro
+screen_intro
+
+
+
+ScreenPrologue
+screen_prologue
+
+
+
+ScreenTitle
+screen_title
+
+
+
+ScreenMenu
+screen_menu
+
+
+
+ScreenOptions
+screen_options
+
+
+
+ScreenPlayerProfile
+screen_player_profile
+
+
+
+ScreenLeaderboards
+screen_leaderboards
+
+
+
+ScreenSeedInput
+screen_seed_input
+
+
+
+ScreenCamp
+screen_camp
+
+
+
+ScreenLevel
+screen_level
+
+
+
+ScreenOnlineLoading
+screen_online_loading
+
+
+
+ScreenOnlineLobby
+screen_online_lobby
+
+
+
+PauseUI
+pause_ui
+
+
+
+JournalUI
+journal_ui
+
+
+
+SaveRelated
+save_related
+
+
+
+GameProps
+
+
+Type
+Name
+Description
+
+
+
+int
+buttons
+
+
+
+bool
+game_has_focus
+
+
+
+Items
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+int
+player_count
+
+
+
+int
+saved_pets_count
+
+
+
+array<ENT_TYPE, 4>
+saved_pets
+Pet information for level transition
+
+
+array<bool, 4>
+is_pet_cursed
+
+
+
+array<bool, 4>
+is_pet_poisoned
+
+
+
+int
+leader
+Index of leader player in coop
+
+
+array<Inventory, MAX_PLAYERS>
+player_inventory
+
+
+
+array<SelectPlayerSlot, MAX_PLAYERS>
+player_select
+
+
+
+JournalProgressStainSlot
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+float
+angle
+
+
+
+float
+scale
+
+
+
+int
+texture_column
+
+
+
+int
+texture_row
+
+
+
+int
+texture_range
+
+
+
+JournalProgressStickerSlot
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+int
+theme
+
+
+
+int
+grid_position
+
+
+
+ENT_TYPE
+entity_type
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+float
+angle
+
+
+
+PlayerSlot
+
+
+Type
+Name
+Description
+
+
+
+INPUTS
+buttons_gameplay
+
+
+
+INPUTS
+buttons
+
+
+
+InputMapping
+input_mapping_keyboard
+
+
+
+InputMapping
+input_mapping_controller
+
+
+
+int
+player_id
+
+
+
+bool
+is_participating
+
+
+
+PlayerSlotSettings
+
+
+Type
+Name
+Description
+
+
+
+bool
+controller_vibration
+
+
+
+bool
+auto_run_enabled
+
+
+
+bool
+controller_right_stick
+
+
+
+QuestsInfo
+
+
+Type
+Name
+Description
+
+
+
+int
+yang_state
+
+
+
+int
+jungle_sisters_flags
+
+
+
+int
+van_horsing_state
+
+
+
+int
+sparrow_state
+
+
+
+int
+madame_tusk_state
+
+
+
+int
+beg_state
+
+
+
+SelectPlayerSlot
+Used in Items
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+activated
+
+
+
+ENT_TYPE
+character
+
+
+
+int
+texture
+
+
+
+StateMemory
+Can be accessed via global state
+
+
+
+Type
+Name
+Description
+
+
+
+int
+screen_last
+Previous SCREEN, used to check where we're coming from when loading another SCREEN
+
+
+int
+screen
+Current SCREEN, generally read-only or weird things will happen
+
+
+int
+screen_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
.
+
+
+int
+ingame
+Is 1 when you in a game, is set to 0 or 1 in main menu, can't be trusted there, normally in a level is 1 unless you go to the options
+
+
+int
+playing
+Is 1 when you are in a level, but going to options sets it to 0 and does not set it back to 1 after the way back, don't trust it
+
+
+PAUSE
+pause
+8bit flags, multiple might be active at the same time
1: Menu: Pauses the level timer and engine. Can't set, controller 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.
+
+
+int
+width
+level width in rooms (number of rooms horizontally)
+
+
+int
+height
+level height in rooms (number of rooms vertically)
+
+
+int
+kali_favor
+
+
+
+int
+kali_status
+
+
+
+int
+kali_altars_destroyed
+Also affects if the player has punish ball, if the punish ball is destroyed it is set to -1
+
+
+int
+kali_gifts
+0 - none, 1 - item, 3 - kapala
+
+
+int
+seed
+Current seed in seeded mode, just set to a funny value and does nothing in adventure mode
+
+
+int
+time_total
+Total frames of current run, equal to the final game time on win
+
+
+int
+world
+Current world number, shown in hud and used by some game logic like choosing the next level on transition
+
+
+int
+world_next
+Next world number, used when loading a new level or transition
+
+
+int
+world_start
+World number to start new runs in
+
+
+int
+level
+Current level number, shown in hud and used by some game logic like choosing the next level on transition
+
+
+int
+level_next
+Next level number, used when loading a new level or transition
+
+
+int
+level_start
+Level number to start new runs in
+
+
+THEME
+theme
+Current THEME number, used to pick the music and by some game logic like choosing the next level on transition
+
+
+THEME
+theme_next
+Next THEME number, used when loading a new level or transition
+
+
+int
+theme_start
+THEME to start new runs in
+
+
+ThemeInfo
+current_theme
+Points to the current ThemeInfo
+
+
+nil
+force_current_theme(int t)
+This function should only be used in a very specific circumstance (forcing the exiting theme when manually transitioning). Will crash the game if used inappropriately!
+
+
+int
+shoppie_aggro
+Current shoppie aggro
+
+
+int
+shoppie_aggro_next
+Shoppie aggro to use in the next level
+
+
+int
+outposts_spawned
+
+
+
+int
+merchant_aggro
+Tun aggro
+
+
+int
+kills_npc
+
+
+
+int
+level_count
+Current zero-based level count, or number of levels completed
+
+
+int
+damage_taken
+Total amount of damage taken, excluding cause of death
+
+
+JOURNAL_FLAG
+journal_flags
+
+
+
+int
+time_last_level
+Level time of previous level in frames, used by game logic to decide dark levels etc
+
+
+int
+time_level
+Level time of current level in frames, show on the hud
+
+
+int
+level_flags
+
+
+
+int
+loading
+Shows the current loading state (0=Not loading, 1=Fadeout, 2=Loading, 3=Fadein). Writing 1 or 2 will trigger a screen load to screen_next
.
+
+
+QUEST_FLAG
+quest_flags
+32bit flags, can be written to trigger a run reset on next level load etc.
+
+
+PRESENCE_FLAG
+presence_flags
+
+
+
+float
+fadevalue
+Current fade-to-black amount (0.0 = all visible; 1.0 = all black). Manipulated by the loading routine when loading > 0.
+
+
+int
+fadeout
+Amount of frames the fadeout should last when loading
+
+
+int
+fadein
+Amount of frames the fadein should last when loading
+
+
+int
+loading_black_screen_timer
+if state.loading is 1, this timer counts down to 0 while the screen is black (used after Ouroboros, in credits etc.)
+
+
+int
+saved_dogs
+Run totals
+
+
+int
+saved_cats
+
+
+
+int
+saved_hamsters
+
+
+
+int
+win_state
+0 = no win 1 = tiamat win 2 = hundun win 3 = CO win; set this and next doorway leads to victory scene
+
+
+Illumination
+illumination
+The global level illumination, very big and bright.
+
+
+int
+money_last_levels
+
+
+
+int
+money_shop_total
+Total negative amount spent in shops during the run
The total money currently available (in single player) is players[1].inventory.money + players[1].inventory.collected_money_total + state.money_shop_total
+
+
+PlayerInputs
+player_inputs
+Access the player inputs even when no player entities are available
+
+
+QuestsInfo
+quests
+NPC quest states
+
+
+Camera
+camera
+Camera bounds and position
+
+
+int
+special_visibility_flags
+
+
+
+CAUSE_OF_DEATH
+cause_of_death
+
+
+
+ENT_TYPE
+cause_of_death_entity_type
+
+
+
+int
+toast_timer
+
+
+
+int
+speechbubble_timer
+
+
+
+int
+speechbubble_owner
+
+
+
+LevelGenSystem
+level_gen
+Entrance and exit coordinates, shop types and all themes
+
+
+int
+correct_ushabti
+See get_correct_ushabti
. == anim_frame - (2 floor(anim_frame/12))
+
+
+Items
+items
+Has the current player count, player inventories and character selections
+
+
+int
+camera_layer
+The currently drawn layer, can't be changed
+
+
+int
+layer_transition_timer
+
+
+
+ScreenTeamSelect
+screen_team_select
+
+
+
+ScreenCharacterSelect
+screen_character_select
+
+
+
+ScreenTransition
+screen_transition
+
+
+
+ScreenDeath
+screen_death
+
+
+
+ScreenWin
+screen_win
+
+
+
+ScreenCredits
+screen_credits
+
+
+
+ScreenScores
+screen_scores
+
+
+
+ScreenConstellation
+screen_constellation
+
+
+
+ScreenRecap
+screen_recap
+
+
+
+ScreenArenaStagesSelect
+screen_arena_stages_select
+
+
+
+ScreenArenaIntro
+screen_arena_intro
+
+
+
+ScreenArenaLevel
+screen_arena_level
+
+
+
+ScreenArenaScore
+screen_arena_score
+
+
+
+ScreenArenaMenu
+screen_arena_menu
+
+
+
+ScreenArenaItems
+screen_arena_items
+
+
+
+int
+get_correct_ushabti()
+Returns animation_frame of the correct ushabti
+
+
+nil
+set_correct_ushabti(int animation_frame)
+
+
+
+ArenaState
+arena
+
+
+
+ENT_TYPE
+speedrun_character
+Who administers the tutorial speedrun in base camp
+
+
+bool
+speedrun_activation_trigger
+must transition from true to false to activate it
+
+
+ENT_TYPE
+end_spaceship_character
+Who pops out the spaceship for a tiamat/hundun win, this is set upon the spaceship door open
+
+
+bool
+world2_coffin_spawned
+
+
+
+bool
+world4_coffin_spawned
+
+
+
+bool
+world6_coffin_spawned
+
+
+
+ENT_TYPE
+first_damage_cause
+
+
+
+int
+first_damage_world
+
+
+
+int
+first_damage_level
+
+
+
+int
+time_speedrun
+
+
+
+ENT_TYPE
+coffin_contents
+the contents of the special coffin that will be spawned during levelgen
+
+
+int
+screen_change_counter
+
+
+
+int
+time_startup
+Number of frames since the game was launched
+
+
+int
+storage_uid
+entity uid of the first floor_storage entity
+
+
+array<ENT_TYPE, 99>
+waddler_storage
+
+
+
+array<int, 99>
+waddler_metadata
+
+
+
+int
+journal_progress_sticker_count
+
+
+
+array<JournalProgressStickerSlot, 40>
+journal_progress_sticker_slots
+stickers for notable items and entities in journal progress page
+
+
+int
+journal_progress_stain_count
+
+
+
+array<JournalProgressStainSlot, 30>
+journal_progress_stain_slots
+blood splats and paw prints in journal progress page
+
+
+int
+journal_progress_theme_count
+
+
+
+array<int, 9>
+journal_progress_theme_slots
+visited themes in journal progress page
+
+
+ThemeInfo
+theme_info
+Points to the current ThemeInfo
+
+
+LogicList
+logic
+Level logic like dice game and cutscenes
+
+
+LiquidPhysics
+liquid
+
+
+
+int
+next_entity_uid
+Next entity spawned will have this uid
+
+
+RoomOwnersInfo
+room_owners
+Holds info about owned rooms and items (shops, challenge rooms, vault etc.)
+
+
+Texture types
TextRenderingInfo
+
+
+Type
+Name
+Description
+
+
+
+
+new
+TextRenderingInfo:new(string text, float scale_x, float scale_y, VANILLA_TEXT_ALIGNMENT alignment, VANILLA_FONT_STYLE fontstyle)
TextRenderingInfo:new(string text, float x, float y, float scale_x, float scale_y, VANILLA_TEXT_ALIGNMENT alignment, VANILLA_FONT_STYLE fontstyle)
Creates new TextRenderingInfo that can be used in VanillaRenderContext draw_text
For static text, it is better to use one object and call draw_text with it, instead of relaying on draw_text creating this object for you
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+int
+text_length
+You can also just use #
operator on the whole object to get the text lenght
+
+
+float
+width
+
+
+
+float
+height
+
+
+
+int
+special_texture_id
+Used to draw buttons and stuff, default is -1 wich uses the buttons texture
+
+
+Texture
+font
+
+
+
+array<Letter>
+get_dest()
+Returns refrence to the letter coordinates relative to the x,y position
+
+
+array<Letter>
+get_source()
+Returns refrence to the letter coordinates in the texture
+
+
+tuple<float, float>
+text_size()
+{width, height}, is only updated when you set/change the text. This is equivalent to draw_text_size
+
+
+nil
+rotate(float angle, optional px, optional py)
+Rotates the text around the pivot point (default 0), pivot is relative to the text position (x, y), use px and py to offset it
+
+
+nil
+set_text(const string text, float scale_x, float scale_y, VANILLA_TEXT_ALIGNMENT alignment, VANILLA_FONT_STYLE fontstyle)
+Changes the text, only position stays the same, everything else (like rotation) is reset or set according to the parameters
+
+
+TextureDefinition
+Use TextureDefinition.new()
to get a new instance to this and pass it to define_entity_texture.
+width
and height
always have to be the size of the image file. They should be divisible by tile_width
and tile_height
respectively.
+tile_width
and tile_height
define the size of a single tile, the image will automatically be divided into these tiles.
+Tiles are labeled in sequence starting at the top left, going right and down at the end of the image (you know, like sentences work in the English language). Use those numbers in Entity::animation_frame
.
+sub_image_offset_x
, sub_image_offset_y
, sub_image_width
and sub_image_height
can be used if only a part of the image should be used. Leave them at zero to ignore this.
+
+
+
+Type
+Name
+Description
+
+
+
+string
+texture_path
+
+
+
+int
+width
+
+
+
+int
+height
+
+
+
+int
+tile_width
+
+
+
+int
+tile_height
+
+
+
+int
+sub_image_offset_x
+
+
+
+int
+sub_image_offset_y
+
+
+
+int
+sub_image_width
+
+
+
+int
+sub_image_height
+
+
+
+TextureRenderingInfo
+
+
+Type
+Name
+Description
+
+
+
+
+new
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+float
+destination_bottom_left_x
+destination is relative to the x,y centerpoint
+
+
+float
+destination_bottom_left_y
+
+
+
+float
+destination_bottom_right_x
+
+
+
+float
+destination_bottom_right_y
+
+
+
+float
+destination_top_left_x
+
+
+
+float
+destination_top_left_y
+
+
+
+float
+destination_top_right_x
+
+
+
+float
+destination_top_right_y
+
+
+
+nil
+set_destination(const AABB& bbox)
+
+
+
+Quad
+dest_get_quad()
+
+
+
+nil
+dest_set_quad(const Quad& quad)
+
+
+
+float
+source_bottom_left_x
+
+
+
+float
+source_bottom_left_y
+
+
+
+float
+source_bottom_right_x
+
+
+
+float
+source_bottom_right_y
+
+
+
+float
+source_top_left_x
+
+
+
+float
+source_top_left_y
+
+
+
+float
+source_top_right_x
+
+
+
+float
+source_top_right_y
+
+
+
+Quad
+source_get_quad()
+
+
+
+nil
+source_set_quad(const Quad& quad)
+
+
+
+Theme types
CustomTheme
+
+Very basic example how to use a CustomTheme in the procedural levels. Search the examples or check Eternal Flame of Gehenna for custom levels.
+
+-- create a new theme based on dwelling
+local my_theme = CustomTheme:new()
+-- get some ember effects from volcana
+my_theme:override(THEME_OVERRIDE.SPAWN_EFFECTS, THEME.VOLCANA)
+-- change level size
+my_theme:post(THEME_OVERRIDE.INIT_LEVEL, function()
+ state.width = 5
+ state.height = 15
+end)
+-- set floor textures to eggy
+my_theme.textures[DYNAMIC_TEXTURE.FLOOR] = TEXTURE.DATA_TEXTURES_FLOOR_EGGPLANT_0
+set_callback(function(ctx)
+ -- use the level gen from ice caves
+ ctx:override_level_files({"generic.lvl", "icecavesarea.lvl"})
+ -- force our theme instead of the default
+ force_custom_theme(my_theme)
+end, ON.PRE_LOAD_LEVEL_FILES)
+
-Search script examples for import
+You can call theme functions from other themes, for example to make all growable tile codes work in your theme:
-table import(string id, string version = "", bool optional = false)
-Load another script by id "author/name" and import its exports
table. Returns:
+local custom = CustomTheme:new()
+custom:post(THEME_OVERRIDE.SPAWN_LEVEL, function()
+ state.level_gen.themes[THEME.VOLCANA]:spawn_traps()
+ state.level_gen.themes[THEME.TIDE_POOL]:spawn_traps()
+ state.level_gen.themes[THEME.JUNGLE]:spawn_traps()
+end)
+
+Customizable ThemeInfo with ability to override certain theming functions from different themes or write custom functions. Check ThemeInfo for some notes on the vanilla theme functions. Warning: We WILL change these function names, especially the unknown ones, when you figure out what they do.
+Derived from ThemeInfo
+
+
+
+Type
+Name
+Description
+
+
+
+CustomTheme
+new(int theme_id_, int base_theme_, bool defaults)
+Create a new theme with an id and base theme, overriding defaults. Check theme functions that are default enabled here.
+
+
+CustomTheme
+new(int theme_id_, int base_theme_)
+Create a new theme with defaults.
+
+
+CustomTheme
+new()
+Create a new theme with base dwelling and id 100.
+
+
+string
+level_file
+Level file to load. Probably doesn't do much in custom themes, especially if you're forcing them in PRE_LOAD_LEVEL_FILES.
+
+
+int
+theme
+Theme index. Probably shouldn't collide with the vanilla ones. Purpose unknown.
+
+
+int
+base_theme
+Base THEME to load enabled functions from, when no other theme is specified.
+
+
+map<DYNAMIC_TEXTURE, int>
+textures
+Add TEXTUREs here to override different dynamic textures.
+
+
+
+override
+override(THEME_OVERRIDE override, bool enabled)
To disable or enable theme functions using the base_theme.
override(THEME_OVERRIDE override, THEME theme)
To override a theme function with another theme.
override(THEME_OVERRIDE override, function func)
To override a theme function with a lua function.
+
+
+nil
+pre(THEME_OVERRIDE index, function func_)
+Set a callback to be called before this theme function.
+
+
+nil
+post(THEME_OVERRIDE index, function func_)
+Set a callback to be called after this theme function, to fix some changes it did for example.
+
+
+nil
+reset_theme_flags()
+
+
+
+nil
+init_flags()
+
+
+
+nil
+init_level()
+
+
+
+nil
+init_rooms()
+
+
+
+nil
+generate_path(bool reset)
+
+
+
+nil
+add_special_rooms()
+
+
+
+nil
+add_player_coffin()
+
+
+
+nil
+add_dirk_coffin()
+
+
+
+nil
+add_idol()
+
+
+
+nil
+add_vault()
+
+
+
+nil
+add_coffin()
+
+
+
+
+add_feeling
+
+
+
+nil
+spawn_level()
+
+
+
+nil
+spawn_border()
+
+
+
+nil
+post_process_level()
+
+
+
+nil
+spawn_traps()
+
+
+
+nil
+post_process_entities()
+
+
+
+nil
+spawn_procedural()
+
+
+
+nil
+spawn_background()
+
+
+
+nil
+spawn_lights()
+
+
+
+nil
+spawn_transition()
+
+
+
+nil
+post_transition()
+
+
+
+nil
+spawn_players()
+
+
+
+nil
+spawn_effects()
+
+
+
+string
+get_level_file()
+
+
+
+int
+get_theme_id()
+
+
+
+int
+get_base_id()
+
+
+
+int
+get_floor_spreading_type()
+
+
+
+int
+get_floor_spreading_type2()
+
+
+
+bool
+get_transition_styled_floor()
+
+
+
+int
+get_transition_floor_modifier()
+
+
+
+int
+get_transition_styled_floor_type()
+
+
+
+int
+get_backwall_type()
+
+
+
+int
+get_border_type()
+
+
+
+int
+get_critter_type()
+
+
+
+float
+get_liquid_gravity()
+
+
+
+bool
+get_player_damage()
+
+
+
+bool
+get_explosion_soot()
+
+
+
+int
+get_backlayer_lut()
+
+
+
+float
+get_backlayer_light_level()
+
+
+
+bool
+get_loop()
+
+
+
+int
+get_vault_level()
+
+
+
+bool
+get_theme_flag(int index)
+
+
+
+int
+get_dynamic_texture(int texture_id)
+Add TEXTUREs to textures
to override different dynamic textures easily.
+
+
+nil
+pre_transition()
+
+
+
+int
+get_exit_room_y_level()
+
+
+
+int
+get_shop_chance()
+
+
+
+nil
+spawn_decoration()
+
+
+
+nil
+spawn_decoration2()
+
+
+
+nil
+spawn_extra()
+
+
+
+nil
+do_procedural_spawn(SpawnInfo info)
+
+
+
+ThemeInfo
-- When hell freezes over: Examples for hooking ThemeInfo virtuals
+
+state.level_gen.themes[THEME.VOLCANA]:set_pre_texture_dynamic(function(theme, id)
+ -- change volcana floor to ice floor
+ if id == DYNAMIC_TEXTURE.FLOOR then
+ return TEXTURE.DATA_TEXTURES_FLOOR_ICE_0
+ end
+end)
+
+state.level_gen.themes[THEME.VOLCANA]:set_pre_spawn_effects(function(theme)
+ -- run the effects function from another theme to get cool ice particle effects
+ for i=1,50 do
+ state.level_gen.themes[THEME.ICE_CAVES]:spawn_effects()
+ end
+ -- then we run this to fix the weird camera bounds set by ice caves
+ state.level_gen.themes[THEME.DWELLING]:spawn_effects()
+ -- don't spawn volcanic effects
+ return true
+end)
+
+-- make players cold
+state.level_gen.themes[THEME.VOLCANA]:set_post_spawn_players(function(theme)
+ for i,p in pairs(get_local_players()) do
+ spawn_over(ENT_TYPE.LOGICAL_FROST_BREATH, p.uid, 0, 0)
+ end
+end)
+
+-- make vlads bluish
+state.level_gen.themes[THEME.VOLCANA]:set_pre_texture_backlayer_lut(function(theme)
+ return TEXTURE.DATA_TEXTURES_LUT_ICECAVES_0
+end)
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+unknown3
+
+
+
+int
+unknown4
+
+
+
+int
+theme
+
+
+
+bool
+allow_beehive
+
+
+
+bool
+allow_leprechaun
+
+
+
+ThemeInfo
+sub_theme
+
+
+
+nil
+reset_theme_flags()
+Sets the beehive and leprechaun flags
+
+
+nil
+init_flags()
+Initializes some flags in the LevelGenSystem, also dark level flag in state.level_flags.
+
+
+nil
+init_level()
+Adds the entrance room and sets spawn_room_x/y. Sets the level size and toast for echoes feeling. Sets some other level_flags, shop related flags and shop_type.
+
+
+nil
+init_rooms()
+
+
+
+nil
+generate_path(bool reset)
+Generates and adds the path rooms and exit room
Params: reset to start over from the beginning if other rooms didn't fit
+
+
+nil
+add_special_rooms()
+Adds rooms related to udjat, black market, castle etc
+
+
+nil
+add_player_coffin()
+Adds a player revival coffin room
+
+
+nil
+add_dirk_coffin()
+Adds a Dirk coffin room
+
+
+nil
+add_idol()
+Adds an idol room
+
+
+nil
+add_vault()
+Adds a vault room
+
+
+nil
+add_coffin()
+Adds a character unlock coffin room
+
+
+nil
+add_special_feeling()
+Adds the metal clanking or oppression rooms
+
+
+nil
+spawn_level()
+Calls many other theme functions to spawn the floor, enemies, items etc, but not background and players. (Disable this to only spawn background and players.)
+
+
+nil
+spawn_border()
+Spawns the border entities (some floor or teleportingborder)
+
+
+nil
+post_process_level()
+Theme specific specialties like randomizing ushabti and Coco coffin location, spawns impostor lakes
+
+
+nil
+spawn_traps()
+Spawns theme specific random traps, pushblocks and critters. Sets special exit doors.
+
+
+nil
+post_process_entities()
+Fixes textures on pleasure palace ladders, adds some decorations
+
+
+nil
+spawn_procedural()
+Adds legs under platforms, random pots, goldbars, monsters, compass indicator, random shadows...
+
+
+nil
+spawn_background()
+Adds the main level background , e.g. CO stars / Duat moon / Plain backwall for other themes
+
+
+nil
+spawn_lights()
+Adds room lights to udjat chest room or black market
+
+
+nil
+spawn_transition()
+Spawns the transition tunnel and players in it
+
+
+nil
+post_transition()
+Handles loading the next level screen from a transition screen
+
+
+nil
+spawn_players()
+Spawns the players with inventory at state.level_gen.spawn_x/y
. Also shop and kali background and probably other stuff for some stupid reason.
+
+
+nil
+spawn_effects()
+Sets the camera bounds and position. Spawns jelly and orbs and the flag in coop. Sets timers/conditions for more jellies and ghosts. Enables the special fog/ember/ice etc particle effects.
+
+
+string
+get_level_file()
+Returns: The .lvl file to load (e.g. dwelling = dwellingarea.lvl except when level == 4 (cavebossarea.lvl))
+
+
+int
+get_theme_id()
+Returns: THEME, or subtheme in CO
+
+
+int
+get_base_id()
+Returns: THEME, or logical base THEME for special levels (Abzu->Tide Pool etc)
+
+
+int
+get_floor_spreading_type()
+Returns: ENT_TYPE used for floor spreading (generic or one of the styled floors)
+
+
+int
+get_floor_spreading_type2()
+Returns: ENT_TYPE used for floor spreading (stone or one of the styled floors)
+
+
+bool
+get_transition_styled_floor()
+Returns: true if transition should use styled floor
+
+
+int
+get_transition_floor_modifier()
+Determines the types of FLOOR_TUNNEL_NEXT/CURRENT (depending on where you are transitioning from/to)
Returns: 85 by default, except for: olmec: 15, cog: 23
+
+
+int
+get_transition_styled_floor_type()
+Returns: ENT_TYPE used for the transition floor
+
+
+int
+get_backwall_type()
+Returns: ENT_TYPE used for the backwall (BG_LEVEL_BACKWALL by default)
+
+
+int
+get_border_type()
+Returns: ENT_TYPE to use for the border tiles
+
+
+int
+get_critter_type()
+Returns: ENT_TYPE for theme specific critter
+
+
+float
+get_liquid_gravity()
+Returns: gravity used to initialize liquid pools (-1..1)
+
+
+bool
+get_player_damage()
+Returns: false to disable most player damage and the usage of bombs and ropes. Enabled in parts of base camp.
+
+
+bool
+get_explosion_soot()
+Returns: true if explosions should spawn background soot
+
+
+int
+get_backlayer_lut()
+Returns: TEXTURE for the LUT to be applied to the special back layer, e.g. vlad's castle
+
+
+float
+get_backlayer_light_level()
+Returns: dynamic backlayer light level (0..1)
+
+
+bool
+get_loop()
+Returns: true if the loop rendering should be enabled (Combine with the right get_border_type)
+
+
+int
+get_vault_level()
+Returns: highest y-level a vault can spawn
+
+
+bool
+get_theme_flag(int index)
+Returns: allow_beehive or allow_leprechaun flag
Params: index: 0 or 1
+
+
+int
+get_dynamic_texture(int texture_id)
+Returns: TEXTURE based on texture_id
Params: DYNAMIC_TEXTURE texture_id
+
+
+nil
+pre_transition()
+Sets state.level_next, world_next and theme_next (or state.win_state) based on level number. Runs when exiting a level.
+
+
+int
+get_exit_room_y_level()
+Returns: usually state.height - 1. For special levels fixed heights are returned.
+
+
+int
+get_shop_chance()
+Returns: inverse shop chance
+
+
+nil
+spawn_decoration()
+Spawns some specific decoration, e.g. Vlad's big banner
+
+
+nil
+spawn_decoration2()
+Spawns some other specific decorations, e.g. grass, flowers, udjat room decal
+
+
+nil
+spawn_extra()
+Spawns specific extra entities and decorations, like gold key, seaweed, lanterns, banners, signs, wires...
+
+
+nil
+do_procedural_spawn(SpawnInfo info)
+Spawns a single procedural entity, used in spawn_procedural
+
+
+CallbackId
+set_pre_virtual(THEME_OVERRIDE entry, function fun)
+Hooks before the virtual function at index entry
.
+
+
+CallbackId
+set_post_virtual(THEME_OVERRIDE entry, function fun)
+Hooks after the virtual function at index entry
.
+
+
+nil
+clear_virtual(CallbackId callback_id)
+Clears the hook given by callback_id
, alternatively use clear_callback()
inside the hook.
+
+
+CallbackId
+set_pre_dtor(function fun)
+Hooks before the virtual function.
The callback signature is nil dtor(ThemeInfo self)
+
+
+CallbackId
+set_post_dtor(function fun)
+Hooks after the virtual function.
The callback signature is nil dtor(ThemeInfo self)
+
+
+CallbackId
+set_pre_reset_theme_flags(function fun)
+Hooks before the virtual function.
The callback signature is bool reset_theme_flags(ThemeInfo self)
Virtual function docs:
Sets the beehive and leprechaun flags
+
+
+CallbackId
+set_post_reset_theme_flags(function fun)
+Hooks after the virtual function.
The callback signature is nil reset_theme_flags(ThemeInfo self)
Virtual function docs:
Sets the beehive and leprechaun flags
+
+
+CallbackId
+set_pre_init_flags(function fun)
+Hooks before the virtual function.
The callback signature is bool init_flags(ThemeInfo self)
Virtual function docs:
Initializes some flags in the LevelGenSystem, also dark level flag in state.level_flags.
+
+
+CallbackId
+set_post_init_flags(function fun)
+Hooks after the virtual function.
The callback signature is nil init_flags(ThemeInfo self)
Virtual function docs:
Initializes some flags in the LevelGenSystem, also dark level flag in state.level_flags.
+
+
+CallbackId
+set_pre_init_level(function fun)
+Hooks before the virtual function.
The callback signature is bool init_level(ThemeInfo self)
Virtual function docs:
Adds the entrance room and sets spawn_room_x/y. Sets the level size and toast for echoes feeling. Sets some other level_flags, shop related flags and shop_type.
+
+
+CallbackId
+set_post_init_level(function fun)
+Hooks after the virtual function.
The callback signature is nil init_level(ThemeInfo self)
Virtual function docs:
Adds the entrance room and sets spawn_room_x/y. Sets the level size and toast for echoes feeling. Sets some other level_flags, shop related flags and shop_type.
+
+
+CallbackId
+set_pre_init_rooms(function fun)
+Hooks before the virtual function.
The callback signature is bool init_rooms(ThemeInfo self)
+
+
+CallbackId
+set_post_init_rooms(function fun)
+Hooks after the virtual function.
The callback signature is nil init_rooms(ThemeInfo self)
+
+
+CallbackId
+set_pre_generate_path(function fun)
+Hooks before the virtual function.
The callback signature is bool generate_path(ThemeInfo self, bool reset)
Virtual function docs:
Generates and adds the path rooms and exit room
Params: reset to start over from the beginning if other rooms didn't fit
+
+
+CallbackId
+set_post_generate_path(function fun)
+Hooks after the virtual function.
The callback signature is nil generate_path(ThemeInfo self, bool reset)
Virtual function docs:
Generates and adds the path rooms and exit room
Params: reset to start over from the beginning if other rooms didn't fit
+
+
+CallbackId
+set_pre_special_rooms(function fun)
+Hooks before the virtual function.
The callback signature is bool special_rooms(ThemeInfo self)
+
+
+CallbackId
+set_post_special_rooms(function fun)
+Hooks after the virtual function.
The callback signature is nil special_rooms(ThemeInfo self)
+
+
+CallbackId
+set_pre_player_coffin(function fun)
+Hooks before the virtual function.
The callback signature is bool player_coffin(ThemeInfo self)
+
+
+CallbackId
+set_post_player_coffin(function fun)
+Hooks after the virtual function.
The callback signature is nil player_coffin(ThemeInfo self)
+
+
+CallbackId
+set_pre_dirk_coffin(function fun)
+Hooks before the virtual function.
The callback signature is bool dirk_coffin(ThemeInfo self)
+
+
+CallbackId
+set_post_dirk_coffin(function fun)
+Hooks after the virtual function.
The callback signature is nil dirk_coffin(ThemeInfo self)
+
+
+CallbackId
+set_pre_idol(function fun)
+Hooks before the virtual function.
The callback signature is bool idol(ThemeInfo self)
+
+
+CallbackId
+set_post_idol(function fun)
+Hooks after the virtual function.
The callback signature is nil idol(ThemeInfo self)
+
+
+CallbackId
+set_pre_vault(function fun)
+Hooks before the virtual function.
The callback signature is bool vault(ThemeInfo self)
+
+
+CallbackId
+set_post_vault(function fun)
+Hooks after the virtual function.
The callback signature is nil vault(ThemeInfo self)
+
+
+CallbackId
+set_pre_coffin(function fun)
+Hooks before the virtual function.
The callback signature is bool coffin(ThemeInfo self)
+
+
+CallbackId
+set_post_coffin(function fun)
+Hooks after the virtual function.
The callback signature is nil coffin(ThemeInfo self)
+
+
+CallbackId
+set_pre_feeling(function fun)
+Hooks before the virtual function.
The callback signature is bool feeling(ThemeInfo self)
+
+
+CallbackId
+set_post_feeling(function fun)
+Hooks after the virtual function.
The callback signature is nil feeling(ThemeInfo self)
+
+
+CallbackId
+set_pre_spawn_level(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_level(ThemeInfo self)
Virtual function docs:
Calls many other theme functions to spawn the floor, enemies, items etc, but not background and players. (Disable this to only spawn background and players.)
+
+
+CallbackId
+set_post_spawn_level(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_level(ThemeInfo self)
Virtual function docs:
Calls many other theme functions to spawn the floor, enemies, items etc, but not background and players. (Disable this to only spawn background and players.)
+
+
+CallbackId
+set_pre_spawn_border(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_border(ThemeInfo self)
Virtual function docs:
Spawns the border entities (some floor or teleportingborder)
+
+
+CallbackId
+set_post_spawn_border(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_border(ThemeInfo self)
Virtual function docs:
Spawns the border entities (some floor or teleportingborder)
+
+
+CallbackId
+set_pre_post_process_level(function fun)
+Hooks before the virtual function.
The callback signature is bool post_process_level(ThemeInfo self)
Virtual function docs:
Theme specific specialties like randomizing ushabti and Coco coffin location, spawns impostor lakes
+
+
+CallbackId
+set_post_post_process_level(function fun)
+Hooks after the virtual function.
The callback signature is nil post_process_level(ThemeInfo self)
Virtual function docs:
Theme specific specialties like randomizing ushabti and Coco coffin location, spawns impostor lakes
+
+
+CallbackId
+set_pre_spawn_traps(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_traps(ThemeInfo self)
Virtual function docs:
Spawns theme specific random traps, pushblocks and critters. Sets special exit doors.
+
+
+CallbackId
+set_post_spawn_traps(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_traps(ThemeInfo self)
Virtual function docs:
Spawns theme specific random traps, pushblocks and critters. Sets special exit doors.
+
+
+CallbackId
+set_pre_post_process_entities(function fun)
+Hooks before the virtual function.
The callback signature is bool post_process_entities(ThemeInfo self)
Virtual function docs:
Fixes textures on pleasure palace ladders, adds some decorations
+
+
+CallbackId
+set_post_post_process_entities(function fun)
+Hooks after the virtual function.
The callback signature is nil post_process_entities(ThemeInfo self)
Virtual function docs:
Fixes textures on pleasure palace ladders, adds some decorations
+
+
+CallbackId
+set_pre_spawn_procedural(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_procedural(ThemeInfo self)
Virtual function docs:
Adds legs under platforms, random pots, goldbars, monsters, compass indicator, random shadows...
+
+
+CallbackId
+set_post_spawn_procedural(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_procedural(ThemeInfo self)
Virtual function docs:
Adds legs under platforms, random pots, goldbars, monsters, compass indicator, random shadows...
+
+
+CallbackId
+set_pre_spawn_background(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_background(ThemeInfo self)
Virtual function docs:
Adds the main level background , e.g. CO stars / Duat moon / Plain backwall for other themes
+
+
+CallbackId
+set_post_spawn_background(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_background(ThemeInfo self)
Virtual function docs:
Adds the main level background , e.g. CO stars / Duat moon / Plain backwall for other themes
+
+
+CallbackId
+set_pre_spawn_lights(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_lights(ThemeInfo self)
Virtual function docs:
Adds room lights to udjat chest room or black market
+
+
+CallbackId
+set_post_spawn_lights(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_lights(ThemeInfo self)
Virtual function docs:
Adds room lights to udjat chest room or black market
+
+
+CallbackId
+set_pre_spawn_transition(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_transition(ThemeInfo self)
Virtual function docs:
Spawns the transition tunnel and players in it
+
+
+CallbackId
+set_post_spawn_transition(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_transition(ThemeInfo self)
Virtual function docs:
Spawns the transition tunnel and players in it
+
+
+CallbackId
+set_pre_post_transition(function fun)
+Hooks before the virtual function.
The callback signature is bool post_transition(ThemeInfo self)
Virtual function docs:
Handles loading the next level screen from a transition screen
+
+
+CallbackId
+set_post_post_transition(function fun)
+Hooks after the virtual function.
The callback signature is nil post_transition(ThemeInfo self)
Virtual function docs:
Handles loading the next level screen from a transition screen
+
+
+CallbackId
+set_pre_spawn_players(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_players(ThemeInfo self)
Virtual function docs:
Spawns the players with inventory at state.level_gen.spawn_x/y
. Also shop and kali background and probably other stuff for some stupid reason.
+
+
+CallbackId
+set_post_spawn_players(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_players(ThemeInfo self)
Virtual function docs:
Spawns the players with inventory at state.level_gen.spawn_x/y
. Also shop and kali background and probably other stuff for some stupid reason.
+
+
+CallbackId
+set_pre_spawn_effects(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_effects(ThemeInfo self)
Virtual function docs:
Sets the camera bounds and position. Spawns jelly and orbs and the flag in coop. Sets timers/conditions for more jellies and ghosts. Enables the special fog/ember/ice etc particle effects.
+
+
+CallbackId
+set_post_spawn_effects(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_effects(ThemeInfo self)
Virtual function docs:
Sets the camera bounds and position. Spawns jelly and orbs and the flag in coop. Sets timers/conditions for more jellies and ghosts. Enables the special fog/ember/ice etc particle effects.
+
+
+CallbackId
+set_pre_theme_id(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> theme_id(ThemeInfo self)
+
+
+CallbackId
+set_post_theme_id(function fun)
+Hooks after the virtual function.
The callback signature is nil theme_id(ThemeInfo self)
+
+
+CallbackId
+set_pre_base_id(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> base_id(ThemeInfo self)
+
+
+CallbackId
+set_post_base_id(function fun)
+Hooks after the virtual function.
The callback signature is nil base_id(ThemeInfo self)
+
+
+CallbackId
+set_pre_ent_floor_spreading(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> ent_floor_spreading(ThemeInfo self)
+
+
+CallbackId
+set_post_ent_floor_spreading(function fun)
+Hooks after the virtual function.
The callback signature is nil ent_floor_spreading(ThemeInfo self)
+
+
+CallbackId
+set_pre_ent_floor_spreading2(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> ent_floor_spreading2(ThemeInfo self)
+
+
+CallbackId
+set_post_ent_floor_spreading2(function fun)
+Hooks after the virtual function.
The callback signature is nil ent_floor_spreading2(ThemeInfo self)
+
+
+CallbackId
+set_pre_transition_styled_floor(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> transition_styled_floor(ThemeInfo self)
+
+
+CallbackId
+set_post_transition_styled_floor(function fun)
+Hooks after the virtual function.
The callback signature is nil transition_styled_floor(ThemeInfo self)
+
+
+CallbackId
+set_pre_transition_modifier(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> transition_modifier(ThemeInfo self)
+
+
+CallbackId
+set_post_transition_modifier(function fun)
+Hooks after the virtual function.
The callback signature is nil transition_modifier(ThemeInfo self)
+
+
+CallbackId
+set_pre_ent_transition_styled_floor(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> ent_transition_styled_floor(ThemeInfo self)
+
+
+CallbackId
+set_post_ent_transition_styled_floor(function fun)
+Hooks after the virtual function.
The callback signature is nil ent_transition_styled_floor(ThemeInfo self)
+
+
+CallbackId
+set_pre_ent_backwall(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> ent_backwall(ThemeInfo self)
+
+
+CallbackId
+set_post_ent_backwall(function fun)
+Hooks after the virtual function.
The callback signature is nil ent_backwall(ThemeInfo self)
+
+
+CallbackId
+set_pre_ent_border(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> ent_border(ThemeInfo self)
+
+
+CallbackId
+set_post_ent_border(function fun)
+Hooks after the virtual function.
The callback signature is nil ent_border(ThemeInfo self)
+
+
+CallbackId
+set_pre_ent_critter(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> ent_critter(ThemeInfo self)
+
+
+CallbackId
+set_post_ent_critter(function fun)
+Hooks after the virtual function.
The callback signature is nil ent_critter(ThemeInfo self)
+
+
+CallbackId
+set_pre_gravity(function fun)
+Hooks before the virtual function.
The callback signature is optional<float> gravity(ThemeInfo self)
+
+
+CallbackId
+set_post_gravity(function fun)
+Hooks after the virtual function.
The callback signature is nil gravity(ThemeInfo self)
+
+
+CallbackId
+set_pre_player_damage(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> player_damage(ThemeInfo self)
+
+
+CallbackId
+set_post_player_damage(function fun)
+Hooks after the virtual function.
The callback signature is nil player_damage(ThemeInfo self)
+
+
+CallbackId
+set_pre_soot(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> soot(ThemeInfo self)
+
+
+CallbackId
+set_post_soot(function fun)
+Hooks after the virtual function.
The callback signature is nil soot(ThemeInfo self)
+
+
+CallbackId
+set_pre_texture_backlayer_lut(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> texture_backlayer_lut(ThemeInfo self)
+
+
+CallbackId
+set_post_texture_backlayer_lut(function fun)
+Hooks after the virtual function.
The callback signature is nil texture_backlayer_lut(ThemeInfo self)
+
+
+CallbackId
+set_pre_backlayer_light_level(function fun)
+Hooks before the virtual function.
The callback signature is optional<float> backlayer_light_level(ThemeInfo self)
+
+
+CallbackId
+set_post_backlayer_light_level(function fun)
+Hooks after the virtual function.
The callback signature is nil backlayer_light_level(ThemeInfo self)
+
+
+CallbackId
+set_pre_loop(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> loop(ThemeInfo self)
+
+
+CallbackId
+set_post_loop(function fun)
+Hooks after the virtual function.
The callback signature is nil loop(ThemeInfo self)
+
+
+CallbackId
+set_pre_vault_level(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> vault_level(ThemeInfo self)
+
+
+CallbackId
+set_post_vault_level(function fun)
+Hooks after the virtual function.
The callback signature is nil vault_level(ThemeInfo self)
+
+
+CallbackId
+set_pre_theme_flag(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> theme_flag(ThemeInfo self, int)
+
+
+CallbackId
+set_post_theme_flag(function fun)
+Hooks after the virtual function.
The callback signature is nil theme_flag(ThemeInfo self, int)
+
+
+CallbackId
+set_pre_texture_dynamic(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> texture_dynamic(ThemeInfo self, int)
+
+
+CallbackId
+set_post_texture_dynamic(function fun)
+Hooks after the virtual function.
The callback signature is nil texture_dynamic(ThemeInfo self, int)
+
+
+CallbackId
+set_pre_pre_transition(function fun)
+Hooks before the virtual function.
The callback signature is bool pre_transition(ThemeInfo self)
Virtual function docs:
Sets state.level_next, world_next and theme_next (or state.win_state) based on level number. Runs when exiting a level.
+
+
+CallbackId
+set_post_pre_transition(function fun)
+Hooks after the virtual function.
The callback signature is nil pre_transition(ThemeInfo self)
Virtual function docs:
Sets state.level_next, world_next and theme_next (or state.win_state) based on level number. Runs when exiting a level.
+
+
+CallbackId
+set_pre_exit_room_y_level(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> exit_room_y_level(ThemeInfo self)
+
+
+CallbackId
+set_post_exit_room_y_level(function fun)
+Hooks after the virtual function.
The callback signature is nil exit_room_y_level(ThemeInfo self)
+
+
+CallbackId
+set_pre_shop_chance(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> shop_chance(ThemeInfo self)
+
+
+CallbackId
+set_post_shop_chance(function fun)
+Hooks after the virtual function.
The callback signature is nil shop_chance(ThemeInfo self)
+
+
+CallbackId
+set_pre_spawn_decoration(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_decoration(ThemeInfo self)
Virtual function docs:
Spawns some specific decoration, e.g. Vlad's big banner
+
+
+CallbackId
+set_post_spawn_decoration(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_decoration(ThemeInfo self)
Virtual function docs:
Spawns some specific decoration, e.g. Vlad's big banner
+
+
+CallbackId
+set_pre_spawn_decoration2(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_decoration2(ThemeInfo self)
Virtual function docs:
Spawns some other specific decorations, e.g. grass, flowers, udjat room decal
+
+
+CallbackId
+set_post_spawn_decoration2(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_decoration2(ThemeInfo self)
Virtual function docs:
Spawns some other specific decorations, e.g. grass, flowers, udjat room decal
+
+
+CallbackId
+set_pre_spawn_extra(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_extra(ThemeInfo self)
Virtual function docs:
Spawns specific extra entities and decorations, like gold key, seaweed, lanterns, banners, signs, wires...
+
+
+CallbackId
+set_post_spawn_extra(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_extra(ThemeInfo self)
Virtual function docs:
Spawns specific extra entities and decorations, like gold key, seaweed, lanterns, banners, signs, wires...
+
+
+CallbackId
+set_pre_do_procedural_spawn(function fun)
+Hooks before the virtual function.
The callback signature is bool do_procedural_spawn(ThemeInfo self, SpawnInfo info)
Virtual function docs:
Spawns a single procedural entity, used in spawn_procedural
+
+
+CallbackId
+set_post_do_procedural_spawn(function fun)
+Hooks after the virtual function.
The callback signature is nil do_procedural_spawn(ThemeInfo self, SpawnInfo info)
Virtual function docs:
Spawns a single procedural entity, used in spawn_procedural
+
+
+Entity types
Background entities
BGBackLayerDoor
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+illumination1
+
+
+
+Illumination
+illumination2
+
+
+
+BGEggshipRoom
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+Entity
+fx_shell
+
+
+
+Entity
+fx_door
+
+
+
+Entity
+platform_left
+
+
+
+Entity
+platform_middle
+
+
+
+Entity
+platform_right
+
+
+
+bool
+player_in
+
+
+
+BGFloatingDebris
+Derived from Entity BGSurfaceLayer
+
+
+
+Type
+Name
+Description
+
+
+
+float
+distance
+Distance it travels up and down from spawn position
+
+
+float
+speed
+
+
+
+float
+sine_angle
+
+
+
+BGMovingStar
+Derived from Entity BGSurfaceStar
+
+
+
+Type
+Name
+Description
+
+
+
+float
+falling_speed
+Can make it rise if set to negative
+
+
+BGRelativeElement
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+float
+relative_x
+
+
+
+float
+relative_y
+
+
+
+BGShootingStar
+Derived from Entity BGRelativeElement
+
+
+
+Type
+Name
+Description
+
+
+
+float
+x_increment
+
+
+
+float
+y_increment
+
+
+
+int
+timer
+
+
+
+int
+max_timer
+
+
+
+float
+size
+Gets smaller as the timer gets close to the max_timer
+
+
+BGShopEntrence
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+on_entering
+
+
+
+BGShopKeeperPrime
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+float
+normal_y
+
+
+
+float
+sine_pos
+
+
+
+int
+bubbles_timer
+
+
+
+bool
+bubble_spawn_trigger
+
+
+
+int
+bubble_spawn_delay
+
+
+
+BGSurfaceLayer
+Derived from Entity BGRelativeElement
+
+
+
+Type
+Name
+Description
+
+
+
+float
+relative_offset_x
+
+
+
+float
+relative_offset_y
+
+
+
+BGSurfaceStar
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+blink_timer
+
+
+
+float
+relative_x
+
+
+
+float
+relative_y
+
+
+
+BGTutorialSign
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+is_shown
+
+
+
+DestructibleBG
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+Effect entities
BurningRopeEffect
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+illumination
+
+
+
+SoundMeta
+sound
+
+
+
+CursedEffect
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+SoundMeta
+sound
+
+
+
+FrostBreathEffect
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+OnFireEffect
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+ParticleEmitterInfo
+particle_smoke
+
+
+
+ParticleEmitterInfo
+particle_flame
+
+
+
+Illumination
+illumination
+
+
+
+PoisonedEffect
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+ParticleEmitterInfo
+particle_burst
+
+
+
+ParticleEmitterInfo
+particle_base
+
+
+
+int
+burst_timer
+
+
+
+bool
+burst_active
+If forced to false, it will not play the sound or spawn burst particles
+
+
+WetEffect
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+Floor entities
Altar
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+for normal altar: counts from 0 to 20 then 0, then 1 then 0 and sacrifice happens
+
+
+Arrowtrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+arrow_shot
+
+
+
+nil
+rearm()
+
+
+
+nil
+trigger(int who_uid)
+The uid must be movable entity for ownership transfers
+
+
+BigSpearTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+spear_uid
+
+
+
+bool
+left_part
+setting the left part to 0 or right part to 1 destroys the trap
+
+
+nil
+trigger(int who_uid, bool left)
+The uid must be movable entity for ownership transfers, has to be called on the left part of the trap,
+
+
+CityOfGoldDoor
+Derived from Entity Floor Door ExitDoor DecoratedDoor
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+unlocked
+
+
+
+ConveyorBelt
+Derived from Entity Floor TransferFloor
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+DecoratedDoor
+Derived from Entity Floor Door ExitDoor
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+special_bg
+
+
+
+Door
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+counter
+
+
+
+Entity
+fx_button
+
+
+
+int
+enter(Entity who)
+
+
+
+bool
+is_unlocked()
+Will alwyas return true
for exits, layers and others that the game never locks, even if you lock it with unlock
function
+
+
+nil
+unlock(bool unlock)
+Lock/Unlock doors
+
+
+EggShipDoor
+Derived from Entity Floor Door
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+EggShipDoorS
+Derived from Entity Floor Door EggShipDoor
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+entered
+
+
+
+ExitDoor
+Derived from Entity Floor Door
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+entered
+if true entering it does not load the transition
+
+
+bool
+special_door
+use provided world/level/theme
+
+
+int
+level
+
+
+
+int
+timer
+
+
+
+int
+world
+
+
+
+int
+theme
+
+
+
+Floor
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+deco_top
+
+
+
+int
+deco_bottom
+
+
+
+int
+deco_left
+
+
+
+int
+deco_right
+
+
+
+nil
+fix_border_tile_animation()
+Sets animation_frame
of the floor for types FLOOR_BORDERTILE
, FLOOR_BORDERTILE_METAL
and FLOOR_BORDERTILE_OCTOPUS
.
+
+
+nil
+fix_decorations(bool fix_also_neighbors, bool fix_styled_floor)
+Used to add decoration to a floor entity after it was spawned outside of level gen, is not necessary when spawning during level gen.
Set fix_also_neighbours
to true
to fix the neighbouring floor tile decorations on the border of the two tiles.
Set fix_styled_floor
to true
to fix decorations on FLOORSTYLED_
entities, those usually only have decorations when broken.
+
+
+nil
+add_decoration(FLOOR_SIDE side)
+Explicitly add a decoration on the given side. Corner decorations only exist for FLOOR_BORDERTILE
and FLOOR_BORDERTILE_OCTOPUS
.
+
+
+nil
+remove_decoration(FLOOR_SIDE side)
+Explicitly remove a decoration on the given side. Corner decorations only exist for FLOOR_BORDERTILE
and FLOOR_BORDERTILE_OCTOPUS
.
+
+
+nil
+decorate_internal()
+
+
+
+ENT_TYPE
+get_floor_type()
+Returns it's ENT_TYPE except for FLOOR_PEN (returns FLOORSTYLED_MINEWOOD) and FLOOR_QUICKSAND, FLOOR_TOMB, FLOOR_EMPRESS_GRAVE which return FLOOR_GENERIC
+
+
+CallbackId
+set_pre_virtual(ENTITY_OVERRIDE entry, function fun)
+Hooks before the virtual function at index entry
.
+
+
+CallbackId
+set_post_virtual(ENTITY_OVERRIDE entry, function fun)
+Hooks after the virtual function at index entry
.
+
+
+nil
+clear_virtual(CallbackId callback_id)
+Clears the hook given by callback_id
, alternatively use clear_callback()
inside the hook.
+
+
+CallbackId
+set_pre_floor_update(function fun)
+Hooks before the virtual function.
The callback signature is bool floor_update(Floor self)
+
+
+CallbackId
+set_post_floor_update(function fun)
+Hooks after the virtual function.
The callback signature is nil floor_update(Floor self)
+
+
+ForceField
+
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+first_item_beam
+
+
+
+Entity
+fx
+
+
+
+SoundMeta
+sound
+
+
+
+Illumination
+emitted_light
+
+
+
+bool
+is_on
+
+
+
+nil
+activate_laserbeam(bool turn_on)
+
+
+
+Generator
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+spawned_uid
+
+
+
+int
+set_timer
+
+
+
+int
+timer
+
+
+
+int
+start_counter
+works only for star challenge
+
+
+bool
+on_off
+works only for star challenge
+
+
+HorizontalForceField
+
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+first_item_beam
+
+
+
+Entity
+fx
+
+
+
+SoundMeta
+sound
+
+
+
+int
+timer
+
+
+
+bool
+is_on
+
+
+
+JungleSpearTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+nil
+trigger(int who_uid, int direction)
+The uid must be movable entity for ownership transfers, direction: 1 = left, 2 = right, 3 = up, 4 = down
+
+
+LaserTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+int
+timer
+counts up from 0 after triggering, cannot shoot again until 360
+
+
+nil
+trigger(int who_uid)
+The uid must be movable entity for ownership transfers
+
+
+LockedDoor
+Derived from Entity Floor Door
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+unlocked
+
+
+
+MainExit
+Derived from Entity Floor Door ExitDoor
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+Entity
+door_blocker
+Normally FX_MAIN_EXIT_DOOR
but setting any entity here will block the door
+
+
+MotherStatue
+
+
+
+
+Type
+Name
+Description
+
+
+
+array<bool, 4>
+players_standing
+Table of player1_standing, player2_standing, ... etc.
+
+
+bool
+player1_standing
+
+
+
+bool
+player2_standing
+
+
+
+bool
+player3_standing
+
+
+
+bool
+player4_standing
+
+
+
+array<bool, 4>
+players_health_received
+Table of player1_health_received, player2_health_received, ... etc.
+
+
+bool
+player1_health_received
+
+
+
+bool
+player2_health_received
+
+
+
+bool
+player3_health_received
+
+
+
+bool
+player4_health_received
+
+
+
+array<int, 4>
+players_health_timer
+Table of player1_health_timer, player2_health_timer, ... etc.
+
+
+int
+player1_health_timer
+
+
+
+int
+player2_health_timer
+
+
+
+int
+player3_health_timer
+
+
+
+int
+player4_health_timer
+
+
+
+int
+eggplantchild_timer
+
+
+
+bool
+eggplantchild_detected
+
+
+
+Pipe
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+direction_type
+3 - straight_horizontal, 4 - blocked, 5 - down_left_turn, 6 - down_right_turn, 8 - blocked, 9 - up_left_turn, 10 - up_right_turn, 12 - straight_vertical
+
+
+bool
+end_pipe
+
+
+
+PoleDeco
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+deco_up
+
+
+
+int
+deco_down
+
+
+
+QuickSand
+
+
+
+
+Type
+Name
+Description
+
+
+
+SlidingWallCeiling
+
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+attached_piece
+
+
+
+int
+active_floor_part_uid
+
+
+
+int
+state
+1 - going up / is at the top, 2 - pause
+
+
+SoundMeta
+ball_rise
+
+
+
+SoundMeta
+ball_drop
+
+
+
+SparkTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+int
+spark_uid
+
+
+
+SpikeballTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+Entity
+chain
+
+
+
+Entity
+end_piece
+
+
+
+int
+state
+0 - none, 1 - start, 2 - going_down, 3 - going_up, 4 - pause; going_up is only right when timer is 0, otherwise it just sits at the bottom
+
+
+int
+timer
+for the start and retract
+
+
+StickyTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+attached_piece_uid
+
+
+
+int
+ball_uid
+
+
+
+int
+state
+0 - none, 1 - start, 2 - going down, 3 - is at the bottom, 4 - going up, 5 - pause
+
+
+int
+timer
+
+
+
+TeleportingBorder
+
-
-table
if the script has exports
-nil
if the script was found but has no exports
-false
if the script was not found but optional is set to true
-- an error if the script was not found and the optional argument was not set
-
-intersection
-
-Search script examples for intersection
-
-Vec2 intersection(const Vec2 A, const Vec2 B, const Vec2 C, const Vec2 D)
-Find intersection point of two lines [A, B] and [C, D], returns INFINITY if the lines don't intersect each other [parallel]
-is_character_female
-
-Search script examples for is_character_female
-
-bool is_character_female(ENT_TYPE type_id)
-Same as Player.is_female
-list_char_mods
-
-Search script examples for list_char_mods
-
-nil list_char_mods()
-List all char.png files recursively from Mods/Packs. Returns table of file paths.
-list_dir
-
-Search script examples for list_dir
-
-nil list_dir(string dir)
-List files in directory relative to the script root. Returns table of file/directory names or nil if not found.
-load_death_screen
-
-Search script examples for load_death_screen
-
-nil load_death_screen()
-Immediately ends the run with the death screen, also calls the save_progress
-load_screen
-
-Search script examples for load_screen
-
-nil load_screen()
-Immediately load a screen based on state.screen_next and stuff
-lowbias32
-
-Search script examples for lowbias32
-
-int lowbias32(int x)
-Some random hash function
-lowbias32_r
-
-Search script examples for lowbias32_r
-
-int lowbias32_r(int x)
-Reverse of some random hash function
-pause
-
-Search script examples for pause
-
-nil pause(bool p)
-Pause/unpause the game.
-This is just short for state.pause == 32
, but that produces an audio bug
-I suggest state.pause == 2
, but that won't run any callback, state.pause == 16
will do the same but set_global_interval will still work
-register_console_command
-
-Search script examples for register_console_command
-
-nil register_console_command(string name, function cmd)
-Adds a command that can be used in the console.
-rgba
-
-Search script examples for rgba
-
-uColor rgba(int r, int g, int b, int a)
-Converts a color to int to be used in drawing functions. Use values from 0..255
.
-save_progress
-
-Search script examples for save_progress
-
-bool save_progress()
-Saves the game to savegame.sav, unless game saves are blocked in the settings. Also runs the ON.SAVE callback. Fails and returns false, if you're trying to save too often (2s).
-save_script
-
-Search script examples for save_script
-
-bool save_script()
-Runs the ON.SAVE callback. Fails and returns false, if you're trying to save too often (2s).
-script_enabled
-
-Search script examples for script_enabled
-
-bool script_enabled(string id, string version = "")
-Check if another script is enabled by id "author/name". You should probably check this after all the other scripts have had a chance to load.
-seed_prng
-
-Search script examples for seed_prng
-
-nil seed_prng(int seed)
-Seed the game prng.
-set_adventure_seed
-
-Search script examples for set_adventure_seed
-
-nil set_adventure_seed(int first, int second)
-Set the current adventure seed pair
-set_character_heart_color
-
-Search script examples for set_character_heart_color
-
-nil set_character_heart_color(ENT_TYPE type_id, Color color)
-Same as Player.set_heart_color
-set_ending_unlock
-- change character unlocked by endings to pilot
-set_ending_unlock(ENT_TYPE.CHAR_PILOT)
+
+
+Type
+Name
+Description
+
+
+
+int
+direction
+0 - right, 1 - left, 2 - bottom, 3 - top, 4 - disable
+
+
+TentacleBottom
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+attached_piece_uid
+
+
+
+int
+tentacle_uid
+
+
+
+int
+state
+0 - none, 1 - start, 2 - moving up, 3 - at the top, 4 - moving down 5 - pause
+
+
+TimedForceField
+Derived from Entity Floor ForceField
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+bool
+pause
+
+
+
+TotemTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+ENT_TYPE
+spawn_entity_type
+
+
+
+int
+first_sound_id
+
+
+
+nil
+trigger(int who_uid, bool left)
+The uid must be movable entity for ownership transfers
+
+
+TransferFloor
+
+
+
+
+Type
+Name
+Description
+
+
+
+map<int, int>
+transferred_entities
+Index is the uid, value is frame the entity entered the floor (time_level), use pairs
to loop thru
+
+
+Generic entities
BoulderSpawner
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+Can be set negative for longer time period, spawns boulder at 150, setting it higher with count to overflow
+
+
+SoundMeta
+sound
+
+
+
+CameraFlash
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+illumination1
+
+
+
+Illumination
+illumination2
+
+
+
+int
+timer
+
+
+
+CinematicAnchor
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+blackbar_top
+
+
+
+Entity
+blackbar_bottom
+
+
+
+float
+roll_in
+0.0 to 1.0
+
+
+CrossBeam
+Derived from Entity
--- change texture of the actual savior in endings to pilot
-set_callback(function()
- set_post_entity_spawn(function(ent)
- if state.screen == SCREEN.WIN then
- ent:set_texture(TEXTURE.DATA_TEXTURES_CHAR_PINK_0)
- end
- clear_callback()
- end, SPAWN_TYPE.SYSTEMIC, MASK.PLAYER)
-end, ON.WIN)
+
+
+Type
+Name
+Description
+
+
+
+int
+attached_to_side_uid
+
+
+
+int
+attached_to_top_uid
+
+
+
+DMAlienBlast
+Derived from Entity
-
-
-Search script examples for set_ending_unlock
-
-nil set_ending_unlock(ENT_TYPE type)
-Force the character unlocked in either ending to ENT_TYPE. Set to 0 to reset to the default guys. Does not affect the texture of the actual savior. (See example)
-set_journal_enabled
-
-Search script examples for set_journal_enabled
-
-nil set_journal_enabled(bool b)
-Enables or disables the journal
-set_level_config
-
-Search script examples for set_level_config
-
-nil set_level_config(LEVEL_CONFIG config, int value)
-Set the value for the specified config
-set_mask
-
-Search script examples for set_mask
-
-Flags set_mask(Flags flags, Flags mask)
-Set a bitmask in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
-set_seed
-
-Search script examples for set_seed
-
-nil set_seed(int seed)
-Set seed and reset run.
-set_setting
-- set some visual settings needed by your mod
--- doing this here will reapply these after visiting the options, which would reset them to real values
+
+
+Type
+Name
+Description
+
+
+
+int
+owner_uid
+
+
+
+int
+timer
+
+
+
+SoundMeta
+sound
+
+
+
+Entity
+reticule_internal
+
+
+
+Entity
+reticule_external
+
+
+
+DMSpawning
+Derived from Entity
-set_callback(function()
- if state.screen_next == SCREEN.LEVEL then
- -- use the secret tiny hud size
- set_setting(GAME_SETTING.HUD_SIZE, 3)
- -- force opaque textboxes
- set_setting(GAME_SETTING.TEXTBOX_OPACITY, 0)
- end
-end, ON.PRE_LOAD_SCREEN)
+
+
+Type
+Name
+Description
+
+
+
+float
+spawn_x
+
+
+
+float
+spawn_y
+
+
+
+float
+sine_pos
+
+
+
+int
+timer
+
+
+
+DecoRegeneratingBlock
+Derived from Entity
-
-
-Search script examples for set_setting
-
-bool set_setting(GAME_SETTING setting, int value)
-Sets the specified setting temporarily. These values are not saved and might reset to the users real settings if they visit the options menu. (Check example.) All settings are available in unsafe mode and only a smaller subset SAFE_SETTING by default for Hud and other visuals. Returns false, if setting failed.
-set_storage_layer
-- Sets the right layer when using the vanilla tile code if waddler is still happy,
--- otherwise spawns the floor to the left of this tile.
--- Manually spawning FLOOR_STORAGE pre-tilecode doesn't seem to work as expected,
--- so we destroy it post-tilecode.
-set_post_tile_code_callback(function(x, y, layer)
- if not test_flag(state.quest_flags, 10) then
- -- Just set the layer and let the vanilla tilecode handle the floor
- set_storage_layer(layer)
- else
- local floor = get_entity(get_grid_entity_at(x, y, layer))
- if floor then
- floor:destroy()
- end
- if get_grid_entity_at(x - 1, y, layer) ~= -1 then
- local left = get_entity(get_grid_entity_at(x - 1, y, layer))
- spawn_grid_entity(left.type.id, x, y, layer)
- end
- end
-end, "storage_floor")
+
+
+Type
+Name
+Description
+
+
+
+DustWallApep
+Derived from Entity
--- This fixes a bug in the game that breaks storage on transition.
--- The old storage_uid is not cleared after every level for some reason.
-set_callback(function()
- state.storage_uid = -1
-end, ON.TRANSITION)
+
+
+Type
+Name
+Description
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+EggplantThrower
+Derived from Entity
--- Having a waddler is completely optional for storage,
--- but this makes a nice waddler room if he still likes you.
-define_tile_code("waddler")
-set_pre_tile_code_callback(function(x, y, layer)
- if not test_flag(state.quest_flags, 10) then
- local uid = spawn_roomowner(ENT_TYPE.MONS_STORAGEGUY, x + 0.5, y, layer, ROOM_TEMPLATE.WADDLER)
- set_on_kill(uid, function()
- -- Disable current level storage if you kill waddler
- state.storage_uid = -1
- end)
- end
- return true
-end, "waddler")
+
+
+Type
+Name
+Description
+
+
+
+Entity
+
+
+Type
+Name
+Description
+
+
+
+EntityDB
+type
+Type of the entity, contains special properties etc. If you want to edit them just for this entity look at the EntityDB
+
+
+Entity
+overlay
+
+
+
+ENT_FLAG
+flags
+see flags.hpp entity_flags
+
+
+ENT_MORE_FLAG
+more_flags
+see flags.hpp more_flags
+
+
+int
+uid
+Unique id of the entity, save it to variable to check this entity later (don't use the whole Entity type as it will be replaced with a different one when this is destroyed)
+
+
+int
+animation_frame
+Number (id) of the sprite in the texture
+
+
+int
+draw_depth
+Depth level that this entity is drawn on.
Don't edit this directly, use set_draw_depth
function
+
+
+float
+x
+Position of the entity in the world, or relative to overlay if attached to something. Use get_position to get real position of anything in the game world.
+
+
+float
+y
+Position of the entity in the world, or relative to overlay if attached to something. Use get_position to get real position of anything in the game world.
+
+
+float
+abs_x
+Absolute position in the world, even if overlaid. Should be the same as get_position. Read only.
+
+
+float
+abs_y
+Absolute position in the world, even if overlaid. Should be the same as get_position. Read only.
+
+
+int
+layer
+Use set_layer
to change
+
+
+float
+width
+Width of the sprite
+
+
+float
+height
+Height of the sprite
+
+
+float
+special_offsetx
+Special offset used for entities attached to others (or picked by others) that need to flip to the other side when the parent flips sides
+
+
+float
+special_offsety
+Special offset used for entities attached to others (or picked by others) that need to flip to the other side when the parent flips sides
+
+
+float
+tile_width
+Size of the sprite in the texture
+
+
+float
+tile_height
+Size of the sprite in the texture
+
+
+float
+angle
+
+
+
+Color
+color
+
+
+
+float
+hitboxx
+Half of the width of the hitbox
+
+
+float
+hitboxy
+Half of the height of the hitbox
+
+
+SHAPE
+shape
+
+
+
+bool
+hitbox_enabled
+
+
+
+float
+offsetx
+Offset of the hitbox in relation to the entity position
+
+
+float
+offsety
+Offset of the hitbox in relation to the entity position
+
+
+RenderInfo
+rendering_info
+
+
+
+any
+user_data
+You can put any arbitrary lua object here for custom entities or player stats, which is then saved across level transitions for players and carried items, mounts etc... This field is local to the script and multiple scripts can write different things in the same entity. The data is saved right before ON.PRE_LOAD_SCREEN from a level and loaded right before ON.POST_LOAD_SCREEN to a level or transition. It is not available yet in post_entity_spawn, but that is a good place to initialize it for new custom entities. See example for more.
+
+
+Entity
+topmost()
+
+
+
+Entity
+topmost_mount()
+
+
+
+bool
+overlaps_with(AABB hitbox)
+
+
+
+bool
+overlaps_with(float rect_left, float rect_bottom, float rect_right, float rect_top)
+Deprecated
Use overlaps_with(AABB hitbox)
instead
+
+
+bool
+overlaps_with(Entity other)
+
+
+
+TEXTURE
+get_texture()
+
+
+
+bool
+set_texture(TEXTURE texture_id)
+Changes the entity texture, check the textures.txt for available vanilla textures or use define_texture to make custom one
+
+
+nil
+set_draw_depth(int draw_depth)
+
+
+
+nil
+set_enable_turning(bool enabled)
+
+
+
+nil
+liberate_from_shop()
+
+
+
+Entity
+get_held_entity()
+
+
+
+nil
+set_layer(LAYER layer)
+Moves the entity to specified layer, nothing else happens, so this does not emulate a door transition
+
+
+nil
+remove()
+Moves the entity to the limbo-layer where it can later be retrieved from again via respawn
+
+
+nil
+respawn(LAYER layer)
+Moves the entity from the limbo-layer (where it was previously put by remove
) to layer
+
+
+nil
+kill(bool destroy_corpse, Entity responsible)
+Kills the entity, you can set responsible to nil
to ignore it
+
+
+nil
+destroy()
+Completely removes the entity from existence
+
+
+nil
+activate(Entity activator)
+Activates a button prompt (with the Use door/Buy button), e.g. buy shop item, activate drill, read sign, interact in camp, ... get_entity(<udjat socket uid>):activate(players[1])
(make sure player 1 has the udjat eye though)
+
+
+nil
+perform_teleport(int delta_x, int delta_y)
+Performs a teleport as if the entity had a teleporter and used it. The delta coordinates are where you want the entity to teleport to relative to its current position, in tiles (so integers, not floats). Positive numbers = to the right and up, negative left and down.
+
+
+bool
+trigger_action(Entity user)
+Triggers weapons and other held items like teleportter, mattock etc. You can check the virtual-availability.md, if entity has open
in the on_open
you can use this function, otherwise it does nothing. Returns false if action could not be performed (cooldown is not 0, no arrow loaded in etc. the animation could still be played thou)
+
+
+int
+get_metadata()
+e.g. for turkey: stores health, poison/curse state, for mattock: remaining swings (returned value is transferred)
+
+
+nil
+apply_metadata(int metadata)
+
+
+
+nil
+set_invisible(bool value)
+
+
+
+array<int>
+get_items()
+
+
+
+bool
+is_in_liquid()
+Returns true if entity is in water/lava
+
+
+bool
+is_cursed()
+
+
+
+CallbackId
+set_pre_virtual(ENTITY_OVERRIDE entry, function fun)
+Hooks before the virtual function at index entry
.
+
+
+CallbackId
+set_post_virtual(ENTITY_OVERRIDE entry, function fun)
+Hooks after the virtual function at index entry
.
+
+
+nil
+clear_virtual(CallbackId callback_id)
+Clears the hook given by callback_id
, alternatively use clear_callback()
inside the hook.
+
+
+CallbackId
+set_pre_dtor(function fun)
+Hooks before the virtual function.
The callback signature is nil dtor(Entity self)
+
+
+CallbackId
+set_post_dtor(function fun)
+Hooks after the virtual function.
The callback signature is nil dtor(Entity self)
+
+
+CallbackId
+set_pre_create_rendering_info(function fun)
+Hooks before the virtual function.
The callback signature is bool create_rendering_info(Entity self)
+
+
+CallbackId
+set_post_create_rendering_info(function fun)
+Hooks after the virtual function.
The callback signature is nil create_rendering_info(Entity self)
+
+
+CallbackId
+set_pre_update_state_machine(function fun)
+Hooks before the virtual function.
The callback signature is bool update_state_machine(Entity self)
+
+
+CallbackId
+set_post_update_state_machine(function fun)
+Hooks after the virtual function.
The callback signature is nil update_state_machine(Entity self)
+
+
+CallbackId
+set_pre_kill(function fun)
+Hooks before the virtual function.
The callback signature is bool kill(Entity self, bool destroy_corpse, Entity responsible)
Virtual function docs:
Kills the entity, you can set responsible to nil
to ignore it
+
+
+CallbackId
+set_post_kill(function fun)
+Hooks after the virtual function.
The callback signature is nil kill(Entity self, bool destroy_corpse, Entity responsible)
Virtual function docs:
Kills the entity, you can set responsible to nil
to ignore it
+
+
+CallbackId
+set_pre_on_collision1(function fun)
+Hooks before the virtual function.
The callback signature is bool on_collision1(Entity self, Entity other_entity)
+
+
+CallbackId
+set_post_on_collision1(function fun)
+Hooks after the virtual function.
The callback signature is nil on_collision1(Entity self, Entity other_entity)
+
+
+CallbackId
+set_pre_destroy(function fun)
+Hooks before the virtual function.
The callback signature is bool destroy(Entity self)
Virtual function docs:
Completely removes the entity from existence
+
+
+CallbackId
+set_post_destroy(function fun)
+Hooks after the virtual function.
The callback signature is nil destroy(Entity self)
Virtual function docs:
Completely removes the entity from existence
+
+
+CallbackId
+set_pre_can_be_pushed(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> can_be_pushed(Entity self)
+
+
+CallbackId
+set_post_can_be_pushed(function fun)
+Hooks after the virtual function.
The callback signature is nil can_be_pushed(Entity self)
+
+
+CallbackId
+set_pre_is_in_liquid(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> is_in_liquid(Entity self)
Virtual function docs:
Returns true if entity is in water/lava
+
+
+CallbackId
+set_post_is_in_liquid(function fun)
+Hooks after the virtual function.
The callback signature is nil is_in_liquid(Entity self)
Virtual function docs:
Returns true if entity is in water/lava
+
+
+CallbackId
+set_pre_set_invisible(function fun)
+Hooks before the virtual function.
The callback signature is bool set_invisible(Entity self, bool value)
+
+
+CallbackId
+set_post_set_invisible(function fun)
+Hooks after the virtual function.
The callback signature is nil set_invisible(Entity self, bool value)
+
+
+CallbackId
+set_pre_friction(function fun)
+Hooks before the virtual function.
The callback signature is optional<float> friction(Entity self)
+
+
+CallbackId
+set_post_friction(function fun)
+Hooks after the virtual function.
The callback signature is nil friction(Entity self)
+
+
+CallbackId
+set_pre_get_held_entity(function fun)
+Hooks before the virtual function.
The callback signature is optional<Entity> get_held_entity(Entity self)
+
+
+CallbackId
+set_post_get_held_entity(function fun)
+Hooks after the virtual function.
The callback signature is nil get_held_entity(Entity self)
+
+
+CallbackId
+set_pre_trigger_action(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> trigger_action(Entity self, Entity user)
Virtual function docs:
Triggers weapons and other held items like teleportter, mattock etc. You can check the virtual-availability.md, if entity has open
in the on_open
you can use this function, otherwise it does nothing. Returns false if action could not be performed (cooldown is not 0, no arrow loaded in etc. the animation could still be played thou)
+
+
+CallbackId
+set_post_trigger_action(function fun)
+Hooks after the virtual function.
The callback signature is nil trigger_action(Entity self, Entity user)
Virtual function docs:
Triggers weapons and other held items like teleportter, mattock etc. You can check the virtual-availability.md, if entity has open
in the on_open
you can use this function, otherwise it does nothing. Returns false if action could not be performed (cooldown is not 0, no arrow loaded in etc. the animation could still be played thou)
+
+
+CallbackId
+set_pre_activate(function fun)
+Hooks before the virtual function.
The callback signature is bool activate(Entity self, Entity activator)
Virtual function docs:
Activates a button prompt (with the Use door/Buy button), e.g. buy shop item, activate drill, read sign, interact in camp, ... get_entity(<udjat socket uid>):activate(players[1])
(make sure player 1 has the udjat eye though)
+
+
+CallbackId
+set_post_activate(function fun)
+Hooks after the virtual function.
The callback signature is nil activate(Entity self, Entity activator)
Virtual function docs:
Activates a button prompt (with the Use door/Buy button), e.g. buy shop item, activate drill, read sign, interact in camp, ... get_entity(<udjat socket uid>):activate(players[1])
(make sure player 1 has the udjat eye though)
+
+
+CallbackId
+set_pre_on_collision2(function fun)
+Hooks before the virtual function.
The callback signature is bool on_collision2(Entity self, Entity other_entity)
+
+
+CallbackId
+set_post_on_collision2(function fun)
+Hooks after the virtual function.
The callback signature is nil on_collision2(Entity self, Entity other_entity)
+
+
+CallbackId
+set_pre_walked_on(function fun)
+Hooks before the virtual function.
The callback signature is bool walked_on(Entity self, Entity*)
+
+
+CallbackId
+set_post_walked_on(function fun)
+Hooks after the virtual function.
The callback signature is nil walked_on(Entity self, Entity*)
+
+
+CallbackId
+set_pre_walked_off(function fun)
+Hooks before the virtual function.
The callback signature is bool walked_off(Entity self, Entity*)
+
+
+CallbackId
+set_post_walked_off(function fun)
+Hooks after the virtual function.
The callback signature is nil walked_off(Entity self, Entity*)
+
+
+CallbackId
+set_pre_ledge_grab(function fun)
+Hooks before the virtual function.
The callback signature is bool ledge_grab(Entity self, Entity*)
+
+
+CallbackId
+set_post_ledge_grab(function fun)
+Hooks after the virtual function.
The callback signature is nil ledge_grab(Entity self, Entity*)
+
+
+CallbackId
+set_pre_stood_on(function fun)
+Hooks before the virtual function.
The callback signature is bool stood_on(Entity self, Entity*)
+
+
+CallbackId
+set_post_stood_on(function fun)
+Hooks after the virtual function.
The callback signature is nil stood_on(Entity self, Entity*)
+
+
+CallbackId
+set_pre_init(function fun)
+Hooks before the virtual function.
The callback signature is bool init(Entity self)
+
+
+CallbackId
+set_post_init(function fun)
+Hooks after the virtual function.
The callback signature is nil init(Entity self)
+
+
+IceSlidingSound
+Derived from Entity LogicalSound
-
-
-Search script examples for set_storage_layer
-
-nil set_storage_layer(LAYER layer)
-Set layer to search for storage items on
-set_tiamat_cutscene_enabled
-
-Search script examples for set_tiamat_cutscene_enabled
-
-nil set_tiamat_cutscene_enabled(bool enable)
-Tiamat cutscene is also responsible for locking the exit door
-So you may need to close it yourself if you still want to be required to kill Tiamat
-show_journal
-
-Search script examples for show_journal
-
-nil show_journal(JOURNALUI_PAGE_SHOWN chapter, int page)
-Open the journal on a chapter and page. The main Journal spread is pages 0..1, so most chapters start at 2. Use even page numbers only.
-test_mask
-
-Search script examples for test_mask
-
-bool test_mask(Flags flags, Flags mask)
-Returns true if a bitmask is set in the number.
-toggle_journal
-
-Search script examples for toggle_journal
-
-nil toggle_journal()
-Open or close the journal as if pressing the journal button. Will respect visible journal popups and force_journal.
-two_lines_angle
-
-Search script examples for two_lines_angle
-
-float two_lines_angle(Vec2 A, Vec2 common, Vec2 B)
-Mesures angle between two lines with one common point
-float two_lines_angle(Vec2 line1_A, Vec2 line1_B, Vec2 line2_A, Vec2 line2_B)
-Gets line1_A, intersection point and line2_B and calls the 3 parameter version of this function
-update_liquid_collision_at
-
-Search script examples for update_liquid_collision_at
-
-nil update_liquid_collision_at(float x, float y, bool add)
-Updates the floor collisions used by the liquids, set add to false to remove tile of collision, set to true to add one
-warp
-
-Search script examples for warp
-
-nil warp(int w, int l, int t)
-Warp to a level immediately.
-Input functions
get_io
-
-Search script examples for get_io
-
-ImGuiIO get_io()
-Returns: ImGuiIO for raw keyboard, mouse and xinput gamepad stuff.
+
+
+Type
+Name
+Description
+
+
+
+JungleTrapTrigger
+Derived from Entity LogicalTrapTrigger
-
-- Note: The clicked/pressed actions only make sense in
ON.GUIFRAME
.
-- Note: Lua starts indexing at 1, you need
keysdown[string.byte('A') + 1]
to find the A key.
-- Note: Overlunky/etc will eat all keys it is currently configured to use, your script will only get leftovers.
-- Note: Gamepad is basically XINPUT_GAMEPAD but variables are renamed and values are normalized to -1.0..1.0 range.
-
-mouse_position
-
-Search script examples for mouse_position
-
-tuple<float, float> mouse_position()
-Current mouse cursor position in screen coordinates.
-return_input
-
-Search script examples for return_input
-
-nil return_input(int uid)
-Return input previously stolen with steal_input
-send_input
-
-Search script examples for send_input
-
-nil send_input(int uid, INPUTS buttons)
-Send input to entity, has to be previously stolen with steal_input
-steal_input
-
-Search script examples for steal_input
-
-nil steal_input(int uid)
-Steal input from a Player, HiredHand or PlayerGhost
-Lighting functions
create_illumination
-
-Search script examples for create_illumination
-
-Illumination create_illumination(Color color, float size, float x, float y)
Illumination create_illumination(Color color, float size, int uid)
-Creates a new Illumination. Don't forget to continuously call refresh_illumination, otherwise your light emitter fades out! Check out the illumination.lua script for an example
-refresh_illumination
-
-Search script examples for refresh_illumination
-
-nil refresh_illumination(Illumination illumination)
-Refreshes an Illumination, keeps it from fading out
-Message functions
cancel_speechbubble
-
-Search script examples for cancel_speechbubble
-
-nil cancel_speechbubble()
cancel_toast
-
-Search script examples for cancel_toast
-
-nil cancel_toast()
console_prinspect
-
-Search script examples for console_prinspect
-
-nil console_prinspect(variadic_args objects)
-Prinspect to ingame console.
-console_print
-
-Search script examples for console_print
-
-nil console_print(string message)
-Print a log message to ingame console.
-log_print
-
-Search script examples for log_print
-
-nil log_print(string message)
-Log to spelunky.log
-lua_print
-
-Search script examples for lua_print
-
-nil lua_print()
-Standard lua print function, prints directly to the terminal but not to the game
-message
-
-Search script examples for message
-
-nil message(string message)
-Same as print
-messpect
-
-Search script examples for messpect
-
-nil messpect(variadic_args objects)
-Same as prinspect
-prinspect
prinspect(state.level, state.level_next)
-local some_stuff_in_a_table = {
- some = state.time_total,
- stuff = state.world
-}
-prinspect(some_stuff_in_a_table)
+
+
+Type
+Name
+Description
+
+
+
+Lava
+
-
-
-Search script examples for prinspect
-
-nil prinspect(variadic_args objects)
-Prints any type of object by first funneling it through inspect
, no need for a manual tostring
or inspect
.
-print
-
-Search script examples for print
-
-nil print(string message)
-Print a log message on screen.
-printf
-
-Search script examples for printf
-
-nil printf()
-Short for print(string.format(...))
-say
-
-Search script examples for say
-
-nil say(int entity_uid, string message, int sound_type, bool top)
-Show a message coming from an entity
-speechbubble_visible
-
-Search script examples for speechbubble_visible
-
-bool speechbubble_visible()
toast
-
-Search script examples for toast
-
-nil toast(string message)
-Show a message that looks like a level feeling.
-toast_visible
-
-Search script examples for toast_visible
-
-bool toast_visible()
Movable Behavior functions
make_custom_behavior
-
-Search script examples for make_custom_behavior
-
-CustomMovableBehavior make_custom_behavior(string_view behavior_name, int state_id, VanillaMovableBehavior base_behavior)
-Make a CustomMovableBehavior
, if base_behavior
is nil
you will have to set all of the
-behavior functions. If a behavior with behavior_name
already exists for your script it will
-be returned instead.
-Network functions
udp_listen
-
-Search script examples for udp_listen
-
-UdpServer udp_listen(string host, in_port_t port, function cb)
-Start an UDP server on specified address and run callback when data arrives. Return a string from the callback to reply. Requires unsafe mode.
-The server will be closed once the handle is released.
-udp_send
-
-Search script examples for udp_send
-
-nil udp_send(string host, in_port_t port, string msg)
-Send data to specified UDP address. Requires unsafe mode.
-Option functions
register_option_bool
register_option_bool("bomb_bag", "BombBag", "Spawn bomb bag at the start of every level", false)
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+LimbAnchor
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+move_timer
+
+
+
+bool
+flip_vertical
+
+
+
+Liquid
+Derived from Entity
-set_callback(function()
- if options.bomb_bag then
- -- Spawn the bomb bag at player location thanks to the LAYER.PLAYER1
- spawn_entity_snapped_to_floor(ENT_TYPE.ITEM_PICKUP_BOMBBAG, 0, 0, LAYER.PLAYER1)
- end
-end, ON.LEVEL)
+
+
+Type
+Name
+Description
+
+
+
+Entity
+fx_surface
+
+
+
+int
+get_liquid_flags()
+
+
+
+nil
+set_liquid_flags(int flags)
+
+
+
+MummyFliesSound
+Derived from Entity LogicalSound
-
-
-Search script examples for register_option_bool
-
-nil register_option_bool(string name, string desc, string long_desc, bool value)
-Add a boolean option that the user can change in the UI. Read with options.name
, value
is the default.
-register_option_button
-
-Search script examples for register_option_button
-
-nil register_option_button(string name, string desc, string long_desc, function on_click)
-Add a button that the user can click in the UI. Sets the timestamp of last click on value and runs the callback function.
-register_option_callback
-
-Search script examples for register_option_callback
-
-nil register_option_callback(string name, object value, function on_render)
-Add custom options using the window drawing functions. Everything drawn in the callback will be rendered in the options window and the return value saved to options[name]
or overwriting the whole options
table if using and empty name.
-value
is the default value, and pretty important because anything defined in the callback function will only be defined after the options are rendered. See the example for details.
-
The callback signature is optional on_render(GuiDrawContext draw_ctx)
-register_option_combo
-
-Search script examples for register_option_combo
-
-nil register_option_combo(string name, string desc, string long_desc, string opts, int value)
-Add a combobox option that the user can change in the UI. Read the int index of the selection with options.name
. Separate opts
with \0
,
-with a double \0\0
at the end. value
is the default index 1..n.
-register_option_float
-
-Search script examples for register_option_float
-
-nil register_option_float(string name, string desc, string long_desc, float value, float min, float max)
-Add a float option that the user can change in the UI. Read with options.name
, value
is the default. Keep in mind these are just soft
-limits, you can override them in the UI with double click.
-register_option_int
-
-Search script examples for register_option_int
-
-nil register_option_int(string name, string desc, string long_desc, int value, int min, int max)
-Add an integer option that the user can change in the UI. Read with options.name
, value
is the default. Keep in mind these are just soft
-limits, you can override them in the UI with double click.
-register_option_string
-
-Search script examples for register_option_string
-
-nil register_option_string(string name, string desc, string long_desc, string value)
-Add a string option that the user can change in the UI. Read with options.name
, value
is the default.
-unregister_option
-
-Search script examples for unregister_option
-
-nil unregister_option(string name)
-Removes an option by name. To make complicated conditionally visible options you should probably just use register_option_callback though.
-Particle functions
advance_screen_particles
-
-Search script examples for advance_screen_particles
-
-nil advance_screen_particles(ParticleEmitterInfo particle_emitter)
-Advances the state of the screen particle emitter (simulates the next positions, ... of all the particles in the emitter). Only used with screen particle emitters. See the particles.lua
example script for more details.
-extinguish_particles
-
-Search script examples for extinguish_particles
-
-nil extinguish_particles(ParticleEmitterInfo particle_emitter)
-Extinguish a particle emitter (use the return value of generate_world_particles
or generate_screen_particles
as the parameter in this function)
-generate_screen_particles
-
-Search script examples for generate_screen_particles
-
-ParticleEmitterInfo generate_screen_particles(int particle_emitter_id, float x, float y)
-Generate particles of the specified type at a certain screen coordinate (use e.g. local emitter = generate_screen_particles(PARTICLEEMITTER.CHARSELECTOR_TORCHFLAME_FLAMES, 0.0, 0.0)
). See the particles.lua
example script for more details.
-generate_world_particles
-
-Search script examples for generate_world_particles
-
-ParticleEmitterInfo generate_world_particles(int particle_emitter_id, int uid)
-Generate particles of the specified type around the specified entity uid (use e.g. local emitter = generate_world_particles(PARTICLEEMITTER.PETTING_PET, players[1].uid)
). You can then decouple the emitter from the entity with emitter.entity_uid = -1
and freely move it around. See the particles.lua
example script for more details.
-get_particle_type
-
-Search script examples for get_particle_type
-
-ParticleDB get_particle_type(int id)
-Get the ParticleDB details of the specified ID
-render_screen_particles
-
-Search script examples for render_screen_particles
-
-nil render_screen_particles(ParticleEmitterInfo particle_emitter)
-Renders the particles to the screen. Only used with screen particle emitters. See the particles.lua
example script for more details.
-Position functions
activate_tiamat_position_hack
activate_tiamat_position_hack(true);
+
+
+Type
+Name
+Description
+
+
+
+int
+mummy_uid
+
+
+
+int
+flies
+Numbers of flies spawned
+
+
+OuroboroCameraAnchor
+Derived from Entity
-set_post_entity_spawn(function(ent)
+
+
+Type
+Name
+Description
+
+
+
+float
+target_x
+
+
+
+float
+target_y
+
+
+
+float
+velocity_x
+
+
+
+float
+velocity_y
+
+
+
+OuroboroCameraZoomin
+Derived from Entity
- -- make them same as in the game, but relative to the tiamat entity
- ent.attack_x = ent.x - 1
- ent.attack_y = ent.y + 2
+
+
+Type
+Name
+Description
+
+
+
+float
+zoomin_level
+Can be set to negative, seams to trigger the warp at some value
+
+
+PalaceSign
+Derived from Entity
-end, SPAWN_TYPE.ANY, 0, ENT_TYPE.MONS_TIAMAT)
-
-
-Search script examples for activate_tiamat_position_hack
-
-nil activate_tiamat_position_hack(bool activate)
-Activate custom variables for position used for detecting the player (normally hardcoded)
-note: because those variables are custom and game does not initiate them, you need to do it yourself for each Tiamat entity, recommending set_post_entity_spawn
-default game values are: attack_x = 17.5 attack_y = 62.5
-distance
-
-Search script examples for distance
-
-float distance(int uid_a, int uid_b)
-Calculate the tile distance of two entities by uid
-draw_text_size
-- draw text
-set_callback(function(draw_ctx)
- -- get a random color
- local color = math.random(0, 0xffffffff)
- -- zoom the font size based on frame
- local size = (get_frame() % 199)+1
- local text = 'Awesome!'
- -- calculate size of text
- local w, h = draw_text_size(size, text)
- -- draw to the center of screen
- draw_ctx:draw_text(0-w/2, 0-h/2, size, text, color)
-end, ON.GUIFRAME)
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+The neon buzz sound
+
+
+Illumination
+illumination
+
+
+
+Illumination
+arrow_illumination
+
+
+
+int
+arrow_change_timer
+
+
+
+PipeTravelerSound
+Derived from Entity LogicalSound
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+enter_exit
+
+
+
+Portal
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+int
+transition_timer
+
+
+
+int
+level
+
+
+
+int
+world
+
+
+
+int
+theme
+
+
+
+int
+timer
+
+
+
+QuickSandSound
+Derived from Entity LogicalSound
-
-
-Search script examples for draw_text_size
-
-tuple<float, float> draw_text_size(float size, string text)
-Calculate the bounding box of text, so you can center it etc. Returns width
, height
in screen distance.
-fix_liquid_out_of_bounds
-- call this in ON.FRAME if needed in your custom level
-set_callback(fix_liquid_out_of_bounds, ON.FRAME)
+
+
+Type
+Name
+Description
+
+
+
+RoomLight
+Derived from Entity
-
-
-Search script examples for fix_liquid_out_of_bounds
-
-nil fix_liquid_out_of_bounds()
-Removes all liquid that is about to go out of bounds, which crashes the game.
-game_position
-
-Search script examples for game_position
-
-tuple<float, float> game_position(float x, float y)
-Get the game coordinates at the screen position (x
, y
)
-get_aabb_bounds
-
-Search script examples for get_aabb_bounds
-
-AABB get_aabb_bounds()
-Same as get_bounds but returns AABB struct instead of loose floats
-get_bounds
-- Draw the level boundaries
-set_callback(function(draw_ctx)
- local xmin, ymax, xmax, ymin = get_bounds()
- local sx, sy = screen_position(xmin, ymax) -- top left
- local sx2, sy2 = screen_position(xmax, ymin) -- bottom right
- draw_ctx:draw_rect(sx, sy, sx2, sy2, 4, 0, rgba(255, 255, 255, 255))
-end, ON.GUIFRAME)
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+illumination
+
+
+
+ShootingStarSpawner
+Derived from Entity
-
-
-Search script examples for get_bounds
-
-tuple<float, float, float, float> get_bounds()
-Basically gets the absolute coordinates of the area inside the unbreakable bedrock walls, from wall to wall. Every solid entity should be
-inside these boundaries. The order is: left x, top y, right x, bottom y
-get_camera_position
-
-Search script examples for get_camera_position
-
-tuple<float, float> get_camera_position()
-Gets the current camera position in the level
-get_hitbox
-
-Search script examples for get_hitbox
-
-AABB get_hitbox(int uid, optional extrude, optional offsetx, optional offsety)
-Gets the hitbox of an entity, use extrude
to make the hitbox bigger/smaller in all directions and offset
to offset the hitbox in a given direction
-get_hud_position
-
-Search script examples for get_hud_position
-
-AABB get_hud_position(int index)
-Approximate bounding box of the player hud element for player index 1..4 based on user settings and player count
-get_image_size
-
-Search script examples for get_image_size
-
-tuple<int, int> get_image_size(string path)
-Get image size from file. Returns a tuple containing width and height.
-get_position
-
-Search script examples for get_position
-
-tuple<float, float, int> get_position(int uid)
-Get position x, y, layer
of entity by uid. Use this, don't use Entity.x/y
because those are sometimes just the offset to the entity
-you're standing on, not real level coordinates.
-get_render_hitbox
-
-Search script examples for get_render_hitbox
-
-AABB get_render_hitbox(int uid, optional extrude, optional offsetx, optional offsety)
-Same as get_hitbox
but based on get_render_position
-get_render_position
-
-Search script examples for get_render_position
-
-tuple<float, float, int> get_render_position(int uid)
-Get interpolated render position x, y, layer
of entity by uid. This gives smooth hitboxes for 144Hz master race etc...
-get_velocity
-
-Search script examples for get_velocity
-
-tuple<float, float> get_velocity(int uid)
-Get velocity vx, vy
of an entity by uid. Use this, don't use Entity.velocityx/velocityy
because those are relative to Entity.overlay
.
-get_window_size
-
-Search script examples for get_window_size
-
-tuple<int, int> get_window_size()
-Gets the resolution (width and height) of the screen
-get_zoom_level
-
-Search script examples for get_zoom_level
-
-float get_zoom_level()
-Get the current set zoom level
-position_is_valid
-
-Search script examples for position_is_valid
-
-bool position_is_valid(float x, float y, LAYER layer, POS_TYPE flags)
-Check if position satifies the given POS_TYPE flags, to be used in a custom is_valid function procedural for spawns.
-screen_aabb
-
-Search script examples for screen_aabb
-
-AABB screen_aabb(AABB box)
-Convert an AABB
to a screen AABB
that can be directly passed to draw functions
-screen_distance
-
-Search script examples for screen_distance
-
-float screen_distance(float x)
-Translate a distance of x
tiles to screen distance to be be used in drawing functions
-screen_position
-
-Search script examples for screen_position
-
-tuple<float, float> screen_position(float x, float y)
-Translate an entity position to screen position to be used in drawing functions
-set_camp_camera_bounds_enabled
-
-Search script examples for set_camp_camera_bounds_enabled
-
-nil set_camp_camera_bounds_enabled(bool b)
-Enables or disables the default position based camp camera bounds, to set them manually yourself
-zoom
-
-Search script examples for zoom
-
-nil zoom(float level)
-Set the zoom level used in levels and shops. 13.5 is the default.
-Room functions
define_room_template
-
-Search script examples for define_room_template
-
-int define_room_template(string room_template, ROOM_TEMPLATE_TYPE type)
-Define a new room template to use with set_room_template
-get_room_index
-
-Search script examples for get_room_index
-
-tuple<int, int> get_room_index(float x, float y)
-Transform a position to a room index to be used in get_room_template
and PostRoomGenerationContext.set_room_template
-get_room_pos
-
-Search script examples for get_room_pos
-
-tuple<float, float> get_room_pos(int x, int y)
-Transform a room index into the top left corner position in the room
-get_room_template
-
-Search script examples for get_room_template
-
-optional<int> get_room_template(int x, int y, LAYER layer)
-Get the room template given a certain index, returns nil
if coordinates are out of bounds
-get_room_template_name
-
-Search script examples for get_room_template_name
-
-string_view get_room_template_name(int room_template)
-For debugging only, get the name of a room template, returns 'invalid'
if room template is not defined
-is_machine_room_origin
-
-Search script examples for is_machine_room_origin
-
-bool is_machine_room_origin(int x, int y)
-Get whether a room is the origin of a machine room
-is_room_flipped
-
-Search script examples for is_room_flipped
-
-bool is_room_flipped(int x, int y)
-Get whether a room is flipped at the given index, returns false
if coordinates are out of bounds
-set_room_template_size
-
-Search script examples for set_room_template_size
-
-bool set_room_template_size(int room_template, int width, int height)
-Set the size of room template in tiles, the template must be of type ROOM_TEMPLATE_TYPE.MACHINE_ROOM
.
-spawn_roomowner
-- spawns waddler selling pets
--- all the aggro etc mechanics from a normal shop still apply
-local x, y, l = get_position(get_player(1).uid)
-local owner = spawn_roomowner(ENT_TYPE.MONS_STORAGEGUY, x+1, y, l, ROOM_TEMPLATE.SHOP)
-add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_DOG, x-1, y, l), owner)
-add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_CAT, x-2, y, l), owner)
-add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_HAMSTER, x-3, y, l), owner)
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+SplashBubbleGenerator
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+Logical entities
LogicalAnchovyFlock
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+float
+current_speed
+Increases until max_speed reached
+
+
+float
+max_speed
+
+
+
+int
+timer
+
+
+
+LogicalConveyorbeltSound
+Derived from Entity LogicalSound
--- use in a tile code to add shops to custom levels
--- this may spawn some shop related decorations too
-define_tile_code("pet_shop_boys")
-set_pre_tile_code_callback(function(x, y, layer)
- local owner = spawn_roomowner(ENT_TYPE.MONS_YANG, x, y, layer, ROOM_TEMPLATE.SHOP)
- -- another dude for the meme, this has nothing to do with the shop
- spawn_on_floor(ENT_TYPE.MONS_BODYGUARD, x+1, y, layer)
- add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_HAMSTER, x+2, y, layer), owner)
- return true
-end, "pet_shop_boys")
+
+
+Type
+Name
+Description
+
+
+
+LogicalDoor
+Derived from Entity
-
-
-Search script examples for spawn_roomowner
-
-int spawn_roomowner(ENT_TYPE owner_type, float x, float y, LAYER layer, ROOM_TEMPLATE room_template = -1)
-Spawn a RoomOwner (or a few other like CavemanShopkeeper) in the coordinates and make them own the room, optionally changing the room template. Returns the RoomOwner uid.
-Shop functions
add_item_to_shop
-
-Search script examples for add_item_to_shop
-
-nil add_item_to_shop(int item_uid, int shop_owner_uid)
-Adds entity as shop item, has to be of Purchasable type, check the entity hierarchy list to find all the Purchasable entity types.
-Adding other entities will result in not obtainable items or game crash
-change_diceshop_prizes
-
-Search script examples for change_diceshop_prizes
-
-nil change_diceshop_prizes(array<ENT_TYPE> ent_types)
-Change ENT_TYPE's spawned in dice shops (Madame Tusk as well), by default there are 25:
-{ITEM_PICKUP_BOMBBAG, ITEM_PICKUP_BOMBBOX, ITEM_PICKUP_ROPEPILE, ITEM_PICKUP_COMPASS, ITEM_PICKUP_PASTE, ITEM_PICKUP_PARACHUTE, ITEM_PURCHASABLE_CAPE, ITEM_PICKUP_SPECTACLES, ITEM_PICKUP_CLIMBINGGLOVES, ITEM_PICKUP_PITCHERSMITT,
-ENT_TYPE_ITEM_PICKUP_SPIKESHOES, ENT_TYPE_ITEM_PICKUP_SPRINGSHOES, ITEM_MACHETE, ITEM_BOOMERANG, ITEM_CROSSBOW, ITEM_SHOTGUN, ITEM_FREEZERAY, ITEM_WEBGUN, ITEM_CAMERA, ITEM_MATTOCK, ITEM_PURCHASABLE_JETPACK, ITEM_PURCHASABLE_HOVERPACK,
-ITEM_TELEPORTER, ITEM_PURCHASABLE_TELEPORTER_BACKPACK, ITEM_PURCHASABLE_POWERPACK}
-Min 6, Max 255, if you want less then 6 you need to write some of them more then once (they will have higher "spawn chance").
-If you use this function in the level with diceshop in it, you have to update item_ids
in the ITEM_DICE_PRIZE_DISPENSER.
-Use empty table as argument to reset to the game default
-is_inside_active_shop_room
-
-Search script examples for is_inside_active_shop_room
-
-bool is_inside_active_shop_room(float x, float y, LAYER layer)
-Checks whether a coordinate is inside a room containing an active shop. This function checks whether the shopkeeper is still alive.
-is_inside_shop_zone
-
-Search script examples for is_inside_shop_zone
-
-bool is_inside_shop_zone(float x, float y, LAYER layer)
-Checks whether a coordinate is inside a shop zone, the rectangle where the camera zooms in a bit. Does not check if the shop is still active!
-spawn_shopkeeper
-- spawns a shopkeeper selling a shotgun next to you
--- converts the current room to a ROOM_TEMPLATE.SHOP with shop music and zoom effect
-local x, y, l = get_position(get_player(1).uid)
-local owner = spawn_shopkeeper(x+1, y, l)
-add_item_to_shop(spawn_on_floor(ENT_TYPE.ITEM_SHOTGUN, x-1, y, l), owner)
+
+
+Type
+Name
+Description
+
+
+
+ENT_TYPE
+door_type
+
+
+
+ENT_TYPE
+platform_type
+
+
+
+bool
+visible
+
+
+
+bool
+platform_spawned
+Is set true when you bomb the door, no matter what door, can't be reset
+
+
+LogicalDrain
+Derived from Entity
--- spawns a shopkeeper selling a puppy next to you
--- also converts the room to a shop, but after the shopkeeper is spawned
--- this enables the safe zone for moving items, but disables shop music and zoom for whatever reason
-local x, y, l = get_position(get_player(1).uid)
-local owner = spawn_shopkeeper(x+1, y, l, ROOM_TEMPLATE.SIDE)
-add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_DOG, x-1, y, l), owner)
-local ctx = PostRoomGenerationContext:new()
-local rx, ry = get_room_index(x, y)
-ctx:set_room_template(rx, ry, l, ROOM_TEMPLATE.SHOP)
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+Little delay between pulling blob of liquid thru
+
+
+LogicalLiquidStreamSound
+Derived from Entity LogicalSound LogicalStaticSound
-
-
-Search script examples for spawn_shopkeeper
-
-int spawn_shopkeeper(float x, float y, LAYER layer, ROOM_TEMPLATE room_template = ROOM_TEMPLATE.SHOP)
-Spawn a Shopkeeper in the coordinates and make the room their shop. Returns the Shopkeeper uid. Also see spawn_roomowner.
-Sound functions
create_sound
-
-Search script examples for create_sound
-
-optional<CustomSound> create_sound(string path)
-Loads a sound from disk relative to this script, ownership might be shared with other code that loads the same file. Returns nil if file can't be found
-get_sound
-
-Search script examples for get_sound
-
-optional<CustomSound> get_sound(string path_or_vanilla_sound)
-Gets an existing sound, either if a file at the same path was already loaded or if it is already loaded by the game
-play_sound
-
-Search script examples for play_sound
-
-SoundMeta play_sound(VANILLA_SOUND sound, int source_uid)
Spawn functions
change_altar_damage_spawns
-
-Search script examples for change_altar_damage_spawns
-
-nil change_altar_damage_spawns(array<ENT_TYPE> ent_types)
-Change ENT_TYPE's spawned when you damage the altar, by default there are 6:
-{MONS_BAT, MONS_BEE, MONS_SPIDER, MONS_JIANGSHI, MONS_FEMALE_JIANGSHI, MONS_VAMPIRE}
-Max 255 types.
-Use empty table as argument to reset to the game default
-change_sunchallenge_spawns
-
-Search script examples for change_sunchallenge_spawns
-
-nil change_sunchallenge_spawns(array<ENT_TYPE> ent_types)
-Change ENT_TYPE's spawned by FLOOR_SUNCHALLENGE_GENERATOR
, by default there are 4:
-{MONS_WITCHDOCTOR, MONS_VAMPIRE, MONS_SORCERESS, MONS_NECROMANCER}
-Because of the game logic number of entity types has to be a power of 2: (1, 2, 4, 8, 16, 32), if you want say 30 types, you need to write two entities two times (they will have higher "spawn chance").
-Use empty table as argument to reset to the game default
-default_spawn_is_valid
-
-Search script examples for default_spawn_is_valid
-
-bool default_spawn_is_valid(float x, float y, LAYER layer)
-Default function in spawn definitions to check whether a spawn is valid or not
-define_extra_spawn
-
-Search script examples for define_extra_spawn
-
-int define_extra_spawn(function do_spawn, function is_valid, int num_spawns_frontlayer, int num_spawns_backlayer)
-Define a new extra spawn, these are semi-guaranteed level gen spawns with a fixed upper bound.
-The function nil do_spawn(float x, float y, LAYER layer)
contains your code to spawn the thing, whatever it is.
-The function bool is_valid(float x, float y, LAYER layer)
determines whether the spawn is legal in the given position and layer.
-Use for example when you can spawn only on the ceiling, under water or inside a shop.
-Set is_valid
to nil
in order to use the default rule (aka. on top of floor and not obstructed).
-To change the number of spawns use PostRoomGenerationContext:set_num_extra_spawns
during ON.POST_ROOM_GENERATION
-No name is attached to the extra spawn since it is not modified from level files, instead every call to this function will return a new uniqe id.
-define_procedural_spawn
-
-Search script examples for define_procedural_spawn
-
-PROCEDURAL_CHANCE define_procedural_spawn(string procedural_spawn, function do_spawn, function is_valid)
-Define a new procedural spawn, the function nil do_spawn(float x, float y, LAYER layer)
contains your code to spawn the thing, whatever it is.
-The function bool is_valid(float x, float y, LAYER layer)
determines whether the spawn is legal in the given position and layer.
-Use for example when you can spawn only on the ceiling, under water or inside a shop.
-Set is_valid
to nil
in order to use the default rule (aka. on top of floor and not obstructed).
-If a user disables your script but still uses your level mod nothing will be spawned in place of your procedural spawn.
-door
-
-Search script examples for door
-
-int door(float x, float y, LAYER layer, int w, int l, int t)
-Short for spawn_door.
-get_missing_extra_spawns
-
-Search script examples for get_missing_extra_spawns
-
-tuple<int, int> get_missing_extra_spawns(int extra_spawn_chance_id)
-Use to query whether any of the requested spawns could not be made, usually because there were not enough valid spaces in the level.
-Returns missing spawns in the front layer and missing spawns in the back layer in that order.
-The value only makes sense after level generation is complete, aka after ON.POST_LEVEL_GENERATION
has run.
-get_procedural_spawn_chance
-
-Search script examples for get_procedural_spawn_chance
-
-int get_procedural_spawn_chance(PROCEDURAL_CHANCE chance_id)
-Get the inverse chance of a procedural spawn for the current level.
-A return value of 0 does not mean the chance is infinite, it means the chance is zero.
-layer_door
-
-Search script examples for layer_door
-
-nil layer_door(float x, float y)
-Short for spawn_layer_door.
-set_ghost_spawn_times
-
-Search script examples for set_ghost_spawn_times
-
-nil set_ghost_spawn_times(int normal = 10800, int cursed = 9000)
-Determines when the ghost appears, either when the player is cursed or not
-spawn
-- spawn a jetpack next to the player
-spawn(ENT_TYPE.ITEM_JETPACK, 1, 0, LAYER.PLAYER, 0, 0)
+
+
+Type
+Name
+Description
+
+
+
+LogicalMiniGame
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+Delay between spwning ufo
+
+
+LogicalRegeneratingBlock
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+LogicalSound
+Derived from Entity
-
-
-Search script examples for spawn
-
-int spawn(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
-Short for spawn_entity.
-spawn_apep
-
-Search script examples for spawn_apep
-
-int spawn_apep(float x, float y, LAYER layer, bool right)
-Spawns apep with the choice if it going left or right, if you want the game to choose use regular spawn functions with ENT_TYPE.MONS_APEP_HEAD
-spawn_companion
-
-Search script examples for spawn_companion
-
-int spawn_companion(ENT_TYPE companion_type, float x, float y, LAYER layer)
-Spawn a companion (hired hand, player character, eggplant child)
-spawn_critical
-
-Search script examples for spawn_critical
-
-int spawn_critical(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
-Short for spawn_entity_nonreplaceable.
-spawn_door
-
-Search script examples for spawn_door
-
-int spawn_door(float x, float y, LAYER layer, int w, int l, int t)
-Spawn a door to another world, level and theme and return the uid of spawned entity.
-Uses level coordinates with LAYER.FRONT and LAYER.BACK, but player-relative coordinates with LAYER.PLAYERn
-spawn_entity
-- spawn megajelly on top of player using absolute coordinates on level start
-set_callback(function()
- local x, y, layer = get_position(players[1].uid)
- spawn_entity(ENT_TYPE.MONS_MEGAJELLYFISH, x, y+3, layer, 0, 0)
-end, ON.LEVEL)
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+LogicalStaticSound
+Derived from Entity LogicalSound
--- spawn clover next to player using player-relative coordinates
-set_callback(function()
- spawn(ENT_TYPE.ITEM_PICKUP_CLOVER, 1, 0, LAYER.PLAYER1, 0, 0)
-end, ON.LEVEL)
+
+
+Type
+Name
+Description
+
+
+
+LogicalTrapTrigger
+Derived from Entity
-
-
-Search script examples for spawn_entity
-
-int spawn_entity(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
-Spawn an entity in position with some velocity and return the uid of spawned entity.
-Uses level coordinates with LAYER.FRONT and LAYER.BACK, but player-relative coordinates with LAYER.PLAYER(n), where (n) is a player number (1-4).
-spawn_entity_nonreplaceable
-
-Search script examples for spawn_entity_nonreplaceable
-
-int spawn_entity_nonreplaceable(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
-Same as spawn_entity
but does not trigger any pre-entity-spawn callbacks, so it will not be replaced by another script
-spawn_entity_over
-
-Search script examples for spawn_entity_over
-
-int spawn_entity_over(ENT_TYPE entity_type, int over_uid, float x, float y)
-Spawn an entity of entity_type
attached to some other entity over_uid
, in offset x
, y
-spawn_entity_snapped_to_floor
-
-Search script examples for spawn_entity_snapped_to_floor
-
-int spawn_entity_snapped_to_floor(ENT_TYPE entity_type, float x, float y, LAYER layer)
-Spawns an entity directly on the floor below the tile at the given position.
-Use this to avoid the little fall that some entities do when spawned during level gen callbacks.
-spawn_grid_entity
-
-Search script examples for spawn_grid_entity
-
-int spawn_grid_entity(ENT_TYPE entity_type, float x, float y, LAYER layer)
-Spawn a grid entity, such as floor or traps, that snaps to the grid.
-spawn_layer_door
-
-Search script examples for spawn_layer_door
-
-nil spawn_layer_door(float x, float y)
-Spawn a door to backlayer.
-spawn_liquid
-
-Search script examples for spawn_liquid
-
-nil spawn_liquid(ENT_TYPE entity_type, float x, float y)
nil spawn_liquid(ENT_TYPE entity_type, float x, float y, float velocityx, float velocityy, int liquid_flags, int amount, float blobs_separation)
-Spawn liquids, always spawns in the front layer, will have fun effects if entity_type
is not a liquid (only the short version, without velocity etc.).
-Don't overuse this, you are still restricted by the liquid pool sizes and thus might crash the game.
-liquid_flags
- not much known about, 2 - will probably crash the game, 3 - pause_physics, 6-12 is probably agitation, surface_tension etc. set to 0 to ignore
-amount
- it will spawn amount x amount (so 1 = 1, 2 = 4, 3 = 6 etc.), blobs_separation
is optional
-spawn_mushroom
-
-Search script examples for spawn_mushroom
-
-int spawn_mushroom(float x, float y, LAYER l)
int spawn_mushroom(float x, float y, LAYER l, int height)
-Spawns and grows mushroom, height relates to the trunk, without it, it will roll the game default 3-5 height
-Regardless, if there is not enough space, it will spawn shorter one or if there is no space even for the smallest one, it will just not spawn at all
-Returns uid of the base or -1 if it wasn't able to spawn
-spawn_on_floor
-
-Search script examples for spawn_on_floor
-
-int spawn_on_floor(ENT_TYPE entity_type, float x, float y, LAYER layer)
-Short for spawn_entity_snapped_to_floor.
-spawn_over
-
-Search script examples for spawn_over
-
-int spawn_over(ENT_TYPE entity_type, int over_uid, float x, float y)
-Short for spawn_entity_over
-spawn_player
-
-Search script examples for spawn_player
-
-nil spawn_player(int player_slot, float x, float y)
-Spawn a player in given location, if player of that slot already exist it will spawn clone, the game may crash as this is very unexpected situation
-If you want to respawn a player that is a ghost, set in his Inventory health
to above 0, and time_of_death
to 0 and call this function, the ghost entity will be removed automatically
-spawn_playerghost
-
-Search script examples for spawn_playerghost
-
-int spawn_playerghost(ENT_TYPE char_type, float x, float y, LAYER layer)
-Spawn the PlayerGhost entity, it will not move and not be connected to any player, you can then use steal_input and send_input to controll it
-or change it's player_inputs
to the input
of real player so he can control it directly
-spawn_tree
-
-Search script examples for spawn_tree
-
-int spawn_tree(float x, float y, LAYER layer)
int spawn_tree(float x, float y, LAYER layer, int height)
-Spawns and grows a tree
-spawn_unrolled_player_rope
-
-Search script examples for spawn_unrolled_player_rope
-
-int spawn_unrolled_player_rope(float x, float y, LAYER layer, TEXTURE texture)
int spawn_unrolled_player_rope(float x, float y, LAYER layer, TEXTURE texture, int max_length)
-Spawns an already unrolled rope as if created by player
-String functions
add_custom_name
-
-Search script examples for add_custom_name
-
-nil add_custom_name(int uid, string name)
-Adds custom name to the item by uid used in the shops
-This is better alternative to add_string
but instead of changing the name for entity type, it changes it for this particular entity
-add_string
-
-Search script examples for add_string
-
-STRINGID add_string(string str)
-Add custom string, currently can only be used for names of shop items (Entitydb->description)
-Returns STRINGID of the new string
-change_string
-
-Search script examples for change_string
-
-nil change_string(STRINGID id, string str)
-Change string at the given id (don't use stringid diretcly for vanilla string, use hash_to_stringid
first)
-This edits custom string and in game strings but changing the language in settings will reset game strings
-clear_custom_name
-
-Search script examples for clear_custom_name
-
-nil clear_custom_name(int uid)
-Clears the name set with add_custom_name
-enum_get_mask_names
-
-Search script examples for enum_get_mask_names
-
-table<string> enum_get_mask_names(table enum, int value)
-Return the matching names for a bitmask in an enum table of masks
-enum_get_name
-
-Search script examples for enum_get_name
-
-string enum_get_name(table enum, int value)
-Return the name of the first matching number in an enum table
-enum_get_names
-
-Search script examples for enum_get_names
-
-table<string> enum_get_names(table enum, int value)
-Return all the names of a number in an enum table
-get_character_name
-
-Search script examples for get_character_name
-
-string get_character_name(ENT_TYPE type_id)
-Same as Player.get_name
-get_character_short_name
-
-Search script examples for get_character_short_name
-
-string get_character_short_name(ENT_TYPE type_id)
-Same as Player.get_short_name
-get_string
-
-Search script examples for get_string
-
-const string get_string(STRINGID string_id)
-Get string behind STRINGID, don't use stringid diretcly for vanilla string, use hash_to_stringid first
-Will return the string of currently choosen language
-hash_to_stringid
-
-Search script examples for hash_to_stringid
-
-STRINGID hash_to_stringid(int hash)
-Convert the hash to stringid
-Check strings00_hashed.str for the hash values, or extract assets with modlunky and check those.
-set_level_string
-- set the level string shown in hud, journal and game over
--- also change the one used in transitions for consistency
-set_callback(function()
- if state.screen_next == SCREEN.LEVEL then
- local level_str = "test" .. tostring(state.level_count)
- set_level_string(level_str)
- change_string(hash_to_stringid(0xda7c0c5b), F"{level_str} COMPLETED!")
- end
-end, ON.PRE_LOAD_SCREEN)
+
+
+Type
+Name
+Description
+
+
+
+int
+min_empty_distance
+Used in BigSpearTrap when it has to have minimum 2 free spaces to be able to trigger, value in tiles
+
+
+int
+trigger_distance
+Value in tiles
+
+
+bool
+vertical
+
+
+
+Monsters, Inc.
Alien
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+int
+jump_timer
+
+
+
+Ammit
+Derived from Entity Movable PowerupCapable Monster
-
-
-Search script examples for set_level_string
-
-nil set_level_string(string str)
-Set the level number shown in the hud and journal to any string. This is reset to the default "%d-%d" automatically just before PRE_LOAD_SCREEN to a level or main menu, so use in PRE_LOAD_SCREEN, POST_LEVEL_GENERATION or similar for each level.
-Use "%d-%d" to reset to default manually. Does not affect the "...COMPLETED!" message in transitions or lines in "Dear Journal", you need to edit them separately with change_string.
-Texture functions
define_texture
-
-Search script examples for define_texture
-
-TEXTURE define_texture(TextureDefinition texture_data)
-Defines a new texture that can be used in Entity::set_texture
-If a texture with the same definition already exists the texture will be reloaded from disk.
-get_texture
-
-Search script examples for get_texture
-
-optional<TEXTURE> get_texture(TextureDefinition texture_data)
-Gets a texture with the same definition as the given, if none exists returns nil
-get_texture_definition
-
-Search script examples for get_texture_definition
-
-TextureDefinition get_texture_definition(TEXTURE texture_id)
-Gets a TextureDefinition
for equivalent to the one used to define the texture with id
-reload_texture
-
-Search script examples for reload_texture
-
-nil reload_texture(string texture_path)
-Reloads a texture from disk, use this only as a development tool for example in the console
-Note that define_texture will also reload the texture if it already exists
-replace_texture
-
-Search script examples for replace_texture
-
-bool replace_texture(TEXTURE vanilla_id, TEXTURE custom_id)
-Replace a vanilla texture definition with a custom texture definition and reload the texture.
-replace_texture_and_heart_color
-
-Search script examples for replace_texture_and_heart_color
-
-bool replace_texture_and_heart_color(TEXTURE vanilla_id, TEXTURE custom_id)
-Replace a vanilla texture definition with a custom texture definition and reload the texture. Set corresponding character heart color to the pixel in the center of the player indicator arrow in that texture. (448,1472)
-reset_lut
-
-Search script examples for reset_lut
-
-nil reset_lut(LAYER layer)
-Same as set_lut(nil, layer)
-reset_texture
-
-Search script examples for reset_texture
-
-nil reset_texture(TEXTURE vanilla_id)
-Reset a replaced vanilla texture to the original and reload the texture.
-set_lut
-
-Search script examples for set_lut
-
-nil set_lut(optional<TEXTURE> texture_id, LAYER layer)
-Force the LUT texture for the given layer (or both) until it is reset.
-Pass nil
in the first parameter to reset
-Theme functions
force_co_subtheme
-
-Search script examples for force_co_subtheme
-
-nil force_co_subtheme(COSUBTHEME subtheme)
-Forces the theme of the next cosmic ocean level(s) (use e.g. force_co_subtheme(COSUBTHEME.JUNGLE)
. Use COSUBTHEME.RESET to reset to default random behaviour)
-force_custom_subtheme
-
-Search script examples for force_custom_subtheme
-
-nil force_custom_subtheme(customtheme)
-Force current subtheme used in the CO theme. You can pass a CustomTheme, ThemeInfo or THEME. Not to be confused with force_co_subtheme.
-force_custom_theme
-
-Search script examples for force_custom_theme
-
-nil force_custom_theme(customtheme)
-Force a theme in PRE_LOAD_LEVEL_FILES, POST_ROOM_GENERATION or PRE_LEVEL_GENERATION to change different aspects of the levelgen. You can pass a CustomTheme, ThemeInfo or THEME.
-get_co_subtheme
-
-Search script examples for get_co_subtheme
-
-COSUBTHEME get_co_subtheme()
-Gets the sub theme of the current cosmic ocean level, returns COSUBTHEME.NONE if the current level is not a CO level.
-Tile code functions
define_tile_code
-
-Search script examples for define_tile_code
-
-TILE_CODE define_tile_code(string tile_code)
-Define a new tile code, to make this tile code do anything you have to use either set_pre_tile_code_callback or set_post_tile_code_callback.
-If a user disables your script but still uses your level mod nothing will be spawned in place of your tile code.
-get_short_tile_code
-
-Search script examples for get_short_tile_code
-
-optional<int> get_short_tile_code(ShortTileCodeDef short_tile_code_def)
-Gets a short tile code based on definition, returns nil
if it can't be found
-get_short_tile_code_definition
-
-Search script examples for get_short_tile_code_definition
-
-optional<ShortTileCodeDef> get_short_tile_code_definition(SHORT_TILE_CODE short_tile_code)
-Gets the definition of a short tile code (if available), will vary depending on which file is loaded
-set_post_tile_code_callback
-
-Search script examples for set_post_tile_code_callback
-
-CallbackId set_post_tile_code_callback(function cb, string tile_code)
-Add a callback for a specific tile code that is called after the game handles the tile code.
-Use this to affect what the game or other scripts spawned in this position.
-This is received even if a previous pre-tile-code-callback has returned true
-
The callback signature is nil post_tile_code(float x, float y, int layer, ROOM_TEMPLATE room_template)
-set_pre_tile_code_callback
-
-Search script examples for set_pre_tile_code_callback
-
-CallbackId set_pre_tile_code_callback(function cb, string tile_code)
-Add a callback for a specific tile code that is called before the game handles the tile code.
-Return true in order to stop the game or scripts loaded after this script from handling this tile code.
-For example, when returning true in this callback set for "floor"
then no floor will spawn in the game (unless you spawn it yourself)
-
The callback signature is bool pre_tile_code(float x, float y, int layer, ROOM_TEMPLATE room_template)
-Deprecated functions
-
-on_frame
-Use set_callback(function, ON.FRAME)
instead
-on_camp
-Use set_callback(function, ON.CAMP)
instead
-on_level
-Use set_callback(function, ON.LEVEL)
instead
-on_start
-Use set_callback(function, ON.START)
instead
-on_transition
-Use set_callback(function, ON.TRANSITION)
instead
-on_death
-Use set_callback(function, ON.DEATH)
instead
-on_win
-Use set_callback(function, ON.WIN)
instead
-on_screen
-Use set_callback(function, ON.SCREEN)
instead
-on_guiframe
-Use set_callback(function, ON.GUIFRAME)
instead
-load_script
-
-Search script examples for load_script
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+Anubis
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+float
+spawn_x
+
+
+
+float
+spawn_y
+
+
+
+float
+attack_proximity_y
+
+
+
+float
+attack_proximity_x
+
+
+
+int
+ai_timer
+
+
+
+int
+next_attack_timer
+
+
+
+int
+psychic_orbs_counter
+
+
+
+bool
+awake
+
+
+
+ApepHead
+Derived from Entity Movable PowerupCapable Monster ApepPart
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound1
+
+
+
+SoundMeta
+sound2
+
+
+
+float
+distance_traveled
+
+
+
+int
+tail_uid
+
+
+
+int
+fx_mouthpiece1_uid
+
+
+
+int
+fx_mouthpiece2_uid
+
+
+
+ApepPart
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+float
+y_pos
+
+
+
+float
+sine_angle
+
+
+
+int
+sync_timer
+or pause timer, used to sync the body parts moving up and down
+
+
+Axolotl
+Derived from Entity Movable PowerupCapable Mount
-nil load_script()
-Same as import().
-read_prng
-
-Search script examples for read_prng
-
+
+
+Type
+Name
+Description
+
+
+
+int
+attack_cooldown
+
+
+
+bool
+can_teleport
+
+
+
+Bat
+Derived from Entity Movable PowerupCapable Monster
-array<int> read_prng()
-Read the game prng state. Use prng:get_pair() instead.
-force_dark_level
-- forces any level to be dark, even bosses
-set_callback(function()
- state.level_flags = set_flag(state.level_flags, 18)
-end, ON.POST_ROOM_GENERATION)
+
+
+Type
+Name
+Description
+
+
+
+float
+spawn_x
+
+
+
+float
+spawn_y
+
+
+
+Bee
+Derived from Entity Movable PowerupCapable Monster
-
-
-Search script examples for force_dark_level
-
+
+
+Type
+Name
+Description
+
+
+
+bool
+can_rest
+
+
+
+SoundMeta
+sound
+
+
+
+int
+fly_hang_timer
+
+
+
+int
+targeting_timer
+
+
+
+int
+walk_start_time
+
+
+
+int
+walk_end_time
+
+
+
+float
+wobble_x
+
+
+
+float
+wobble_y
+
+
+
+Beg
+Derived from Entity Movable PowerupCapable Monster NPC
-nil force_dark_level(bool g)
-Set level flag 18 on post room generation instead, to properly force every level to dark
-get_entities
-
-Search script examples for get_entities
-
-array<int> get_entities()
-Use get_entities_by(0, MASK.ANY, LAYER.BOTH)
instead
-get_entities_by_mask
-
-Search script examples for get_entities_by_mask
-
-array<int> get_entities_by_mask(int mask)
-Use get_entities_by(0, mask, LAYER.BOTH)
instead
-get_entities_by_layer
-
-Search script examples for get_entities_by_layer
-
-array<int> get_entities_by_layer(LAYER layer)
-Use get_entities_by(0, MASK.ANY, layer)
instead
-get_entities_overlapping
-
-Search script examples for get_entities_overlapping
-
-array<int> get_entities_overlapping(array<ENT_TYPE> entity_types, int mask, float sx, float sy, float sx2, float sy2, LAYER layer)
array<int> get_entities_overlapping(ENT_TYPE entity_type, int mask, float sx, float sy, float sx2, float sy2, LAYER layer)
-Use get_entities_overlapping_hitbox
instead
-get_entity_ai_state
-
-Search script examples for get_entity_ai_state
-
-int get_entity_ai_state(int uid)
-As the name is misleading. use entity move_state
field instead
-set_arrowtrap_projectile
-
-Search script examples for set_arrowtrap_projectile
-
-nil set_arrowtrap_projectile(ENT_TYPE regular_entity_type, ENT_TYPE poison_entity_type)
-Use replace_drop(DROP.ARROWTRAP_WOODENARROW, new_arrow_type) and replace_drop(DROP.POISONEDARROWTRAP_WOODENARROW, new_arrow_type) instead
-set_blood_multiplication
-
-Search script examples for set_blood_multiplication
-
-nil set_blood_multiplication(int default_multiplier, int vladscape_multiplier)
-This function never worked properly as too many places in the game individually check for vlads cape and calculate the blood multiplication
-default_multiplier
doesn't do anything due to some changes in last game updates, vladscape_multiplier
only changes the multiplier to some entities death's blood spit
-set_camera_position
-
-Search script examples for set_camera_position
-
-nil set_camera_position(float cx, float cy)
-this doesn't actually work at all. See State -> Camera the for proper camera handling
-setflag
-
-Search script examples for setflag
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+int
+disappear_timer
+
+
+
+Bodyguard
+Derived from Entity Movable PowerupCapable Monster NPC
+
+
+
+Type
+Name
+Description
+
+
+
+int
+position_state
+0 - none, 1 - Tusk dice shop, 2 - Entrence to pleasure palace, 3 - Basement entrance to pleasure palace
+
+
+bool
+message_shown
+
+
+
+CatMummy
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+int
+ai_state
+
+
+
+int
+attack_timer
+
+
+
+Caveman
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
+
+Type
+Name
+Description
+
+
+
+int
+wake_up_timer
+
+
+
+int
+can_pick_up_timer
+0 = can pick something up, when holding forced to 179, after tripping and regaining consciousness counts down to 0
+
+
+int
+aggro_timer
+keeps resetting when angry and a player is nearby
+
+
+CavemanShopkeeper
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+tripping
+
+
+
+bool
+shop_entered
+
+
+
+Cobra
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+int
+spit_timer
+
+
+
+Crabman
+Derived from Entity Movable PowerupCapable Monster
-nil setflag()
-clrflag
-
-Search script examples for clrflag
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+int
+invincibility_timer
+
+
+
+int
+poison_attack_timer
+
+
+
+int
+attacking_claw_uid
+
+
+
+bool
+at_maximum_attack
+
+
+
+Critter
+Derived from Entity Movable PowerupCapable Monster
-nil clrflag()
-testflag
-
-Search script examples for testflag
-
+
+
+Type
+Name
+Description
+
+
+
+int
+last_picked_up_by_uid
+
+
+
+int
+holding_state
+
+
+
+CritterBeetle
+Derived from Entity Movable PowerupCapable Monster Critter
-nil testflag()
-read_input
-
-Search script examples for read_input
-
+
+
+Type
+Name
+Description
+
+
+
+bool
+pause
+used when he's getting eaten
+
+
+CritterButterfly
+Derived from Entity Movable PowerupCapable Monster Critter
-INPUTS read_input(int uid)
-Use players[1].input.buttons_gameplay
for only the inputs during the game, or .buttons
for all the inputs, even during the pause menu
-Of course, you can get the Player by other mean, it doesn't need to be the players
table
-You can only read inputs from actual players, HH don't have any inputs
-read_stolen_input
-
-Search script examples for read_stolen_input
-
+
+
+Type
+Name
+Description
+
+
+
+int
+change_direction_timer
+
+
+
+int
+vertical_flight_direction
+
+
+
+CritterCrab
+Derived from Entity Movable PowerupCapable Monster Critter
-INPUTS read_stolen_input(int uid)
-Read input that has been previously stolen with steal_input
-Use state.player_inputs.player_slots[player_slot].buttons_gameplay
for only the inputs during the game, or .buttons
for all the inputs, even during the pause menu
-clear_entity_callback
-
-Search script examples for clear_entity_callback
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+bool
+walking_left
+
+
+
+bool
+unfriendly
+moves away from its target instead of towards it
+
+
+CritterDrone
+Derived from Entity Movable PowerupCapable Monster Critter
-nil clear_entity_callback(int uid, CallbackId cb_id)
-Use entity.clear_virtual
instead.
-Clears a callback that is specific to an entity.
-set_pre_statemachine
-
-Search script examples for set_pre_statemachine
-
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+SoundMeta
+sound
+
+
+
+float
+applied_hor_momentum
+
+
+
+float
+applied_ver_momentum
+
+
+
+bool
+unfriendly
+moves away from its target instead of towards it
+
+
+int
+move_timer
+
+
+
+CritterFirefly
+Derived from Entity Movable PowerupCapable Monster Critter
-optional<CallbackId> set_pre_statemachine(int uid, function fun)
-Use entity:set_pre_update_state_machine
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-uid
has to be the uid of a Movable
or else stuff will break.
-Sets a callback that is called right before the statemachine, return true
to skip the statemachine update.
-Use this only when no other approach works, this call can be expensive if overused.
-Check here to see whether you can use this callback on the entity type you intend to.
-
The callback signature is bool statemachine(Entity self)
-set_post_statemachine
-
-Search script examples for set_post_statemachine
-
+
+
+Type
+Name
+Description
+
+
+
+float
+sine_amplitude
+
+
+
+float
+sine_frequency
+
+
+
+float
+sine_angle
+
+
+
+int
+change_direction_timer
+
+
+
+int
+sit_timer
+
+
+
+int
+sit_cooldown_timer
+
+
+
+CritterFish
+Derived from Entity Movable PowerupCapable Monster Critter
-optional<CallbackId> set_post_statemachine(int uid, function fun)
-Use entity:set_post_update_state_machine
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-uid
has to be the uid of a Movable
or else stuff will break.
-Sets a callback that is called right after the statemachine, so you can override any values the satemachine might have set (e.g. animation_frame
).
-Use this only when no other approach works, this call can be expensive if overused.
-Check here to see whether you can use this callback on the entity type you intend to.
-
The callback signature is nil statemachine(Entity self)
-set_on_destroy
-
-Search script examples for set_on_destroy
-
+
+
+Type
+Name
+Description
+
+
+
+int
+swim_pause_timer
+
+
+
+bool
+player_in_proximity
+
+
+
+CritterLocust
+Derived from Entity Movable PowerupCapable Monster Critter
-optional<CallbackId> set_on_destroy(int uid, function fun)
-Use entity:set_pre_destroy
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right when an entity is destroyed, e.g. as if by Entity.destroy()
before the game applies any side effects.
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is nil on_destroy(Entity self)
-set_on_kill
-
-Search script examples for set_on_kill
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+jump_timer
+
+
+
+CritterPenguin
+Derived from Entity Movable PowerupCapable Monster Critter
-optional<CallbackId> set_on_kill(int uid, function fun)
-Use entity:set_pre_kill
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right when an entity is eradicated, before the game applies any side effects.
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is nil on_kill(Entity self, Entity killer)
-set_on_damage
-
-Search script examples for set_on_damage
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+int
+jump_timer
+
+
+
+CritterSlime
+Derived from Entity Movable PowerupCapable Monster Critter
-optional<CallbackId> set_on_damage(int uid, function fun)
-Use entity:set_pre_damage
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right before an entity is damaged, return true
to skip the game's damage handling.
-Note that damage_dealer can be nil ! (long fall, ...)
-DO NOT CALL self:damage()
in the callback !
-Use this only when no other approach works, this call can be expensive if overused.
-The entity has to be of a Movable type.
-
The callback signature is bool on_damage(Entity self, Entity damage_dealer, int damage_amount, float vel_x, float vel_y, int stun_amount, int iframes)
-set_pre_floor_update
-
-Search script examples for set_pre_floor_update
-
+
+
+Type
+Name
+Description
+
+
+
+float
+x_direction
+
+
+
+float
+y_direction
+
+
+
+float
+pos_x
+
+
+
+float
+pos_y
+
+
+
+float
+rotation_center_x
+
+
+
+float
+rotation_center_y
+
+
+
+float
+rotation_angle
+
+
+
+float
+rotation_speed
+
+
+
+int
+walk_pause_timer
+
+
+
+CritterSnail
+Derived from Entity Movable PowerupCapable Monster Critter
-optional<CallbackId> set_pre_floor_update(int uid, function fun)
-Use entity:set_pre_floor_update
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right before a floor is updated (by killed neighbor), return true
to skip the game's neighbor update handling.
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is bool pre_floor_update(Entity self)
-set_post_floor_update
-- Use FLOOR_GENERIC with textures from different themes that update correctly when destroyed.
--- This lets you use the custom tile code 'floor_generic_tidepool'
--- in the level editor to spawn tidepool floor in dwelling for example...
-define_tile_code("floor_generic_tidepool")
-set_pre_tile_code_callback(function(x, y, layer)
- local uid = spawn_grid_entity(ENT_TYPE.FLOOR_GENERIC, x, y, layer)
- set_post_floor_update(uid, function(me)
- me:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TIDEPOOL_0)
- for i,v in ipairs(entity_get_items_by(me.uid, ENT_TYPE.DECORATION_GENERIC, MASK.DECORATION)) do
- local deco = get_entity(v)
- deco:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TIDEPOOL_0)
- end
- end)
- return true
-end, "floor_generic_tidepool")
+
+
+Type
+Name
+Description
+
+
+
+float
+x_direction
+
+
+
+float
+y_direction
+
+
+
+float
+pos_x
+
+
+
+float
+pos_y
+
+
+
+float
+rotation_center_x
+
+
+
+float
+rotation_center_y
+
+
+
+float
+rotation_angle
+
+
+
+float
+rotation_speed
+
+
+
+Crocman
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
+Type
+Name
+Description
+
+
+
+int
+teleport_cooldown
+
+
+
+EggplantMinister
+Derived from Entity Movable PowerupCapable Monster
--- Fix quicksand decorations when not in temple
-set_post_entity_spawn(function(ent)
- ent:set_post_floor_update(function(me)
- me:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TEMPLE_0)
- for i,v in ipairs(entity_get_items_by(me.uid, ENT_TYPE.DECORATION_GENERIC, MASK.DECORATION)) do
- local deco = get_entity(v)
- deco:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TEMPLE_0)
- end
- end)
-end, SPAWN_TYPE.ANY, MASK.FLOOR, ENT_TYPE.FLOOR_QUICKSAND)
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+walk_pause_timer
+
+
+
+int
+squish_timer
+
+
+
+FireFrog
+Derived from Entity Movable PowerupCapable Monster Frog
-
-
-Search script examples for set_post_floor_update
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+Firebug
+Derived from Entity Movable PowerupCapable Monster
-optional<CallbackId> set_post_floor_update(int uid, function fun)
-Use entity:set_post_floor_update
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right after a floor is updated (by killed neighbor).
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is nil post_floor_update(Entity self)
-set_on_open
-
-Search script examples for set_on_open
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+fire_timer
+
+
+
+bool
+going_up
+
+
+
+bool
+detached_from_chain
+
+
+
+FirebugUnchained
+Derived from Entity Movable PowerupCapable Monster
-optional<CallbackId> set_on_open(int uid, function fun)
-Use entity:set_pre_trigger_action
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right when a container is opened by the player (up+whip)
-Use this only when no other approach works, this call can be expensive if overused.
-Check here to see whether you can use this callback on the entity type you intend to.
-
The callback signature is nil on_open(Entity entity_self, Entity opener)
-set_pre_collision1
-
-Search script examples for set_pre_collision1
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+float
+max_flight_height
+
+
+
+int
+ai_timer
+
+
+
+int
+walking_timer
+
+
+
+Fish
+Derived from Entity Movable PowerupCapable Monster
-optional<CallbackId> set_pre_collision1(int uid, function fun)
-Use entity:set_pre_collision1
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right before the collision 1 event, return true
to skip the game's collision handling.
-Use this only when no other approach works, this call can be expensive if overused.
-Check here to see whether you can use this callback on the entity type you intend to.
-
The callback signature is bool pre_collision1(Entity entity_self, Entity collision_entity)
-set_pre_collision2
-
-Search script examples for set_pre_collision2
-
+
+
+Type
+Name
+Description
+
+
+
+int
+change_direction_timer
+
+
+
+ForestSister
+Derived from Entity Movable PowerupCapable Monster NPC
-optional<CallbackId> set_pre_collision2(int uid, function fun)
-Use entity:set_pre_collision2
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right before the collision 2 event, return true
to skip the game's collision handling.
-Use this only when no other approach works, this call can be expensive if overused.
-Check here to see whether you can use this callback on the entity type you intend to.
-
The callback signature is bool pre_collision12(Entity self, Entity collision_entity)
-set_pre_render
-
-Search script examples for set_pre_render
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+Frog
+Derived from Entity Movable PowerupCapable Monster
-optional<CallbackId> set_pre_render(int uid, function fun)
-Use entity.rendering_info:set_pre_render
in combination with render_info:get_entity
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right after the entity is rendered.
-Return true
to skip the original rendering function and all later pre_render callbacks.
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is bool render(VanillaRenderContext render_ctx, Entity self)
-set_post_render
-
-Search script examples for set_post_render
-
+
+
+Type
+Name
+Description
+
+
+
+int
+grub_being_eaten_uid
+
+
+
+int
+jump_timer
+
+
+
+bool
+pause
+
+
+
+Ghist
+Derived from Entity Movable PowerupCapable Monster
-optional<CallbackId> set_post_render(int uid, function fun)
-Use entity.rendering_info:set_post_render
in combination with render_info:get_entity
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right after the entity is rendered.
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is nil post_render(VanillaRenderContext render_ctx, Entity self)
-generate_particles
-
-Search script examples for generate_particles
-
-ParticleEmitterInfo generate_particles(int particle_emitter_id, int uid)
-Use generate_world_particles
-draw_line
-
-Search script examples for draw_line
-
+
+
+Type
+Name
+Description
+
+
+
+int
+body_uid
+
+
+
+int
+idle_timer
+
+
+
+SoundMeta
+sound
+
+
+
+int
+transparency
+
+
+
+int
+fadeout
+
+
+
+Ghost
+Derived from Entity Movable PowerupCapable Monster
-nil draw_line(float x1, float y1, float x2, float y2, float thickness, uColor color)
-Use GuiDrawContext.draw_line
instead
-draw_rect
-
-Search script examples for draw_rect
-
+
+
+Type
+Name
+Description
+
+
+
+int
+split_timer
+for SMALL_HAPPY this is also the sequence timer of its various states
+
+
+int
+wobble_timer
+
+
+
+int
+pace_timer
+Controls ghost pacing when all players are dead.
+
+
+float
+velocity_multiplier
+
+
+
+GHOST_BEHAVIOR
+ghost_behaviour
+
+
+
+Illumination
+emitted_light
+
+
+
+Entity
+linked_ghost
+
+
+
+SoundMeta
+sound
+
+
+
+bool
+blown_by_player
+
+
+
+bool
+happy_dancing_clockwise
+
+
+
+float
+target_dist_visibility_factor
+
+
+
+float
+target_layer_visibility_factor
+
+
+
+GiantFish
+Derived from Entity Movable PowerupCapable Monster
-nil draw_rect(float x1, float y1, float x2, float y2, float thickness, float rounding, uColor color)
-Use GuiDrawContext.draw_rect
instead
-draw_rect_filled
-
-Search script examples for draw_rect_filled
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+change_direction_timer
+when bouncing into a wall
+
+
+int
+lose_interest_timer
+delay in-between attacks
+
+
+GiantFly
+Derived from Entity Movable PowerupCapable Monster
-nil draw_rect_filled(float x1, float y1, float x2, float y2, float rounding, uColor color)
-Use GuiDrawContext.draw_rect_filled
instead
-draw_circle
-
-Search script examples for draw_circle
-
+
+
+Type
+Name
+Description
+
+
+
+Entity
+head_entity
+
+
+
+SoundMeta
+sound
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+float
+sine_amplitude
+
+
+
+float
+sine_frequency
+
+
+
+float
+delta_y_angle
+
+
+
+int
+sine_counter
+
+
+
+GiantFrog
+Derived from Entity Movable PowerupCapable Monster
-nil draw_circle(float x, float y, float radius, float thickness, uColor color)
-Use GuiDrawContext.draw_circle
instead
-draw_circle_filled
-
-Search script examples for draw_circle_filled
-
+
+
+Type
+Name
+Description
+
+
+
+Entity
+door_front_layer
+
+
+
+Entity
+door_back_layer
+
+
+
+Entity
+platform
+
+
+
+int
+attack_timer
+
+
+
+int
+frogs_ejected_in_cycle
+
+
+
+int
+invincibility_timer
+
+
+
+int
+mouth_close_timer
+
+
+
+bool
+mouth_open_trigger
+opens the mouth and starts mouth_close_timer, used when detecting grub in the mouth area
+
+
+GoldMonkey
+Derived from Entity Movable PowerupCapable Monster
-nil draw_circle_filled(float x, float y, float radius, uColor color)
-Use GuiDrawContext.draw_circle_filled
instead
-draw_text
-
-Search script examples for draw_text
-
+
+
+Type
+Name
+Description
+
+
+
+int
+jump_timer
+
+
+
+int
+poop_timer
+
+
+
+int
+poop_count
+
+
+
+Grub
+Derived from Entity Movable PowerupCapable Monster
-nil draw_text(float x, float y, float size, string text, uColor color)
-Use GuiDrawContext.draw_text
instead
-draw_image
-
-Search script examples for draw_image
-
+
+
+Type
+Name
+Description
+
+
+
+float
+rotation_delta
+
+
+
+bool
+drop
+
+
+
+int
+looking_for_new_direction_timer
+used when he touches floor/wall/ceiling
+
+
+int
+walk_pause_timer
+
+
+
+int
+turn_into_fly_timer
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+SoundMeta
+sound
+
+
+
+HangSpider
+Derived from Entity Movable PowerupCapable Monster
-nil draw_image(IMAGE image, float x1, float y1, float x2, float y2, float uvx1, float uvy1, float uvx2, float uvy2, uColor color)
-Use GuiDrawContext.draw_image
instead
-draw_image_rotated
-
-Search script examples for draw_image_rotated
-
+
+
+Type
+Name
+Description
+
+
+
+int
+dangle_jump_timer
+
+
+
+float
+ceiling_pos_x
+
+
+
+float
+ceiling_pos_y
+
+
+
+Hermitcrab
+Derived from Entity Movable PowerupCapable Monster
-nil draw_image_rotated(IMAGE image, float x1, float y1, float x2, float y2, float uvx1, float uvy1, float uvx2, float uvy2, uColor color, float angle, float px, float py)
-Use GuiDrawContext.draw_image_rotated
instead
-window
-
-Search script examples for window
-
+
+
+Type
+Name
+Description
+
+
+
+ENT_TYPE
+carried_entity_type
+
+
+
+int
+carried_entity_uid
+
+
+
+int
+walk_spit_timer
+
+
+
+bool
+is_active
+whether it is hidden behind the carried block or not, if true you can damage him
+
+
+bool
+is_inactive
+
+
+
+bool
+spawn_new_carried_item
+defaults to true, when toggled to false, a new carried item spawns
+
+
+HornedLizard
+Derived from Entity Movable PowerupCapable Monster
-nil window(string title, float x, float y, float w, float h, bool movable, function callback)
-Use GuiDrawContext.window
instead
-win_text
-
-Search script examples for win_text
-
+
+
+Type
+Name
+Description
+
+
+
+int
+eaten_uid
+dungbeetle being eaten
+
+
+int
+walk_pause_timer
+alternates between walking and pausing when timer reaches zero
+
+
+int
+attack_cooldown_timer
+won't attack until timer reaches zero
+
+
+int
+blood_squirt_timer
+
+
+
+SoundMeta
+sound
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+Hundun
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+float
+applied_hor_velocity
+
+
+
+float
+applied_ver_velocity
+
+
+
+int
+birdhead_entity_uid
+
+
+
+int
+snakehead_entity_uid
+
+
+
+float
+y_level
+current floor level
+
+
+int
+bounce_timer
+
+
+
+int
+fireball_timer
+
+
+
+bool
+birdhead_defeated
+
+
+
+bool
+snakehead_defeated
+
+
+
+int
+hundun_flags
+1: Will move to the left, 2: Birdhead emerged, 3: Snakehead emerged, 4: Top level arena reached, 5: Birdhead shot last - to alternate the heads shooting fireballs
+
+
+float
+y_limit
+This is custom variable, you need activate_hundun_hack to use it
+
+
+float
+rising_speed_x
+This is custom variable, you need activate_hundun_hack to use it
+
+
+float
+rising_speed_y
+This is custom variable, you need activate_hundun_hack to use it
+
+
+float
+bird_head_spawn_y
+This is custom variable, you need activate_hundun_hack to use it
+
+
+float
+snake_head_spawn_y
+This is custom variable, you need activate_hundun_hack to use it
+
+
+HundunHead
+Derived from Entity Movable PowerupCapable Monster
-nil win_text(string text)
-Use GuiDrawContext.win_text
instead
-win_separator
-
-Search script examples for win_separator
-
+
+
+Type
+Name
+Description
+
+
+
+float
+attack_position_x
+Posiotion where the head will move on attack
+
+
+float
+attack_position_y
+
+
+
+int
+egg_crack_effect_uid
+
+
+
+int
+targeted_player_uid
+
+
+
+int
+looking_for_target_timer
+also cooldown before attack
+
+
+int
+invincibility_timer
+
+
+
+Imp
+Derived from Entity Movable PowerupCapable Monster
-nil win_separator()
-Use GuiDrawContext.win_separator
instead
-win_inline
-
-Search script examples for win_inline
-
+
+
+Type
+Name
+Description
+
+
+
+int
+carrying_uid
+
+
+
+float
+patrol_y_level
+
+
+
+Jiangshi
+Derived from Entity Movable PowerupCapable Monster
-nil win_inline()
-Use GuiDrawContext.win_inline
instead
-win_sameline
-
-Search script examples for win_sameline
-
+
+
+Type
+Name
+Description
+
+
+
+int
+wait_timer
+wait time between jumps
+
+
+int
+jump_counter
+only female aka assassin: when 0 will jump up into ceiling
+
+
+bool
+on_ceiling
+only female aka assassin
+
+
+JumpDog
+Derived from Entity Movable PowerupCapable Monster
-nil win_sameline(float offset, float spacing)
-Use GuiDrawContext.win_sameline
instead
-win_button
-
-Search script examples for win_button
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+int
+squish_timer
+
+
+
+Kingu
+Derived from Entity Movable PowerupCapable Monster
-bool win_button(string text)
-Use GuiDrawContext.win_button
instead
-win_input_text
-
-Search script examples for win_input_text
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound1
+initialized when breaking the shell (sliding down sound maybe?)
+
+
+SoundMeta
+sound2
+Turning into stone sound
+
+
+float
+climb_direction_x
+
+
+
+float
+climb_direction_y
+
+
+
+int
+climb_pause_timer
+
+
+
+int
+shell_invincibility_timer
+
+
+
+int
+monster_spawn_timer
+
+
+
+int
+initial_shell_health
+excalibur wipes out immediately, bombs take off 11 points, when 0 vulnerable to whip
+
+
+bool
+player_seen_by_kingu
+
+
+
+Lahamu
+Derived from Entity Movable PowerupCapable Monster
-string win_input_text(string label, string value)
-Use GuiDrawContext.win_input_text
instead
-win_input_int
-
-Search script examples for win_input_int
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+Entity
+eyeball
+
+
+
+int
+attack_cooldown_timer
+
+
+
+Lamassu
+Derived from Entity Movable PowerupCapable Monster
-int win_input_int(string label, int value)
-Use GuiDrawContext.win_input_int
instead
-win_input_float
-
-Search script examples for win_input_float
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+Entity
+attack_effect_entity
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+Illumination
+emitted_light
+
+
+
+int
+walk_pause_timer
+
+
+
+int
+flight_timer
+
+
+
+int
+attack_timer
+
+
+
+float
+attack_angle
+
+
+
+Lavamander
+Derived from Entity Movable PowerupCapable Monster
-float win_input_float(string label, float value)
-Use GuiDrawContext.win_input_float
instead
-win_slider_int
-
-Search script examples for win_slider_int
-
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+int
+shoot_lava_timer
+when this timer reaches zero, it appears on the surface/shoots lava, triggers on player proximity
+
+
+int
+jump_pause_timer
+
+
+
+int
+lava_detection_timer
+
+
+
+bool
+is_hot
+
+
+
+int
+player_detect_state
+0 - didnt_saw_player, 1 - saw_player, 2 - spited_lava; probably used so he won't spit imminently after seeing the player
+
+
+Leprechaun
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
-int win_slider_int(string label, int value, int min, int max)
-Use GuiDrawContext.win_slider_int
instead
-win_drag_int
-
-Search script examples for win_drag_int
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+hump_timer
+
+
+
+int
+target_in_sight_timer
+
+
+
+int
+gold
+amount of gold he picked up, will be drooped on death
+
+
+int
+timer_after_humping
+
+
+
+MagmaMan
+Derived from Entity Movable PowerupCapable Monster
-int win_drag_int(string label, int value, int min, int max)
-Use GuiDrawContext.win_drag_int
instead
-win_slider_float
-
-Search script examples for win_slider_float
-
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+SoundMeta
+sound
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+int
+jump_timer
+
+
+
+int
+alive_timer
+
+
+
+Mantrap
+Derived from Entity Movable PowerupCapable Monster
-float win_slider_float(string label, float value, float min, float max)
-Use GuiDrawContext.win_slider_float
instead
-win_drag_float
-
-Search script examples for win_drag_float
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+alternates between walking and pausing every time it reaches zero
+
+
+int
+eaten_uid
+the uid of the entity the mantrap has eaten, in case it can break out, like a shopkeeper
+
+
+Mech
+Derived from Entity Movable PowerupCapable Mount
-float win_drag_float(string label, float value, float min, float max)
-Use GuiDrawContext.win_drag_float
instead
-win_check
-
-Search script examples for win_check
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+crouch_walk_sound
+
+
+
+SoundMeta
+explosion_sound
+
+
+
+int
+gun_cooldown
+
+
+
+bool
+walking
+
+
+
+bool
+breaking_wall
+
+
+
+MegaJellyfish
+Derived from Entity Movable PowerupCapable Monster
-bool win_check(string label, bool value)
-Use GuiDrawContext.win_check
instead
-win_combo
-
-Search script examples for win_combo
-
+
+
+Type
+Name
+Description
+
+
+
+Entity
+flipper1
+
+
+
+Entity
+flipper2
+
+
+
+SoundMeta
+sound
+
+
+
+int
+orb_uid
+game checks if this uid, and two following exist, if not, the Jellyfish starts chasing player
+
+
+int
+tail_bg_uid
+
+
+
+float
+applied_velocity
+
+
+
+float
+wagging_tail_counter
+
+
+
+int
+flipper_distance
+only applies to door-blocking one
+
+
+int
+velocity_application_timer
+
+
+
+Mole
+Derived from Entity Movable PowerupCapable Monster
-int win_combo(string label, int selected, string opts)
-Use GuiDrawContext.win_combo
instead
-win_pushid
-
-Search script examples for win_pushid
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+burrowing_sound
+
+
+
+SoundMeta
+nonburrowing_sound
+
+
+
+ParticleEmitterInfo
+burrowing_particle
+
+
+
+float
+burrow_dir_x
+
+
+
+float
+burrow_dir_y
+
+
+
+int
+burrowing_in_uid
+stores the last uid as well
+
+
+int
+counter_burrowing
+
+
+
+int
+counter_nonburrowing
+
+
+
+int
+countdown_for_appearing
+
+
+
+int
+digging_state
+0 - non_burrowed, 1 - unknown, 2 - burrowed, 3 - state_change
+
+
+Monkey
+Derived from Entity Movable PowerupCapable Monster
-nil win_pushid(int id)
-Use GuiDrawContext.win_pushid
instead
-win_popid
-
-Search script examples for win_popid
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+jump_timer
+
+
+
+bool
+on_vine
+
+
+
+Monster
+Derived from Entity Movable PowerupCapable
-nil win_popid()
-Use GuiDrawContext.win_popid
instead
-win_image
-
-Search script examples for win_image
-
+
+
+Type
+Name
+Description
+
+
+
+int
+chased_target_uid
+
+
+
+int
+target_selection_timer
+
+
+
+Mosquito
+Derived from Entity Movable PowerupCapable Monster
-nil win_image(IMAGE image, float width, float height)
-Use GuiDrawContext.win_image
instead
-Non-Entity types
Arena types
ArenaConfigArenas
-Used in ArenaState
+
+
+Type
+Name
+Description
+
+
+
+float
+direction_x
+
+
+
+float
+direction_y
+
+
+
+float
+stuck_rel_pos_x
+
+
+
+float
+stuck_rel_pos_y
+
+
+
+SoundMeta
+sound
+
+
+
+int
+timer
+
+
+
+Mount
+Derived from Entity Movable PowerupCapable
@@ -5093,208 +21593,392 @@ Non-Entity types
Arena types<
-bool
-dwelling_1
+int
+rider_uid
-bool
-dwelling_2
+SoundMeta
+sound
bool
-dwelling_3
+can_doublejump
bool
-dwelling_4
+tamed
-bool
-dwelling_5
+int
+walk_pause_timer
-bool
-jungle_1
+int
+taming_timer
bool
-jungle_2
+used_double_jump()
-bool
-jungle_3
+nil
+remove_rider()
-bool
-jungle_4
+nil
+carry(Movable rider)
-bool
-jungle_5
+nil
+tame(bool value)
+
+Mummy
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-volcana_1
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+NPC
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-volcana_2
+Type
+Name
+Description
+
+
+
+float
+climb_direction
-bool
-volcana_3
+int
+target_in_sight_timer
-bool
-volcana_4
+int
+ai_state
bool
-volcana_5
+aggro
+for bodyguard and shopkeeperclone it spawns a weapon as well
+
+
+Necromancer
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
-bool
-tidepool_1
+float
+red_skeleton_spawn_x
-bool
-tidepool_2
+float
+red_skeleton_spawn_y
-bool
-tidepool_3
+int
+resurrection_uid
-bool
-tidepool_4
+int
+resurrection_timer
+
+Octopus
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
+
+Type
+Name
+Description
+
+
+
+Olmite
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
+
+Type
+Name
+Description
+
+
bool
-tidepool_5
+armor_on
bool
-temple_1
-
+in_stack
+disables the attack, stun, lock's looking left flag between stack
bool
-temple_2
+in_stack2
+is set to false couple frame after being detached from stack
+
+
+int
+on_top_uid
-bool
-temple_3
+float
+y_offset
-bool
-temple_4
+int
+attack_cooldown_timer
+
+OsirisHand
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-temple_5
+Type
+Name
+Description
+
+
+
+int
+attack_cooldown_timer
+
+OsirisHead
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
-bool
-icecaves_1
+int
+right_hand_uid
+right from his perspective
+
+
+int
+left_hand_uid
bool
-icecaves_2
+moving_left
-bool
-icecaves_3
+int
+targeting_timer
-bool
-icecaves_4
-
+int
+invincibility_timer
+
+
+
+Pet
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+fx_button
+
+
+
+int
+petting_by_uid
+person whos petting it, only in the camp
+
+
+int
+yell_counter
+counts up to 400 (6.6 sec), when 0 the pet yells out
+
+
+int
+func_timer
+used when free running in the camp
+
+
+int
+active_state
+-1 = sitting and yelling, 0 = either running, dead or picked up
+
+
+int
+petted_counter
+number of times petted in the camp
+
+
+Player
+Derived from Entity Movable PowerupCapable
+
+
+
+Type
+Name
+Description
+
+
+
+Inventory
+inventory
+
+
+
+Illumination
+emitted_light
+
+
+
+int
+linked_companion_parent
+entity uid
+
+
+int
+linked_companion_child
+entity uid
+
+
+Ai
+ai
+
+
+
+PlayerSlot
+input
+
+
+
+Entity
+basecamp_button_entity
+Used in base camp to talk with the NPC's
+
+
+int
+jump_lock_timer
+Increases when holding jump button in the air, set to max while jumping. If this isn't 0, a jump will only be
registered if the jump button was not held on the previous frame.
-bool
-icecaves_5
-
+int
+coyote_timer
+can jump while airborne if greater than 0
-bool
-neobabylon_1
-
+int
+swim_timer
+Timer between strokes when holding jump button in water.
-bool
-neobabylon_2
-
+int
+hired_hand_name
+0-25 alphabetical index of hired hand names.
-bool
-neobabylon_3
+nil
+set_jetpack_fuel(int fuel)
-bool
-neobabylon_4
+int
+kapala_blood_amount()
-bool
-neobabylon_5
-
+string
+get_name()
+Get the full name of the character, this will be the modded name not only the vanilla name.
-bool
-sunkencity_1
-
+string
+get_short_name()
+Get the short name of the character, this will be the modded name not only the vanilla name.
-bool
-sunkencity_2
-
+Color
+get_heart_color()
+Get the heart color of the character, this will be the modded heart color not only the vanilla heart color.
bool
-sunkencity_3
-
+is_female()
+Check whether the character is female, will be true
if the character was modded to be female as well.
-bool
-sunkencity_4
-
+nil
+set_heart_color(Color hcolor)
+Set the heart color the character.
-bool
-sunkencity_5
-
+nil
+let_go()
+Drops from ladders, ropes and ledge grabs
-ArenaConfigEquippedItems
-Used in ArenaState
+PowerupCapable
+
@@ -5304,48 +21988,38 @@ ArenaConfigEquippedItems
-bool
-paste
-
-
-
-bool
-climbing_gloves
-
-
-
-bool
-pitchers_mitt
-
+nil
+remove_powerup(ENT_TYPE powerup_type)
+Removes a currently applied powerup. Specify ENT_TYPE.ITEM_POWERUP_xxx
, not ENT_TYPE.ITEM_PICKUP_xxx
! Removing the Eggplant crown does not seem to undo the throwing of eggplants, the other powerups seem to work.
-bool
-spike_shoes
-
+nil
+give_powerup(ENT_TYPE powerup_type)
+Gives the player/monster the specified powerup. Specify ENT_TYPE.ITEM_POWERUP_xxx
, not ENT_TYPE.ITEM_PICKUP_xxx
! Giving true crown to a monster crashes the game.
bool
-spring_shoes
-
+has_powerup(ENT_TYPE powerup_type)
+Checks whether the player/monster has a certain powerup
-bool
-parachute
-
+array<ENT_TYPE>
+get_powerups()
+Return all powerups that the entity has
-bool
-kapala
-
+nil
+unequip_backitem()
+Unequips the currently worn backitem
-bool
-scepter
-
+int
+worn_backitem()
+Returns the uid of the currently worn backitem, or -1 if wearing nothing
-ArenaConfigItems
-Used in ArenaState
+ProtoShopkeeper
+Derived from Entity Movable PowerupCapable Monster
@@ -5355,208 +22029,262 @@ ArenaConfigItems
-bool
-rock
-
+int
+movement_state
+1: "Headpulse/explosion related, 2: Walking, 3: Headpulse/explosion related, 4: Crawling, 6: Headpulse/explosion related
-bool
-pot
+int
+walk_pause_explode_timer
-bool
-bombbag
-
+int
+walking_speed
+0 = slow, 4 = fast
+
+Qilin
+Derived from Entity Movable PowerupCapable Mount
+
+
-bool
-bombbox
-
+Type
+Name
+Description
+
-bool
-ropepile
+SoundMeta
+fly_gallop_sound
-bool
-pickup_12bag
+int
+attack_cooldown
+
+Quillback
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
-bool
-pickup_24bag
-
+Type
+Name
+Description
+
-bool
-cooked_turkey
+SoundMeta
+sound
-bool
-royal_jelly
+ParticleEmitterInfo
+particle
bool
-torch
+seen_player
+
+Robot
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
-bool
-boomerang
-
+Type
+Name
+Description
+
-bool
-machete
+SoundMeta
+sound
-bool
-mattock
+Illumination
+emitted_light_explosion
+
+Rockdog
+Derived from Entity Movable PowerupCapable Mount
+
+
-bool
-crossbow
-
+Type
+Name
+Description
+
-bool
-webgun
+int
+attack_cooldown
+
+RoomOwner
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-freezeray
-
+Type
+Name
+Description
+
-bool
-shotgun
+int
+room_index
-bool
-camera
+float
+climb_y_direction
-bool
-plasma_cannon
+int
+ai_state
-bool
-wooden_shield
+int
+patrol_timer
-bool
-metal_shield
+int
+lose_interest_timer
-bool
-teleporter
-
+int
+countdown_timer
+can't shot when the timer is running
bool
-mine
+is_patrolling
bool
-snaptrap
-
+aggro_trigger
+setting this makes him angry, if it's shopkeeper you get 2 agrro points
bool
-paste
-
+was_hurt
+also is set true if you set aggro to true, get's trigger even when whiping
+
+Scarab
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-climbing_gloves
-
+Type
+Name
+Description
+
-bool
-pitchers_mitt
+SoundMeta
+sound
-bool
-spike_shoes
+Illumination
+emitted_light
-bool
-spring_shoes
-
+int
+timer
+how long to stay in current position
+
+Scorpion
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-parachute
-
+Type
+Name
+Description
+
-bool
-cape
+int
+walk_pause_timer
-bool
-vlads_cape
+int
+jump_cooldown_timer
+
+Shopkeeper
+Derived from Entity Movable PowerupCapable Monster RoomOwner
+
+
-bool
-jetpack
-
+Type
+Name
+Description
+
-bool
-hoverpack
-
+int
+name
+0 - Ali, 1 - Bob, 2 - Comso ... and so one, anything above 28 is just random string, can crash the game
-bool
-telepack
-
+int
+shotgun_attack_delay
+can't shot when the timer is running
bool
-powerpack
-
+has_key
+will drop key after stun/kill
bool
-excalibur
+is_ear
bool
-scepter
+shop_owner
+
+Skeleton
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-kapala
-
+Type
+Name
+Description
+
-bool
-true_crown
-
+int
+explosion_timer
+-1 = never explodes
-ArenaState
-Used in StateMemory
+Sorceress
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
@@ -5567,170 +22295,191 @@ ArenaState
int
-current_arena
-
-
-
-array<int, 4>
-player_teams
+inbetween_attack_timer
-int
-format
+float
+in_air_timer
-int
-ruleset
+Illumination
+halo_emitted_light
-array<int, 4>
-player_lives
+Entity
+fx_entity
-array<int, 4>
-player_totalwins
+SoundMeta
+sound
-array<bool, 4>
-player_won
+int
+hover_timer
+
+Spider
+Derived from Entity Movable PowerupCapable Monster
+
+
-int
-timer
-The menu selection for timer, default values 0..20 where 0 == 30 seconds, 19 == 10 minutes and 20 == infinite. Can go higher, although this will glitch the menu text. Actual time (seconds) = (state.arena.timer + 1) x 30
+Type
+Name
+Description
+
-int
-timer_ending
+float
+ceiling_pos_x
-int
-wins
+float
+ceiling_pos_y
int
-lives
-
+jump_timer
+For the giant spider, some times he shot web instead of jumping
-int
-time_to_win
-
+float
+trigger_distance
+only in the x coord
+
+Tadpole
+Derived from Entity Movable PowerupCapable Monster
+
+
-array<int, 4>
-player_idolheld_countdown
-
+Type
+Name
+Description
+
int
-health
+acceleration_timer
-int
-bombs
+bool
+player_spotted
+
+Terra
+Derived from Entity Movable PowerupCapable Monster
+
+
-int
-ropes
-
+Type
+Name
+Description
+
-int
-stun_time
+Entity
+fx_button
-int
-mount
+float
+x_pos
int
-arena_select
+abuse_speechbubble_timer
+
+Tiamat
+Derived from Entity Movable PowerupCapable Monster
+
+
-ArenaConfigArenas
-arenas
-
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+Turning into stone sound
int
-dark_level_chance
+fx_tiamat_head
int
-crate_frequency
+fx_tiamat_arm_right1
-ArenaConfigItems
-items_enabled
+int
+fx_tiamat_arm_right2
-ArenaConfigItems
-items_in_crate
+int
+frown_timer
int
-held_item
+damage_timer
int
-equipped_backitem
+attack_timer
-ArenaConfigEquippedItems
-equipped_items
+float
+tail_angle
-int
-whip_damage
+float
+tail_radian
-bool
-final_ghost
+float
+tail_move_speed
-int
-breath_cooldown
+float
+right_arm_angle
-bool
-punish_ball
-
+float
+attack_x
+This is custom variable, you need activate_tiamat_position_hack to use it
+
+
+float
+attack_y
+This is custom variable, you need activate_tiamat_position_hack to use it
-Callback context types
GuiDrawContext
-- Draw the level boundaries
-set_callback(function(draw_ctx)
- local xmin, ymax, xmax, ymin = get_bounds()
- local sx, sy = screen_position(xmin, ymax) -- top left
- local sx2, sy2 = screen_position(xmax, ymin) -- bottom right
- draw_ctx:draw_rect(sx, sy, sx2, sy2, 4, 0, rgba(255, 255, 255, 255))
-end, ON.GUIFRAME)
-
-
-Used in register_option_callback and set_callback with ON.GUIFRAME
+Tun
+Derived from Entity Movable PowerupCapable Monster RoomOwner
@@ -5740,224 +22489,256 @@ Callback context types
UFO
+Derived from Entity Movable PowerupCapable Monster
+
+
-nil
-draw_poly(array points, float thickness, uColor color)
-Draws a polyline on screen.
+Type
+Name
+Description
+
-nil
-draw_poly_filled(array points, uColor color)
-Draws a filled convex polyline on screen.
+SoundMeta
+sound
+
-nil
-draw_bezier_cubic(Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float thickness, uColor color)
-Draws a cubic bezier curve on screen.
+int
+patrol_distance
+
-nil
-draw_bezier_quadratic(Vec2 p1, Vec2 p2, Vec2 p3, float thickness, uColor color)
-Draws a quadratic bezier curve on screen.
+int
+attack_cooldown_timer
+
-nil
-draw_circle(float x, float y, float radius, float thickness, uColor color)
-Draws a circle on screen
+bool
+is_falling
+
+
+Vampire
+Derived from Entity Movable PowerupCapable Monster
+
+
-nil
-draw_circle_filled(float x, float y, float radius, uColor color)
-Draws a filled circle on screen
+Type
+Name
+Description
+
-nil
-draw_text(float x, float y, float size, string text, uColor color)
-Draws text in screen coordinates x
, y
, anchored top-left. Text size 0 uses the default 18.
+float
+jump_trigger_distance_x
+
-nil
-draw_image(IMAGE image, float left, float top, float right, float bottom, float uvx1, float uvy1, float uvx2, float uvy2, uColor color)
-Draws an image on screen from top-left to bottom-right. Use UV coordinates 0, 0, 1, 1
to just draw the whole image.
+float
+jump_trigger_distance_y
+
-nil
-draw_image(IMAGE image, AABB rect, AABB uv_rect, uColor color)
-Draws an image on screen from top-left to bottom-right. Use UV coordinates 0, 0, 1, 1
to just draw the whole image.
+float
+sleep_pos_x
+
-nil
-draw_image_rotated(IMAGE image, float left, float top, float right, float bottom, float uvx1, float uvy1, float uvx2, float uvy2, uColor color, float angle, float px, float py)
-Same as draw_image
but rotates the image by angle in radians around the pivot offset from the center of the rect (meaning px=py=0
rotates around the center)
+float
+sleep_pos_y
+
-nil
-draw_image_rotated(IMAGE image, AABB rect, AABB uv_rect, uColor color, float angle, float px, float py)
-Same as draw_image
but rotates the image by angle in radians around the pivot offset from the center of the rect (meaning px=py=0
rotates around the center)
+int
+walk_pause_timer
+
+
+VanHorsing
+Derived from Entity Movable PowerupCapable Monster NPC
+
+
-nil
-draw_layer(DRAW_LAYER layer)
-Draw on top of UI windows, including platform windows that may be outside the game area, or only in current widget window. Defaults to main viewport background.
+Type
+Name
+Description
+
bool
-window(string title, float x, float y, float w, float h, bool movable, function callback)
-Create a new widget window. Put all win_ widgets inside the callback function. The window functions are just wrappers for the
ImGui widgets, so read more about them there. Use screen position and distance, or 0, 0, 0, 0
to
autosize in center. Use just a ##Label
as title to hide titlebar.
Important: Keep all your labels unique! If you need inputs with the same label, add ##SomeUniqueLabel
after the text, or use pushid to
give things unique ids. ImGui doesn't know what you clicked if all your buttons have the same text...
Returns false if the window was closed from the X.
The callback signature is nil win(GuiDrawContext ctx, Vec2 pos, Vec2 size)
-
-
-nil
-win_text(string text)
-Add some text to window, automatically wrapped
-
-
-nil
-win_separator()
-Add a separator line to window
-
-
-nil
-win_separator_text(string text)
-Add a separator text line to window
-
-
-nil
-win_inline()
-Add next thing on the same line. This is same as win_sameline(0, -1)
-
-
-nil
-win_sameline(float offset, float spacing)
-Add next thing on the same line, with an offset
+show_text
+if set to true, he will say 'i've been hunting this fiend a long time!' when on screen
bool
-win_button(string text)
-Add a button
+special_message_shown
+one way door message has been shown
+
+Vlad
+Derived from Entity Movable PowerupCapable Monster Vampire
+
+
-string
-win_input_text(string label, string value)
-Add a text field
+Type
+Name
+Description
+
int
-win_input_int(string label, int value)
-Add an integer field
+teleport_timer
+triggers when Vlad teleports, when timer running he can't teleport and will stun when hit
-float
-win_input_float(string label, float value)
-Add a float field
+bool
+aggro
+or is awake
+
+Waddler
+Derived from Entity Movable PowerupCapable Monster RoomOwner
+
+
-int
-win_slider_int(string label, int value, int min, int max)
-Add an integer slider
+Type
+Name
+Description
+
+
+
+bool
+player_detected
+
+
+
+bool
+on_the_ground
+
int
-win_drag_int(string label, int value, int min, int max)
-Add an integer dragfield
+air_timer
+
+
+WalkingMonster
+Derived from Entity Movable PowerupCapable Monster
+
+
-float
-win_slider_float(string label, float value, float min, float max)
-Add an float slider
+Type
+Name
+Description
+
-float
-win_drag_float(string label, float value, float min, float max)
-Add an float dragfield
+int
+chatting_to_uid
+
-bool
-win_check(string label, bool value)
-Add a checkbox
+int
+walk_pause_timer
+alternates between walking and pausing every time it reaches zero
int
-win_combo(string label, int selected, string opts)
-Add a combo box
+cooldown_timer
+used for chatting with other monsters, attack cooldowns etc.
+
+WitchDoctor
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
-nil
-win_pushid(int id)
-Add unique identifier to the stack, to distinguish identical inputs from each other. Put before the input.
+Type
+Name
+Description
+
-nil
-win_pushid(string id)
-Add unique identifier to the stack, to distinguish identical inputs from each other. Put before the input.
+SoundMeta
+sound
+
-nil
-win_popid()
-Pop unique identifier from the stack. Put after the input.
+int
+skull_regen_timer
+
+
+WitchDoctorSkull
+Derived from Entity Movable PowerupCapable Monster
+
+
-nil
-win_image(IMAGE image, float width, float height)
-Draw image to window.
+Type
+Name
+Description
+
-bool
-win_imagebutton(string label, IMAGE image, float width, float height, float uvx1, float uvy1, float uvx2, float uvy2)
-Draw imagebutton to window.
+int
+witch_doctor_uid
+
-nil
-win_section(string title, function callback)
-Add a collapsing accordion section, put contents in the callback function.
+Illumination
+emitted_light
+
-nil
-win_indent(float width)
-Indent contents, or unindent if negative
+SoundMeta
+sound
+
-nil
-win_width(float width)
-Sets next item width (width>1: width in pixels, width<0: to the right of window, -1<width<1: fractional, multiply by available window width)
+float
+rotation_angle
+
-LoadContext
-Context received in ON.LOAD
-Used to load from save_{}.dat into a string
+Yama
+Derived from Entity Movable PowerupCapable Monster
@@ -5967,14 +22748,13 @@ LoadContext
-string
-load()
+bool
+message_shown
-PostRoomGenerationContext
-Context received in ON.POST_ROOM_GENERATION.
-Used to change the room templates in the level and other shenanigans that affect level gen.
+Yang
+Derived from Entity Movable PowerupCapable Monster RoomOwner
@@ -5984,54 +22764,64 @@ PostRoomGenerationContext
-bool
-set_room_template(int x, int y, LAYER layer, ROOM_TEMPLATE room_template)
-Set the room template at the given index and layer, returns false
if the index is outside of the level.
+set<int>
+turkeys_in_den
+Table of uid's of the turkeys, goes only up to 3, is nil when yang is angry
bool
-mark_as_machine_room_origin(int x, int y, LAYER layer)
-Marks the room as the origin of a machine room, should be the top-left corner of the machine room
Run this after setting the room template for the room, otherwise the machine room will not spawn correctly
+first_message_shown
+I'm looking for turkeys, wanna help?
bool
-mark_as_set_room(int x, int y, LAYER layer)
-Marks the room as a set-room, a corresponding setroomy-x
template must be loaded, else the game will crash
+quest_incomplete
+Is set to false when the quest is over (Yang dead or second turkey delivered)
bool
-unmark_as_set_room(int x, int y, LAYER layer)
-Unmarks the room as a set-room
+special_message_shown
+Tusk palace/black market/one way door - message shown
+
+
+YetiKing
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
-bool
-set_shop_type(int x, int y, LAYER layer, int shop_type)
-Set the shop type for a specific room, does nothing if the room is not a shop
+int
+walk_pause_timer
+
-bool
-set_procedural_spawn_chance(PROCEDURAL_CHANCE chance_id, int inverse_chance)
-Force a spawn chance for this level, has the same restrictions as specifying the spawn chance in the .lvl file.
Note that the actual chance to spawn is 1/inverse_chance
and that is also slightly skewed because of technical reasons.
Returns false
if the given chance is not defined.
+Illumination
+emitted_light
+
-nil
-set_num_extra_spawns(int extra_spawn_id, int num_spawns_front_layer, int num_spawns_back_layer)
-Change the amount of extra spawns for the given extra_spawn_id
.
+ParticleEmitterInfo
+particle_fog
+
-optional<SHORT_TILE_CODE>
-define_short_tile_code(ShortTileCodeDef short_tile_code_def)
-Defines a new short tile code, automatically picks an unused character or returns a used one in case of an exact match
Returns nil
if all possible short tile codes are already in use
+ParticleEmitterInfo
+particle_dust
+
-nil
-change_short_tile_code(SHORT_TILE_CODE short_tile_code, ShortTileCodeDef short_tile_code_def)
-Overrides a specific short tile code, this means it will change for the whole level
+ParticleEmitterInfo
+particle_sparkles
+
-PreHandleRoomTilesContext
-Context received in ON.PRE_HANDLE_ROOM_TILES.
-Used to change the room data as well as add a backlayer room if none is set yet.
+YetiQueen
+Derived from Entity Movable PowerupCapable Monster
@@ -6041,43 +22831,39 @@ PreHandleRoomTilesContext
-optional<SHORT_TILE_CODE>
-get_short_tile_code(int tx, int ty, LAYER layer)
-Gets the tile code at the specified tile coordinate
Valid coordinates are 0 <= tx < CONST.ROOM_WIDTH
, 0 <= ty < CONST.ROOM_HEIGHT
and layer
in {LAYER.FRONT, LAYER.BACK}
Also returns nil
if layer == LAYER.BACK
and the room does not have a back layer
-
-
-bool
-set_short_tile_code(int tx, int ty, LAYER layer, SHORT_TILE_CODE short_tile_code)
-Sets the tile code at the specified tile coordinate
Valid coordinates are 0 <= tx < CONST.ROOM_WIDTH
, 0 <= ty < CONST.ROOM_HEIGHT
and layer
in {LAYER.FRONT, LAYER.BACK, LAYER.BOTH}
Also returns false
if layer == LAYER.BACK
and the room does not have a back layer
-
-
-array<tuple<int, int, LAYER>>
-find_all_short_tile_codes(LAYER layer, SHORT_TILE_CODE short_tile_code)
-Finds all places a short tile code is used in the room, layer
must be in {LAYER.FRONT, LAYER.BACK, LAYER.BOTH}
Returns an empty list if layer == LAYER.BACK
and the room does not have a back layer
+int
+walk_pause_timer
+
+
+Movable entities
AcidBubble
+
+
+
-bool
-replace_short_tile_code(LAYER layer, SHORT_TILE_CODE short_tile_code, SHORT_TILE_CODE replacement_short_tile_code)
-Replaces all instances of short_tile_code
in the given layer with replacement_short_tile_code
, layer
must be in {LAYER.FRONT, LAYER.BACK, LAYER.BOTH}
Returns false
if layer == LAYER.BACK
and the room does not have a back layer
+Type
+Name
+Description
+
-bool
-has_back_layer()
-Check whether the room has a back layer
+float
+speed_x
+
-nil
-add_empty_back_layer()
-Add a back layer filled with all 0
if there is no back layer yet
Does nothing if there already is a backlayer
+float
+speed_y
+
-nil
-add_copied_back_layer()
-Add a back layer that is a copy of the front layer
Does nothing if there already is a backlayer
+float
+float_counter
+
-PreLoadLevelFilesContext
-Context received in ON.PRE_LOAD_LEVEL_FILES, used for forcing specific .lvl
files to load.
+AnkhPowerup
+Derived from Entity Movable Powerup
@@ -6087,20 +22873,43 @@ PreLoadLevelFilesContext
-nil
-override_level_files(array levels)
-Block all loading .lvl
files and instead load the specified .lvl
files. This includes generic.lvl
so if you need it specify it here.
All .lvl
files are loaded relative to Data/Levels
, but they can be completely custom .lvl
files that ship with your mod so long as they are in said folder.
Use at your own risk, some themes/levels expect a certain level file to be loaded.
+SoundMeta
+sound
+
-nil
-add_level_files(array levels)
-Load additional levels files other than the ones that would usually be loaded. Stacks with override_level_files
if that was called first.
All .lvl
files are loaded relative to Data/Levels
, but they can be completely custom .lvl
files that ship with your mod so long as they are in said folder.
+Entity
+player
+
+
+
+Entity
+fx_glow
+
+
+
+int
+timer1
+
+
+
+int
+timer2
+
+
+
+int
+timer3
+
+
+
+bool
+music_on_off
+
-SaveContext
-Context received in ON.SAVE
-Used to save a string to some form of save_{}.dat
-Future calls to this will override the save
+Arrow
+Derived from Entity Movable Purchasable
@@ -6110,13 +22919,38 @@ SaveContext
+int
+flame_uid
+
+
+
bool
-save(string data)
+is_on_fire
+
+
+
+bool
+is_poisoned
+
+
+
+bool
+shot_from_trap
+
+
+
+nil
+poison_arrow(bool poisoned)
+
+
+
+nil
+light_up(bool lit)
-VanillaRenderContext
-Used in set_callback ON.RENDER_ callbacks, set_post_render, set_post_render_screen, set_pre_render, set_pre_render_screen
+AxolotlShot
+Derived from Entity Movable Projectile
@@ -6126,193 +22960,231 @@ VanillaRenderContext
-nil
-draw_text(const string& text, float x, float y, float scale_x, float scale_y, Color color, VANILLA_TEXT_ALIGNMENT alignment, VANILLA_FONT_STYLE fontstyle)
-Draw text using the built-in renderer
Use in combination with ON.RENDER_✱ events. See vanilla_rendering.lua in the example scripts.
-
-
-nil
-draw_text(const TextRenderingInfo tri, Color color)
+int
+trapped_uid
-tuple<float, float>
-draw_text_size(const string& text, float scale_x, float scale_y, int fontstyle)
-Measure the provided text using the built-in renderer
If you can, consider creating your own TextRenderingInfo instead
You can then use :text_size()
and draw_text
with that one object
draw_text_size
works by creating new TextRenderingInfo just to call :text_size()
, which is not very optimal
-
-
-nil
-draw_screen_texture(TEXTURE texture_id, int row, int column, float left, float top, float right, float bottom, Color color)
-Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+float
+size
+
-nil
-draw_screen_texture(TEXTURE texture_id, int row, int column, const AABB& rect, Color color)
-Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+float
+swing
+
-nil
-draw_screen_texture(TEXTURE texture_id, int row, int column, const AABB& rect, Color color, float angle, float px, float py)
-Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer with angle, px/py is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+float
+swing_periodicity
+
-nil
-draw_screen_texture(TEXTURE texture_id, int row, int column, const Quad& dest, Color color)
-Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+float
+distance_after_capture
+
+
+Backpack
+
+
+
-nil
-draw_screen_texture(TEXTURE texture_id, const Quad& source, const Quad& dest, Color color)
-Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer. source
- the coordinates in the texture, dest
- the coordinates on the screen
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+Type
+Name
+Description
+
-nil
-draw_screen_texture(TEXTURE texture_id, TextureRenderingInfo tri, Color color)
-Draw a texture in screen coordinates using TextureRenderingInfo
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+bool
+explosion_trigger
+More like on fire trigger, the explosion happens when the timer reaches > 29
-nil
-set_corner_finish(CORNER_FINISH c)
-Set the prefered way of drawing corners for the non filled shapes
+int
+explosion_timer
+
nil
-draw_screen_line(const Vec2& A, const Vec2& B, float thickness, Color color)
-Draws a line on screen using the built-in renderer from point A
to point B
.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+trigger_explosion()
+
+
+Birdies
+
+
+
-nil
-draw_screen_rect(const AABB& rect, float thickness, Color color, optional angle, optional px, optional py)
-Draw rectangle in screen coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc. (corner from the AABB, not the visible one from adding the thickness
)
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+Type
+Name
+Description
+
+
+Bomb
+
+
+
-nil
-draw_screen_rect_filled(const AABB& rect, Color color, optional angle, optional px, optional py)
-Draw filled rectangle in screen coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+Type
+Name
+Description
+
-nil
-draw_screen_triangle(const Triangle& triangle, float thickness, Color color)
-Draw triangle in screen coordinates using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+SoundMeta
+sound
+
-nil
-draw_screen_triangle_filled(const Triangle& triangle, Color color)
-Draw filled triangle in screen coordinates using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+float
+scale_hor
+1.25 = default regular bomb, 1.875 = default giant bomb, > 1.25 generates ENT_TYPE_FX_POWEREDEXPLOSION
-nil
-draw_screen_poly(array points, float thickness, Color color, bool closed)
-Draw a polyline on screen from points using the built-in renderer
Draws from the first to the last point, use closed
to connect first and last as well
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+float
+scale_ver
+
-nil
-draw_screen_poly(const Quad& points, float thickness, Color color, bool closed)
-Draw quadrilateral in screen coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+bool
+is_big_bomb
+is bomb from powerpack
+
+BoneBlock
+
+
+
-nil
-draw_screen_poly_filled(array points, Color color)
-Draw a convex polygon on screen from points using the built-in renderer
Can probably draw almost any polygon, but the convex one is guaranteed to look correct
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+Type
+Name
+Description
+
+
+Boombox
+
+
+
-nil
-draw_screen_poly_filled(const Quad& points, Color color)
-Draw filled quadrilateral in screen coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+Type
+Name
+Description
+
-nil
-draw_world_texture(TEXTURE texture_id, int row, int column, float left, float top, float right, float bottom, Color color)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a Quad instead
+Entity
+fx_button
+
-nil
-draw_world_texture(TEXTURE texture_id, int row, int column, const AABB& dest, Color color)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a Quad instead
+ParticleEmitterInfo
+music_note1
+
-nil
-draw_world_texture(TEXTURE texture_id, int row, int column, const AABB& dest, Color color, float angle, float px, float py)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer with angle, px/py is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a Quad instead
+ParticleEmitterInfo
+music_note2
+
-nil
-draw_world_texture(TEXTURE texture_id, int row, int column, const Quad& dest, Color color, WORLD_SHADER shader)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
The shader
parameter controls how to render the texture
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+float
+spawn_y
+
-nil
-draw_world_texture(TEXTURE texture_id, int row, int column, const Quad& dest, Color color)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+int
+station
+
-nil
-draw_world_texture(TEXTURE texture_id, const Quad& source, const Quad& dest, Color color, WORLD_SHADER shader)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer. source
- the coordinates in the texture, dest
- the coordinates on the screen
The shader
parameter controls how to render the texture
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+int
+station_change_delay
+
-nil
-draw_world_texture(TEXTURE texture_id, const Quad& source, const Quad& dest, Color color)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer. source
- the coordinates in the texture, dest
- the coordinates on the screen
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+int
+jump_timer
+
-nil
-draw_world_line(const Vec2& A, const Vec2& B, float thickness, Color color)
-Draws a line in world coordinates using the built-in renderer from point A
to point B
.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+int
+jump_state
+
+
+Boomerang
+Derived from Entity Movable Purchasable
+
+
-nil
-draw_world_rect(const AABB& rect, float thickness, Color color, optional angle, optional px, optional py)
-Draw rectangle in world coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc. (corner from the AABB, not the visible one from adding the thickness
)
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+Type
+Name
+Description
+
-nil
-draw_world_rect_filled(const AABB& rect, Color color, optional angle, optional px, optional py)
-Draw rectangle in world coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+SoundMeta
+sound
+
-nil
-draw_world_triangle(const Triangle& triangle, float thickness, Color color)
-Draw triangle in world coordinates using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+ParticleEmitterInfo
+trail
+
-nil
-draw_world_triangle_filled(const Triangle& triangle, Color color)
-Draw filled triangle in world coordinates using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+float
+distance
+
-nil
-draw_world_poly(array points, float thickness, Color color, bool closed)
-Draw a polyline in world coordinates from points using the built-in renderer
Draws from the first to the last point, use closed
to connect first and last as well
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+float
+rotation
+
-nil
-draw_world_poly(const Quad& points, float thickness, Color color, bool closed)
-Draw quadrilateral in world coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+int
+returns_to_uid
+
+
+Boulder
+
+
+
-nil
-draw_world_poly_filled(array points, Color color)
-Draw a convex polygon in world coordinates from points using the built-in renderer
Can probably draw almost any polygon, but the convex one is guaranteed to look correct
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+Type
+Name
+Description
+
-nil
-draw_world_poly_filled(const Quad& points, Color color)
-Draw filled quadrilateral in world coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+int
+is_rolling
+is set to 1 when the boulder first hits the ground
+
+Bow
+Derived from Entity Movable Purchasable
+
+
-AABB
-bounding_box
-
+Type
+Name
+Description
+
-
-render_draw_depth
+float
+get_arrow_special_offset()
-Entity related types
Ai
-Used in Player
+Bullet
+Derived from Entity Movable Projectile
@@ -6321,49 +23193,61 @@ Entity related types
Ai
Description
+
+Button
+
+
+
-Entity
-target
-
+Type
+Name
+Description
+
int
-target_uid
-
+button_sprite
+Only one can be set:
1 - pad: A, key: Z
2 - pad: X, key: X
4 - pad: B, key: C
8 - pad: Y, key: D
16 - pad: LB, key: L Shift
32 - pad: RB, key: A
64 - pad: menu?, key: (none)
128 - pad: copy?, key: Tab
-int
-timer
+float
+visibility
-int
-state
-AI state (patrol, sleep, attack, aggro...)
+bool
+is_visible
+It's false for selldialog used in shops
-int
-last_state
-
+bool
+player_trigger
+It's set true even if player does not see the button, like the drill or COG door
int
-trust
-Levels completed with, 0..3
+seen
+
-1 - hasn't been seen
0 - last seen by player 1
1 - last seen by player 2
2 - last seen by player 3
3 - last seen by player 4
+
+Cape
+Derived from Entity Movable Backpack
+
+
-int
-whipped
-Number of times whipped by player
+Type
+Name
+Description
-
-int
-walk_pause_timer
-positive: walking, negative: wating/idle
+
+
+bool
+floating_down
+
-Animation
-Used in EntityDB
+Chain
+
@@ -6374,88 +23258,33 @@ Animation
int
-id
-
-
-
-int
-first_tile
+attached_to_uid
int
-num_tiles
+timer
+
+ChainedPushBlock
+Derived from Entity Movable PushBlock
+
+
-int
-interval
-
+Type
+Name
+Description
+
-REPEAT_TYPE
-repeat_mode
+bool
+is_chained
-EntityDB
-
-When cloning an entity type, remember to save it in the script for as long as you need it. Otherwise the memory will be freed immediately, which eventually leads to a crash when used or overwritten by other stuff:
-
--- Create a special fast snake type with weird animation
-special_snake = EntityDB:new(ENT_TYPE.MONS_SNAKE)
-special_snake.max_speed = 1
-special_snake.acceleration = 2
-special_snake.animations[2].num_tiles = 1
-
-set_post_entity_spawn(function(snake)
- -- 50% chance to make snakes special
- if prng:random_chance(2, PRNG_CLASS.PROCEDURAL_SPAWNS) then
- -- Assign custom type
- snake.type = special_snake
- -- This is only really needed if types are changed during the level
- snake.current_animation = special_snake.animations[2]
- end
-end, SPAWN_TYPE.ANY, MASK.MONSTER, ENT_TYPE.MONS_SNAKE)
-
-
-You can also use Entity.user_data to store the custom type:
-
--- Custom player who is buffed a bit every level
-set_callback(function()
- -- Doing this to include HH
- for i,v in ipairs(get_entities_by_mask(MASK.PLAYER)) do
- local player = get_entity(v)
-
- -- Create new custom type on the first level, based on the original type
- if not player.user_data then
- player.user_data = {}
- player.user_data.type = EntityDB:new(player.type.id)
- end
-
- -- Set the player entity type to the custom type every level
- player.type = player.user_data.type
-
- -- Buff the player every subsequent level
- if state.level_count > 0 then
- player.type.max_speed = player.type.max_speed * 1.1
- player.type.acceleration = player.type.acceleration * 1.1
- player.type.jump = player.type.jump * 1.1
- end
- end
-end, ON.POST_LEVEL_GENERATION)
-
-
-Illegal bad example, don't do this:
-
-set_callback(function()
- -- Nobody owns the new type and the memory is freed immediately, eventually leading to a crash
- players[1].type = EntityDB:new(players[1].type)
- players[1].type.max_speed = 2
-end, ON.POST_LEVEL_GENERATION)
-
-Used in Entity and get_type
-Stores static common data for an ENT_TYPE. You can also clone entity types with the copy constructor to create new custom entities with different common properties. This tool can be helpful when messing with the animations. The default values are also listed in entities.json.
+Chest
+
@@ -6465,202 +23294,306 @@ EntityDB
-EntityDB
-new(EntityDB other)
+bool
+leprechaun
-EntityDB
-new(ENT_TYPE)
-
+bool
+bomb
+size of the bomb is random, if set both true only leprechaun spawns
+
+
+ClamBase
+
+
+
+
+Type
+Name
+Description
+
ENT_TYPE
-id
+treasure_type
int
-search_flags
-MASK
+treasure_uid
+
float
-width
+treasure_x_pos
float
-height
+treasure_y_pos
-float
-offsetx
+int
+top_part_uid
+
+Claw
+
+
+
+
+Type
+Name
+Description
+
+
-float
-offsety
+int
+crabman_uid
float
-hitboxx
+spawn_x
float
-hitboxy
+spawn_y
+
+ClimbableRope
+
+
+
-int
-draw_depth
-
+Type
+Name
+Description
+
int
-collision2_mask
-MASK, will only call collision2 when colliding with entities that match this mask.
+segment_nr_inverse
+
int
-collision_mask
-MASK used for collision with floors.
+burn_timer
+entity is killed after 20
-float
-friction
+Entity
+above_part
-float
-elasticity
+Entity
+below_part
-float
-weight
+int
+segment_nr
+
+CloneGunShot
+Derived from Entity Movable Projectile LightShot
+
+
-float
-acceleration
-
+Type
+Name
+Description
+
-float
-max_speed
+int
+timer
float
-sprint_factor
+spawn_y
+
+Coffin
+
+
+
-float
-jump
-
+Type
+Name
+Description
+
-float
-glow_red
+ENT_TYPE
+inside
-float
-glow_green
+int
+timer
-float
-glow_blue
+bool
+player_respawn
+
+Coin
+
+
+
-float
-glow_alpha
-
+Type
+Name
+Description
+
int
-damage
+nominal_price
+
+Container
+
+
+
-int
-life
+Type
+Name
+Description
+
+
+
+ENT_TYPE
+inside
+
+CookFire
+Derived from Entity Movable Torch
+
+
-int
-sacrifice_value
-Favor for sacrificing alive. Halved when dead (health == 0).
+Type
+Name
+Description
+
-int
-blood_content
+Illumination
+emitted_light
-int
-texture
+ParticleEmitterInfo
+particles_smoke
-map<int, Animation>
-animations
+ParticleEmitterInfo
+particles_flames
-int
-properties_flags
+ParticleEmitterInfo
+particles_warp
-int
-default_flags
+SoundMeta
+sound
+
+CrushElevator
+
+
+
-int
-default_more_flags
+Type
+Name
+Description
+
+
+
+float
+y_limit
+This is custom variable, you need activate_crush_elevator_hack to use it
+
+
+float
+speed
+This is custom variable, you need activate_crush_elevator_hack to use it
+
+
+Crushtrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+float
+dirx
-bool
-leaves_corpse_behind
+float
+diry
int
-sound_killed_by_player
-
+timer
+counts from 30 to 0 before moving, after it stops, counts from 60 to 0 before it can be triggered again
int
-sound_killed_by_other
-
+bounce_back_timer
+counts from 7 to 0 after it hits the wall and moves away until the timer hits 0, then moves back and counts from 255 until it hits the wall again, if needed it will start the counter again for another bounce
+
+CursedPot
+
+
+
-STRINGID
-description
-
+Type
+Name
+Description
+
-int
-tilex
+ParticleEmitterInfo
+smoke
-int
-tiley
+ParticleEmitterInfo
+smoke2
-HudInventory
+CustomMovableBehavior
+Opaque handle to a custom movable behavior from a script mod
+Derived from MovableBehavior
+
Type
@@ -6669,68 +23602,101 @@ HudInventory
-bool
-enabled
+VanillaMovableBehavior
+base_behavior
-int
-health
-
+nil
+set_force_state(function force_state)
+Set the force_state
function of a CustomMovableBehavior
, this will be called every frame when
the movable is updated. If an force_state
is already set it will be overridden. The signature
of the function is bool force_state(Movable movable, function base_fun)
, when the function returns true
the movable will
enter this behavior. If no base behavior is set base_fun
will be nil
.
-int
-bombs
-
+nil
+set_on_enter(function on_enter)
+Set the on_enter
function of a CustomMovableBehavior
, this will be called when the movable
enters the state. If an on_enter
is already set it will be overridden. The signature of the
function is nil on_enter(Movable movable, function base_fun))
. If no base behavior is set base_fun
will be nil
.
-int
-ropes
-
+nil
+set_on_exit(function on_exit)
+Set the on_exit
function of a CustomMovableBehavior
, this will be called when the movable
leaves the state. If an on_exit
is already set it will be overridden. The signature of the
function is nil on_exit(Movable movable, function base_fun))
. If no base behavior is set base_fun
will be nil
.
-bool
-ankh
-
+nil
+set_update_logic(function update_logic)
+Set the update_logic
function of a CustomMovableBehavior
, this will be called every frame when
the movable is updated. If an update_logic
is already set it will be overridden. The signature
of the function is nil update_logic(Movable movable, function base_fun))
, use it to change the color, texture,
some timers, etc. of the movable. If no base behavior is set base_fun
will be nil
.
-bool
-kapala
-
+nil
+set_update_world(function update_world)
+Set the update_world
function of a CustomMovableBehavior
, this will be called every frame when
the movable is updated. If an update_world
is already set it will be overridden. The signature
of the function is nil update_world(Movable movable, function base_fun))
, use this to update the move, velocity,
current_animation, etc. of the movable, then call mov:generic_update_world
to update the movable. If no
base behavior is set base_fun
will be nil
.
-int
-kapala_blood
+nil
+set_get_next_state_id(function get_next_state_id)
+Set the get_next_state_id
function of a CustomMovableBehavior
, this will be called every frame when
the movable is updated. If an get_next_state_id
is already set it will be overridden. The signature
of the function is int get_next_state_id(Movable movable, function base_fun))
, use this to move to another state, return nil
.
or this behaviors state_id
to remain in this behavior. If no base behavior is set base_fun
will be nil
.
+
+
+Drill
+
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound1
-bool
-poison
+SoundMeta
+sound2
-bool
-curse
+Entity
+top_chain_piece
-bool
-elixir
+nil
+trigger()
+
+DummyPurchasableEntity
+Derived from Entity Movable Purchasable
+
+
-ENT_TYPE
-crown
-Powerup type or 0
+Type
+Name
+Description
+
+
+
+EggSac
+
+
+
+
+Type
+Name
+Description
+
int
-item_count
-Amount of generic pickup items at the bottom. Set to 0 to not draw them.
+timer
+
-Inventory
-Used in Player, PlayerGhost and Items
+EggshipCenterJetFlame
+
@@ -6740,158 +23706,240 @@ Inventory
-int
-money
-Sum of the money collected in current level
+SoundMeta
+sound
+
-int
-bombs
+Illumination
+emitted_light
-int
-ropes
+ParticleEmitterInfo
+particle
-int
-player_slot
+bool
+smoke_on
+
+
+
+Elevator
+
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
int
-poison_tick_timer
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+timer
+pause timer, counts down 60 to 0
bool
-cursed
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+moving_up
+
+
+EmpressGrave
+
+
+
-bool
-elixir_buff
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
-int
-health
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Entity
+fx_button
+
-int
-kapala_blood_amount
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Entity
+ghost
+
+
+Excalibur
+
+
+
-int
-time_of_death
-Is set to state.time_total when player dies in coop (to determinate who should be first to re-spawn from coffin)
+Type
+Name
+Description
+
-ENT_TYPE
-held_item
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+bool
+in_stone
+
+
+Explosion
+
+
+
-int
-held_item_metadata
-Metadata of the held item (health, is cursed etc.)
Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
-ENT_TYPE
-mount_type
-Used to transfer information to transition/next level (player rading a mout). Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Illumination
+emitted_light
+
+
+FallingPlatform
+
+
+
-int
-mount_metadata
-Metadata of the mount (health, is cursed etc.)
Used to transfer information to transition/next level (player rading a mout). Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
int
-kills_level
+timer
-int
-kills_total
+float
+shaking_factor
-int
-collected_money_total
-Total money collected during previous levels (so excluding the current one)
+float
+y_pos
+
+
+Fireball
+Derived from Entity Movable Projectile LightShot SoundShot
+
+
-int
-collected_money_count
-Count/size for the collected_money
arrays
+Type
+Name
+Description
+
-array<ENT_TYPE, 512>
-collected_money
-Types of gold/gems collected during this level, used later to display during the transition
+ParticleEmitterInfo
+particle
+
+
+Flame
+
+
+
-array<int, 512>
-collected_money_values
-Values of gold/gems collected during this level, used later to display during the transition
+Type
+Name
+Description
+
-array<ENT_TYPE, 256>
-killed_enemies
-Types of enemies killed during this level, used later to display during the transition
+SoundMeta
+sound
+
-int
-companion_count
-Number of companions, it will determinate how many companions will be transfered to next level
Increments when player acquires new companion, decrements when one of them dies
+Illumination
+emitted_light
+
+
+FlameSize
+Derived from Entity Movable Flame
+
+
-array<ENT_TYPE, 8>
-companions
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
-array<ENT_TYPE, 8>
-companion_held_items
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+float
+flame_size
+if changed, gradually goes down (0.03 per frame) to the default size
+
+Fly
+
+
+
-array<int, 8>
-companion_held_item_metadatas
-Metadata of items held by companions (health, is cursed etc.)
Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
-array<int, 8>
-companion_trust
-(0..3) Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+int
+timer
+
+
+FlyHead
+
+
+
-array<int, 8>
-companion_health
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
-array<int, 8>
-companion_poison_tick_timers
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+int
+vored_entity_uid
+
+
+FrozenLiquid
+
+
+
-array<bool, 8>
-is_companion_cursed
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
+
+FxAlienBlast
+
+
+
-array<ENT_TYPE, 30>
-acquired_powerups
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
-Generic types
AABB
-Axis-Aligned-Bounding-Box, represents for example a hitbox of an entity or the size of a gui element
+FxAnkhBrokenPiece
+
@@ -6900,109 +23948,155 @@ Generic types
AABB
Description
+
+FxAnkhRotatingSpark
+
+
+
-AABB
-new()
-Create a new axis aligned bounding box - defaults to all zeroes
+Type
+Name
+Description
+
-AABB
-new(AABB)
-Copy an axis aligned bounding box
+float
+radius
+
-AABB
-new(Vec2 top_left, Vec2 bottom_right)
+float
+inclination
-AABB
-new(float left_, float top_, float right_, float bottom_)
-Create a new axis aligned bounding box by specifying its values
+float
+speed
+0 - 1.0
float
-left
+sine_angle
float
-bottom
+size
+
+FxCompass
+
+
+
+
+Type
+Name
+Description
+
+
float
-right
-
+sine_angle
+Counts form 0 to 2pi, responsible for moving back and forth
float
-top
+visibility
bool
-overlaps_with(const AABB& other)
-
+is_active
+Player has compass
+
+FxEmpress
+
+
+
-AABB&
-abs()
-Fixes the AABB if any of the sides have negative length
+Type
+Name
+Description
+
-AABB&
-extrude(float amount)
-Grows or shrinks the AABB by the given amount in all directions.
If amount < 0
and abs(amount) > right/top - left/bottom
the respective dimension of the AABB will become 0
.
+float
+sine_angle
+
+
+FxFireflyLight
+
+
+
-AABB&
-extrude(float amount_x, float amount_y)
-Grows or shrinks the AABB by the given amount in each direction.
If amount_x/y < 0
and abs(amount_x/y) > right/top - left/bottom
the respective dimension of the AABB will become 0
.
+Type
+Name
+Description
+
-AABB&
-offset(float off_x, float off_y)
-Offsets the AABB by the given offset.
+Illumination
+illumination
+
-float
-area()
-Compute area of the AABB, can be zero if one dimension is zero or negative if one dimension is inverted.
+int
+light_timer
+
-tuple<float, float>
-center()
-Short for (aabb.left + aabb.right) / 2.0f, (aabb.top + aabb.bottom) / 2.0f
.
+int
+cooldown_timer
+Timer between light flashes
+
+FxHundunNeckPiece
+
+
+
-float
-width()
-Short for aabb.right - aabb.left
.
+Type
+Name
+Description
+
-float
-height()
-Short for aabb.top - aabb.bottom
.
+int
+kill_timer
+Short timer after the head is dead
+
+
+FxJellyfishStar
+
+
+
+
+Type
+Name
+Description
+
-bool
-is_point_inside(const Vec2 p)
-Checks if point lies between left/right and top/bottom
+float
+rotation_angle
+
-bool
-is_point_inside(float x, float y)
+float
+radius
-tuple<float, float, float, float>
-split()
+float
+speed
-BackgroundMusic
-Used in GameManager
+FxJetpackFlame
+
@@ -7012,90 +24106,151 @@ BackgroundMusic
-BackgroundSound
-game_startup
+ParticleEmitterInfo
+particle_smoke
-BackgroundSound
-main_backgroundtrack
+ParticleEmitterInfo
+particle_flame
-BackgroundSound
-basecamp
+SoundMeta
+sound
-BackgroundSound
-win_scene
+Illumination
+illumination
+
+FxKinguSliding
+
+
+
-BackgroundSound
-arena
-
+Type
+Name
+Description
+
-BackgroundSound
-arena_intro_and_win
+ParticleEmitterInfo
+particle
+
+FxLamassuAttack
+
+
+
-BackgroundSound
-level_gameplay
-
+Type
+Name
+Description
+
-BackgroundSound
-dark_level
+float
+attack_angle
+
+FxMainExitDoor
+
+
+
-BackgroundSound
-level_transition
-
+Type
+Name
+Description
+
-BackgroundSound
-backlayer
+Illumination
+emitted_light
-BackgroundSound
-shop
+int
+timer
+When breaking open in tutorial
+
+
+FxNecromancerANKH
+
+
+
+
+Type
+Name
+Description
+
+
+
+FxOuroboroDragonPart
+
+
+
+
+Type
+Name
+Description
+
+
+
+float
+speed
-BackgroundSound
-angered_shopkeeper
+int
+timer
-BackgroundSound
-inside_sunken_city_pipe
+ParticleEmitterInfo
+particle
+
+FxOuroboroOccluder
+
+
+
-BackgroundSound
-pause_menu
+Type
+Name
+Description
+
+
+
+FxPickupEffect
+
+
+
+
+Type
+Name
+Description
+
+
+
+float
+spawn_y
-BackgroundSound
-death_transition
+float
+visibility
-Color
-- make a semi transparent red color and print it in different formats
-local color = Color:red()
-color.a = 0.5
-local r, g, b, a = color:get_rgba()
-prinspect(r, g, b, a) -- 255, 0, 0, 128
-prinspect(color.r, color.g, color.b, color.a) -- 1.0, 0.0, 0.0, 0.5
-prinspect(string.format("%x"), color:get_ucolor()) -- 800000ff
+FxPlayerIndicator
+
-
Type
@@ -7104,155 +24259,161 @@ Color
Color
-new()
-Create a new color - defaults to black
-
-
-Color
-new(Color)
-
-
-
-Color
-new(float r_, float g_, float b_, float a_)
-Create a new color by specifying its values
-
-
-float
-r
+int
+attached_to
float
-g
+pos_x
float
-b
+pos_y
+
+FxQuickSand
+
+
+
-float
-a
-
+Type
+Name
+Description
+
+
+FxSaleContainer
+
+
+
-Color
-white()
-
+Type
+Name
+Description
+
-Color
-silver()
+Entity
+fx_value
-Color
-gray()
+Entity
+fx_icon
-Color
-black()
+Entity
+fx_button
-Color
-red()
-
+float
+shake_amplitude
+For effect when you don't have enough money
-Color
-maroon()
-
+bool
+sound_trigger
+Also sound_played, keeps re-triggering from time to time
-Color
-yellow()
+int
+pop_in_out_procentage
+
+FxShotgunBlast
+
+
+
-Color
-olive()
-
+Type
+Name
+Description
+
-Color
-lime()
+Illumination
+illumination
+
+FxSorceressAttack
+
+
+
-Color
-green()
-
+Type
+Name
+Description
+
-Color
-aqua()
+float
+size
+
+FxSparkSmall
+
+
+
-Color
-teal()
-
+Type
+Name
+Description
+
-Color
-blue()
+int
+timer
+
+FxSpringtrapRing
+
+
+
-Color
-navy()
-
+Type
+Name
+Description
+
-Color
-fuchsia()
+int
+timer
-Color
-purple()
+Illumination
+illumination
+
+FxTiamatHead
+
+
+
-tuple<int, int, int, int>
-get_rgba()
-Returns RGBA colors in 0..255 range
-
-
-Color&
-set_rgba(int red, int green, int blue, int alpha)
-Changes color based on given RGBA colors in 0..255 range
-
-
-uColor
-get_ucolor()
-Returns the uColor
used in GuiDrawContext
drawing functions
+Type
+Name
+Description
+
-Color&
-set_ucolor(const uColor color)
-Changes color based on given uColor
+int
+timer
+
-Hud
set_callback(function(ctx, hud)
- -- draw on screen bottom but keep neat animations
- if hud.y > 0 then hud.y = -hud.y end
- -- spoof some values
- hud.data.inventory[1].health = prng:random_int(1, 99, 0)
- -- hide generic pickup items
- hud.data.inventory[1].item_count = 0
- -- hide money element
- hud.data.money.opacity = 0
- -- get real current opacity of p1 inventory element
- prinspect(hud.data.players[1].opacity * hud.data.opacity * hud.opacity)
-end, ON.RENDER_PRE_HUD)
+FxTiamatTail
+
-
Type
@@ -7262,21 +24423,23 @@ Hud
<
float
-y
-
+angle_two
+Added _two just to not shadow angle in entity, it's angle but the pivot point is at the edge
float
-opacity
+x_pos
-HudData
-data
+float
+y_pos
-HudData
+FxTiamatTorso
+
+
Type
@@ -7285,77 +24448,82 @@ HudData
-array<HudInventory, MAX_PLAYERS>
-inventory
-
-
-
-bool
-udjat
-
-
-
int
-money_total
+timer
-int
-money_counter
-
+float
+torso_target_size
+Slowly increases/decreases to the given value
+
+FxTornJournalPage
+
+
+
-int
-time_total
-
+Type
+Name
+Description
+
int
-time_level
-
+page_number
+Only in tutorial
+
+FxUnderwaterBubble
+
+
+
-int
-world_num
-
+Type
+Name
+Description
+
int
-level_num
+bubble_source_uid
int
-seed
-
-
-
-float
-opacity
-
+direction
+1 / -1
-array<HudPlayer, MAX_PLAYERS>
-players
-
+bool
+pop
+Setting it true makes it disappear/fade away
-HudMoney
-money
+bool
+inverted
+
+FxVatBubble
+
+
+
-HudElement
-timer
-
+Type
+Name
+Description
+
-HudElement
-level
+float
+max_y
-HudElement
+FxWaterDrop
+
+
Type
@@ -7365,22 +24533,17 @@ HudElement
bool
-dim
-Hide background and dim if using the auto adjust setting.
-
-
-float
-opacity
-Background will be drawn if this is not 0.5
+inverted
+
int
-time_dim
-Level time when element should dim again after hilighted, INT_MAX if dimmed on auto adjust. 0 on opaque.
+droplet_source_uid
+
-HudMoney
-Derived from HudElement
+FxWebbedEffect
+
@@ -7390,23 +24553,13 @@ HudMoney
-int
-total
-
-
-
-int
-counter
-
-
-
-int
-timer
+bool
+visible
-HudPlayer
-Derived from HudElement
+FxWitchdoctorHint
+
@@ -7415,24 +24568,30 @@ HudPlayer
Description
+
+GhostBreath
+Derived from Entity Movable Projectile
+
+
-int
-health
-
+Type
+Name
+Description
+
int
-bombs
+timer
-int
-ropes
+bool
+big_cloud
-ItemOwnerDetails
-Used in RoomOwnersInfo
+GiantClamTop
+
@@ -7442,17 +24601,19 @@ ItemOwnerDetails
-ENT_TYPE
-owner_type
+int
+close_timer
int
-owner_uid
+open_timer
-Letter
+Goldbar
+
+
Type
@@ -7460,34 +24621,9 @@ Letter
Description
-
-Triangle
-bottom
-
-
-
-Triangle
-top
-
-
-
-Quad
-get_quad()
-Get the Quad of a letter (easier to work with compared to the two triangles)
This assumes that the triangles are in the correct 'touching each other' position
if the positions were altered the results may not end up as expected
-
-
-nil
-set_quad(Quad quad)
-Inverse of the get_quad
-
-
-Vec2
-center()
-Get's approximated center of a letter by finding the highest and lowest values, then finding the center of a rectangle build from those values
-
-MagmamanSpawnPosition
-Used in LogicList
+Gun
+Derived from Entity Movable Purchasable
@@ -7497,28 +24633,28 @@ MagmamanSpawnPosition
-MagmamanSpawnPosition
-new(int x_, int y_)
+int
+cooldown
int
-x
-
+shots
+used only for webgun
int
-y
-
+shots2
+used only for clonegun
int
-timer
-
+in_chamber
+Only for webgun, uid of the webshot entity
-MovableBehavior
-Opaque handle to a movable behavior used in some Movable functions
+HangAnchor
+
@@ -7529,20 +24665,12 @@ MovableBehavior
int
-get_state_id()
+spider_uid
-
-int
-get_state_id()
-Get the state_id
of a behavior, this is the id that needs to be returned from a behavior's
get_next_state_id
to enter this state, given that the behavior is added to the movable.
-
-PRNG
-PRNG (short for Pseudo-Random-Number-Generator) holds 10 128bit wide buffers of memory that are mutated on every generation of a random number.
-The game uses specific buffers for specific scenarios, for example the third buffer is used every time particles are spawned to determine a random velocity.
-The used buffer is determined by PRNG_CLASS. If you want to make a mod that does not affect level generation but still uses the prng then you want to stay away from specific buffers.
-If you don't care what part of the game you affect just use prng.random
.
+HangStrand
+
@@ -7552,57 +24680,51 @@ PRNG
-nil
-seed(int seed)
-Same as seed_prng
-
-
float
-random_float(PRNG_CLASS type)
-Generate a random floating point number in the range [0, 1)
-
-
-bool
-random_chance(int inverse_chance, PRNG_CLASS type)
-Returns true with a chance of 1/inverse_chance
-
-
-optional<int>
-random_index(int i, PRNG_CLASS type)
-Generate a integer number in the range [1, i]
or nil
if i < 1
-
-
-optional<int>
-random_int(int min, int max, PRNG_CLASS type)
-Generate a integer number in the range [min, max]
or nil
if max < min
+start_pos_y
+
+
+Honey
+
+
+
-float
-random()
-Drop-in replacement for math.random()
+Type
+Name
+Description
+
-optional<int>
-random(int i)
-Drop-in replacement for math.random(i)
+int
+wiggle_timer
+
+
+Hoverpack
+Derived from Entity Movable Backpack
+
+
-optional<int>
-random(int min, int max)
-Drop-in replacement for math.random(min, max)
+Type
+Name
+Description
+
-tuple<int, int>
-get_pair(PRNG_CLASS type)
+SoundMeta
+sound
-nil
-set_pair(PRNG_CLASS type, int first, int second)
+bool
+is_on
-Quad
+HundunChest
+Derived from Entity Movable Treasure
+
Type
@@ -7611,126 +24733,134 @@ Quad
-Quad
-new()
-
-
-
-Quad
-new(Quad)
+int
+timer
+
+Idol
+
+
+
-Quad
-new(Vec2 bottom_left_, Vec2 bottom_right_, Vec2 top_right_, Vec2 top_left_)
-
+Type
+Name
+Description
+
-Quad
-new(float _bottom_left_x, float _bottom_left_y, float _bottom_right_x, float _bottom_right_y, float _top_right_x, float _top_right_y, float _top_left_x, float _top_left_y)
-
+bool
+trap_triggered
+if you set it to true for the ice caves or volcano idol, the trap won't trigger
-Quad
-new(AABB aabb)
-
+int
+touch
+changes to 0 when first picked up by player and back to -1 if HH picks it up
float
-bottom_left_x
+spawn_x
float
-bottom_left_y
+spawn_y
+
+Jetpack
+Derived from Entity Movable Backpack
+
+
-float
-bottom_right_x
-
+Type
+Name
+Description
+
-float
-bottom_right_y
+bool
+flame_on
-float
-top_right_x
+int
+fuel
+
+JungleSpearCosmetic
+
+
+
-float
-top_right_y
-
+Type
+Name
+Description
+
float
-top_left_x
+move_x
float
-top_left_y
+move_y
+
+KapalaPowerup
+Derived from Entity Movable Powerup
+
+
-AABB
-get_AABB()
-Returns the max/min values of the Quad
+Type
+Name
+Description
+
-Quad&
-offset(float off_x, float off_y)
+int
+amount_of_blood
+
+LampFlame
+Derived from Entity Movable Flame
+
+
-Quad&
-rotate(float angle, float px, float py)
-Rotates a Quad by an angle, px/py are not offsets, use :get_AABB():center()
to get approximated center for simetrical quadrangle
-
-
-Quad&
-flip_horizontally()
-
+Type
+Name
+Description
+
-Quad&
-flip_vertically()
+ParticleEmitterInfo
+flame_particle
+
+Landmine
+Derived from Entity Movable LightEmitter
+
+
-bool
-is_point_inside(Vec2 p, optional epsilon)
-Check if point lies inside of triangle
Because of the imprecise nature of floating point values, the epsilon
value is needed to compare the floats, the default value is 0.00001
-
-
-bool
-is_point_inside(float x, float y, optional epsilon)
-
+Type
+Name
+Description
+
-tuple<Vec2, Vec2, Vec2, Vec2>
-split()
-Returns the corners in order: bottom_left, bottom_right, top_right, top_left
+int
+timer
+explodes at 57, if you set it to 58 will count to overflow
-RenderInfo
-
-For using a custom normal map:
-
-set_post_entity_spawn(function(ent)
- -- Doesn't really make sense with this texture, you can use your custom normal texture id here
- ent.rendering_info:set_normal_map_texture(TEXTURE.DATA_TEXTURES_FLOORSTYLED_GOLD_NORMAL_0)
- ent.rendering_info.shader = 30 -- Make sure to set the shader to one that uses normal map
-end, SPAWN_TYPE.LEVEL_GEN, MASK.FLOOR, ENT_TYPE.FLOORSTYLED_MINEWOOD)
-
-
-Note: if using set_texture_num, make sure to have used set_second_texture/set_third_texture before, since not doing so can lead to crashes
-
-
-Some information used to render the entity, can not be changed, used in Entity
+LaserBeam
+
@@ -7740,128 +24870,134 @@ RenderInfo
-float
-x
-
-
-
-float
-y
-
-
-
-WORLD_SHADER
-shader
-
-
-
-Quad
-source
+ParticleEmitterInfo
+sparks
-Quad
-destination
+Illumination
+emitted_light
+
+Leaf
+
+
+
-float
-tilew
-
+Type
+Name
+Description
+
float
-tileh
-
+fade_away_counter
+counts to 100.0 then the leaf fades away
-bool
-facing_left
+int
+swing_direction
bool
-render_inactive
+fade_away_trigger
+
+LightArrow
+Derived from Entity Movable Purchasable Arrow
+
+
-int
-texture_num
-
+Type
+Name
+Description
+
-class Entity
-get_entity()
+Illumination
+emitted_light
+
+LightArrowPlatform
+
+
+
-bool
-set_normal_map_texture(TEXTURE texture_id)
-Sets second_texture to the texture specified, then sets third_texture to SHINE_0 and texture_num to 3. You still have to change shader to 30 to render with normal map (same as COG normal maps)
-
-
-optional<TEXTURE>
-get_second_texture
-
+Type
+Name
+Description
+
-optional<TEXTURE>
-get_third_texture
+Illumination
+emitted_light
+
+LightEmitter
+
+
+
-bool
-set_second_texture(TEXTURE texture_id)
-
+Type
+Name
+Description
+
-bool
-set_third_texture(TEXTURE texture_id)
+Illumination
+emitted_light
+
+LightShot
+Derived from Entity Movable Projectile
+
+
-bool
-set_texture_num(int texture_id)
-Set the number of textures that may be used, need to have them set before for it to work
-
-
-CallbackId
-set_pre_virtual(RENDER_INFO_OVERRIDE entry, function fun)
-Hooks before the virtual function at index entry
.
-
-
-CallbackId
-set_post_virtual(RENDER_INFO_OVERRIDE entry, function fun)
-Hooks after the virtual function at index entry
.
+Type
+Name
+Description
+
-nil
-clear_virtual(CallbackId callback_id)
-Clears the hook given by callback_id
, alternatively use clear_callback()
inside the hook.
+Illumination
+emitted_light
+
+
+LiquidSurface
+
+
+
-CallbackId
-set_pre_dtor(function fun)
-Hooks before the virtual function.
The callback signature is nil dtor(RenderInfo self)
+Type
+Name
+Description
+
-CallbackId
-set_post_dtor(function fun)
-Hooks after the virtual function.
The callback signature is nil dtor(RenderInfo self)
+float
+glow_radius
+
-CallbackId
-set_pre_render(function fun)
-Hooks before the virtual function.
The callback signature is bool render(RenderInfo self, float float, VanillaRenderContext vanilla_render_context)
+float
+sine_pos
+
-CallbackId
-set_post_render(function fun)
-Hooks after the virtual function.
The callback signature is nil render(RenderInfo self, float float, VanillaRenderContext vanilla_render_context)
+float
+sine_pos_increment
+
-RoomOwnerDetails
-Used in RoomOwnersInfo
+Mattock
+Derived from Entity Movable Purchasable
@@ -7872,22 +25008,28 @@ RoomOwnerDetails
int
-layer
+remaining
+
+MegaJellyfishEye
+
+
+
-int
-room_index
-
+Type
+Name
+Description
+
int
-owner_uid
+timer
-RoomOwnersInfo
-Used in StateMemory
+MiniGameAsteroid
+
@@ -7897,18 +25039,13 @@ RoomOwnersInfo
-custom_map<int, ItemOwnerDetails>
-owned_items
-key/index is the uid of an item
-
-
-array<RoomOwnerDetails>
-owned_rooms
+float
+spin_speed
-ShortTileCodeDef
-Used in get_short_tile_code, get_short_tile_code_definition and PostRoomGenerationContext
+MiniGameShip
+
@@ -7918,22 +25055,34 @@ ShortTileCodeDef
-TILE_CODE
-tile_code
-Tile code that is used by default when this short tile code is encountered. Defaults to 0.
+SoundMeta
+sound
+
-int
-chance
-Chance in percent to pick tile_code
over alt_tile_code
, ignored if chance == 0
. Defaults to 100.
+float
+velocity_x
+
-TILE_CODE
-alt_tile_code
-Alternative tile code, ignored if chance == 100
. Defaults to 0.
+float
+velocity_y
+
+
+
+float
+swing
+
+
+
+float
+up_down_normal
+0.0 - down, 1.0 - up, 0.5 - idle
-Triangle
+MiniGameShipOffset
+
+
Type
@@ -7942,377 +25091,400 @@ Triangle
-Triangle
-new()
+float
+offset_x
-Triangle
-new(Triangle)
+float
+offset_y
-Triangle
-new(Vec2 _a, Vec2 _b, Vec2 _c)
-
+float
+normal_y_offset
+Is added to offset_y
+
+Movable
+Derived from Entity
+
+
-Triangle
-new(float ax, float ay, float bx, float by, float cx, float cy)
-
+Type
+Name
+Description
+
Vec2
-A
-
+move
+{movex, movey}
-Vec2
-B
-
+float
+movex
+Move directions (-1.0 to 1.0) that represent in whit direction the entity want's to move
-Vec2
-C
-
+float
+movey
+Move directions (-1.0 to 1.0) that represent in whit direction the entity want's to move
-Triangle&
-offset(const Vec2& off)
+BUTTON
+buttons
-Triangle&
-offset(float x, float y)
+BUTTON
+buttons_previous
-Triangle&
-rotate(float angle, float px, float py)
-Rotate triangle by an angle, the px/py are just coordinates, not offset from the center
+int
+stand_counter
+
-Vec2
-center()
-Also known as centroid
+float
+jump_height_multiplier
+EntityDB.jump gets multiplied by this to get the jump
-tuple<float, float, float>
-get_angles()
-Returns ABC, BCA, CAB angles in radians
+int
+owner_uid
+
-Triangle&
-scale(float scale)
+int
+last_owner_uid
-float
-area()
+Animation
+current_animation
-bool
-is_point_inside(Vec2 p, optional epsilon)
-Check if point lies inside of triangle
Because of the imprecise nature of floating point values, the epsilon
value is needed to compare the floats, the default value is 0.0001
+int
+idle_counter
+
-bool
-is_point_inside(float x, float y, optional epsilon)
+int
+standing_on_uid
-tuple<Vec2, Vec2, Vec2>
-split()
-Returns the corner points
+float
+velocityx
+speed, can be relative to the platform you standing on (pushblocks, elevators), use get_velocity to get accurate speed in the game world
-
-Vec2
-Simple object to hold pair of coordinates
-
-
-Type
-Name
-Description
+float
+velocityy
+speed, can be relative to the platform you standing on (pushblocks, elevators), use get_velocity to get accurate speed in the game world
+
+
+int
+holding_uid
+
-
-Vec2
-new()
+int
+state
-Vec2
-new(Vec2)
+int
+last_state
-Vec2
-new(float x_, float y_)
+int
+move_state
-float
-x
+int
+health
-float
-y
+int
+stun_timer
-Vec2&
-rotate(float angle, float px, float py)
+int
+stun_state
-float
-distance_to(const Vec2 other)
-Just simple pythagoras theorem
+int
+lock_input_timer
+Related to taking damage, also drops you from ladder/rope, can't be set while on the ground unless you're on a mount
-tuple<float, float>
-split()
+int
+wet_effect_timer
-
-Input types
Gamepad
-Used in ImGuiIO
-
-
-Type
-Name
-Description
+int
+poison_tick_timer
+Used to apply damage from poison, can be set to -1 to cure poison, to set poison use poison_entity
-
-bool
-enabled
+int
+falling_timer
-GAMEPAD
-buttons
+bool
+is_poisoned()
-float
-lt
+int
+dark_shadow_timer
-float
-rt
+int
+onfire_effect_timer
-float
-lx
+int
+exit_invincibility_timer
-float
-ly
+int
+invincibility_frames_timer
-float
-rx
+int
+frozen_timer
-float
-ry
+bool
+is_button_pressed(BUTTON button)
-
-ImGuiIO
-Used in get_io
-
-
-Type
-Name
-Description
+bool
+is_button_held(BUTTON button)
+
-
-Vec2
-displaysize
+bool
+is_button_released(BUTTON button)
-float
-framerate
+int
+price
-bool
-wantkeyboard
+nil
+stun(int framecount)
-bool
-keysdown[ImGuiKey_COUNT]
+nil
+freeze(int framecount)
-
-keydown
-bool keydown(int keycode)
bool keydown(char key)
+nil
+light_on_fire(int time)
+Does not damage entity
+nil
+set_cursed(bool b)
-keypressed
-bool keypressed(int keycode, bool repeat = false)
bool keypressed(char key, bool repeat = false)
+nil
+drop(Entity entity_to_drop)
-keyreleased
-bool keyreleased(int keycode)
bool keyreleased(char key)
-bool
-keyctrl
+nil
+pick_up(Entity entity_to_pick_up)
bool
-keyshift
+can_jump()
-bool
-keyalt
+Entity
+standing_on()
+nil
+add_money(int money)
+Adds or subtracts the specified amount of money to the movable's (player's) inventory. Shows the calculation animation in the HUD.
+
+
bool
-keysuper
+is_on_fire()
bool
-wantmouse
-
+damage(int damage_dealer_uid, int damage_amount, int stun_time, float velocity_x, float velocity_y, int iframes)
+Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities
Returns: true if entity was affected, damage_dealer should break etc. false if the event should be ignored by damage_dealer?
-Vec2
-mousepos
-
+array<int>
+get_all_behaviors()
+Get all avaible behavior ids
bool
-mousedown[5]
-
+set_behavior(int behavior_id)
+Set behavior, this is more than just state as it's an active function, for example climbing ladder is a behavior and it doesn't actually need ladder/rope entity
Returns false if entity doesn't have this behavior id
-bool
-mouseclicked[5]
-
+int
+get_behavior()
+Get the current behavior id
-bool
-mousedoubleclicked[5]
-
+nil
+set_gravity(float gravity)
+Force the gravity for this entity. Will override anything set by special states like swimming too, unless you reset it. Default 1.0
-float
-mousewheel
-
+nil
+reset_gravity()
+Remove the gravity hook and reset to defaults
-Gamepad
-gamepad
-
+nil
+set_position(float to_x, float to_y)
+Set the absolute position of an entity and offset all rendering related things accordingly to teleport without any interpolation or graphical glitches. If the camera is focused on the entity, it is also moved.
-
-gamepads
-Gamepad gamepads(int index)
This is the XInput index 1..4, might not be the same as the player slot.
+VanillaMovableBehavior
+get_base_behavior(int state_id)
+Gets a vanilla behavior from this movable, needs to be called before clear_behaviors
but the returned values are still valid after a call to clear_behaviors
-bool
-showcursor
-
+nil
+add_behavior(MovableBehavior behavior)
+Add a behavior to this movable, can be either a VanillaMovableBehavior
or a
CustomMovableBehavior
-
-InputMapping
-Used in PlayerSlot
-
-
-Type
-Name
-Description
+nil
+clear_behavior(MovableBehavior behavior)
+Clear a specific behavior of this movable, can be either a VanillaMovableBehavior
or a
CustomMovableBehavior
, a behavior with this behaviors state_id
may be required to
run this movables statemachine without crashing, so add a new one if you are not sure
-
-int
-jump
-
+nil
+clear_behaviors()
+Clears all behaviors of this movable, need to call add_behavior
to avoid crashing
-int
-attack
-
+nil
+generic_update_world()
+Move a movable according to its velocity, update physics, gravity, etc.
Will also update movable.animation_frame
and various timers and counters
-int
-bomb
-
+nil
+generic_update_world(bool disable_gravity)
+Move a movable according to its velocity, can disable gravity
Will also update movable.animation_frame
and various timers and counters
-int
-rope
-
+nil
+generic_update_world(Vec2 move, float sprint_factor, bool disable_gravity, bool on_rope)
+Move a movable according to its velocity and move
, if the movables BUTTON.RUN
is
held apply sprint_factor
on move.x
, can disable gravity or lock its horizontal
movement via on_rope
. Use this for example to update a custom enemy type.
Will also update movable.animation_frame
and various timers and counters
-int
-walk_run
-
+CallbackId
+set_pre_virtual(ENTITY_OVERRIDE entry, function fun)
+Hooks before the virtual function at index entry
.
-int
-use_door_buy
-
+CallbackId
+set_post_virtual(ENTITY_OVERRIDE entry, function fun)
+Hooks after the virtual function at index entry
.
-int
-pause_menu
-
+nil
+clear_virtual(CallbackId callback_id)
+Clears the hook given by callback_id
, alternatively use clear_callback()
inside the hook.
-int
-journal
-
+CallbackId
+set_pre_damage(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> damage(Movable self, int damage_dealer_uid, int damage_amount, int stun_time, float velocity_x, float velocity_y, int iframes)
Virtual function docs:
Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities
Returns: true if entity was affected, damage_dealer should break etc. false if the event should be ignored by damage_dealer?
-int
-left
-
+CallbackId
+set_post_damage(function fun)
+Hooks after the virtual function.
The callback signature is nil damage(Movable self, int damage_dealer_uid, int damage_amount, int stun_time, float velocity_x, float velocity_y, int iframes)
Virtual function docs:
Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities
Returns: true if entity was affected, damage_dealer should break etc. false if the event should be ignored by damage_dealer?
-int
-right
-
+CallbackId
+set_pre_apply_movement(function fun)
+Hooks before the virtual function.
The callback signature is bool apply_movement(Movable self)
-int
-up
-
+CallbackId
+set_post_apply_movement(function fun)
+Hooks after the virtual function.
The callback signature is nil apply_movement(Movable self)
+
+
+CallbackId
+set_pre_check_is_falling(function fun)
+Hooks before the virtual function.
The callback signature is bool check_is_falling(Movable self)
+
+
+CallbackId
+set_post_check_is_falling(function fun)
+Hooks after the virtual function.
The callback signature is nil check_is_falling(Movable self)
+
+
+CallbackId
+set_pre_process_input(function fun)
+Hooks before the virtual function.
The callback signature is bool process_input(Movable self)
+
+
+CallbackId
+set_post_process_input(function fun)
+Hooks after the virtual function.
The callback signature is nil process_input(Movable self)
+
+
+MovingIcon
+
+
+
+
+Type
+Name
+Description
+
int
-down
-
+movement_timer
+Used to move it up and down in sync with others
-PlayerInputs
-Used in StateMemory
+Olmec
+
@@ -8322,58 +25494,58 @@ PlayerInputs
-array<PlayerSlot, MAX_PLAYERS>
-player_slots
+SoundMeta
+sound
-PlayerSlot
-player_slot_1
+int
+target_uid
-PlayerSlot
-player_slot_2
-
+int
+attack_phase
+0 = stomp, 1 = bombs, 2 = stomp+ufos, 3 = in lava
-PlayerSlot
-player_slot_3
-
+int
+attack_timer
+in phase 0/2: time spent looking for player, in phase 1: time between bomb salvo
-PlayerSlot
-player_slot_4
-
+int
+ai_timer
+general timer that counts down whenever olmec is active
-array<PlayerSlotSettings, MAX_PLAYERS>
-player_settings
-
+int
+move_direction
+-1 = left, 0 = down, 1 = right, phase 0/2: depends on target, phase 1: travel direction
-PlayerSlotSettings
-player_slot_1_settings
+int
+jump_timer
-PlayerSlotSettings
-player_slot_2_settings
+int
+phase1_amount_of_bomb_salvos
-PlayerSlotSettings
-player_slot_3_settings
+int
+unknown_attack_state
-
-PlayerSlotSettings
-player_slot_4_settings
+
+int
+broken_floaters()
-Journal types
JournalPage
-Used in set_callback with ON.RENDER_POST_JOURNAL_PAGE
+OlmecCannon
+
@@ -8383,28 +25555,18 @@ Journal types
JournalPage
-TextureRenderingInfo
-background
-
-
-
int
-page_number
+timer
-bool
-is_right_side_page()
-background.x < 0
-
-
-JOURNAL_PAGE_TYPE
-get_type()
+int
+bombs_left
-JournalPageBestiary
-Derived from JournalPage JournalPageDiscoverable
+OlmecFloater
+
@@ -8414,43 +25576,54 @@ JournalPageBestiary
-TextureRenderingInfo
-monster_background
+bool
+both_floaters_intact
-TextureRenderingInfo
-monster_icon
+bool
+on_breaking
+
+OlmecShip
+
+
+
-TextureRenderingInfo
-defeated_killedby_black_bars
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
-TextRenderingInfo
-defeated_text_info
+Entity
+door_fx
-TextRenderingInfo
-defeated_value_text_info
+ParticleEmitterInfo
+smoke
-TextRenderingInfo
-killedby_text_info
+int
+flight_time
-TextRenderingInfo
-killedby_value_text_info
+bool
+has_spawned_jetflames
-JournalPageDeathCause
-Derived from JournalPage
+Orb
+
@@ -8460,13 +25633,18 @@ JournalPageDeathCause
-TextRenderingInfo
-death_cause_text_info
+SoundMeta
+sound
+
+
+
+int
+timer
-JournalPageDeathMenu
-Derived from JournalPage
+ParachutePowerup
+Derived from Entity Movable Powerup
@@ -8477,47 +25655,53 @@ JournalPageDeathMenu
int
-selected_menu_index
-
+falltime_deploy
+this gets compared with entity's falling_timer
-TextRenderingInfo
-game_over_text_info
+bool
+deployed
-TextRenderingInfo
-level_text_info
+nil
+deploy()
-TextRenderingInfo
-level_value_text_info
-
+int
+gold_timer
+Timer for spawning a single gold nugget.
-TextRenderingInfo
-money_text_info
-
+int
+gold_spawning_time
+Time until gold nuggets stop spawning.
+
+PlayerBag
+
+
+
-TextRenderingInfo
-money_value_text_info
-
+Type
+Name
+Description
+
-TextRenderingInfo
-time_text_info
+int
+bombs
-TextRenderingInfo
-time_value_text_info
+int
+ropes
-JournalPageDiscoverable
-Derived from JournalPage
+PlayerGhost
+Derived from Entity Movable LightEmitter
@@ -8527,49 +25711,43 @@ JournalPageDiscoverable
-bool
-show_main_image
+ParticleEmitterInfo
+sparkles_particle
-TextRenderingInfo
-title_text_info
+PlayerSlot
+player_inputs
-TextRenderingInfo
-entry_text_info
+Inventory
+inventory
-TextRenderingInfo
-chapter_title_text_info
+SoundMeta
+sound
-
-JournalPageFeats
-Derived from JournalPage
-
-
-Type
-Name
-Description
+int
+body_uid
+Is not set to -1 when crushed
-
-TextRenderingInfo
-chapter_title_text_info
+int
+shake_timer
-TextureRenderingInfo
-feat_icons
+int
+boost_timer
-JournalPageItems
-Derived from JournalPage JournalPageDiscoverable
+Pot
+Derived from Entity Movable Purchasable
@@ -8579,18 +25757,18 @@ JournalPageItems
-TextureRenderingInfo
-item_icon
+ENT_TYPE
+inside
-TextureRenderingInfo
-item_background
+bool
+dont_transfer_dmg
-JournalPageJournalMenu
-Derived from JournalPage
+Powerup
+
@@ -8599,24 +25777,25 @@ JournalPageJournalMenu
Description
+
+Present
+Derived from Entity Movable Purchasable
+
+
-int
-selected_menu_index
-
-
-
-TextRenderingInfo
-journal_text_info
-
+Type
+Name
+Description
+
-TextureRenderingInfo
-completion_badge
+ENT_TYPE
+inside
-JournalPageLastGamePlayed
-Derived from JournalPage
+PrizeDispenser
+
@@ -8626,58 +25805,71 @@ JournalPageLastGamePlayed
-TextureRenderingInfo
-main_image
-
-
-
-TextRenderingInfo
-last_game_played_text_info
-
+array<int, 6>
+item_ids
+Id's of the items (not types), by default 0-24, look at change_diceshop_prizes for the list of default prizes
so for example: id 0 equals ITEM_PICKUP_BOMBBAG, id 1 equals ITEM_PICKUP_BOMBBOX etc. Game generates 6 but uses max 5 for Tusk dice shop
-TextRenderingInfo
-level_text_info
+int
+prizes_spawned
+
+Projectile
+
+
+
-TextRenderingInfo
-level_value_text_info
-
+Type
+Name
+Description
+
+
+PunishBall
+
+
+
-TextRenderingInfo
-money_text_info
-
+Type
+Name
+Description
+
-TextRenderingInfo
-money_value_text_info
+int
+attached_to_uid
-TextRenderingInfo
-time_text_info
-
+int
+timer
+counts down from 20 while the ball is eligible to break a floor and tries to break it at 0
-TextRenderingInfo
-time_value_text_info
+float
+x_pos
-int
-sticker_count
+float
+y_pos
+
+Purchasable
+
+
+
-array<TextureRenderingInfo, 20>
-stickers
-
+Type
+Name
+Description
+
-JournalPagePeople
-Derived from JournalPage JournalPageDiscoverable
+PushBlock
+
@@ -8687,23 +25879,23 @@ JournalPagePeople
-TextureRenderingInfo
-character_background
+SoundMeta
+sound
-TextureRenderingInfo
-character_icon
+ParticleEmitterInfo
+dust_particle
-TextureRenderingInfo
-character_drawing
+float
+dest_pos_x
-JournalPagePlaces
-Derived from JournalPage JournalPageDiscoverable
+RegenBlock
+
@@ -8713,13 +25905,13 @@ JournalPagePlaces
-TextureRenderingInfo
-main_image
+bool
+on_breaking
-JournalPagePlayerProfile
-Derived from JournalPage
+RollingItem
+Derived from Entity Movable Purchasable
@@ -8729,123 +25921,117 @@ JournalPagePlayerProfile
-TextureRenderingInfo
-player_icon
-
-
-
-int
-player_icon_id
-
-
-
-TextRenderingInfo
-player_profile_text_info
-
-
-
-TextRenderingInfo
-plays_text_info
-
-
-
-TextRenderingInfo
-plays_value_text_info
-
-
-
-TextRenderingInfo
-wins_text_info
-
-
-
-TextRenderingInfo
-wins_value_text_info
+float
+roll_speed
+
+Rubble
+
+
+
-TextRenderingInfo
-deaths_text_info
-
+Type
+Name
+Description
+
+
+ScepterShot
+Derived from Entity Movable LightEmitter
+
+
-TextRenderingInfo
-deaths_value_text_info
-
+Type
+Name
+Description
+
-TextRenderingInfo
-win_pct_text_info
+SoundMeta
+sound
-TextRenderingInfo
-win_pct_value_text_info
+float
+speed
-TextRenderingInfo
-average_score_text_info
-
+int
+idle_timer
+short timer before it goes after target
+
+Shield
+Derived from Entity Movable Purchasable
+
+
-TextRenderingInfo
-average_score_value_text_info
-
+Type
+Name
+Description
+
-TextRenderingInfo
-top_score_text_info
+float
+shake
+
+SkullDropTrap
+
+
+
-TextRenderingInfo
-top_score_value_text_info
-
+Type
+Name
+Description
+
-TextRenderingInfo
-deepest_level_text_info
+SoundMeta
+sound
-TextRenderingInfo
-deepest_level_value_text_info
+int
+left_skull_uid
-TextRenderingInfo
-deadliest_level_text_info
+int
+middle_skull_uid
-TextRenderingInfo
-deadliest_level_value_text_info
+int
+right_skull_uid
-TextRenderingInfo
-average_time_text_info
+int
+left_skull_drop_time
-TextRenderingInfo
-average_time_value_text_info
+int
+middle_skull_drop_time
-TextRenderingInfo
-best_time_text_info
+int
+right_skull_drop_time
-TextRenderingInfo
-best_time_value_text_info
-
+int
+timer
+counts from 60 to 0, 3 times, the last time dropping the skulls, then random longer timer for reset
-JournalPageProgress
-Derived from JournalPage
+SleepBubble
+
@@ -8855,13 +26041,13 @@ JournalPageProgress
-TextureRenderingInfo
-coffeestain_top
+int
+show_hide_timer
-JournalPageRecap
-Derived from JournalPage
+SnapTrap
+
@@ -8870,20 +26056,19 @@ JournalPageRecap
Description
-
-JournalPageStory
-Derived from JournalPage
-
-
-Type
-Name
-Description
+int
+bait_uid
+
+
+
+int
+reload_timer
+
-
-JournalPageTraps
-Derived from JournalPage JournalPageDiscoverable
+SoundShot
+Derived from Entity Movable Projectile LightShot
@@ -8893,19 +26078,13 @@ JournalPageTraps
-TextureRenderingInfo
-trap_icon
-
-
-
-TextureRenderingInfo
-trap_background
+SoundMeta
+sound
-Levelgen types
DoorCoords
-Deprecated
- kept for backward compatibility, don't use, check LevelGenSystem.exit_doors
+Spark
+Derived from Entity Movable Flame
@@ -8915,90 +26094,100 @@ Levelgen types
DoorCoords
-float
-door1_x
+ParticleEmitterInfo
+particle
-float
-door1_y
+Entity
+fx_entity
float
-door2_x
-door2 only valid when there are two in the level, like Volcana drill, Olmec, ...
+rotation_center_x
+
float
-door2_y
+rotation_center_y
-
-LevelGenSystem
-Data relating to level generation, changing anything in here from ON.LEVEL or later will likely have no effect, used in StateMemory
-
-
-Type
-Name
-Description
+float
+rotation_angle
+
-
-ShopType
-shop_type
-
+float
+size
+slowly goes down to default 1.0, is 0.0 when not on screen
-ShopType
-backlayer_shop_type
-
+float
+size_multiply
+0.0 when not on screen
-int
-shop_music
-
+float
+next_size
+width and height will be set to next_size size_multiply
next frame
int
-backlayer_shop_music
-
+size_change_timer
+very short timer before next size change, giving a pulsing effect
float
-spawn_x
-
+speed
+This is custom variable, you need activate_sparktraps_hack to use it
float
-spawn_y
-
+distance
+This is custom variable, you need activate_sparktraps_hack to use it
+
+Spear
+
+
+
-int
-spawn_room_x
-
+Type
+Name
+Description
+
int
-spawn_room_y
+sound_id
+
+SpecialShot
+Derived from Entity Movable LightEmitter
+
+
-custom_array<Vec2>
-exit_doors
+Type
+Name
+Description
+
+
+
+float
+target_x
-ThemeInfo
-themes[18]
+float
+target_y
-Lighting types
Illumination
-Generic obcject for lights in the game, you can make your own with create_illumination
-Used in StateMemory, Player, PlayerGhost, BurningRopeEffect ...
+StretchChain
+
@@ -9008,93 +26197,112 @@ Lighting types
Illumination
-array<LightParams, 4>
-lights
-Table of light1, light2, ... etc.
-
-
-LightParams
-light1
+int
+at_end_of_chain_uid
-LightParams
-light2
+float
+dot_offset
-LightParams
-light3
+int
+position_in_chain
-LightParams
-light4
-It's rendered on objects around, not as an actual bright spot
+int
+inverse_doubled_position_in_chain
+
-float
-brightness
+bool
+is_dot_hidden
+
+Switch
+
+
+
-float
-brightness_multiplier
-
+Type
+Name
+Description
+
-float
-light_pos_x
+int
+timer
+
+TV
+
+
+
-float
-light_pos_y
-
+Type
+Name
+Description
+
-float
-offset_x
+SoundMeta
+sound
-float
-offset_y
+Entity
+fx_button
-float
-distortion
+Illumination
+emitted_light
int
-entity_uid
+station
+
+Teleporter
+Derived from Entity Movable Purchasable
+
+
-int
-flags
-see flags.hpp illumination_flags
+Type
+Name
+Description
+
int
-type_flags
-Only one can be set: 1 - Follow camera, 2 - Follow Entity, 3 - Rectangle, full brightness
Rectangle always uses light1, even when it's disabled in flags
+teleport_number
+
+
+TeleporterBackpack
+Derived from Entity Movable Backpack
+
+
-bool
-enabled
-
+Type
+Name
+Description
+
int
-layer
+teleport_number
-LightParams
-Used in Illumination
+Telescope
+
@@ -9104,29 +26312,23 @@ LightParams
-float
-red
-
-
-
-float
-green
+Entity
+fx_button
-float
-blue
+Entity
+camera_anchor
-float
-size
+int
+looked_through_by_uid
-Liquid types
LiquidPhysics
-Use LIQUID_POOL enum for the index
-Used in StateMemory
+Tentacle
+Derived from Entity Movable Chain
@@ -9136,13 +26338,13 @@ Liquid types
LiquidPhysics
-array<LiquidPool, 5>
-pools
+Entity
+bottom
-LiquidPhysicsEngine
-Used in LiquidPool
+ThinIce
+
@@ -9152,43 +26354,61 @@ LiquidPhysicsEngine
-bool
-pause
-
+int
+strength
+counts down when standing on, maximum is 134 as based of this value it changes animation_frame, and above that value it changes to wrong sprite
+
+TiamatShot
+Derived from Entity Movable LightEmitter
+
+
-float
-gravity
-
+Type
+Name
+Description
+
-float
-cohesion
+SoundMeta
+sound
+
+TimedPowderkeg
+Derived from Entity Movable PushBlock
+
+
-float
-elasticity
-
+Type
+Name
+Description
+
-float
-size
-
+int
+timer
+timer till explosion, -1 = pause, counts down
+
+TimedShot
+Derived from Entity Movable Projectile LightShot
+
+
-float
-weight
-
+Type
+Name
+Description
+
int
-count
+timer
-LiquidPhysicsParams
-Used in LiquidPool
+Torch
+
@@ -9198,23 +26418,28 @@ LiquidPhysicsParams
-float
-gravity
+int
+flame_uid
-float
-cohesion
+bool
+is_lit
+It's used just to check, to light/extinguish use light_up
function
+
+
+nil
+light_up(bool lit)
-float
-elasticity
+ENT_TYPE
+get_flame_type()
-LiquidPool
-Used in LiquidPhysics
+TorchFlame
+Derived from Entity Movable Flame
@@ -9224,18 +26449,28 @@ LiquidPool
-LiquidPhysicsParams
-default
+ParticleEmitterInfo
+smoke_particle
-LiquidPhysicsEngine
-engine
+ParticleEmitterInfo
+flame_particle
+
+
+
+ParticleEmitterInfo
+warp_particle
+
+
+
+float
+flame_size
-Logic types
Logic
-Used in LogicList
+TrapPart
+
@@ -9245,14 +26480,13 @@ Logic types
Logic
-int
-logic_index
+Entity
+ceiling
-LogicDiceShop
-Used in LogicList
-Derived from Logic
+Treasure
+
@@ -9262,78 +26496,99 @@ LogicDiceShop
-int
-bet_machine
-
-
-
-int
-die1
-
-
-
-int
-die2
-
+bool
+cashed
+spawns a dust effect and adds money for the total
+
+TreasureHook
+
+
+
-int
-die_1_value
-
+Type
+Name
+Description
+
-int
-die_2_value
+SoundMeta
+sound
+
+TrueCrownPowerup
+Derived from Entity Movable Powerup
+
+
-int
-prize_dispenser
-
+Type
+Name
+Description
+
int
-prize
+timer
+
+UdjatSocket
+
+
+
-int
-forcefield
-
+Type
+Name
+Description
+
-bool
-bet_active
+Entity
+fx_button
+
+UnchainedSpikeBall
+
+
+
-bool
-forcefield_deactivated
-
+Type
+Name
+Description
+
bool
-boss_angry
+bounce
+
+Ushabti
+
+
+
-int
-result_announcement_timer
-
+Type
+Name
+Description
+
int
-won_prizes_count
+wiggle_timer
int
-balance
+shine_timer
-LogicList
-Used in StateMemory
+VanillaMovableBehavior
+Opaque handle to a movable behavior from the vanilla game
+Derived from MovableBehavior
@@ -9342,30 +26597,41 @@ LogicList
Description
+
+VladsCape
+Derived from Entity Movable Backpack Cape
+
+
-LogicOlmecCutscene
-olmec_cutscene
-
+Type
+Name
+Description
+
-LogicTiamatCutscene
-tiamat_cutscene
+bool
+can_double_jump
+
+WallTorch
+Derived from Entity Movable Torch
+
+
-LogicMagmamanSpawn
-magmaman_spawn
-
+Type
+Name
+Description
+
-LogicDiceShop
-diceshop
-
+bool
+dropped_gold
+if false, it will drop gold when light up
-LogicOlmecCutscene
-Used in LogicList
-Derived from Logic
+Web
+
@@ -9375,29 +26641,29 @@ LogicOlmecCutscene
-Entity
-olmec
-
-
-
-Entity
-player
-
+float
+decay_rate
+Is subtracted from the color alpha every frame after the stand_counter
is more than 300.
Entity automatically dies when the alpha is less than 0.1
+
+WebShot
+Derived from Entity Movable Projectile
+
+
-Entity
-cinematic_anchor
-
+Type
+Name
+Description
+
-int
-timer
-
+bool
+shot
+if false, it's attached to the gun
-LogicTiamatCutscene
-Used in LogicList
-Derived from Logic
+WoodenlogTrap
+
@@ -9407,23 +26673,34 @@ LogicTiamatCutscene
-Entity
-tiamat
+int
+ceiling_1_uid
-Entity
-player
+int
+ceiling_2_uid
-Entity
-cinematic_anchor
+float
+falling_speed
+
+YellowCape
+Derived from Entity Movable Backpack Cape
+
+
+
+Type
+Name
+Description
+
+
-int
-timer
+SoundMeta
+sound
diff --git a/docs/light.html b/docs/light.html
index 1c4502964..a15112975 100644
--- a/docs/light.html
+++ b/docs/light.html
@@ -1828,269 +1828,1585 @@
-
LogicTiamatCutscene
+ -
+ LogicVolcana
+
-
-
- -
- Events
-
- -
- ON.LOGO
-
- -
- ON.INTRO
-
- -
- ON.PROLOGUE
-
- -
- ON.TITLE
-
- -
- ON.MENU
-
- -
- ON.OPTIONS
-
- -
- ON.PLAYER_PROFILE
-
- -
- ON.LEADERBOARD
-
- -
- ON.SEED_INPUT
-
- -
- ON.CHARACTER_SELECT
-
- -
- ON.TEAM_SELECT
-
- -
- ON.CAMP
-
- -
- ON.LEVEL
-
- -
- ON.TRANSITION
-
- -
- ON.DEATH
-
-
- ON.SPACESHIP
-
- -
- ON.WIN
+ Online types
+
+ -
+ Online
+
+ -
+ OnlineLobby
+
+ -
+ OnlinePlayer
+
+
-
- ON.CREDITS
+ Particle types
+
+ -
+ Particle
+
+ -
+ ParticleDB
+
+ -
+ ParticleEmitterInfo
+
+
-
- ON.SCORES
+ Savegame types
+
+ -
+ Constellation
+
+ -
+ ConstellationLine
+
+ -
+ ConstellationStar
+
+ -
+ SaveData
+
+
-
- ON.CONSTELLATION
+ Screen types
+
+ -
+ FlyingThing
+
+ -
+ JournalPopupUI
+
+ -
+ JournalUI
+
+ -
+ PauseUI
+
+ -
+ SaveRelated
+
+ -
+ Screen
+
+ -
+ ScreenArenaIntro
+
+ -
+ ScreenArenaItems
+
+ -
+ ScreenArenaLevel
+
+ -
+ ScreenArenaMenu
+
+ -
+ ScreenArenaScore
+
+ -
+ ScreenArenaStagesSelect
+
+ -
+ ScreenCamp
+
+ -
+ ScreenCharacterSelect
+
+ -
+ ScreenConstellation
+
+ -
+ ScreenCredits
+
+ -
+ ScreenDeath
+
+ -
+ ScreenIntro
+
+ -
+ ScreenLeaderboards
+
+ -
+ ScreenLevel
+
+ -
+ ScreenLogo
+
+ -
+ ScreenMenu
+
+ -
+ ScreenOnlineLoading
+
+ -
+ ScreenOnlineLobby
+
+ -
+ ScreenOptions
+
+ -
+ ScreenPlayerProfile
+
+ -
+ ScreenPrologue
+
+ -
+ ScreenRecap
+
+ -
+ ScreenScores
+
+ -
+ ScreenSeedInput
+
+ -
+ ScreenTeamSelect
+
+ -
+ ScreenTitle
+
+ -
+ ScreenTransition
+
+ -
+ ScreenWin
+
+ -
+ ScreenZoomAnimation
+
+
-
- ON.RECAP
+ Sound types
+
+ -
+ BackgroundSound
+
+ -
+ CustomSound
+
+ -
+ PlayingSound
+
+ -
+ SoundMeta
+
+
-
- ON.ARENA_MENU
+ State types
+
+ -
+ Camera
+
+ -
+ GameManager
+
+ -
+ GameProps
+
+ -
+ Items
+
+ -
+ JournalProgressStainSlot
+
+ -
+ JournalProgressStickerSlot
+
+ -
+ PlayerSlot
+
+ -
+ PlayerSlotSettings
+
+ -
+ QuestsInfo
+
+ -
+ SelectPlayerSlot
+
+ -
+ StateMemory
+
+
-
- ON.ARENA_STAGES
+ Texture types
+
+ -
+ TextRenderingInfo
+
+ -
+ TextureDefinition
+
+ -
+ TextureRenderingInfo
+
+
-
- ON.ARENA_ITEMS
+ Theme types
+
+ -
+ CustomTheme
+
+ -
+ ThemeInfo
+
+
+
+
+ -
+ Entity types
+
-
- ON.ARENA_SELECT
+ Background entities
+
+ -
+ BGBackLayerDoor
+
+ -
+ BGEggshipRoom
+
+ -
+ BGFloatingDebris
+
+ -
+ BGMovingStar
+
+ -
+ BGRelativeElement
+
+ -
+ BGShootingStar
+
+ -
+ BGShopEntrence
+
+ -
+ BGShopKeeperPrime
+
+ -
+ BGSurfaceLayer
+
+ -
+ BGSurfaceStar
+
+ -
+ BGTutorialSign
+
+ -
+ DestructibleBG
+
+
-
- ON.ARENA_INTRO
+ Effect entities
+
+ -
+ BurningRopeEffect
+
+ -
+ CursedEffect
+
+ -
+ FrostBreathEffect
+
+ -
+ OnFireEffect
+
+ -
+ PoisonedEffect
+
+ -
+ WetEffect
+
+
-
- ON.ARENA_MATCH
-
- -
- ON.ARENA_SCORE
-
- -
- ON.ONLINE_LOADING
-
- -
- ON.ONLINE_LOBBY
-
- -
- ON.GUIFRAME
-
- -
- ON.FRAME
-
- -
- ON.GAMEFRAME
-
- -
- ON.SCREEN
-
- -
- ON.START
-
- -
- ON.LOADING
-
- -
- ON.RESET
-
- -
- ON.SAVE
-
- -
- ON.LOAD
-
- -
- ON.PRE_LOAD_LEVEL_FILES
-
- -
- ON.PRE_LEVEL_GENERATION
-
- -
- ON.PRE_LOAD_SCREEN
-
- -
- ON.POST_ROOM_GENERATION
-
- -
- ON.POST_LEVEL_GENERATION
-
- -
- ON.POST_LOAD_SCREEN
-
- -
- ON.PRE_GET_RANDOM_ROOM
-
- -
- ON.PRE_HANDLE_ROOM_TILES
-
- -
- ON.SCRIPT_ENABLE
-
- -
- ON.SCRIPT_DISABLE
-
- -
- ON.RENDER_PRE_HUD
-
- -
- ON.RENDER_POST_HUD
-
- -
- ON.RENDER_PRE_PAUSE_MENU
-
- -
- ON.RENDER_POST_PAUSE_MENU
-
- -
- ON.RENDER_PRE_BLURRED_BACKGROUND
-
- -
- ON.RENDER_POST_BLURRED_BACKGROUND
-
- -
- ON.RENDER_PRE_DRAW_DEPTH
-
- -
- ON.RENDER_POST_DRAW_DEPTH
-
- -
- ON.RENDER_PRE_JOURNAL_PAGE
-
- -
- ON.RENDER_POST_JOURNAL_PAGE
-
- -
- ON.RENDER_PRE_LAYER
-
- -
- ON.RENDER_POST_LAYER
-
- -
- ON.RENDER_PRE_LEVEL
-
- -
- ON.RENDER_POST_LEVEL
-
- -
- ON.RENDER_PRE_GAME
-
- -
- ON.RENDER_POST_GAME
+ Floor entities
+
+ -
+ Altar
+
+ -
+ Arrowtrap
+
+ -
+ BigSpearTrap
+
+ -
+ CityOfGoldDoor
+
+ -
+ ConveyorBelt
+
+ -
+ DecoratedDoor
+
+ -
+ Door
+
+ -
+ EggShipDoor
+
+ -
+ EggShipDoorS
+
+ -
+ ExitDoor
+
+ -
+ Floor
+
+ -
+ ForceField
+
+ -
+ Generator
+
+ -
+ HorizontalForceField
+
+ -
+ JungleSpearTrap
+
+ -
+ LaserTrap
+
+ -
+ LockedDoor
+
+ -
+ MainExit
+
+ -
+ MotherStatue
+
+ -
+ Pipe
+
+ -
+ PoleDeco
+
+ -
+ QuickSand
+
+ -
+ SlidingWallCeiling
+
+ -
+ SparkTrap
+
+ -
+ SpikeballTrap
+
+ -
+ StickyTrap
+
+ -
+ TeleportingBorder
+
+ -
+ TentacleBottom
+
+ -
+ TimedForceField
+
+ -
+ TotemTrap
+
+ -
+ TransferFloor
+
+
-
- ON.SPEECH_BUBBLE
+ Generic entities
+
+ -
+ BoulderSpawner
+
+ -
+ CameraFlash
+
+ -
+ CinematicAnchor
+
+ -
+ CrossBeam
+
+ -
+ DMAlienBlast
+
+ -
+ DMSpawning
+
+ -
+ DecoRegeneratingBlock
+
+ -
+ DustWallApep
+
+ -
+ EggplantThrower
+
+ -
+ Entity
+
+ -
+ IceSlidingSound
+
+ -
+ JungleTrapTrigger
+
+ -
+ Lava
+
+ -
+ LimbAnchor
+
+ -
+ Liquid
+
+ -
+ MummyFliesSound
+
+ -
+ OuroboroCameraAnchor
+
+ -
+ OuroboroCameraZoomin
+
+ -
+ PalaceSign
+
+ -
+ PipeTravelerSound
+
+ -
+ Portal
+
+ -
+ QuickSandSound
+
+ -
+ RoomLight
+
+ -
+ ShootingStarSpawner
+
+ -
+ SplashBubbleGenerator
+
+
-
- ON.TOAST
+ Logical entities
+
+ -
+ LogicalAnchovyFlock
+
+ -
+ LogicalConveyorbeltSound
+
+ -
+ LogicalDoor
+
+ -
+ LogicalDrain
+
+ -
+ LogicalLiquidStreamSound
+
+ -
+ LogicalMiniGame
+
+ -
+ LogicalRegeneratingBlock
+
+ -
+ LogicalSound
+
+ -
+ LogicalStaticSound
+
+ -
+ LogicalTrapTrigger
+
+
-
- ON.DEATH_MESSAGE
-
- -
- ON.PRE_LOAD_JOURNAL_CHAPTER
-
- -
- ON.POST_LOAD_JOURNAL_CHAPTER
-
- -
- ON.PRE_GET_FEAT
-
- -
- ON.PRE_SET_FEAT
-
- -
- ON.PRE_UPDATE
-
- -
- ON.POST_UPDATE
-
- -
- ON.USER_DATA
-
-
-
- -
- Enums
-
- -
- BEG
-
- -
- BUTTON
-
- -
- CAUSE_OF_DEATH
-
- -
- CHAR_STATE
-
- -
- CONST
-
- -
- CORNER_FINISH
-
- -
- COSUBTHEME
-
- -
- DAMAGE_TYPE
-
- -
- DRAW_LAYER
+ Monsters, Inc.
+
+ -
+ Alien
+
+ -
+ Ammit
+
+ -
+ Anubis
+
+ -
+ ApepHead
+
+ -
+ ApepPart
+
+ -
+ Axolotl
+
+ -
+ Bat
+
+ -
+ Bee
+
+ -
+ Beg
+
+ -
+ Bodyguard
+
+ -
+ CatMummy
+
+ -
+ Caveman
+
+ -
+ CavemanShopkeeper
+
+ -
+ Cobra
+
+ -
+ Crabman
+
+ -
+ Critter
+
+ -
+ CritterBeetle
+
+ -
+ CritterButterfly
+
+ -
+ CritterCrab
+
+ -
+ CritterDrone
+
+ -
+ CritterFirefly
+
+ -
+ CritterFish
+
+ -
+ CritterLocust
+
+ -
+ CritterPenguin
+
+ -
+ CritterSlime
+
+ -
+ CritterSnail
+
+ -
+ Crocman
+
+ -
+ EggplantMinister
+
+ -
+ FireFrog
+
+ -
+ Firebug
+
+ -
+ FirebugUnchained
+
+ -
+ Fish
+
+ -
+ ForestSister
+
+ -
+ Frog
+
+ -
+ Ghist
+
+ -
+ Ghost
+
+ -
+ GiantFish
+
+ -
+ GiantFly
+
+ -
+ GiantFrog
+
+ -
+ GoldMonkey
+
+ -
+ Grub
+
+ -
+ HangSpider
+
+ -
+ Hermitcrab
+
+ -
+ HornedLizard
+
+ -
+ Hundun
+
+ -
+ HundunHead
+
+ -
+ Imp
+
+ -
+ Jiangshi
+
+ -
+ JumpDog
+
+ -
+ Kingu
+
+ -
+ Lahamu
+
+ -
+ Lamassu
+
+ -
+ Lavamander
+
+ -
+ Leprechaun
+
+ -
+ MagmaMan
+
+ -
+ Mantrap
+
+ -
+ Mech
+
+ -
+ MegaJellyfish
+
+ -
+ Mole
+
+ -
+ Monkey
+
+ -
+ Monster
+
+ -
+ Mosquito
+
+ -
+ Mount
+
+ -
+ Mummy
+
+ -
+ NPC
+
+ -
+ Necromancer
+
+ -
+ Octopus
+
+ -
+ Olmite
+
+ -
+ OsirisHand
+
+ -
+ OsirisHead
+
+ -
+ Pet
+
+ -
+ Player
+
+ -
+ PowerupCapable
+
+ -
+ ProtoShopkeeper
+
+ -
+ Qilin
+
+ -
+ Quillback
+
+ -
+ Robot
+
+ -
+ Rockdog
+
+ -
+ RoomOwner
+
+ -
+ Scarab
+
+ -
+ Scorpion
+
+ -
+ Shopkeeper
+
+ -
+ Skeleton
+
+ -
+ Sorceress
+
+ -
+ Spider
+
+ -
+ Tadpole
+
+ -
+ Terra
+
+ -
+ Tiamat
+
+ -
+ Tun
+
+ -
+ UFO
+
+ -
+ Vampire
+
+ -
+ VanHorsing
+
+ -
+ Vlad
+
+ -
+ Waddler
+
+ -
+ WalkingMonster
+
+ -
+ WitchDoctor
+
+ -
+ WitchDoctorSkull
+
+ -
+ Yama
+
+ -
+ Yang
+
+ -
+ YetiKing
+
+ -
+ YetiQueen
+
+
+
+ -
+ Movable entities
+
+ -
+ AcidBubble
+
+ -
+ AnkhPowerup
+
+ -
+ Arrow
+
+ -
+ AxolotlShot
+
+ -
+ Backpack
+
+ -
+ Birdies
+
+ -
+ Bomb
+
+ -
+ BoneBlock
+
+ -
+ Boombox
+
+ -
+ Boomerang
+
+ -
+ Boulder
+
+ -
+ Bow
+
+ -
+ Bullet
+
+ -
+ Button
+
+ -
+ Cape
+
+ -
+ Chain
+
+ -
+ ChainedPushBlock
+
+ -
+ Chest
+
+ -
+ ClamBase
+
+ -
+ Claw
+
+ -
+ ClimbableRope
+
+ -
+ CloneGunShot
+
+ -
+ Coffin
+
+ -
+ Coin
+
+ -
+ Container
+
+ -
+ CookFire
+
+ -
+ CrushElevator
+
+ -
+ Crushtrap
+
+ -
+ CursedPot
+
+ -
+ CustomMovableBehavior
+
+ -
+ Drill
+
+ -
+ DummyPurchasableEntity
+
+ -
+ EggSac
+
+ -
+ EggshipCenterJetFlame
+
+ -
+ Elevator
+
+ -
+ EmpressGrave
+
+ -
+ Excalibur
+
+ -
+ Explosion
+
+ -
+ FallingPlatform
+
+ -
+ Fireball
+
+ -
+ Flame
+
+ -
+ FlameSize
+
+ -
+ Fly
+
+ -
+ FlyHead
+
+ -
+ FrozenLiquid
+
+ -
+ FxAlienBlast
+
+ -
+ FxAnkhBrokenPiece
+
+ -
+ FxAnkhRotatingSpark
+
+ -
+ FxCompass
+
+ -
+ FxEmpress
+
+ -
+ FxFireflyLight
+
+ -
+ FxHundunNeckPiece
+
+ -
+ FxJellyfishStar
+
+ -
+ FxJetpackFlame
+
+ -
+ FxKinguSliding
+
+ -
+ FxLamassuAttack
+
+ -
+ FxMainExitDoor
+
+ -
+ FxNecromancerANKH
+
+ -
+ FxOuroboroDragonPart
+
+ -
+ FxOuroboroOccluder
+
+ -
+ FxPickupEffect
+
+ -
+ FxPlayerIndicator
+
+ -
+ FxQuickSand
+
+ -
+ FxSaleContainer
+
+ -
+ FxShotgunBlast
+
+ -
+ FxSorceressAttack
+
+ -
+ FxSparkSmall
+
+ -
+ FxSpringtrapRing
+
+ -
+ FxTiamatHead
+
+ -
+ FxTiamatTail
+
+ -
+ FxTiamatTorso
+
+ -
+ FxTornJournalPage
+
+ -
+ FxUnderwaterBubble
+
+ -
+ FxVatBubble
+
+ -
+ FxWaterDrop
+
+ -
+ FxWebbedEffect
+
+ -
+ FxWitchdoctorHint
+
+ -
+ GhostBreath
+
+ -
+ GiantClamTop
+
+ -
+ Goldbar
+
+ -
+ Gun
+
+ -
+ HangAnchor
+
+ -
+ HangStrand
+
+ -
+ Honey
+
+ -
+ Hoverpack
+
+ -
+ HundunChest
+
+ -
+ Idol
+
+ -
+ Jetpack
+
+ -
+ JungleSpearCosmetic
+
+ -
+ KapalaPowerup
+
+ -
+ LampFlame
+
+ -
+ Landmine
+
+ -
+ LaserBeam
+
+ -
+ Leaf
+
+ -
+ LightArrow
+
+ -
+ LightArrowPlatform
+
+ -
+ LightEmitter
+
+ -
+ LightShot
+
+ -
+ LiquidSurface
+
+ -
+ Mattock
+
+ -
+ MegaJellyfishEye
+
+ -
+ MiniGameAsteroid
+
+ -
+ MiniGameShip
+
+ -
+ MiniGameShipOffset
+
+ -
+ Movable
+
+ -
+ MovingIcon
+
+ -
+ Olmec
+
+ -
+ OlmecCannon
+
+ -
+ OlmecFloater
+
+ -
+ OlmecShip
+
+ -
+ Orb
+
+ -
+ ParachutePowerup
+
+ -
+ PlayerBag
+
+ -
+ PlayerGhost
+
+ -
+ Pot
+
+ -
+ Powerup
+
+ -
+ Present
+
+ -
+ PrizeDispenser
+
+ -
+ Projectile
+
+ -
+ PunishBall
+
+ -
+ Purchasable
+
+ -
+ PushBlock
+
+ -
+ RegenBlock
+
+ -
+ RollingItem
+
+ -
+ Rubble
+
+ -
+ ScepterShot
+
+ -
+ Shield
+
+ -
+ SkullDropTrap
+
+ -
+ SleepBubble
+
+ -
+ SnapTrap
+
+ -
+ SoundShot
+
+ -
+ Spark
+
+ -
+ Spear
+
+ -
+ SpecialShot
+
+ -
+ StretchChain
+
+ -
+ Switch
+
+ -
+ TV
+
+ -
+ Teleporter
+
+ -
+ TeleporterBackpack
+
+ -
+ Telescope
+
+ -
+ Tentacle
+
+ -
+ ThinIce
+
+ -
+ TiamatShot
+
+ -
+ TimedPowderkeg
+
+ -
+ TimedShot
+
+ -
+ Torch
+
+ -
+ TorchFlame
+
+ -
+ TrapPart
+
+ -
+ Treasure
+
+ -
+ TreasureHook
+
+ -
+ TrueCrownPowerup
+
+ -
+ UdjatSocket
+
+ -
+ UnchainedSpikeBall
+
+ -
+ Ushabti
+
+ -
+ VanillaMovableBehavior
+
+ -
+ VladsCape
+
+ -
+ WallTorch
+
+ -
+ Web
+
+ -
+ WebShot
+
+ -
+ WoodenlogTrap
+
+ -
+ YellowCape
+
+
+
+
+
+ -
+ Events
+
+ -
+ ON.LOGO
+
+ -
+ ON.INTRO
+
+ -
+ ON.PROLOGUE
+
+ -
+ ON.TITLE
+
+ -
+ ON.MENU
+
+ -
+ ON.OPTIONS
+
+ -
+ ON.PLAYER_PROFILE
+
+ -
+ ON.LEADERBOARD
+
+ -
+ ON.SEED_INPUT
+
+ -
+ ON.CHARACTER_SELECT
+
+ -
+ ON.TEAM_SELECT
+
+ -
+ ON.CAMP
+
+ -
+ ON.LEVEL
+
+ -
+ ON.TRANSITION
+
+ -
+ ON.DEATH
+
+ -
+ ON.SPACESHIP
+
+ -
+ ON.WIN
+
+ -
+ ON.CREDITS
+
+ -
+ ON.SCORES
+
+ -
+ ON.CONSTELLATION
+
+ -
+ ON.RECAP
+
+ -
+ ON.ARENA_MENU
+
+ -
+ ON.ARENA_STAGES
+
+ -
+ ON.ARENA_ITEMS
+
+ -
+ ON.ARENA_SELECT
+
+ -
+ ON.ARENA_INTRO
+
+ -
+ ON.ARENA_MATCH
+
+ -
+ ON.ARENA_SCORE
+
+ -
+ ON.ONLINE_LOADING
+
+ -
+ ON.ONLINE_LOBBY
+
+ -
+ ON.GUIFRAME
+
+ -
+ ON.FRAME
+
+ -
+ ON.GAMEFRAME
+
+ -
+ ON.SCREEN
+
+ -
+ ON.START
+
+ -
+ ON.LOADING
+
+ -
+ ON.RESET
+
+ -
+ ON.SAVE
+
+ -
+ ON.LOAD
+
+ -
+ ON.PRE_LOAD_LEVEL_FILES
+
+ -
+ ON.PRE_LEVEL_GENERATION
+
+ -
+ ON.PRE_LOAD_SCREEN
+
+ -
+ ON.POST_ROOM_GENERATION
+
+ -
+ ON.POST_LEVEL_GENERATION
+
+ -
+ ON.POST_LOAD_SCREEN
+
+ -
+ ON.PRE_GET_RANDOM_ROOM
+
+ -
+ ON.PRE_HANDLE_ROOM_TILES
+
+ -
+ ON.SCRIPT_ENABLE
+
+ -
+ ON.SCRIPT_DISABLE
+
+ -
+ ON.RENDER_PRE_HUD
+
+ -
+ ON.RENDER_POST_HUD
+
+ -
+ ON.RENDER_PRE_PAUSE_MENU
+
+ -
+ ON.RENDER_POST_PAUSE_MENU
+
+ -
+ ON.RENDER_PRE_BLURRED_BACKGROUND
+
+ -
+ ON.RENDER_POST_BLURRED_BACKGROUND
+
+ -
+ ON.RENDER_PRE_DRAW_DEPTH
+
+ -
+ ON.RENDER_POST_DRAW_DEPTH
+
+ -
+ ON.RENDER_PRE_JOURNAL_PAGE
+
+ -
+ ON.RENDER_POST_JOURNAL_PAGE
+
+ -
+ ON.RENDER_PRE_LAYER
+
+ -
+ ON.RENDER_POST_LAYER
+
+ -
+ ON.RENDER_PRE_LEVEL
+
+ -
+ ON.RENDER_POST_LEVEL
+
+ -
+ ON.RENDER_PRE_GAME
+
+ -
+ ON.RENDER_POST_GAME
+
+ -
+ ON.SPEECH_BUBBLE
+
+ -
+ ON.TOAST
+
+ -
+ ON.DEATH_MESSAGE
+
+ -
+ ON.PRE_LOAD_JOURNAL_CHAPTER
+
+ -
+ ON.POST_LOAD_JOURNAL_CHAPTER
+
+ -
+ ON.PRE_GET_FEAT
+
+ -
+ ON.PRE_SET_FEAT
+
+ -
+ ON.PRE_UPDATE
+
+ -
+ ON.POST_UPDATE
+
+ -
+ ON.USER_DATA
+
+
+
+ -
+ Enums
+
+ -
+ BEG
+
+ -
+ BUTTON
+
+ -
+ CAUSE_OF_DEATH
+
+ -
+ CHAR_STATE
+
+ -
+ CONST
+
+ -
+ CORNER_FINISH
+
+ -
+ COSUBTHEME
+
+ -
+ DAMAGE_TYPE
+
+ -
+ DRAW_LAYER
-
DROP
@@ -2282,2808 +3598,17992 @@
Overlunky/Playlunky Lua API
Read this first
-- We try not to make breaking changes to the API, but some stupid errors or new stuff that was guessed wrong may have to be changed. Sorry!
-- If you encounter something that doesn't seem quite right, please raise your voice instead of conforming to it outright.
-- This doc is generated from dozens of C++ files by a janky-ass python script however, so there may be weird documentation errors that hopefully don't reflect weird errors in the API.
-- This doc doesn't have a lot of examples, that's why we have examples/. There are also sample mods for things that make more sense in Playlunky.
-- This doc and the examples are written for a person who already knows how to program in Lua.
-- This doc doesn't cover how to actually load scripts. Check the README for instructions.
-- This doc is up to date for the Overlunky WHIP build and Playlunky nightly build. If you're using a stable release from the past, you might find some things here don't work.
-- Set
OL_DEBUG=1
in the same environment where the game is running to keep the Overlunky terminal open for better debug prints. This could be cmd
or even the system environment variables if playing on Steam. Playlunky will also print the messages to terminal (even from Overlunky) if ran with the -console
switch.
+- We try not to make breaking changes to the API, but some stupid errors or new stuff that was guessed wrong may have to be changed. Sorry!
+- If you encounter something that doesn't seem quite right, please raise your voice instead of conforming to it outright.
+- This doc is generated from dozens of C++ files by a janky-ass python script however, so there may be weird documentation errors that hopefully don't reflect weird errors in the API.
+- This doc doesn't have a lot of examples, that's why we have examples/. There are also sample mods for things that make more sense in Playlunky.
+- This doc and the examples are written for a person who already knows how to program in Lua.
+- This doc doesn't cover how to actually load scripts. Check the README for instructions.
+- This doc is up to date for the Overlunky WHIP build and Playlunky nightly build. If you're using a stable release from the past, you might find some things here don't work.
+- Set
OL_DEBUG=1
in the same environment where the game is running to keep the Overlunky terminal open for better debug prints. This could be cmd
or even the system environment variables if playing on Steam. Playlunky will also print the messages to terminal (even from Overlunky) if ran with the -console
switch.
+
+External Function Library
+If you use a text editor/IDE that has a Lua linter available you can download spel2.lua, place it in a folder of your choice and specify that folder as a "external function library". For example VSCode with the Lua Extension offers this feature. This will allow you to get auto-completion of API functions along with linting
+Lua libraries
+The following Lua libraries and their functions are available. You can read more about them in the Lua documentation. We're using Lua 5.4 with the Sol C++ binding.
+math
base
string
table
coroutine
package
json
+To save data in your mod it makes a lot of sense to use json
to encode a table into a string and decode strings to table. For example this code that saves table and loads it back:
+local some_mod_data_that_should_be_saved = {{
+ kills = 0,
+ unlocked = false
+}}
+set_callback(function(save_ctx)
+ local save_data_str = json.encode(some_mod_data_that_should_be_saved)
+ save_ctx:save(save_data_str)
+end, ON.SAVE)
+
+set_callback(function(load_ctx)
+ local load_data_str = load_ctx:load()
+ if load_data_str ~= "" then
+ some_mod_data_that_should_be_saved = json.decode(load_data_str)
+ end
+end, ON.LOAD)
+
inspect
+This module is a great substitute for tostring
because it can convert any type to a string and thus helps a lot with debugging. Use for example like this:
+local look_ma_no_tostring = {
+ number = 15,
+ nested_table = {
+ array = {
+ 1,
+ 2,
+ 4
+ }
+ }
+}
+message(inspect(look_ma_no_tostring))
+--[[prints:
+{
+ number = 15,
+ nested_table = {
+ array = { 1, 2, 4 }
+ }
+}
+]]
+
format
+This allows you to make strings without having to do a lot of tostring
and ..
by placing your variables directly inside of the string. Use F
in front of your string and wrap variables you want to print in {}
, for example like this:
+for _, player in players do
+ local royal_title = nil
+ if player:is_female() then
+ royal_title = 'Queen'
+ else
+ royal_title = 'King'
+ end
+ local name = F'{player:get_name()} aka {royal_title} {player:get_short_name()}'
+ message(name)
+end
+
Unsafe mode
+Setting meta.unsafe = true
enables the rest of the standard Lua libraries like io
and os
, loading dlls with require and package.loadlib
. Using unsafe scripts requires users to enable the option in the overlunky.ini file which is found in the Spelunky 2 installation directory.
+Modules
+You can load modules with require "mymod"
or require "mydir.mymod"
, just put mymod.lua
in the same directory the script is, or in mydir/
to keep things organized.
+
+Check the Lua tutorial or examples how to actually make modules.
+
+You can also import other loaded script mods to your own mod if they have exports
.
+Aliases
+Used to clarify what kind of values can be passed and returned from a function, even if the underlying type is really just an integer or a string. This should help to avoid bugs where one would for example just pass a random integer to a function expecting a callback id.
+
+
+
+Name
+Type
+
+
+
+CallbackId
+int;
+
+
+Flags
+int;
+
+
+uColor
+int;
+
+
+SHORT_TILE_CODE
+int;
+
+
+STRINGID
+int;
+
+
+FEAT
+int;
+
+
+Global variables
+These variables are always there to use.
+meta
meta.name = "Awesome Mod"
+meta.version = "1.0"
+meta.author = "You"
+meta.description = [[
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut at nulla porttitor, lobortis magna at, tempus dolor. Cras non ligula tellus. Duis tincidunt sodales velit et ornare. Mauris eu sapien finibus dolor dictum malesuada in non elit.
+
+ Aenean luctus leo ut diam ornare viverra. Nunc condimentum interdum elit, quis porttitor quam finibus ac. Nam mattis, lectus commodo placerat tristique, justo justo congue dui, sed sodales nunc sem ut neque.
+]]
+-- set this to enable unsafe mode
+--meta.unsafe = true
+
+-- rest of your mod goes here
+
+
array<mixed> meta
+
+Search script examples for meta
+
+
+Table of strings where you should set some script metadata shown in the UI and used by other scripts to find your script.
+state
if state.time_level > 300 and state.theme == THEME.DWELLING then
+ toast("Congratulations for lasting 5 seconds in Dwelling")
+end
+
+
StateMemory state
+
+Search script examples for state
+
+
+A bunch of game state variables. Your ticket to almost anything that is not an Entity.
+game_manager
if game_manager.game_props.game_has_focus == false then
+ message("Come back soon!")
+end
+
+
GameManager game_manager
+
+Search script examples for game_manager
+
+
+The GameManager gives access to a couple of Screens as well as the pause and journal UI elements
+online
message = "Currently playing: "
+for _, p in pairs(online.online_players) do
+ if p.ready_state ~= 0 then
+ message = message .. p.player_name .. " "
+ end
+end
+print(message)
+
+
Online online
+
+Search script examples for online
+
+
+The Online object has information about the online lobby and its players
+players
-- Make the player invisible, use only in single player only mods
+
+players[1].flags = set_flag(players[1].flags, 1)
+
+
array<Player> players
+
+Search script examples for players
+
+
+An array of Player of the current players. This is just a list of existing Player entities in order, i.e., players[1]
is not guaranteed to be P1 if they have been gibbed for example. See get_player.
+savegame
+
+Print best time from savegame
+
+prinspect(savegame.time_best)
+
SaveData savegame
+
+Search script examples for savegame
+
+
+Provides access to the save data, updated as soon as something changes (i.e. before it's written to savegame.sav.) Use save_progress to save to savegame.sav.
+options
register_option_bool("bomb_bag", "BombBag", "Spawn bomb bag at the start of every level", false)
+
+set_callback(function()
+ if options.bomb_bag then
+ -- Spawn the bomb bag at player location thanks to the LAYER.PLAYER1
+ spawn_entity_snapped_to_floor(ENT_TYPE.ITEM_PICKUP_BOMBBAG, 0, 0, LAYER.PLAYER1)
+ end
+end, ON.LEVEL)
+
+
optional<array<mixed>> options
+
+Search script examples for options
+
+
+Table of options set in the UI, added with the register_option_functions, but nil
before any options are registered. You can also write your own options in here or override values defined in the register functions/UI before or after they are registered. Check the examples for many different use cases and saving options to disk.
+prng
--Make it so there is 50% chance that the Ankh will be destroyed
+
+set_callback(function ()
+ -- more or less 50% chance
+ if prng:random(2) == 1 then
+ -- get all Ankh's in a level
+ ankhs = get_entities_by(ENT_TYPE.ITEM_PICKUP_ANKH, MASK.ITEM, LAYER.BOTH)
+ for _, uid in pairs(ankhs) do
+ get_entity(uid):destroy()
+ end
+ end
+end, ON.LEVEL)
+
+
PRNG prng
+
+Search script examples for prng
+
+
+The global prng state, calling any function on it will advance the prng state, thus desynchronizing clients if it does not happen on both clients.
+Functions
+The game functions like spawn
use level coordinates. Draw functions use normalized screen coordinates from -1.0 .. 1.0
where 0.0, 0.0
is the center of the screen.
+Callback functions
clear_callback
+
+Create three explosions and then clear the interval
+
+local count = 0 -- this upvalues to the interval
+set_interval(function()
+ count = count + 1
+ spawn(ENT_TYPE.FX_EXPLOSION, 0, 0, LAYER.FRONT, 0, 0)
+ if count >= 3 then
+ -- calling this without parameters clears the callback that's calling it
+ clear_callback()
+ end
+end, 60)
+
+
+Search script examples for clear_callback
+
+nil clear_callback(optional<CallbackId> id)
+Clear previously added callback id
or call without arguments inside any callback to clear that callback after it returns.
+clear_screen_callback
+
+Search script examples for clear_screen_callback
+
+nil clear_screen_callback(int screen_id, CallbackId cb_id)
+Clears a callback that is specific to a screen.
+clear_vanilla_sound_callback
+
+Search script examples for clear_vanilla_sound_callback
+
+nil clear_vanilla_sound_callback(CallbackId id)
+Clears a previously set callback
+set_callback
+
+Search script examples for set_callback
+
+CallbackId set_callback(function cb, ON event)
+Returns unique id for the callback to be used in clear_callback.
+Add global callback function to be called on an event.
+set_global_interval
+
+Search script examples for set_global_interval
+
+CallbackId set_global_interval(function cb, int frames)
+Returns unique id for the callback to be used in clear_callback. You can also return false
from your function to clear the callback.
+Add global callback function to be called every frames
engine frames. This timer is never paused or cleared.
+set_global_timeout
+
+Search script examples for set_global_timeout
+
+CallbackId set_global_timeout(function cb, int frames)
+Returns unique id for the callback to be used in clear_callback.
+Add global callback function to be called after frames
engine frames. This timer is never paused or cleared.
+set_interval
+
+Create three explosions and then clear the interval
+
+local count = 0 -- this upvalues to the interval
+set_interval(function()
+ count = count + 1
+ spawn(ENT_TYPE.FX_EXPLOSION, 0, 0, LAYER.FRONT, 0, 0)
+ if count >= 3 then
+ -- calling this without parameters clears the fallback that's calling it
+ clear_callback()
+ end
+end, 60)
+
+
+Search script examples for set_interval
+
+CallbackId set_interval(function cb, int frames)
+Returns unique id for the callback to be used in clear_callback. You can also return false
from your function to clear the callback.
+Add per level callback function to be called every frames
engine frames
+Ex. frames = 100 - will call the function on 100th frame from this point. This might differ in the exact timing of first frame depending as in what part of the frame you call this function
+or even be one frame off if called right before the time_level variable is updated
+If you require precise timing, choose the start of your interval in one of those safe callbacks:
+The SCREEN callbacks: from ON.LOGO to ON.ONLINE_LOBBY or custom callbacks ON.FRAME, ON.SCREEN, ON.START, ON.LOADING, ON.RESET, ON.POST_UPDATE
+Timer is paused on pause and cleared on level transition.
+set_on_player_instagib
+
+Search script examples for set_on_player_instagib
+
+optional<CallbackId> set_on_player_instagib(int uid, function fun)
+Returns unique id for the callback to be used in clear_callback or nil
if uid is not valid.
+Sets a callback that is called right when an player/hired hand is crushed/insta-gibbed, return true
to skip the game's crush handling.
+The game's instagib function will be forcibly executed (regardless of whatever you return in the callback) when the entity's health is zero.
+This is so that when the entity dies (from other causes), the death screen still gets shown.
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is bool on_player_instagib(Entity self)
+set_post_entity_spawn
+
+Search script examples for set_post_entity_spawn
+
+CallbackId set_post_entity_spawn(function cb, SPAWN_TYPE flags, int mask, variadic_args entity_types)
+Add a callback for a spawn of specific entity types or mask. Set mask
to MASK.ANY
to ignore that.
+This is run right after the entity is spawned but before and particular properties are changed, e.g. owner or velocity.
+
The callback signature is nil post_entity_spawn(Entity ent, SPAWN_TYPE spawn_flags)
+set_post_render_screen
+
+Search script examples for set_post_render_screen
+
+optional<CallbackId> set_post_render_screen(int screen_id, function fun)
+Returns unique id for the callback to be used in clear_screen_callback or nil
if screen_id is not valid.
+Sets a callback that is called right after the screen is drawn.
+
The callback signature is nil render_screen(Screen self, VanillaRenderContext render_ctx)
+set_pre_entity_spawn
+
+Search script examples for set_pre_entity_spawn
+
+CallbackId set_pre_entity_spawn(function cb, SPAWN_TYPE flags, int mask, variadic_args entity_types)
+Add a callback for a spawn of specific entity types or mask. Set mask
to MASK.ANY
to ignore that.
+This is run before the entity is spawned, spawn your own entity and return its uid to replace the intended spawn.
+In many cases replacing the intended entity won't have the indended effect or will even break the game, so use only if you really know what you're doing.
+
The callback signature is optional pre_entity_spawn(ENT_TYPE entity_type, float x, float y, int layer, Entity overlay_entity, SPAWN_TYPE spawn_flags)
+set_pre_render_screen
+
+Search script examples for set_pre_render_screen
+
+optional<CallbackId> set_pre_render_screen(int screen_id, function fun)
+Returns unique id for the callback to be used in clear_screen_callback or nil
if screen_id is not valid.
+Sets a callback that is called right before the screen is drawn, return true
to skip the default rendering.
+
The callback signature is bool render_screen(Screen self, VanillaRenderContext render_ctx)
+set_timeout
+
+Search script examples for set_timeout
+
+CallbackId set_timeout(function cb, int frames)
+Returns unique id for the callback to be used in clear_callback.
+Add per level callback function to be called after frames
engine frames. Timer is paused on pause and cleared on level transition.
+set_vanilla_sound_callback
+
+Search script examples for set_vanilla_sound_callback
+
+CallbackId set_vanilla_sound_callback(VANILLA_SOUND name, VANILLA_SOUND_CALLBACK_TYPE types, function cb)
+Returns unique id for the callback to be used in clear_vanilla_sound_callback.
+Sets a callback for a vanilla sound which lets you hook creation or playing events of that sound
+Callbacks are executed on another thread, so avoid touching any global state, only the local Lua state is protected
+If you set such a callback and then play the same sound yourself you have to wait until receiving the STARTED event before changing any properties on the sound. Otherwise you may cause a deadlock.
+
The callback signature is nil on_vanilla_sound(PlayingSound sound)
+Debug functions
dump_network
+
+Search script examples for dump_network
+
+nil dump_network()
+Hook the sendto and recvfrom functions and start dumping network data to terminal
+get_address
+
+Search script examples for get_address
+
+size_t get_address(string_view address_name)
+Get the address for a pattern name
+get_rva
+
+Search script examples for get_rva
+
+size_t get_rva(string_view address_name)
+Get the rva for a pattern name
+raise
+
+Search script examples for raise
+
+nil raise()
+Raise a signal and probably crash the game
+Entity functions
activate_sparktraps_hack
activate_sparktraps_hack(true);
+
+-- set random speed, direction and distance for the spark
+set_post_entity_spawn(function(ent)
+
+ direction = 1
+ if prng:random_chance(2, PRNG_CLASS.ENTITY_VARIATION) then
+ direction = -1
+ end
+
+ ent.speed = prng:random_float(PRNG_CLASS.ENTITY_VARIATION) * 0.1 * direction
+ ent.distance = prng:random_float(PRNG_CLASS.ENTITY_VARIATION) * 10
+
+end, SPAWN_TYPE.ANY, 0, ENT_TYPE.ITEM_SPARK)
+
+
+Search script examples for activate_sparktraps_hack
+
+nil activate_sparktraps_hack(bool activate)
+Activate custom variables for speed and distance in the ITEM_SPARK
+note: because those the variables are custom and game does not initiate them, you need to do it yourself for each spark, recommending set_post_entity_spawn
+default game values are: speed = -0.015, distance = 3.0
+apply_entity_db
+
+Search script examples for apply_entity_db
+
+nil apply_entity_db(int uid)
+Apply changes made in get_type() to entity instance by uid.
+attach_ball_and_chain
+
+Search script examples for attach_ball_and_chain
+
+int attach_ball_and_chain(int uid, float off_x, float off_y)
+Spawns and attaches ball and chain to uid
, the initial position of the ball is at the entity position plus off_x
, off_y
+attach_entity
+
+Search script examples for attach_entity
+
+nil attach_entity(int overlay_uid, int attachee_uid)
+Attaches attachee
to overlay
, similar to setting get_entity(attachee).overlay = get_entity(overlay)
.
+However this function offsets attachee
(so you don't have to) and inserts it into overlay
's inventory.
+carry
+
+Search script examples for carry
+
+nil carry(int mount_uid, int rider_uid)
+Make mount_uid
carry rider_uid
on their back. Only use this with actual mounts and living things.
+change_waddler_drop
+
+Search script examples for change_waddler_drop
+
+nil change_waddler_drop(array<ENT_TYPE> ent_types)
+Change ENT_TYPE's spawned when Waddler dies, by default there are 3:
+{ITEM_PICKUP_COMPASS, ITEM_CHEST, ITEM_KEY}
+Max 255 types.
+Use empty table as argument to reset to the game default
+drop
+
+Search script examples for drop
+
+nil drop(int who_uid, int what_uid)
+Drop an entity by uid
+enter_door
+
+Search script examples for enter_door
+
+nil enter_door(int player_uid, int door_uid)
+Calls the enter door function, position doesn't matter, can also enter closed doors (like COG, EW) without unlocking them
+entity_get_items_by
+
+Search script examples for entity_get_items_by
+
+array<int> entity_get_items_by(int uid, array<ENT_TYPE> entity_types, int mask)
array<int> entity_get_items_by(int uid, ENT_TYPE entity_type, int mask)
+Gets uids of entities attached to given entity uid. Use entity_type
and mask
(MASK) to filter, set them to 0 to return all attached entities.
+entity_has_item_type
+
+Search script examples for entity_has_item_type
+
+bool entity_has_item_type(int uid, array<ENT_TYPE> entity_types)
bool entity_has_item_type(int uid, ENT_TYPE entity_type)
+Check if the entity uid
has some ENT_TYPE entity_type
in their inventory, can also use table of entity_types
+entity_has_item_uid
+
+Search script examples for entity_has_item_uid
+
+bool entity_has_item_uid(int uid, int item_uid)
+Check if the entity uid
has some specific item_uid
by uid in their inventory
+entity_remove_item
+
+Search script examples for entity_remove_item
+
+nil entity_remove_item(int uid, int item_uid)
+Remove item by uid from entity
+filter_entities
+
+Search script examples for filter_entities
+
+array<int> filter_entities(array entities, function predicate)
+Returns a list of all uids in entities
for which predicate(get_entity(uid))
returns true
+flip_entity
+
+Search script examples for flip_entity
+
+nil flip_entity(int uid)
+Flip entity around by uid. All new entities face right by default.
+force_olmec_phase_0
+
+Search script examples for force_olmec_phase_0
+
+nil force_olmec_phase_0(bool b)
+Forces Olmec to stay on phase 0 (stomping)
+get_door_target
+
+Search script examples for get_door_target
+
+tuple<int, int, int> get_door_target(int uid)
+Get door target world
, level
, theme
+get_entities_at
+
+Search script examples for get_entities_at
+
+array<int> get_entities_at(array<ENT_TYPE> entity_types, int mask, float x, float y, LAYER layer, float radius)
array<int> get_entities_at(ENT_TYPE entity_type, int mask, float x, float y, LAYER layer, float radius)
+Get uids of matching entities inside some radius (ENT_TYPE, MASK). Set entity_type
or mask
to 0
to ignore that, can also use table of entity_types
+Recommended to always set the mask, even if you look for one entity type
+get_entities_by
-- find all cavemen and give them bombs
+-- using a type and mask in get_entities_by speeds up the search, cause the api knows which bucket to search in
+for i,uid in ipairs(get_entities_by(ENT_TYPE.MONS_CAVEMAN, MASK.MONSTER, LAYER.BOTH)) do
+ local x, y, l = get_position(uid)
+ spawn_entity_snapped_to_floor(ENT_TYPE.ITEM_BOMB, x, y, l)
+end
+
+
+
+Search script examples for get_entities_by
+
+array<int> get_entities_by(array<ENT_TYPE> entity_types, int mask, LAYER layer)
array<int> get_entities_by(ENT_TYPE entity_type, int mask, LAYER layer)
+Get uids of entities by some conditions (ENT_TYPE, MASK). Set entity_type
or mask
to 0
to ignore that, can also use table of entity_types.
+Recommended to always set the mask, even if you look for one entity type
+get_entities_by_type
local types = {ENT_TYPE.MONS_SNAKE, ENT_TYPE.MONS_BAT}
+set_callback(function()
+ local uids = get_entities_by_type(ENT_TYPE.MONS_SNAKE, ENT_TYPE.MONS_BAT)
+ -- is not the same thing as this, but also works
+ local uids2 = get_entities_by_type(types)
+ print(tostring(#uids).." == "..tostring(#uids2))
+end, ON.LEVEL)
+
+
+
+Search script examples for get_entities_by_type
+
+array<int> get_entities_by_type(int, int...)
+Get uids of entities matching id. This function is variadic, meaning it accepts any number of id's.
+You can even pass a table!
+This function can be slower than the get_entities_by with the mask parameter filled
+get_entities_overlapping_hitbox
+
+Search script examples for get_entities_overlapping_hitbox
+
+array<int> get_entities_overlapping_hitbox(array<ENT_TYPE> entity_types, int mask, AABB hitbox, LAYER layer)
array<int> get_entities_overlapping_hitbox(ENT_TYPE entity_type, int mask, AABB hitbox, LAYER layer)
+Get uids of matching entities overlapping with the given hitbox. Set entity_type
or mask
to 0
to ignore that, can also use table of entity_types
+get_entity
+
+Search script examples for get_entity
+
+Entity get_entity(int uid)
+Get the Entity behind an uid, converted to the correct type. To see what type you will get, consult the entity hierarchy list
+get_entity_name
+
+Search script examples for get_entity_name
+
+string get_entity_name(ENT_TYPE type, optional fallback_strategy)
+Get localized name of an entity, pass fallback_strategy
as true
to fall back to the ENT_TYPE.
enum name
+if the entity has no localized name
+get_entity_type
+
+Search script examples for get_entity_type
+
+ENT_TYPE get_entity_type(int uid)
+Get the ENT_TYPE... of the entity by uid
+get_grid_entity_at
+
+Search script examples for get_grid_entity_at
+
+int get_grid_entity_at(float x, float y, LAYER layer)
+Gets a grid entity, such as floor or spikes, at the given position and layer.
+get_local_players
+
+Search script examples for get_local_players
+
+nil get_local_players()
+Get the thread-local version of players
+get_player
+
+Search script examples for get_player
+
+Player get_player(int slot, bool or_ghost = false)
+Returns Player (or PlayerGhost if get_player(1, true)
) with this player slot
+get_playerghost
+
+Search script examples for get_playerghost
+
+PlayerGhost get_playerghost(int slot)
+Returns PlayerGhost with this player slot 1..4
+get_type
+
+Search script examples for get_type
+
+EntityDB get_type(int id)
+Get the EntityDB behind an ENT_TYPE...
+kill_entity
+
+Search script examples for kill_entity
+
+nil kill_entity(int uid, optional destroy_corpse = nullopt)
+Kills an entity by uid. destroy_corpse
defaults to true
, if you are killing for example a caveman and want the corpse to stay make sure to pass false
.
+lock_door_at
+
+Search script examples for lock_door_at
+
+nil lock_door_at(float x, float y)
+Try to lock the exit at coordinates
+modify_ankh_health_gain
+
+Search script examples for modify_ankh_health_gain
+
+nil modify_ankh_health_gain(int max_health, int beat_add_health)
+Change how much health the ankh gives you after death, with every beat (the heart beat effect) it will add beat_add_health
to your health,
+beat_add_health
has to be divisor of health
and can't be 0, otherwise the function does nothing. Set health
to 0 to return to the game defaults
+If you set health
above the game max health it will be forced down to the game max
+modify_sparktraps
+
+Search script examples for modify_sparktraps
+
+nil modify_sparktraps(float angle_increment = 0.015, float distance = 3.0)
+Changes characteristics of (all) sparktraps: speed, rotation direction and distance from center
+Speed: expressed as the amount that should be added to the angle every frame (use a negative number to go in the other direction)
+Distance from center: if you go above 3.0 the game might crash because a spark may go out of bounds!
+move_entity
+
+Search script examples for move_entity
+
+nil move_entity(int uid, float x, float y, float vx, float vy)
nil move_entity(int uid, float x, float y, float vx, float vy, LAYER layer)
+Teleport entity to coordinates with optional velocity
+move_grid_entity
+
+Search script examples for move_grid_entity
+
+nil move_grid_entity(int uid, float x, float y, LAYER layer)
+Teleport grid entity, the destination should be whole number, this ensures that the collisions will work properly
+pick_up
-- spawn and equip a jetpack on the player
+pick_up(players[1].uid, spawn(ENT_TYPE.ITEM_JETPACK, 0, 0, LAYER.PLAYER, 0, 0))
+
+
+
+Search script examples for pick_up
+
+nil pick_up(int who_uid, int what_uid)
+Pick up another entity by uid. Make sure you're not already holding something, or weird stuff will happen.
+poison_entity
+
+Search script examples for poison_entity
+
+nil poison_entity(int entity_uid)
+Poisons entity, to cure poison set Movable.poison_tick_timer
to -1
+replace_drop
+
+Search script examples for replace_drop
+
+nil replace_drop(int drop_id, ENT_TYPE new_drop_entity_type)
+Changes a particular drop, e.g. what Van Horsing throws at you (use e.g. replace_drop(DROP.VAN_HORSING_DIAMOND, ENT_TYPE.ITEM_PLASMACANNON))
+Use 0
as type to reset this drop to default, use -1
as drop_id to reset all to default
+set_boss_door_control_enabled
+
+Search script examples for set_boss_door_control_enabled
+
+nil set_boss_door_control_enabled(bool enable)
+Allows you to disable the control over the door for Hundun and Tiamat
+This will also prevent game crashing when there is no exit door when they are in level
+set_contents
+
+Search script examples for set_contents
+
+nil set_contents(int uid, ENT_TYPE item_entity_type)
+Set the contents of Coffin, Present, Pot, Container
+Check the entity hierarchy list for what the exact ENT_TYPE's can this function affect
+set_cursepot_ghost_enabled
+
+Search script examples for set_cursepot_ghost_enabled
+
+nil set_cursepot_ghost_enabled(bool enable)
+Determines whether the ghost appears when breaking the ghost pot
+set_door
+
+Search script examples for set_door
+
+nil set_door(int uid, int w, int l, int t)
+Short for set_door_target.
+set_door_target
+
+Search script examples for set_door_target
+
+nil set_door_target(int uid, int w, int l, int t)
+Make an ENT_TYPE.FLOOR_DOOR_EXIT go to world w
, level l
, theme t
+set_drop_chance
+
+Search script examples for set_drop_chance
+
+nil set_drop_chance(int dropchance_id, int new_drop_chance)
+Alters the drop chance for the provided monster-item combination (use e.g. set_drop_chance(DROPCHANCE.MOLE_MATTOCK, 10) for a 1 in 10 chance)
+Use -1
as dropchance_id to reset all to default
+set_explosion_mask
+
+Search script examples for set_explosion_mask
+
+nil set_explosion_mask(int mask)
+Sets which entities are affected by a bomb explosion. Default = MASK.PLAYER | MASK.MOUNT | MASK.MONSTER | MASK.ITEM | MASK.ACTIVEFLOOR | MASK.FLOOR
+set_kapala_blood_threshold
+
+Search script examples for set_kapala_blood_threshold
+
+nil set_kapala_blood_threshold(int threshold)
+Sets the amount of blood drops in the Kapala needed to trigger a health increase (default = 7).
+set_kapala_hud_icon
+
+Search script examples for set_kapala_hud_icon
+
+nil set_kapala_hud_icon(int icon_index)
+Sets the hud icon for the Kapala (0-6 ; -1 for default behaviour).
+If you set a Kapala treshold greater than 7, make sure to set the hud icon in the range 0-6, or other icons will appear in the hud!
+set_max_rope_length
+
+Search script examples for set_max_rope_length
+
+nil set_max_rope_length(int length)
+Sets the maximum length of a thrown rope (anchor segment not included). Unfortunately, setting this higher than default (6) creates visual glitches in the rope, even though it is fully functional.
+set_olmec_cutscene_enabled
+
+Search script examples for set_olmec_cutscene_enabled
+
+nil set_olmec_cutscene_enabled(bool enable)
set_olmec_phase_y_level
+
+Search script examples for set_olmec_phase_y_level
+
+nil set_olmec_phase_y_level(int phase, float y)
+Sets the Y-level at which Olmec changes phases
+set_time_ghost_enabled
+
+Search script examples for set_time_ghost_enabled
+
+nil set_time_ghost_enabled(bool b)
+Determines whether the time ghost appears, including the showing of the ghost toast
+set_time_jelly_enabled
+
+Search script examples for set_time_jelly_enabled
+
+nil set_time_jelly_enabled(bool b)
+Determines whether the time jelly appears in cosmic ocean
+unequip_backitem
+
+Search script examples for unequip_backitem
+
+nil unequip_backitem(int who_uid)
+Unequips the currently worn backitem
+unlock_door_at
+
+Search script examples for unlock_door_at
+
+nil unlock_door_at(float x, float y)
+Try to unlock the exit at coordinates
+waddler_count_entity
+
+Search script examples for waddler_count_entity
+
+int waddler_count_entity(ENT_TYPE entity_type)
+Returns how many of a specific entity type Waddler has stored
+waddler_entity_type_in_slot
+
+Search script examples for waddler_entity_type_in_slot
+
+int waddler_entity_type_in_slot(int slot)
+Gets the entity type of the item in the provided slot
+waddler_get_entity_meta
+
+Search script examples for waddler_get_entity_meta
+
+int waddler_get_entity_meta(int slot)
+Gets the 16-bit meta-value associated with the entity type in the associated slot
+waddler_remove_entity
+
+Search script examples for waddler_remove_entity
+
+nil waddler_remove_entity(ENT_TYPE entity_type, int amount_to_remove = 99)
+Removes an entity type from Waddler's storage. Second param determines how many of the item to remove (default = remove all)
+waddler_set_entity_meta
+
+Search script examples for waddler_set_entity_meta
+
+nil waddler_set_entity_meta(int slot, int meta)
+Sets the 16-bit meta-value associated with the entity type in the associated slot
+waddler_store_entity
+
+Search script examples for waddler_store_entity
+
+int waddler_store_entity(ENT_TYPE entity_type)
+Store an entity type in Waddler's storage. Returns the slot number the item was stored in or -1 when storage is full and the item couldn't be stored.
+worn_backitem
+
+Search script examples for worn_backitem
+
+int worn_backitem(int who_uid)
+Returns the uid of the currently worn backitem, or -1 if wearing nothing
+Feat functions
change_feat
+
+Search script examples for change_feat
+
+nil change_feat(FEAT feat, bool hidden, string name, string description)
+Helper function to set the title and description strings for a FEAT with change_string, as well as the hidden state.
+get_feat
+
+Search script examples for get_feat
+
+tuple<bool, bool, const string, const string> get_feat(FEAT feat)
+Check if the user has performed a feat (Real Steam achievement or a hooked one). Returns: bool unlocked, bool hidden, string name, string description
+get_feat_hidden
+
+Search script examples for get_feat_hidden
+
+bool get_feat_hidden(FEAT feat)
+Get the visibility of a feat
+set_feat_hidden
+
+Search script examples for set_feat_hidden
+
+nil set_feat_hidden(FEAT feat, bool hidden)
+Set the visibility of a feat
+Flag functions
clr_flag
+
+Search script examples for clr_flag
+
+Flags clr_flag(Flags flags, int bit)
+Clears the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
+flip_flag
+
+Search script examples for flip_flag
+
+Flags flip_flag(Flags flags, int bit)
+Flips the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
+get_entity_flags
+
+Search script examples for get_entity_flags
+
+int get_entity_flags(int uid)
+Get the flags
field from entity by uid
+get_entity_flags2
+
+Search script examples for get_entity_flags2
+
+int get_entity_flags2(int uid)
+Get the more_flags
field from entity by uid
+get_level_flags
+
+Search script examples for get_level_flags
+
+int get_level_flags()
+Get state.level_flags
+set_entity_flags
+
+Search script examples for set_entity_flags
+
+nil set_entity_flags(int uid, int flags)
+Set the flags
field from entity by uid
+set_entity_flags2
+
+Search script examples for set_entity_flags2
+
+nil set_entity_flags2(int uid, int flags)
+Set the more_flags
field from entity by uid
+set_flag
+
+Search script examples for set_flag
+
+Flags set_flag(Flags flags, int bit)
+Set the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
+set_level_flags
+
+Search script examples for set_level_flags
+
+nil set_level_flags(int flags)
+Set state.level_flags
+test_flag
+
+Search script examples for test_flag
+
+bool test_flag(Flags flags, int bit)
+Returns true if the nth bit is set in the number.
+Generic functions
activate_crush_elevator_hack
+
+Search script examples for activate_crush_elevator_hack
+
+nil activate_crush_elevator_hack(bool activate)
+Activate custom variables for speed and y coordinate limit for crushing elevator
+note: because those variables are custom and game does not initiate them, you need to do it yourself for each CrushElevator entity, recommending set_post_entity_spawn
+default game values are: speed = 0.0125, y_limit = 98.5
+activate_hundun_hack
+
+Search script examples for activate_hundun_hack
+
+nil activate_hundun_hack(bool activate)
+Activate custom variables for y coordinate limit for hundun and spawn of it's heads
+note: because those variables are custom and game does not initiate them, you need to do it yourself for each Hundun entity, recommending set_post_entity_spawn
+default game value are: y_limit = 98.5, rising_speed_x = 0, rising_speed_y = 0.0125, bird_head_spawn_y = 55, snake_head_spawn_y = 71
+change_poison_timer
+
+Search script examples for change_poison_timer
+
+nil change_poison_timer(int frames)
+Change the amount of frames after the damage from poison is applied
+clear_cache
+
+Search script examples for clear_cache
+
+nil clear_cache()
+Clear cache for a file path or the whole directory
+clr_mask
+
+Search script examples for clr_mask
+
+Flags clr_mask(Flags flags, Flags mask)
+Clears a bitmask in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
+create_image
+
+Search script examples for create_image
+
+tuple<IMAGE, int, int> create_image(string path)
+Create image from file. Returns a tuple containing id, width and height.
+Depending on the image size, this can take a moment, preferably don't create them dynamically, rather create all you need in global scope so it will load them as soon as the game starts
+create_image_crop
+
+Search script examples for create_image_crop
+
+tuple<IMAGE, int, int> create_image_crop(string path, int x, int y, int w, int h)
+Create image from file, cropped to the geometry provided. Returns a tuple containing id, width and height.
+Depending on the image size, this can take a moment, preferably don't create them dynamically, rather create all you need in global scope so it will load them as soon as the game starts
+disable_floor_embeds
+
+Search script examples for disable_floor_embeds
+
+bool disable_floor_embeds(bool disable)
+Disable all crust item spawns, returns whether they were already disabled before the call
+flip_mask
+
+Search script examples for flip_mask
+
+Flags flip_mask(Flags flags, Flags mask)
+Flips the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
+force_journal
+
+Search script examples for force_journal
+
+nil force_journal(int chapter, int entry)
+Force the journal to open on a chapter and entry# when pressing the journal button. Only use even entry numbers. Set chapter to JOURNALUI_PAGE_SHOWN.JOURNAL
to reset. (This forces the journal toggle to always read from game_manager.save_related.journal_popup_ui.entry_to_show
etc.)
+get_adventure_seed
+
+Search script examples for get_adventure_seed
+
+tuple<int, int> get_adventure_seed()
+Get the current adventure seed pair
+get_character_heart_color
+
+Search script examples for get_character_heart_color
+
+Color get_character_heart_color(ENT_TYPE type_id)
+Same as Player.get_heart_color
+get_frame
+
+Search script examples for get_frame
+
+int get_frame()
+Get the current global frame count since the game was started. You can use this to make some timers yourself, the engine runs at 60fps.
+get_id
+
+Search script examples for get_id
+
+string get_id()
+Get your sanitized script id to be used in import.
+get_level_config
+
+Search script examples for get_level_config
+
+int get_level_config(LEVEL_CONFIG config)
+Gets the value for the specified config
+get_local_prng
+
+Search script examples for get_local_prng
+
+nil get_local_prng()
+Get the thread-local version of prng
+get_local_state
+
+Search script examples for get_local_state
+
+nil get_local_state()
+Get the thread-local version of state
+get_ms
+
+Search script examples for get_ms
+
+nil get_ms()
+Get the current timestamp in milliseconds since the Unix Epoch.
+get_setting
+
+Search script examples for get_setting
+
+optional<int> get_setting(GAME_SETTING setting)
+Gets the specified setting, values might need to be interpreted differently per setting
+god
+
+Search script examples for god
+
+nil god(bool g)
+Enable/disable godmode for players.
+god_companions
+
+Search script examples for god_companions
+
+nil god_companions(bool g)
+Enable/disable godmode for companions.
+grow_chainandblocks
+
+Search script examples for grow_chainandblocks
+
+bool grow_chainandblocks()
bool grow_chainandblocks(int x, int y)
+Grow chains from ENT_TYPE_FLOOR_CHAIN_CEILING
and chain with blocks on it from ENT_TYPE_FLOOR_CHAINANDBLOCKS_CEILING
, it starts looking for the ceilings from the top left corner of a level.
+To limit it use the parameters, so x = 10 will only grow chains from ceilings with x < 10, with y = 10 it's ceilings that have y > (level bound top - 10)
+grow_poles
+
+Search script examples for grow_poles
+
+nil grow_poles(LAYER l, int max_lengh)
nil grow_poles(LAYER l, int max_lengh, AABB area, bool destroy_broken)
+Grow pole from GROWABLE_CLIMBING_POLE
entities in a level, area
default is whole level, destroy_broken
default is false
+grow_vines
+
+Search script examples for grow_vines
+
+nil grow_vines(LAYER l, int max_lengh)
nil grow_vines(LAYER l, int max_lengh, AABB area, bool destroy_broken)
+Grow vines from GROWABLE_VINE
and VINE_TREE_TOP
entities in a level, area
default is whole level, destroy_broken
default is false
+http_get
+
+Search script examples for http_get
+
+optional<string> http_get(string url)
+Send a synchronous HTTP GET request and return response as a string or nil on an error
+http_get_async
+
+Search script examples for http_get_async
+
+HttpRequest http_get_async(string url, function on_data)
+Send an asynchronous HTTP GET request and run the callback when done. If there is an error, response will be nil and vice versa.
+The callback signature is nil on_data(string response, string error)
+import
+
+Search script examples for import
+
+table import(string id, string version = "", bool optional = false)
+Load another script by id "author/name" and import its exports
table. Returns:
+
+
+table
if the script has exports
+nil
if the script was found but has no exports
+false
if the script was not found but optional is set to true
+- an error if the script was not found and the optional argument was not set
-External Function Library
-If you use a text editor/IDE that has a Lua linter available you can download spel2.lua, place it in a folder of your choice and specify that folder as a "external function library". For example VSCode with the Lua Extension offers this feature. This will allow you to get auto-completion of API functions along with linting
-Lua libraries
-The following Lua libraries and their functions are available. You can read more about them in the Lua documentation. We're using Lua 5.4 with the Sol C++ binding.
-math
base
string
table
coroutine
package
json
-To save data in your mod it makes a lot of sense to use json
to encode a table into a string and decode strings to table. For example this code that saves table and loads it back:
-local some_mod_data_that_should_be_saved = {{
- kills = 0,
- unlocked = false
-}}
-set_callback(function(save_ctx)
- local save_data_str = json.encode(some_mod_data_that_should_be_saved)
- save_ctx:save(save_data_str)
-end, ON.SAVE)
+intersection
+
+Search script examples for intersection
+
+Vec2 intersection(const Vec2 A, const Vec2 B, const Vec2 C, const Vec2 D)
+Find intersection point of two lines [A, B] and [C, D], returns INFINITY if the lines don't intersect each other [parallel]
+is_character_female
+
+Search script examples for is_character_female
+
+bool is_character_female(ENT_TYPE type_id)
+Same as Player.is_female
+list_char_mods
+
+Search script examples for list_char_mods
+
+nil list_char_mods()
+List all char.png files recursively from Mods/Packs. Returns table of file paths.
+list_dir
+
+Search script examples for list_dir
+
+nil list_dir(string dir)
+List files in directory relative to the script root. Returns table of file/directory names or nil if not found.
+load_death_screen
+
+Search script examples for load_death_screen
+
+nil load_death_screen()
+Immediately ends the run with the death screen, also calls the save_progress
+load_screen
+
+Search script examples for load_screen
+
+nil load_screen()
+Immediately load a screen based on state.screen_next and stuff
+lowbias32
+
+Search script examples for lowbias32
+
+int lowbias32(int x)
+Some random hash function
+lowbias32_r
+
+Search script examples for lowbias32_r
+
+int lowbias32_r(int x)
+Reverse of some random hash function
+pause
+
+Search script examples for pause
+
+nil pause(bool p)
+Pause/unpause the game.
+This is just short for state.pause == 32
, but that produces an audio bug
+I suggest state.pause == 2
, but that won't run any callback, state.pause == 16
will do the same but set_global_interval will still work
+register_console_command
+
+Search script examples for register_console_command
+
+nil register_console_command(string name, function cmd)
+Adds a command that can be used in the console.
+rgba
+
+Search script examples for rgba
+
+uColor rgba(int r, int g, int b, int a)
+Converts a color to int to be used in drawing functions. Use values from 0..255
.
+save_progress
+
+Search script examples for save_progress
+
+bool save_progress()
+Saves the game to savegame.sav, unless game saves are blocked in the settings. Also runs the ON.SAVE callback. Fails and returns false, if you're trying to save too often (2s).
+save_script
+
+Search script examples for save_script
+
+bool save_script()
+Runs the ON.SAVE callback. Fails and returns false, if you're trying to save too often (2s).
+script_enabled
+
+Search script examples for script_enabled
+
+bool script_enabled(string id, string version = "")
+Check if another script is enabled by id "author/name". You should probably check this after all the other scripts have had a chance to load.
+seed_prng
+
+Search script examples for seed_prng
+
+nil seed_prng(int seed)
+Seed the game prng.
+set_adventure_seed
+
+Search script examples for set_adventure_seed
+
+nil set_adventure_seed(int first, int second)
+Set the current adventure seed pair
+set_character_heart_color
+
+Search script examples for set_character_heart_color
+
+nil set_character_heart_color(ENT_TYPE type_id, Color color)
+Same as Player.set_heart_color
+set_ending_unlock
-- change character unlocked by endings to pilot
+set_ending_unlock(ENT_TYPE.CHAR_PILOT)
+
+-- change texture of the actual savior in endings to pilot
+set_callback(function()
+ set_post_entity_spawn(function(ent)
+ if state.screen == SCREEN.WIN then
+ ent:set_texture(TEXTURE.DATA_TEXTURES_CHAR_PINK_0)
+ end
+ clear_callback()
+ end, SPAWN_TYPE.SYSTEMIC, MASK.PLAYER)
+end, ON.WIN)
+
+
+
+Search script examples for set_ending_unlock
+
+nil set_ending_unlock(ENT_TYPE type)
+Force the character unlocked in either ending to ENT_TYPE. Set to 0 to reset to the default guys. Does not affect the texture of the actual savior. (See example)
+set_journal_enabled
+
+Search script examples for set_journal_enabled
+
+nil set_journal_enabled(bool b)
+Enables or disables the journal
+set_level_config
+
+Search script examples for set_level_config
+
+nil set_level_config(LEVEL_CONFIG config, int value)
+Set the value for the specified config
+set_mask
+
+Search script examples for set_mask
+
+Flags set_mask(Flags flags, Flags mask)
+Set a bitmask in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
+set_seed
+
+Search script examples for set_seed
+
+nil set_seed(int seed)
+Set seed and reset run.
+set_setting
-- set some visual settings needed by your mod
+-- doing this here will reapply these after visiting the options, which would reset them to real values
+
+set_callback(function()
+ if state.screen_next == SCREEN.LEVEL then
+ -- use the secret tiny hud size
+ set_setting(GAME_SETTING.HUD_SIZE, 3)
+ -- force opaque textboxes
+ set_setting(GAME_SETTING.TEXTBOX_OPACITY, 0)
+ end
+end, ON.PRE_LOAD_SCREEN)
+
+
+
+Search script examples for set_setting
+
+bool set_setting(GAME_SETTING setting, int value)
+Sets the specified setting temporarily. These values are not saved and might reset to the users real settings if they visit the options menu. (Check example.) All settings are available in unsafe mode and only a smaller subset SAFE_SETTING by default for Hud and other visuals. Returns false, if setting failed.
+set_storage_layer
-- Sets the right layer when using the vanilla tile code if waddler is still happy,
+-- otherwise spawns the floor to the left of this tile.
+-- Manually spawning FLOOR_STORAGE pre-tilecode doesn't seem to work as expected,
+-- so we destroy it post-tilecode.
+set_post_tile_code_callback(function(x, y, layer)
+ if not test_flag(state.quest_flags, 10) then
+ -- Just set the layer and let the vanilla tilecode handle the floor
+ set_storage_layer(layer)
+ else
+ local floor = get_entity(get_grid_entity_at(x, y, layer))
+ if floor then
+ floor:destroy()
+ end
+ if get_grid_entity_at(x - 1, y, layer) ~= -1 then
+ local left = get_entity(get_grid_entity_at(x - 1, y, layer))
+ spawn_grid_entity(left.type.id, x, y, layer)
+ end
+ end
+end, "storage_floor")
-set_callback(function(load_ctx)
- local load_data_str = load_ctx:load()
- if load_data_str ~= "" then
- some_mod_data_that_should_be_saved = json.decode(load_data_str)
+-- This fixes a bug in the game that breaks storage on transition.
+-- The old storage_uid is not cleared after every level for some reason.
+set_callback(function()
+ state.storage_uid = -1
+end, ON.TRANSITION)
+
+-- Having a waddler is completely optional for storage,
+-- but this makes a nice waddler room if he still likes you.
+define_tile_code("waddler")
+set_pre_tile_code_callback(function(x, y, layer)
+ if not test_flag(state.quest_flags, 10) then
+ local uid = spawn_roomowner(ENT_TYPE.MONS_STORAGEGUY, x + 0.5, y, layer, ROOM_TEMPLATE.WADDLER)
+ set_on_kill(uid, function()
+ -- Disable current level storage if you kill waddler
+ state.storage_uid = -1
+ end)
end
-end, ON.LOAD)
-
inspect
-This module is a great substitute for tostring
because it can convert any type to a string and thus helps a lot with debugging. Use for example like this:
-local look_ma_no_tostring = {
- number = 15,
- nested_table = {
- array = {
- 1,
- 2,
- 4
- }
- }
+ return true
+end, "waddler")
+
+
+
+Search script examples for set_storage_layer
+
+nil set_storage_layer(LAYER layer)
+Set layer to search for storage items on
+set_tiamat_cutscene_enabled
+
+Search script examples for set_tiamat_cutscene_enabled
+
+nil set_tiamat_cutscene_enabled(bool enable)
+Tiamat cutscene is also responsible for locking the exit door
+So you may need to close it yourself if you still want to be required to kill Tiamat
+show_journal
+
+Search script examples for show_journal
+
+nil show_journal(JOURNALUI_PAGE_SHOWN chapter, int page)
+Open the journal on a chapter and page. The main Journal spread is pages 0..1, so most chapters start at 2. Use even page numbers only.
+test_mask
+
+Search script examples for test_mask
+
+bool test_mask(Flags flags, Flags mask)
+Returns true if a bitmask is set in the number.
+toggle_journal
+
+Search script examples for toggle_journal
+
+nil toggle_journal()
+Open or close the journal as if pressing the journal button. Will respect visible journal popups and force_journal.
+two_lines_angle
+
+Search script examples for two_lines_angle
+
+float two_lines_angle(Vec2 A, Vec2 common, Vec2 B)
+Mesures angle between two lines with one common point
+float two_lines_angle(Vec2 line1_A, Vec2 line1_B, Vec2 line2_A, Vec2 line2_B)
+Gets line1_A, intersection point and line2_B and calls the 3 parameter version of this function
+update_liquid_collision_at
+
+Search script examples for update_liquid_collision_at
+
+nil update_liquid_collision_at(float x, float y, bool add)
+Updates the floor collisions used by the liquids, set add to false to remove tile of collision, set to true to add one
+warp
+
+Search script examples for warp
+
+nil warp(int w, int l, int t)
+Warp to a level immediately.
+Input functions
get_io
+
+Search script examples for get_io
+
+ImGuiIO get_io()
+Returns: ImGuiIO for raw keyboard, mouse and xinput gamepad stuff.
+
+
+- Note: The clicked/pressed actions only make sense in
ON.GUIFRAME
.
+- Note: Lua starts indexing at 1, you need
keysdown[string.byte('A') + 1]
to find the A key.
+- Note: Overlunky/etc will eat all keys it is currently configured to use, your script will only get leftovers.
+- Note: Gamepad is basically XINPUT_GAMEPAD but variables are renamed and values are normalized to -1.0..1.0 range.
+
+mouse_position
+
+Search script examples for mouse_position
+
+tuple<float, float> mouse_position()
+Current mouse cursor position in screen coordinates.
+return_input
+
+Search script examples for return_input
+
+nil return_input(int uid)
+Return input previously stolen with steal_input
+send_input
+
+Search script examples for send_input
+
+nil send_input(int uid, INPUTS buttons)
+Send input to entity, has to be previously stolen with steal_input
+steal_input
+
+Search script examples for steal_input
+
+nil steal_input(int uid)
+Steal input from a Player, HiredHand or PlayerGhost
+Lighting functions
create_illumination
+
+Search script examples for create_illumination
+
+Illumination create_illumination(Color color, float size, float x, float y)
Illumination create_illumination(Color color, float size, int uid)
+Creates a new Illumination. Don't forget to continuously call refresh_illumination, otherwise your light emitter fades out! Check out the illumination.lua script for an example
+refresh_illumination
+
+Search script examples for refresh_illumination
+
+nil refresh_illumination(Illumination illumination)
+Refreshes an Illumination, keeps it from fading out
+Message functions
cancel_speechbubble
+
+Search script examples for cancel_speechbubble
+
+nil cancel_speechbubble()
cancel_toast
+
+Search script examples for cancel_toast
+
+nil cancel_toast()
console_prinspect
+
+Search script examples for console_prinspect
+
+nil console_prinspect(variadic_args objects)
+Prinspect to ingame console.
+console_print
+
+Search script examples for console_print
+
+nil console_print(string message)
+Print a log message to ingame console.
+log_print
+
+Search script examples for log_print
+
+nil log_print(string message)
+Log to spelunky.log
+lua_print
+
+Search script examples for lua_print
+
+nil lua_print()
+Standard lua print function, prints directly to the terminal but not to the game
+message
+
+Search script examples for message
+
+nil message(string message)
+Same as print
+messpect
+
+Search script examples for messpect
+
+nil messpect(variadic_args objects)
+Same as prinspect
+prinspect
prinspect(state.level, state.level_next)
+local some_stuff_in_a_table = {
+ some = state.time_total,
+ stuff = state.world
}
-message(inspect(look_ma_no_tostring))
---[[prints:
-{
- number = 15,
- nested_table = {
- array = { 1, 2, 4 }
- }
-}
-]]
-
format
-This allows you to make strings without having to do a lot of tostring
and ..
by placing your variables directly inside of the string. Use F
in front of your string and wrap variables you want to print in {}
, for example like this:
-for _, player in players do
- local royal_title = nil
- if player:is_female() then
- royal_title = 'Queen'
- else
- royal_title = 'King'
+prinspect(some_stuff_in_a_table)
+
+
+
+Search script examples for prinspect
+
+nil prinspect(variadic_args objects)
+Prints any type of object by first funneling it through inspect
, no need for a manual tostring
or inspect
.
+print
+
+Search script examples for print
+
+nil print(string message)
+Print a log message on screen.
+printf
+
+Search script examples for printf
+
+nil printf()
+Short for print(string.format(...))
+say
+
+Search script examples for say
+
+nil say(int entity_uid, string message, int sound_type, bool top)
+Show a message coming from an entity
+speechbubble_visible
+
+Search script examples for speechbubble_visible
+
+bool speechbubble_visible()
toast
+
+Search script examples for toast
+
+nil toast(string message)
+Show a message that looks like a level feeling.
+toast_visible
+
+Search script examples for toast_visible
+
+bool toast_visible()
Movable Behavior functions
make_custom_behavior
+
+Search script examples for make_custom_behavior
+
+CustomMovableBehavior make_custom_behavior(string_view behavior_name, int state_id, VanillaMovableBehavior base_behavior)
+Make a CustomMovableBehavior
, if base_behavior
is nil
you will have to set all of the
+behavior functions. If a behavior with behavior_name
already exists for your script it will
+be returned instead.
+Network functions
udp_listen
+
+Search script examples for udp_listen
+
+UdpServer udp_listen(string host, in_port_t port, function cb)
+Start an UDP server on specified address and run callback when data arrives. Return a string from the callback to reply. Requires unsafe mode.
+The server will be closed once the handle is released.
+udp_send
+
+Search script examples for udp_send
+
+nil udp_send(string host, in_port_t port, string msg)
+Send data to specified UDP address. Requires unsafe mode.
+Option functions
register_option_bool
register_option_bool("bomb_bag", "BombBag", "Spawn bomb bag at the start of every level", false)
+
+set_callback(function()
+ if options.bomb_bag then
+ -- Spawn the bomb bag at player location thanks to the LAYER.PLAYER1
+ spawn_entity_snapped_to_floor(ENT_TYPE.ITEM_PICKUP_BOMBBAG, 0, 0, LAYER.PLAYER1)
end
- local name = F'{player:get_name()} aka {royal_title} {player:get_short_name()}'
- message(name)
-end
-
Unsafe mode
-Setting meta.unsafe = true
enables the rest of the standard Lua libraries like io
and os
, loading dlls with require and package.loadlib
. Using unsafe scripts requires users to enable the option in the overlunky.ini file which is found in the Spelunky 2 installation directory.
-Modules
-You can load modules with require "mymod"
or require "mydir.mymod"
, just put mymod.lua
in the same directory the script is, or in mydir/
to keep things organized.
+end, ON.LEVEL)
-Check the Lua tutorial or examples how to actually make modules.
+
+
+Search script examples for register_option_bool
+
+nil register_option_bool(string name, string desc, string long_desc, bool value)
+Add a boolean option that the user can change in the UI. Read with options.name
, value
is the default.
+register_option_button
+
+Search script examples for register_option_button
+
+nil register_option_button(string name, string desc, string long_desc, function on_click)
+Add a button that the user can click in the UI. Sets the timestamp of last click on value and runs the callback function.
+register_option_callback
+
+Search script examples for register_option_callback
+
+nil register_option_callback(string name, object value, function on_render)
+Add custom options using the window drawing functions. Everything drawn in the callback will be rendered in the options window and the return value saved to options[name]
or overwriting the whole options
table if using and empty name.
+value
is the default value, and pretty important because anything defined in the callback function will only be defined after the options are rendered. See the example for details.
+
The callback signature is optional on_render(GuiDrawContext draw_ctx)
+register_option_combo
+
+Search script examples for register_option_combo
+
+nil register_option_combo(string name, string desc, string long_desc, string opts, int value)
+Add a combobox option that the user can change in the UI. Read the int index of the selection with options.name
. Separate opts
with \0
,
+with a double \0\0
at the end. value
is the default index 1..n.
+register_option_float
+
+Search script examples for register_option_float
+
+nil register_option_float(string name, string desc, string long_desc, float value, float min, float max)
+Add a float option that the user can change in the UI. Read with options.name
, value
is the default. Keep in mind these are just soft
+limits, you can override them in the UI with double click.
+register_option_int
+
+Search script examples for register_option_int
+
+nil register_option_int(string name, string desc, string long_desc, int value, int min, int max)
+Add an integer option that the user can change in the UI. Read with options.name
, value
is the default. Keep in mind these are just soft
+limits, you can override them in the UI with double click.
+register_option_string
+
+Search script examples for register_option_string
+
+nil register_option_string(string name, string desc, string long_desc, string value)
+Add a string option that the user can change in the UI. Read with options.name
, value
is the default.
+unregister_option
+
+Search script examples for unregister_option
+
+nil unregister_option(string name)
+Removes an option by name. To make complicated conditionally visible options you should probably just use register_option_callback though.
+Particle functions
advance_screen_particles
+
+Search script examples for advance_screen_particles
+
+nil advance_screen_particles(ParticleEmitterInfo particle_emitter)
+Advances the state of the screen particle emitter (simulates the next positions, ... of all the particles in the emitter). Only used with screen particle emitters. See the particles.lua
example script for more details.
+extinguish_particles
+
+Search script examples for extinguish_particles
+
+nil extinguish_particles(ParticleEmitterInfo particle_emitter)
+Extinguish a particle emitter (use the return value of generate_world_particles
or generate_screen_particles
as the parameter in this function)
+generate_screen_particles
+
+Search script examples for generate_screen_particles
+
+ParticleEmitterInfo generate_screen_particles(int particle_emitter_id, float x, float y)
+Generate particles of the specified type at a certain screen coordinate (use e.g. local emitter = generate_screen_particles(PARTICLEEMITTER.CHARSELECTOR_TORCHFLAME_FLAMES, 0.0, 0.0)
). See the particles.lua
example script for more details.
+generate_world_particles
+
+Search script examples for generate_world_particles
+
+ParticleEmitterInfo generate_world_particles(int particle_emitter_id, int uid)
+Generate particles of the specified type around the specified entity uid (use e.g. local emitter = generate_world_particles(PARTICLEEMITTER.PETTING_PET, players[1].uid)
). You can then decouple the emitter from the entity with emitter.entity_uid = -1
and freely move it around. See the particles.lua
example script for more details.
+get_particle_type
+
+Search script examples for get_particle_type
+
+ParticleDB get_particle_type(int id)
+Get the ParticleDB details of the specified ID
+render_screen_particles
+
+Search script examples for render_screen_particles
+
+nil render_screen_particles(ParticleEmitterInfo particle_emitter)
+Renders the particles to the screen. Only used with screen particle emitters. See the particles.lua
example script for more details.
+Position functions
activate_tiamat_position_hack
activate_tiamat_position_hack(true);
-You can also import other loaded script mods to your own mod if they have exports
.
-Aliases
-Used to clarify what kind of values can be passed and returned from a function, even if the underlying type is really just an integer or a string. This should help to avoid bugs where one would for example just pass a random integer to a function expecting a callback id.
+set_post_entity_spawn(function(ent)
-
-
-Name
-Type
-
-
-
-CallbackId
-int;
-
-
-Flags
-int;
-
-
-uColor
-int;
-
-
-SHORT_TILE_CODE
-int;
-
-
-STRINGID
-int;
-
-
-FEAT
-int;
-
-
-Global variables
-These variables are always there to use.
-meta
meta.name = "Awesome Mod"
-meta.version = "1.0"
-meta.author = "You"
-meta.description = [[
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut at nulla porttitor, lobortis magna at, tempus dolor. Cras non ligula tellus. Duis tincidunt sodales velit et ornare. Mauris eu sapien finibus dolor dictum malesuada in non elit.
+ -- make them same as in the game, but relative to the tiamat entity
+ ent.attack_x = ent.x - 1
+ ent.attack_y = ent.y + 2
- Aenean luctus leo ut diam ornare viverra. Nunc condimentum interdum elit, quis porttitor quam finibus ac. Nam mattis, lectus commodo placerat tristique, justo justo congue dui, sed sodales nunc sem ut neque.
-]]
--- set this to enable unsafe mode
---meta.unsafe = true
+end, SPAWN_TYPE.ANY, 0, ENT_TYPE.MONS_TIAMAT)
+
+
+Search script examples for activate_tiamat_position_hack
+
+nil activate_tiamat_position_hack(bool activate)
+Activate custom variables for position used for detecting the player (normally hardcoded)
+note: because those variables are custom and game does not initiate them, you need to do it yourself for each Tiamat entity, recommending set_post_entity_spawn
+default game values are: attack_x = 17.5 attack_y = 62.5
+distance
+
+Search script examples for distance
+
+float distance(int uid_a, int uid_b)
+Calculate the tile distance of two entities by uid
+draw_text_size
-- draw text
+set_callback(function(draw_ctx)
+ -- get a random color
+ local color = math.random(0, 0xffffffff)
+ -- zoom the font size based on frame
+ local size = (get_frame() % 199)+1
+ local text = 'Awesome!'
+ -- calculate size of text
+ local w, h = draw_text_size(size, text)
+ -- draw to the center of screen
+ draw_ctx:draw_text(0-w/2, 0-h/2, size, text, color)
+end, ON.GUIFRAME)
--- rest of your mod goes here
+
+
+Search script examples for draw_text_size
+
+tuple<float, float> draw_text_size(float size, string text)
+Calculate the bounding box of text, so you can center it etc. Returns width
, height
in screen distance.
+fix_liquid_out_of_bounds
-- call this in ON.FRAME if needed in your custom level
+set_callback(fix_liquid_out_of_bounds, ON.FRAME)
-
array<mixed> meta
+
+
+Search script examples for fix_liquid_out_of_bounds
+
+nil fix_liquid_out_of_bounds()
+Removes all liquid that is about to go out of bounds, which crashes the game.
+game_position
+
+Search script examples for game_position
+
+tuple<float, float> game_position(float x, float y)
+Get the game coordinates at the screen position (x
, y
)
+get_aabb_bounds
+
+Search script examples for get_aabb_bounds
+
+AABB get_aabb_bounds()
+Same as get_bounds but returns AABB struct instead of loose floats
+get_bounds
-- Draw the level boundaries
+set_callback(function(draw_ctx)
+ local xmin, ymax, xmax, ymin = get_bounds()
+ local sx, sy = screen_position(xmin, ymax) -- top left
+ local sx2, sy2 = screen_position(xmax, ymin) -- bottom right
+ draw_ctx:draw_rect(sx, sy, sx2, sy2, 4, 0, rgba(255, 255, 255, 255))
+end, ON.GUIFRAME)
+
+
+
+Search script examples for get_bounds
+
+tuple<float, float, float, float> get_bounds()
+Basically gets the absolute coordinates of the area inside the unbreakable bedrock walls, from wall to wall. Every solid entity should be
+inside these boundaries. The order is: left x, top y, right x, bottom y
+get_camera_position
+
+Search script examples for get_camera_position
+
+tuple<float, float> get_camera_position()
+Gets the current camera position in the level
+get_hitbox
+
+Search script examples for get_hitbox
+
+AABB get_hitbox(int uid, optional extrude, optional offsetx, optional offsety)
+Gets the hitbox of an entity, use extrude
to make the hitbox bigger/smaller in all directions and offset
to offset the hitbox in a given direction
+get_hud_position
+
+Search script examples for get_hud_position
+
+AABB get_hud_position(int index)
+Approximate bounding box of the player hud element for player index 1..4 based on user settings and player count
+get_image_size
-Search script examples for meta
+Search script examples for get_image_size
-
-Table of strings where you should set some script metadata shown in the UI and used by other scripts to find your script.
-state
if state.time_level > 300 and state.theme == THEME.DWELLING then
- toast("Congratulations for lasting 5 seconds in Dwelling")
-end
-
-
StateMemory state
+tuple<int, int> get_image_size(string path)
+Get image size from file. Returns a tuple containing width and height.
+get_position
-Search script examples for state
+Search script examples for get_position
-
-A bunch of game state variables. Your ticket to almost anything that is not an Entity.
-game_manager
if game_manager.game_props.game_has_focus == false then
- message("Come back soon!")
-end
-
-
GameManager game_manager
+tuple<float, float, int> get_position(int uid)
+Get position x, y, layer
of entity by uid. Use this, don't use Entity.x/y
because those are sometimes just the offset to the entity
+you're standing on, not real level coordinates.
+get_render_hitbox
-Search script examples for game_manager
+Search script examples for get_render_hitbox
-
-The GameManager gives access to a couple of Screens as well as the pause and journal UI elements
-online
message = "Currently playing: "
-for _, p in pairs(online.online_players) do
- if p.ready_state ~= 0 then
- message = message .. p.player_name .. " "
- end
-end
-print(message)
-
-
Online online
+AABB get_render_hitbox(int uid, optional extrude, optional offsetx, optional offsety)
+Same as get_hitbox
but based on get_render_position
+get_render_position
-Search script examples for online
+Search script examples for get_render_position
-
-The Online object has information about the online lobby and its players
-players
-- Make the player invisible, use only in single player only mods
-
-players[1].flags = set_flag(players[1].flags, 1)
-
-
array<Player> players
+tuple<float, float, int> get_render_position(int uid)
+Get interpolated render position x, y, layer
of entity by uid. This gives smooth hitboxes for 144Hz master race etc...
+get_velocity
-Search script examples for players
+Search script examples for get_velocity
-
-An array of Player of the current players. This is just a list of existing Player entities in order, i.e., players[1]
is not guaranteed to be P1 if they have been gibbed for example. See get_player.
-savegame
+tuple<float, float> get_velocity(int uid)
+Get velocity vx, vy
of an entity by uid. Use this, don't use Entity.velocityx/velocityy
because those are relative to Entity.overlay
.
+get_window_size
-Print best time from savegame
+Search script examples for get_window_size
-prinspect(savegame.time_best)
-
SaveData savegame
+tuple<int, int> get_window_size()
+Gets the resolution (width and height) of the screen
+get_zoom_level
-Search script examples for savegame
+Search script examples for get_zoom_level
-
-Provides access to the save data, updated as soon as something changes (i.e. before it's written to savegame.sav.) Use save_progress to save to savegame.sav.
-options
register_option_bool("bomb_bag", "BombBag", "Spawn bomb bag at the start of every level", false)
-
-set_callback(function()
- if options.bomb_bag then
- -- Spawn the bomb bag at player location thanks to the LAYER.PLAYER1
- spawn_entity_snapped_to_floor(ENT_TYPE.ITEM_PICKUP_BOMBBAG, 0, 0, LAYER.PLAYER1)
- end
-end, ON.LEVEL)
-
-
optional<array<mixed>> options
+float get_zoom_level()
+Get the current set zoom level
+position_is_valid
-Search script examples for options
+Search script examples for position_is_valid
+bool position_is_valid(float x, float y, LAYER layer, POS_TYPE flags)
+Check if position satifies the given POS_TYPE flags, to be used in a custom is_valid function procedural for spawns.
+screen_aabb
+
+Search script examples for screen_aabb
+
+AABB screen_aabb(AABB box)
+Convert an AABB
to a screen AABB
that can be directly passed to draw functions
+screen_distance
+
+Search script examples for screen_distance
+
+float screen_distance(float x)
+Translate a distance of x
tiles to screen distance to be be used in drawing functions
+screen_position
+
+Search script examples for screen_position
+
+tuple<float, float> screen_position(float x, float y)
+Translate an entity position to screen position to be used in drawing functions
+set_camp_camera_bounds_enabled
+
+Search script examples for set_camp_camera_bounds_enabled
+
+nil set_camp_camera_bounds_enabled(bool b)
+Enables or disables the default position based camp camera bounds, to set them manually yourself
+zoom
+
+Search script examples for zoom
+
+nil zoom(float level)
+Set the zoom level used in levels and shops. 13.5 is the default.
+Room functions
define_room_template
+
+Search script examples for define_room_template
+
+int define_room_template(string room_template, ROOM_TEMPLATE_TYPE type)
+Define a new room template to use with set_room_template
+get_room_index
+
+Search script examples for get_room_index
+
+tuple<int, int> get_room_index(float x, float y)
+Transform a position to a room index to be used in get_room_template
and PostRoomGenerationContext.set_room_template
+get_room_pos
+
+Search script examples for get_room_pos
+
+tuple<float, float> get_room_pos(int x, int y)
+Transform a room index into the top left corner position in the room
+get_room_template
+
+Search script examples for get_room_template
+
+optional<int> get_room_template(int x, int y, LAYER layer)
+Get the room template given a certain index, returns nil
if coordinates are out of bounds
+get_room_template_name
+
+Search script examples for get_room_template_name
+
+string_view get_room_template_name(int room_template)
+For debugging only, get the name of a room template, returns 'invalid'
if room template is not defined
+is_machine_room_origin
+
+Search script examples for is_machine_room_origin
+
+bool is_machine_room_origin(int x, int y)
+Get whether a room is the origin of a machine room
+is_room_flipped
+
+Search script examples for is_room_flipped
+
+bool is_room_flipped(int x, int y)
+Get whether a room is flipped at the given index, returns false
if coordinates are out of bounds
+set_room_template_size
+
+Search script examples for set_room_template_size
+
+bool set_room_template_size(int room_template, int width, int height)
+Set the size of room template in tiles, the template must be of type ROOM_TEMPLATE_TYPE.MACHINE_ROOM
.
+spawn_roomowner
-- spawns waddler selling pets
+-- all the aggro etc mechanics from a normal shop still apply
+local x, y, l = get_position(get_player(1).uid)
+local owner = spawn_roomowner(ENT_TYPE.MONS_STORAGEGUY, x+1, y, l, ROOM_TEMPLATE.SHOP)
+add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_DOG, x-1, y, l), owner)
+add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_CAT, x-2, y, l), owner)
+add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_HAMSTER, x-3, y, l), owner)
-Table of options set in the UI, added with the register_option_functions, but nil
before any options are registered. You can also write your own options in here or override values defined in the register functions/UI before or after they are registered. Check the examples for many different use cases and saving options to disk.
-prng
--Make it so there is 50% chance that the Ankh will be destroyed
-
-set_callback(function ()
- -- more or less 50% chance
- if prng:random(2) == 1 then
- -- get all Ankh's in a level
- ankhs = get_entities_by(ENT_TYPE.ITEM_PICKUP_ANKH, MASK.ITEM, LAYER.BOTH)
- for _, uid in pairs(ankhs) do
- get_entity(uid):destroy()
- end
- end
-end, ON.LEVEL)
+-- use in a tile code to add shops to custom levels
+-- this may spawn some shop related decorations too
+define_tile_code("pet_shop_boys")
+set_pre_tile_code_callback(function(x, y, layer)
+ local owner = spawn_roomowner(ENT_TYPE.MONS_YANG, x, y, layer, ROOM_TEMPLATE.SHOP)
+ -- another dude for the meme, this has nothing to do with the shop
+ spawn_on_floor(ENT_TYPE.MONS_BODYGUARD, x+1, y, layer)
+ add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_HAMSTER, x+2, y, layer), owner)
+ return true
+end, "pet_shop_boys")
-
PRNG prng
+
-Search script examples for prng
+Search script examples for spawn_roomowner
-
-The global prng state, calling any function on it will advance the prng state, thus desynchronizing clients if it does not happen on both clients.
-Functions
-The game functions like spawn
use level coordinates. Draw functions use normalized screen coordinates from -1.0 .. 1.0
where 0.0, 0.0
is the center of the screen.
-Callback functions
clear_callback
+int spawn_roomowner(ENT_TYPE owner_type, float x, float y, LAYER layer, ROOM_TEMPLATE room_template = -1)
+Spawn a RoomOwner (or a few other like CavemanShopkeeper) in the coordinates and make them own the room, optionally changing the room template. Returns the RoomOwner uid.
+Shop functions
add_item_to_shop
-Create three explosions and then clear the interval
+Search script examples for add_item_to_shop
-local count = 0 -- this upvalues to the interval
-set_interval(function()
- count = count + 1
- spawn(ENT_TYPE.FX_EXPLOSION, 0, 0, LAYER.FRONT, 0, 0)
- if count >= 3 then
- -- calling this without parameters clears the callback that's calling it
- clear_callback()
- end
-end, 60)
+nil add_item_to_shop(int item_uid, int shop_owner_uid)
+Adds entity as shop item, has to be of Purchasable type, check the entity hierarchy list to find all the Purchasable entity types.
+Adding other entities will result in not obtainable items or game crash
+change_diceshop_prizes
+
+Search script examples for change_diceshop_prizes
+
+nil change_diceshop_prizes(array<ENT_TYPE> ent_types)
+Change ENT_TYPE's spawned in dice shops (Madame Tusk as well), by default there are 25:
+{ITEM_PICKUP_BOMBBAG, ITEM_PICKUP_BOMBBOX, ITEM_PICKUP_ROPEPILE, ITEM_PICKUP_COMPASS, ITEM_PICKUP_PASTE, ITEM_PICKUP_PARACHUTE, ITEM_PURCHASABLE_CAPE, ITEM_PICKUP_SPECTACLES, ITEM_PICKUP_CLIMBINGGLOVES, ITEM_PICKUP_PITCHERSMITT,
+ENT_TYPE_ITEM_PICKUP_SPIKESHOES, ENT_TYPE_ITEM_PICKUP_SPRINGSHOES, ITEM_MACHETE, ITEM_BOOMERANG, ITEM_CROSSBOW, ITEM_SHOTGUN, ITEM_FREEZERAY, ITEM_WEBGUN, ITEM_CAMERA, ITEM_MATTOCK, ITEM_PURCHASABLE_JETPACK, ITEM_PURCHASABLE_HOVERPACK,
+ITEM_TELEPORTER, ITEM_PURCHASABLE_TELEPORTER_BACKPACK, ITEM_PURCHASABLE_POWERPACK}
+Min 6, Max 255, if you want less then 6 you need to write some of them more then once (they will have higher "spawn chance").
+If you use this function in the level with diceshop in it, you have to update item_ids
in the ITEM_DICE_PRIZE_DISPENSER.
+Use empty table as argument to reset to the game default
+is_inside_active_shop_room
+
+Search script examples for is_inside_active_shop_room
+
+bool is_inside_active_shop_room(float x, float y, LAYER layer)
+Checks whether a coordinate is inside a room containing an active shop. This function checks whether the shopkeeper is still alive.
+is_inside_shop_zone
+
+Search script examples for is_inside_shop_zone
+
+bool is_inside_shop_zone(float x, float y, LAYER layer)
+Checks whether a coordinate is inside a shop zone, the rectangle where the camera zooms in a bit. Does not check if the shop is still active!
+spawn_shopkeeper
-- spawns a shopkeeper selling a shotgun next to you
+-- converts the current room to a ROOM_TEMPLATE.SHOP with shop music and zoom effect
+local x, y, l = get_position(get_player(1).uid)
+local owner = spawn_shopkeeper(x+1, y, l)
+add_item_to_shop(spawn_on_floor(ENT_TYPE.ITEM_SHOTGUN, x-1, y, l), owner)
+
+-- spawns a shopkeeper selling a puppy next to you
+-- also converts the room to a shop, but after the shopkeeper is spawned
+-- this enables the safe zone for moving items, but disables shop music and zoom for whatever reason
+local x, y, l = get_position(get_player(1).uid)
+local owner = spawn_shopkeeper(x+1, y, l, ROOM_TEMPLATE.SIDE)
+add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_DOG, x-1, y, l), owner)
+local ctx = PostRoomGenerationContext:new()
+local rx, ry = get_room_index(x, y)
+ctx:set_room_template(rx, ry, l, ROOM_TEMPLATE.SHOP)
+
-Search script examples for clear_callback
+Search script examples for spawn_shopkeeper
-nil clear_callback(optional<CallbackId> id)
-Clear previously added callback id
or call without arguments inside any callback to clear that callback after it returns.
-clear_screen_callback
+int spawn_shopkeeper(float x, float y, LAYER layer, ROOM_TEMPLATE room_template = ROOM_TEMPLATE.SHOP)
+Spawn a Shopkeeper in the coordinates and make the room their shop. Returns the Shopkeeper uid. Also see spawn_roomowner.
+Sound functions
create_sound
-Search script examples for clear_screen_callback
+Search script examples for create_sound
-nil clear_screen_callback(int screen_id, CallbackId cb_id)
-Clears a callback that is specific to a screen.
-clear_vanilla_sound_callback
+optional<CustomSound> create_sound(string path)
+Loads a sound from disk relative to this script, ownership might be shared with other code that loads the same file. Returns nil if file can't be found
+get_sound
-Search script examples for clear_vanilla_sound_callback
+Search script examples for get_sound
-nil clear_vanilla_sound_callback(CallbackId id)
-Clears a previously set callback
-set_callback
+optional<CustomSound> get_sound(string path_or_vanilla_sound)
+Gets an existing sound, either if a file at the same path was already loaded or if it is already loaded by the game
+play_sound
-Search script examples for set_callback
+Search script examples for play_sound
-CallbackId set_callback(function cb, ON event)
-Returns unique id for the callback to be used in clear_callback.
-Add global callback function to be called on an event.
-set_global_interval
+SoundMeta play_sound(VANILLA_SOUND sound, int source_uid)
Spawn functions
change_altar_damage_spawns
-Search script examples for set_global_interval
+Search script examples for change_altar_damage_spawns
-CallbackId set_global_interval(function cb, int frames)
-Returns unique id for the callback to be used in clear_callback. You can also return false
from your function to clear the callback.
-Add global callback function to be called every frames
engine frames. This timer is never paused or cleared.
-set_global_timeout
+nil change_altar_damage_spawns(array<ENT_TYPE> ent_types)
+Change ENT_TYPE's spawned when you damage the altar, by default there are 6:
+{MONS_BAT, MONS_BEE, MONS_SPIDER, MONS_JIANGSHI, MONS_FEMALE_JIANGSHI, MONS_VAMPIRE}
+Max 255 types.
+Use empty table as argument to reset to the game default
+change_sunchallenge_spawns
-Search script examples for set_global_timeout
+Search script examples for change_sunchallenge_spawns
-CallbackId set_global_timeout(function cb, int frames)
-Returns unique id for the callback to be used in clear_callback.
-Add global callback function to be called after frames
engine frames. This timer is never paused or cleared.
-set_interval
+nil change_sunchallenge_spawns(array<ENT_TYPE> ent_types)
+Change ENT_TYPE's spawned by FLOOR_SUNCHALLENGE_GENERATOR
, by default there are 4:
+{MONS_WITCHDOCTOR, MONS_VAMPIRE, MONS_SORCERESS, MONS_NECROMANCER}
+Because of the game logic number of entity types has to be a power of 2: (1, 2, 4, 8, 16, 32), if you want say 30 types, you need to write two entities two times (they will have higher "spawn chance").
+Use empty table as argument to reset to the game default
+default_spawn_is_valid
-Create three explosions and then clear the interval
+Search script examples for default_spawn_is_valid
-local count = 0 -- this upvalues to the interval
-set_interval(function()
- count = count + 1
- spawn(ENT_TYPE.FX_EXPLOSION, 0, 0, LAYER.FRONT, 0, 0)
- if count >= 3 then
- -- calling this without parameters clears the fallback that's calling it
- clear_callback()
- end
-end, 60)
-
+bool default_spawn_is_valid(float x, float y, LAYER layer)
+Default function in spawn definitions to check whether a spawn is valid or not
+define_extra_spawn
-Search script examples for set_interval
+Search script examples for define_extra_spawn
-CallbackId set_interval(function cb, int frames)
-Returns unique id for the callback to be used in clear_callback. You can also return false
from your function to clear the callback.
-Add per level callback function to be called every frames
engine frames
-Ex. frames = 100 - will call the function on 100th frame from this point. This might differ in the exact timing of first frame depending as in what part of the frame you call this function
-or even be one frame off if called right before the time_level variable is updated
-If you require precise timing, choose the start of your interval in one of those safe callbacks:
-The SCREEN callbacks: from ON.LOGO to ON.ONLINE_LOBBY or custom callbacks ON.FRAME, ON.SCREEN, ON.START, ON.LOADING, ON.RESET, ON.POST_UPDATE
-Timer is paused on pause and cleared on level transition.
-set_on_player_instagib
+int define_extra_spawn(function do_spawn, function is_valid, int num_spawns_frontlayer, int num_spawns_backlayer)
+Define a new extra spawn, these are semi-guaranteed level gen spawns with a fixed upper bound.
+The function nil do_spawn(float x, float y, LAYER layer)
contains your code to spawn the thing, whatever it is.
+The function bool is_valid(float x, float y, LAYER layer)
determines whether the spawn is legal in the given position and layer.
+Use for example when you can spawn only on the ceiling, under water or inside a shop.
+Set is_valid
to nil
in order to use the default rule (aka. on top of floor and not obstructed).
+To change the number of spawns use PostRoomGenerationContext:set_num_extra_spawns
during ON.POST_ROOM_GENERATION
+No name is attached to the extra spawn since it is not modified from level files, instead every call to this function will return a new uniqe id.
+define_procedural_spawn
-Search script examples for set_on_player_instagib
+Search script examples for define_procedural_spawn
-optional<CallbackId> set_on_player_instagib(int uid, function fun)
-Returns unique id for the callback to be used in clear_callback or nil
if uid is not valid.
-Sets a callback that is called right when an player/hired hand is crushed/insta-gibbed, return true
to skip the game's crush handling.
-The game's instagib function will be forcibly executed (regardless of whatever you return in the callback) when the entity's health is zero.
-This is so that when the entity dies (from other causes), the death screen still gets shown.
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is bool on_player_instagib(Entity self)
-set_post_entity_spawn
+PROCEDURAL_CHANCE define_procedural_spawn(string procedural_spawn, function do_spawn, function is_valid)
+Define a new procedural spawn, the function nil do_spawn(float x, float y, LAYER layer)
contains your code to spawn the thing, whatever it is.
+The function bool is_valid(float x, float y, LAYER layer)
determines whether the spawn is legal in the given position and layer.
+Use for example when you can spawn only on the ceiling, under water or inside a shop.
+Set is_valid
to nil
in order to use the default rule (aka. on top of floor and not obstructed).
+If a user disables your script but still uses your level mod nothing will be spawned in place of your procedural spawn.
+door
-Search script examples for set_post_entity_spawn
+Search script examples for door
-CallbackId set_post_entity_spawn(function cb, SPAWN_TYPE flags, int mask, variadic_args entity_types)
-Add a callback for a spawn of specific entity types or mask. Set mask
to MASK.ANY
to ignore that.
-This is run right after the entity is spawned but before and particular properties are changed, e.g. owner or velocity.
-
The callback signature is nil post_entity_spawn(Entity ent, SPAWN_TYPE spawn_flags)
-set_post_render_screen
+int door(float x, float y, LAYER layer, int w, int l, int t)
+Short for spawn_door.
+get_missing_extra_spawns
-Search script examples for set_post_render_screen
+Search script examples for get_missing_extra_spawns
-optional<CallbackId> set_post_render_screen(int screen_id, function fun)
-Returns unique id for the callback to be used in clear_screen_callback or nil
if screen_id is not valid.
-Sets a callback that is called right after the screen is drawn.
-
The callback signature is nil render_screen(Screen self, VanillaRenderContext render_ctx)
-set_pre_entity_spawn
+tuple<int, int> get_missing_extra_spawns(int extra_spawn_chance_id)
+Use to query whether any of the requested spawns could not be made, usually because there were not enough valid spaces in the level.
+Returns missing spawns in the front layer and missing spawns in the back layer in that order.
+The value only makes sense after level generation is complete, aka after ON.POST_LEVEL_GENERATION
has run.
+get_procedural_spawn_chance
-Search script examples for set_pre_entity_spawn
+Search script examples for get_procedural_spawn_chance
-CallbackId set_pre_entity_spawn(function cb, SPAWN_TYPE flags, int mask, variadic_args entity_types)
-Add a callback for a spawn of specific entity types or mask. Set mask
to MASK.ANY
to ignore that.
-This is run before the entity is spawned, spawn your own entity and return its uid to replace the intended spawn.
-In many cases replacing the intended entity won't have the indended effect or will even break the game, so use only if you really know what you're doing.
-
The callback signature is optional pre_entity_spawn(ENT_TYPE entity_type, float x, float y, int layer, Entity overlay_entity, SPAWN_TYPE spawn_flags)
-set_pre_render_screen
+int get_procedural_spawn_chance(PROCEDURAL_CHANCE chance_id)
+Get the inverse chance of a procedural spawn for the current level.
+A return value of 0 does not mean the chance is infinite, it means the chance is zero.
+layer_door
-Search script examples for set_pre_render_screen
+Search script examples for layer_door
-optional<CallbackId> set_pre_render_screen(int screen_id, function fun)
-Returns unique id for the callback to be used in clear_screen_callback or nil
if screen_id is not valid.
-Sets a callback that is called right before the screen is drawn, return true
to skip the default rendering.
-
The callback signature is bool render_screen(Screen self, VanillaRenderContext render_ctx)
-set_timeout
+nil layer_door(float x, float y)
+Short for spawn_layer_door.
+set_ghost_spawn_times
-Search script examples for set_timeout
+Search script examples for set_ghost_spawn_times
-CallbackId set_timeout(function cb, int frames)
-Returns unique id for the callback to be used in clear_callback.
-Add per level callback function to be called after frames
engine frames. Timer is paused on pause and cleared on level transition.
-set_vanilla_sound_callback
+nil set_ghost_spawn_times(int normal = 10800, int cursed = 9000)
+Determines when the ghost appears, either when the player is cursed or not
+spawn
-- spawn a jetpack next to the player
+spawn(ENT_TYPE.ITEM_JETPACK, 1, 0, LAYER.PLAYER, 0, 0)
+
+
-Search script examples for set_vanilla_sound_callback
+Search script examples for spawn
-CallbackId set_vanilla_sound_callback(VANILLA_SOUND name, VANILLA_SOUND_CALLBACK_TYPE types, function cb)
-Returns unique id for the callback to be used in clear_vanilla_sound_callback.
-Sets a callback for a vanilla sound which lets you hook creation or playing events of that sound
-Callbacks are executed on another thread, so avoid touching any global state, only the local Lua state is protected
-If you set such a callback and then play the same sound yourself you have to wait until receiving the STARTED event before changing any properties on the sound. Otherwise you may cause a deadlock.
-
The callback signature is nil on_vanilla_sound(PlayingSound sound)
-Debug functions
dump_network
+int spawn(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
+Short for spawn_entity.
+spawn_apep
-Search script examples for dump_network
+Search script examples for spawn_apep
-nil dump_network()
-Hook the sendto and recvfrom functions and start dumping network data to terminal
-get_address
+int spawn_apep(float x, float y, LAYER layer, bool right)
+Spawns apep with the choice if it going left or right, if you want the game to choose use regular spawn functions with ENT_TYPE.MONS_APEP_HEAD
+spawn_companion
-Search script examples for get_address
+Search script examples for spawn_companion
-size_t get_address(string_view address_name)
-Get the address for a pattern name
-get_rva
+int spawn_companion(ENT_TYPE companion_type, float x, float y, LAYER layer)
+Spawn a companion (hired hand, player character, eggplant child)
+spawn_critical
-Search script examples for get_rva
+Search script examples for spawn_critical
-size_t get_rva(string_view address_name)
-Get the rva for a pattern name
-raise
+int spawn_critical(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
+Short for spawn_entity_nonreplaceable.
+spawn_door
-Search script examples for raise
+Search script examples for spawn_door
-nil raise()
-Raise a signal and probably crash the game
-Entity functions
activate_sparktraps_hack
activate_sparktraps_hack(true);
-
--- set random speed, direction and distance for the spark
-set_post_entity_spawn(function(ent)
-
- direction = 1
- if prng:random_chance(2, PRNG_CLASS.ENTITY_VARIATION) then
- direction = -1
- end
+int spawn_door(float x, float y, LAYER layer, int w, int l, int t)
+Spawn a door to another world, level and theme and return the uid of spawned entity.
+Uses level coordinates with LAYER.FRONT and LAYER.BACK, but player-relative coordinates with LAYER.PLAYERn
+spawn_entity
-- spawn megajelly on top of player using absolute coordinates on level start
+set_callback(function()
+ local x, y, layer = get_position(players[1].uid)
+ spawn_entity(ENT_TYPE.MONS_MEGAJELLYFISH, x, y+3, layer, 0, 0)
+end, ON.LEVEL)
- ent.speed = prng:random_float(PRNG_CLASS.ENTITY_VARIATION) * 0.1 * direction
- ent.distance = prng:random_float(PRNG_CLASS.ENTITY_VARIATION) * 10
+-- spawn clover next to player using player-relative coordinates
+set_callback(function()
+ spawn(ENT_TYPE.ITEM_PICKUP_CLOVER, 1, 0, LAYER.PLAYER1, 0, 0)
+end, ON.LEVEL)
-end, SPAWN_TYPE.ANY, 0, ENT_TYPE.ITEM_SPARK)
-Search script examples for activate_sparktraps_hack
+Search script examples for spawn_entity
+
+int spawn_entity(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
+Spawn an entity in position with some velocity and return the uid of spawned entity.
+Uses level coordinates with LAYER.FRONT and LAYER.BACK, but player-relative coordinates with LAYER.PLAYER(n), where (n) is a player number (1-4).
+spawn_entity_nonreplaceable
+
+Search script examples for spawn_entity_nonreplaceable
+
+int spawn_entity_nonreplaceable(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
+Same as spawn_entity
but does not trigger any pre-entity-spawn callbacks, so it will not be replaced by another script
+spawn_entity_over
+
+Search script examples for spawn_entity_over
+
+int spawn_entity_over(ENT_TYPE entity_type, int over_uid, float x, float y)
+Spawn an entity of entity_type
attached to some other entity over_uid
, in offset x
, y
+spawn_entity_snapped_to_floor
+
+Search script examples for spawn_entity_snapped_to_floor
+
+int spawn_entity_snapped_to_floor(ENT_TYPE entity_type, float x, float y, LAYER layer)
+Spawns an entity directly on the floor below the tile at the given position.
+Use this to avoid the little fall that some entities do when spawned during level gen callbacks.
+spawn_grid_entity
+
+Search script examples for spawn_grid_entity
-nil activate_sparktraps_hack(bool activate)
-Activate custom variables for speed and distance in the ITEM_SPARK
-note: because those the variables are custom and game does not initiate them, you need to do it yourself for each spark, recommending set_post_entity_spawn
-default game values are: speed = -0.015, distance = 3.0
-apply_entity_db
+int spawn_grid_entity(ENT_TYPE entity_type, float x, float y, LAYER layer)
+Spawn a grid entity, such as floor or traps, that snaps to the grid.
+spawn_layer_door
-Search script examples for apply_entity_db
+Search script examples for spawn_layer_door
-nil apply_entity_db(int uid)
-Apply changes made in get_type() to entity instance by uid.
-attach_ball_and_chain
+nil spawn_layer_door(float x, float y)
+Spawn a door to backlayer.
+spawn_liquid
-Search script examples for attach_ball_and_chain
+Search script examples for spawn_liquid
-int attach_ball_and_chain(int uid, float off_x, float off_y)
-Spawns and attaches ball and chain to uid
, the initial position of the ball is at the entity position plus off_x
, off_y
-attach_entity
+nil spawn_liquid(ENT_TYPE entity_type, float x, float y)
nil spawn_liquid(ENT_TYPE entity_type, float x, float y, float velocityx, float velocityy, int liquid_flags, int amount, float blobs_separation)
+Spawn liquids, always spawns in the front layer, will have fun effects if entity_type
is not a liquid (only the short version, without velocity etc.).
+Don't overuse this, you are still restricted by the liquid pool sizes and thus might crash the game.
+liquid_flags
- not much known about, 2 - will probably crash the game, 3 - pause_physics, 6-12 is probably agitation, surface_tension etc. set to 0 to ignore
+amount
- it will spawn amount x amount (so 1 = 1, 2 = 4, 3 = 6 etc.), blobs_separation
is optional
+spawn_mushroom
-Search script examples for attach_entity
+Search script examples for spawn_mushroom
-nil attach_entity(int overlay_uid, int attachee_uid)
-Attaches attachee
to overlay
, similar to setting get_entity(attachee).overlay = get_entity(overlay)
.
-However this function offsets attachee
(so you don't have to) and inserts it into overlay
's inventory.
-carry
+int spawn_mushroom(float x, float y, LAYER l)
int spawn_mushroom(float x, float y, LAYER l, int height)
+Spawns and grows mushroom, height relates to the trunk, without it, it will roll the game default 3-5 height
+Regardless, if there is not enough space, it will spawn shorter one or if there is no space even for the smallest one, it will just not spawn at all
+Returns uid of the base or -1 if it wasn't able to spawn
+spawn_on_floor
-Search script examples for carry
+Search script examples for spawn_on_floor
-nil carry(int mount_uid, int rider_uid)
-Make mount_uid
carry rider_uid
on their back. Only use this with actual mounts and living things.
-change_waddler_drop
+int spawn_on_floor(ENT_TYPE entity_type, float x, float y, LAYER layer)
+Short for spawn_entity_snapped_to_floor.
+spawn_over
-Search script examples for change_waddler_drop
+Search script examples for spawn_over
-nil change_waddler_drop(array<ENT_TYPE> ent_types)
-Change ENT_TYPE's spawned when Waddler dies, by default there are 3:
-{ITEM_PICKUP_COMPASS, ITEM_CHEST, ITEM_KEY}
-Max 255 types.
-Use empty table as argument to reset to the game default
-drop
+int spawn_over(ENT_TYPE entity_type, int over_uid, float x, float y)
+Short for spawn_entity_over
+spawn_player
-Search script examples for drop
+Search script examples for spawn_player
-nil drop(int who_uid, int what_uid)
-Drop an entity by uid
-enter_door
+nil spawn_player(int player_slot, float x, float y)
+Spawn a player in given location, if player of that slot already exist it will spawn clone, the game may crash as this is very unexpected situation
+If you want to respawn a player that is a ghost, set in his Inventory health
to above 0, and time_of_death
to 0 and call this function, the ghost entity will be removed automatically
+spawn_playerghost
-Search script examples for enter_door
+Search script examples for spawn_playerghost
-nil enter_door(int player_uid, int door_uid)
-Calls the enter door function, position doesn't matter, can also enter closed doors (like COG, EW) without unlocking them
-entity_get_items_by
+int spawn_playerghost(ENT_TYPE char_type, float x, float y, LAYER layer)
+Spawn the PlayerGhost entity, it will not move and not be connected to any player, you can then use steal_input and send_input to controll it
+or change it's player_inputs
to the input
of real player so he can control it directly
+spawn_tree
-Search script examples for entity_get_items_by
+Search script examples for spawn_tree
-array<int> entity_get_items_by(int uid, array<ENT_TYPE> entity_types, int mask)
array<int> entity_get_items_by(int uid, ENT_TYPE entity_type, int mask)
-Gets uids of entities attached to given entity uid. Use entity_type
and mask
(MASK) to filter, set them to 0 to return all attached entities.
-entity_has_item_type
+int spawn_tree(float x, float y, LAYER layer)
int spawn_tree(float x, float y, LAYER layer, int height)
+Spawns and grows a tree
+spawn_unrolled_player_rope
-Search script examples for entity_has_item_type
+Search script examples for spawn_unrolled_player_rope
-bool entity_has_item_type(int uid, array<ENT_TYPE> entity_types)
bool entity_has_item_type(int uid, ENT_TYPE entity_type)
-Check if the entity uid
has some ENT_TYPE entity_type
in their inventory, can also use table of entity_types
-entity_has_item_uid
+int spawn_unrolled_player_rope(float x, float y, LAYER layer, TEXTURE texture)
int spawn_unrolled_player_rope(float x, float y, LAYER layer, TEXTURE texture, int max_length)
+Spawns an already unrolled rope as if created by player
+String functions
add_custom_name
-Search script examples for entity_has_item_uid
+Search script examples for add_custom_name
-bool entity_has_item_uid(int uid, int item_uid)
-Check if the entity uid
has some specific item_uid
by uid in their inventory
-entity_remove_item
+nil add_custom_name(int uid, string name)
+Adds custom name to the item by uid used in the shops
+This is better alternative to add_string
but instead of changing the name for entity type, it changes it for this particular entity
+add_string
-Search script examples for entity_remove_item
+Search script examples for add_string
-nil entity_remove_item(int uid, int item_uid)
-Remove item by uid from entity
-filter_entities
+STRINGID add_string(string str)
+Add custom string, currently can only be used for names of shop items (Entitydb->description)
+Returns STRINGID of the new string
+change_string
-Search script examples for filter_entities
+Search script examples for change_string
-array<int> filter_entities(array entities, function predicate)
-Returns a list of all uids in entities
for which predicate(get_entity(uid))
returns true
-flip_entity
+nil change_string(STRINGID id, string str)
+Change string at the given id (don't use stringid diretcly for vanilla string, use hash_to_stringid
first)
+This edits custom string and in game strings but changing the language in settings will reset game strings
+clear_custom_name
-Search script examples for flip_entity
+Search script examples for clear_custom_name
-nil flip_entity(int uid)
-Flip entity around by uid. All new entities face right by default.
-force_olmec_phase_0
+nil clear_custom_name(int uid)
+Clears the name set with add_custom_name
+enum_get_mask_names
-Search script examples for force_olmec_phase_0
+Search script examples for enum_get_mask_names
-nil force_olmec_phase_0(bool b)
-Forces Olmec to stay on phase 0 (stomping)
-get_door_target
+table<string> enum_get_mask_names(table enum, int value)
+Return the matching names for a bitmask in an enum table of masks
+enum_get_name
-Search script examples for get_door_target
+Search script examples for enum_get_name
-tuple<int, int, int> get_door_target(int uid)
-Get door target world
, level
, theme
-get_entities_at
+string enum_get_name(table enum, int value)
+Return the name of the first matching number in an enum table
+enum_get_names
-Search script examples for get_entities_at
+Search script examples for enum_get_names
-array<int> get_entities_at(array<ENT_TYPE> entity_types, int mask, float x, float y, LAYER layer, float radius)
array<int> get_entities_at(ENT_TYPE entity_type, int mask, float x, float y, LAYER layer, float radius)
-Get uids of matching entities inside some radius (ENT_TYPE, MASK). Set entity_type
or mask
to 0
to ignore that, can also use table of entity_types
-Recommended to always set the mask, even if you look for one entity type
-get_entities_by
-- find all cavemen and give them bombs
--- using a type and mask in get_entities_by speeds up the search, cause the api knows which bucket to search in
-for i,uid in ipairs(get_entities_by(ENT_TYPE.MONS_CAVEMAN, MASK.MONSTER, LAYER.BOTH)) do
- local x, y, l = get_position(uid)
- spawn_entity_snapped_to_floor(ENT_TYPE.ITEM_BOMB, x, y, l)
-end
-
-
+table<string> enum_get_names(table enum, int value)
+Return all the names of a number in an enum table
+get_character_name
-Search script examples for get_entities_by
+Search script examples for get_character_name
-array<int> get_entities_by(array<ENT_TYPE> entity_types, int mask, LAYER layer)
array<int> get_entities_by(ENT_TYPE entity_type, int mask, LAYER layer)
-Get uids of entities by some conditions (ENT_TYPE, MASK). Set entity_type
or mask
to 0
to ignore that, can also use table of entity_types.
-Recommended to always set the mask, even if you look for one entity type
-get_entities_by_type
local types = {ENT_TYPE.MONS_SNAKE, ENT_TYPE.MONS_BAT}
-set_callback(function()
- local uids = get_entities_by_type(ENT_TYPE.MONS_SNAKE, ENT_TYPE.MONS_BAT)
- -- is not the same thing as this, but also works
- local uids2 = get_entities_by_type(types)
- print(tostring(#uids).." == "..tostring(#uids2))
-end, ON.LEVEL)
-
-
+string get_character_name(ENT_TYPE type_id)
+Same as Player.get_name
+get_character_short_name
-Search script examples for get_entities_by_type
+Search script examples for get_character_short_name
-array<int> get_entities_by_type(int, int...)
-Get uids of entities matching id. This function is variadic, meaning it accepts any number of id's.
-You can even pass a table!
-This function can be slower than the get_entities_by with the mask parameter filled
-get_entities_overlapping_hitbox
+string get_character_short_name(ENT_TYPE type_id)
+Same as Player.get_short_name
+get_string
-Search script examples for get_entities_overlapping_hitbox
+Search script examples for get_string
-array<int> get_entities_overlapping_hitbox(array<ENT_TYPE> entity_types, int mask, AABB hitbox, LAYER layer)
array<int> get_entities_overlapping_hitbox(ENT_TYPE entity_type, int mask, AABB hitbox, LAYER layer)
-Get uids of matching entities overlapping with the given hitbox. Set entity_type
or mask
to 0
to ignore that, can also use table of entity_types
-get_entity
+const string get_string(STRINGID string_id)
+Get string behind STRINGID, don't use stringid diretcly for vanilla string, use hash_to_stringid first
+Will return the string of currently choosen language
+hash_to_stringid
-Search script examples for get_entity
+Search script examples for hash_to_stringid
-Entity get_entity(int uid)
-Get the Entity behind an uid, converted to the correct type. To see what type you will get, consult the entity hierarchy list
-get_entity_name
+STRINGID hash_to_stringid(int hash)
+Convert the hash to stringid
+Check strings00_hashed.str for the hash values, or extract assets with modlunky and check those.
+set_level_string
-- set the level string shown in hud, journal and game over
+-- also change the one used in transitions for consistency
+set_callback(function()
+ if state.screen_next == SCREEN.LEVEL then
+ local level_str = "test" .. tostring(state.level_count)
+ set_level_string(level_str)
+ change_string(hash_to_stringid(0xda7c0c5b), F"{level_str} COMPLETED!")
+ end
+end, ON.PRE_LOAD_SCREEN)
+
+
-Search script examples for get_entity_name
+Search script examples for set_level_string
-string get_entity_name(ENT_TYPE type, optional fallback_strategy)
-Get localized name of an entity, pass fallback_strategy
as true
to fall back to the ENT_TYPE.
enum name
-if the entity has no localized name
-get_entity_type
+nil set_level_string(string str)
+Set the level number shown in the hud and journal to any string. This is reset to the default "%d-%d" automatically just before PRE_LOAD_SCREEN to a level or main menu, so use in PRE_LOAD_SCREEN, POST_LEVEL_GENERATION or similar for each level.
+Use "%d-%d" to reset to default manually. Does not affect the "...COMPLETED!" message in transitions or lines in "Dear Journal", you need to edit them separately with change_string.
+Texture functions
define_texture
-Search script examples for get_entity_type
+Search script examples for define_texture
-ENT_TYPE get_entity_type(int uid)
-Get the ENT_TYPE... of the entity by uid
-get_grid_entity_at
+TEXTURE define_texture(TextureDefinition texture_data)
+Defines a new texture that can be used in Entity::set_texture
+If a texture with the same definition already exists the texture will be reloaded from disk.
+get_texture
-Search script examples for get_grid_entity_at
+Search script examples for get_texture
-int get_grid_entity_at(float x, float y, LAYER layer)
-Gets a grid entity, such as floor or spikes, at the given position and layer.
-get_local_players
+optional<TEXTURE> get_texture(TextureDefinition texture_data)
+Gets a texture with the same definition as the given, if none exists returns nil
+get_texture_definition
-Search script examples for get_local_players
+Search script examples for get_texture_definition
-nil get_local_players()
-Get the thread-local version of players
-get_player
+TextureDefinition get_texture_definition(TEXTURE texture_id)
+Gets a TextureDefinition
for equivalent to the one used to define the texture with id
+reload_texture
-Search script examples for get_player
+Search script examples for reload_texture
-Player get_player(int slot, bool or_ghost = false)
-Returns Player (or PlayerGhost if get_player(1, true)
) with this player slot
-get_playerghost
+nil reload_texture(string texture_path)
+Reloads a texture from disk, use this only as a development tool for example in the console
+Note that define_texture will also reload the texture if it already exists
+replace_texture
-Search script examples for get_playerghost
+Search script examples for replace_texture
-PlayerGhost get_playerghost(int slot)
-Returns PlayerGhost with this player slot 1..4
-get_type
+bool replace_texture(TEXTURE vanilla_id, TEXTURE custom_id)
+Replace a vanilla texture definition with a custom texture definition and reload the texture.
+replace_texture_and_heart_color
-Search script examples for get_type
+Search script examples for replace_texture_and_heart_color
-EntityDB get_type(int id)
-Get the EntityDB behind an ENT_TYPE...
-kill_entity
+bool replace_texture_and_heart_color(TEXTURE vanilla_id, TEXTURE custom_id)
+Replace a vanilla texture definition with a custom texture definition and reload the texture. Set corresponding character heart color to the pixel in the center of the player indicator arrow in that texture. (448,1472)
+reset_lut
-Search script examples for kill_entity
+Search script examples for reset_lut
-nil kill_entity(int uid, optional destroy_corpse = nullopt)
-Kills an entity by uid. destroy_corpse
defaults to true
, if you are killing for example a caveman and want the corpse to stay make sure to pass false
.
-lock_door_at
+nil reset_lut(LAYER layer)
+Same as set_lut(nil, layer)
+reset_texture
-Search script examples for lock_door_at
+Search script examples for reset_texture
-nil lock_door_at(float x, float y)
-Try to lock the exit at coordinates
-modify_ankh_health_gain
+nil reset_texture(TEXTURE vanilla_id)
+Reset a replaced vanilla texture to the original and reload the texture.
+set_lut
-Search script examples for modify_ankh_health_gain
+Search script examples for set_lut
-nil modify_ankh_health_gain(int max_health, int beat_add_health)
-Change how much health the ankh gives you after death, with every beat (the heart beat effect) it will add beat_add_health
to your health,
-beat_add_health
has to be divisor of health
and can't be 0, otherwise the function does nothing. Set health
to 0 to return to the game defaults
-If you set health
above the game max health it will be forced down to the game max
-modify_sparktraps
+nil set_lut(optional<TEXTURE> texture_id, LAYER layer)
+Force the LUT texture for the given layer (or both) until it is reset.
+Pass nil
in the first parameter to reset
+Theme functions
force_co_subtheme
-Search script examples for modify_sparktraps
+Search script examples for force_co_subtheme
-nil modify_sparktraps(float angle_increment = 0.015, float distance = 3.0)
-Changes characteristics of (all) sparktraps: speed, rotation direction and distance from center
-Speed: expressed as the amount that should be added to the angle every frame (use a negative number to go in the other direction)
-Distance from center: if you go above 3.0 the game might crash because a spark may go out of bounds!
-move_entity
+nil force_co_subtheme(COSUBTHEME subtheme)
+Forces the theme of the next cosmic ocean level(s) (use e.g. force_co_subtheme(COSUBTHEME.JUNGLE)
. Use COSUBTHEME.RESET to reset to default random behaviour)
+force_custom_subtheme
-Search script examples for move_entity
+Search script examples for force_custom_subtheme
-nil move_entity(int uid, float x, float y, float vx, float vy)
nil move_entity(int uid, float x, float y, float vx, float vy, LAYER layer)
-Teleport entity to coordinates with optional velocity
-move_grid_entity
+nil force_custom_subtheme(customtheme)
+Force current subtheme used in the CO theme. You can pass a CustomTheme, ThemeInfo or THEME. Not to be confused with force_co_subtheme.
+force_custom_theme
-Search script examples for move_grid_entity
+Search script examples for force_custom_theme
-nil move_grid_entity(int uid, float x, float y, LAYER layer)
-Teleport grid entity, the destination should be whole number, this ensures that the collisions will work properly
-pick_up
-- spawn and equip a jetpack on the player
-pick_up(players[1].uid, spawn(ENT_TYPE.ITEM_JETPACK, 0, 0, LAYER.PLAYER, 0, 0))
-
-
+nil force_custom_theme(customtheme)
+Force a theme in PRE_LOAD_LEVEL_FILES, POST_ROOM_GENERATION or PRE_LEVEL_GENERATION to change different aspects of the levelgen. You can pass a CustomTheme, ThemeInfo or THEME.
+get_co_subtheme
-Search script examples for pick_up
+Search script examples for get_co_subtheme
-nil pick_up(int who_uid, int what_uid)
-Pick up another entity by uid. Make sure you're not already holding something, or weird stuff will happen.
-poison_entity
+COSUBTHEME get_co_subtheme()
+Gets the sub theme of the current cosmic ocean level, returns COSUBTHEME.NONE if the current level is not a CO level.
+Tile code functions
define_tile_code
-Search script examples for poison_entity
+Search script examples for define_tile_code
-nil poison_entity(int entity_uid)
-Poisons entity, to cure poison set Movable.poison_tick_timer
to -1
-replace_drop
+TILE_CODE define_tile_code(string tile_code)
+Define a new tile code, to make this tile code do anything you have to use either set_pre_tile_code_callback or set_post_tile_code_callback.
+If a user disables your script but still uses your level mod nothing will be spawned in place of your tile code.
+get_short_tile_code
-Search script examples for replace_drop
+Search script examples for get_short_tile_code
-nil replace_drop(int drop_id, ENT_TYPE new_drop_entity_type)
-Changes a particular drop, e.g. what Van Horsing throws at you (use e.g. replace_drop(DROP.VAN_HORSING_DIAMOND, ENT_TYPE.ITEM_PLASMACANNON))
-Use 0
as type to reset this drop to default, use -1
as drop_id to reset all to default
-set_boss_door_control_enabled
+optional<int> get_short_tile_code(ShortTileCodeDef short_tile_code_def)
+Gets a short tile code based on definition, returns nil
if it can't be found
+get_short_tile_code_definition
-Search script examples for set_boss_door_control_enabled
+Search script examples for get_short_tile_code_definition
-nil set_boss_door_control_enabled(bool enable)
-Allows you to disable the control over the door for Hundun and Tiamat
-This will also prevent game crashing when there is no exit door when they are in level
-set_contents
+optional<ShortTileCodeDef> get_short_tile_code_definition(SHORT_TILE_CODE short_tile_code)
+Gets the definition of a short tile code (if available), will vary depending on which file is loaded
+set_post_tile_code_callback
-Search script examples for set_contents
+Search script examples for set_post_tile_code_callback
-nil set_contents(int uid, ENT_TYPE item_entity_type)
-Set the contents of Coffin, Present, Pot, Container
-Check the entity hierarchy list for what the exact ENT_TYPE's can this function affect
-set_cursepot_ghost_enabled
+CallbackId set_post_tile_code_callback(function cb, string tile_code)
+Add a callback for a specific tile code that is called after the game handles the tile code.
+Use this to affect what the game or other scripts spawned in this position.
+This is received even if a previous pre-tile-code-callback has returned true
+
The callback signature is nil post_tile_code(float x, float y, int layer, ROOM_TEMPLATE room_template)
+set_pre_tile_code_callback
-Search script examples for set_cursepot_ghost_enabled
+Search script examples for set_pre_tile_code_callback
-nil set_cursepot_ghost_enabled(bool enable)
-Determines whether the ghost appears when breaking the ghost pot
-set_door
+CallbackId set_pre_tile_code_callback(function cb, string tile_code)
+Add a callback for a specific tile code that is called before the game handles the tile code.
+Return true in order to stop the game or scripts loaded after this script from handling this tile code.
+For example, when returning true in this callback set for "floor"
then no floor will spawn in the game (unless you spawn it yourself)
+
The callback signature is bool pre_tile_code(float x, float y, int layer, ROOM_TEMPLATE room_template)
+Deprecated functions
+
+on_frame
+Use set_callback(function, ON.FRAME)
instead
+on_camp
+Use set_callback(function, ON.CAMP)
instead
+on_level
+Use set_callback(function, ON.LEVEL)
instead
+on_start
+Use set_callback(function, ON.START)
instead
+on_transition
+Use set_callback(function, ON.TRANSITION)
instead
+on_death
+Use set_callback(function, ON.DEATH)
instead
+on_win
+Use set_callback(function, ON.WIN)
instead
+on_screen
+Use set_callback(function, ON.SCREEN)
instead
+on_guiframe
+Use set_callback(function, ON.GUIFRAME)
instead
+load_script
-Search script examples for set_door
+Search script examples for load_script
-nil set_door(int uid, int w, int l, int t)
-Short for set_door_target.
-set_door_target
+
+nil load_script()
+Same as import().
+read_prng
-Search script examples for set_door_target
+Search script examples for read_prng
-nil set_door_target(int uid, int w, int l, int t)
-Make an ENT_TYPE.FLOOR_DOOR_EXIT go to world w
, level l
, theme t
-set_drop_chance
+
+array<int> read_prng()
+Read the game prng state. Use prng:get_pair() instead.
+force_dark_level
-- forces any level to be dark, even bosses
+set_callback(function()
+ state.level_flags = set_flag(state.level_flags, 18)
+end, ON.POST_ROOM_GENERATION)
+
+
-Search script examples for set_drop_chance
+Search script examples for force_dark_level
-nil set_drop_chance(int dropchance_id, int new_drop_chance)
-Alters the drop chance for the provided monster-item combination (use e.g. set_drop_chance(DROPCHANCE.MOLE_MATTOCK, 10) for a 1 in 10 chance)
-Use -1
as dropchance_id to reset all to default
-set_explosion_mask
+
+nil force_dark_level(bool g)
+Set level flag 18 on post room generation instead, to properly force every level to dark
+get_entities
-Search script examples for set_explosion_mask
+Search script examples for get_entities
-nil set_explosion_mask(int mask)
-Sets which entities are affected by a bomb explosion. Default = MASK.PLAYER | MASK.MOUNT | MASK.MONSTER | MASK.ITEM | MASK.ACTIVEFLOOR | MASK.FLOOR
-set_kapala_blood_threshold
+array<int> get_entities()
+Use get_entities_by(0, MASK.ANY, LAYER.BOTH)
instead
+get_entities_by_mask
-Search script examples for set_kapala_blood_threshold
+Search script examples for get_entities_by_mask
-nil set_kapala_blood_threshold(int threshold)
-Sets the amount of blood drops in the Kapala needed to trigger a health increase (default = 7).
-set_kapala_hud_icon
+array<int> get_entities_by_mask(int mask)
+Use get_entities_by(0, mask, LAYER.BOTH)
instead
+get_entities_by_layer
-Search script examples for set_kapala_hud_icon
+Search script examples for get_entities_by_layer
-nil set_kapala_hud_icon(int icon_index)
-Sets the hud icon for the Kapala (0-6 ; -1 for default behaviour).
-If you set a Kapala treshold greater than 7, make sure to set the hud icon in the range 0-6, or other icons will appear in the hud!
-set_max_rope_length
+array<int> get_entities_by_layer(LAYER layer)
+Use get_entities_by(0, MASK.ANY, layer)
instead
+get_entities_overlapping
-Search script examples for set_max_rope_length
+Search script examples for get_entities_overlapping
-nil set_max_rope_length(int length)
-Sets the maximum length of a thrown rope (anchor segment not included). Unfortunately, setting this higher than default (6) creates visual glitches in the rope, even though it is fully functional.
-set_olmec_cutscene_enabled
+array<int> get_entities_overlapping(array<ENT_TYPE> entity_types, int mask, float sx, float sy, float sx2, float sy2, LAYER layer)
array<int> get_entities_overlapping(ENT_TYPE entity_type, int mask, float sx, float sy, float sx2, float sy2, LAYER layer)
+Use get_entities_overlapping_hitbox
instead
+get_entity_ai_state
-Search script examples for set_olmec_cutscene_enabled
+Search script examples for get_entity_ai_state
-nil set_olmec_cutscene_enabled(bool enable)
set_olmec_phase_y_level
+int get_entity_ai_state(int uid)
+As the name is misleading. use entity move_state
field instead
+set_arrowtrap_projectile
-Search script examples for set_olmec_phase_y_level
+Search script examples for set_arrowtrap_projectile
-nil set_olmec_phase_y_level(int phase, float y)
-Sets the Y-level at which Olmec changes phases
-set_time_ghost_enabled
+nil set_arrowtrap_projectile(ENT_TYPE regular_entity_type, ENT_TYPE poison_entity_type)
+Use replace_drop(DROP.ARROWTRAP_WOODENARROW, new_arrow_type) and replace_drop(DROP.POISONEDARROWTRAP_WOODENARROW, new_arrow_type) instead
+set_blood_multiplication
-Search script examples for set_time_ghost_enabled
+Search script examples for set_blood_multiplication
-nil set_time_ghost_enabled(bool b)
-Determines whether the time ghost appears, including the showing of the ghost toast
-set_time_jelly_enabled
+nil set_blood_multiplication(int default_multiplier, int vladscape_multiplier)
+This function never worked properly as too many places in the game individually check for vlads cape and calculate the blood multiplication
+default_multiplier
doesn't do anything due to some changes in last game updates, vladscape_multiplier
only changes the multiplier to some entities death's blood spit
+set_camera_position
-Search script examples for set_time_jelly_enabled
+Search script examples for set_camera_position
-nil set_time_jelly_enabled(bool b)
-Determines whether the time jelly appears in cosmic ocean
-unequip_backitem
+nil set_camera_position(float cx, float cy)
+this doesn't actually work at all. See State -> Camera the for proper camera handling
+setflag
+
+Search script examples for setflag
+
+
+nil setflag()
+clrflag
-Search script examples for unequip_backitem
+Search script examples for clrflag
-nil unequip_backitem(int who_uid)
-Unequips the currently worn backitem
-unlock_door_at
+
+nil clrflag()
+testflag
-Search script examples for unlock_door_at
+Search script examples for testflag
-nil unlock_door_at(float x, float y)
-Try to unlock the exit at coordinates
-waddler_count_entity
+
+nil testflag()
+read_input
-Search script examples for waddler_count_entity
+Search script examples for read_input
-int waddler_count_entity(ENT_TYPE entity_type)
-Returns how many of a specific entity type Waddler has stored
-waddler_entity_type_in_slot
+
+INPUTS read_input(int uid)
+Use players[1].input.buttons_gameplay
for only the inputs during the game, or .buttons
for all the inputs, even during the pause menu
+Of course, you can get the Player by other mean, it doesn't need to be the players
table
+You can only read inputs from actual players, HH don't have any inputs
+read_stolen_input
-Search script examples for waddler_entity_type_in_slot
+Search script examples for read_stolen_input
-int waddler_entity_type_in_slot(int slot)
-Gets the entity type of the item in the provided slot
-waddler_get_entity_meta
+
+INPUTS read_stolen_input(int uid)
+Read input that has been previously stolen with steal_input
+Use state.player_inputs.player_slots[player_slot].buttons_gameplay
for only the inputs during the game, or .buttons
for all the inputs, even during the pause menu
+clear_entity_callback
-Search script examples for waddler_get_entity_meta
+Search script examples for clear_entity_callback
-int waddler_get_entity_meta(int slot)
-Gets the 16-bit meta-value associated with the entity type in the associated slot
-waddler_remove_entity
+
+nil clear_entity_callback(int uid, CallbackId cb_id)
+Use entity.clear_virtual
instead.
+Clears a callback that is specific to an entity.
+set_pre_statemachine
-Search script examples for waddler_remove_entity
+Search script examples for set_pre_statemachine
-nil waddler_remove_entity(ENT_TYPE entity_type, int amount_to_remove = 99)
-Removes an entity type from Waddler's storage. Second param determines how many of the item to remove (default = remove all)
-waddler_set_entity_meta
+
+optional<CallbackId> set_pre_statemachine(int uid, function fun)
+Use entity:set_pre_update_state_machine
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+uid
has to be the uid of a Movable
or else stuff will break.
+Sets a callback that is called right before the statemachine, return true
to skip the statemachine update.
+Use this only when no other approach works, this call can be expensive if overused.
+Check here to see whether you can use this callback on the entity type you intend to.
+
The callback signature is bool statemachine(Entity self)
+set_post_statemachine
-Search script examples for waddler_set_entity_meta
+Search script examples for set_post_statemachine
-nil waddler_set_entity_meta(int slot, int meta)
-Sets the 16-bit meta-value associated with the entity type in the associated slot
-waddler_store_entity
+
+optional<CallbackId> set_post_statemachine(int uid, function fun)
+Use entity:set_post_update_state_machine
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+uid
has to be the uid of a Movable
or else stuff will break.
+Sets a callback that is called right after the statemachine, so you can override any values the satemachine might have set (e.g. animation_frame
).
+Use this only when no other approach works, this call can be expensive if overused.
+Check here to see whether you can use this callback on the entity type you intend to.
+
The callback signature is nil statemachine(Entity self)
+set_on_destroy
-Search script examples for waddler_store_entity
+Search script examples for set_on_destroy
-int waddler_store_entity(ENT_TYPE entity_type)
-Store an entity type in Waddler's storage. Returns the slot number the item was stored in or -1 when storage is full and the item couldn't be stored.
-worn_backitem
+
+optional<CallbackId> set_on_destroy(int uid, function fun)
+Use entity:set_pre_destroy
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right when an entity is destroyed, e.g. as if by Entity.destroy()
before the game applies any side effects.
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is nil on_destroy(Entity self)
+set_on_kill
-Search script examples for worn_backitem
+Search script examples for set_on_kill
-int worn_backitem(int who_uid)
-Returns the uid of the currently worn backitem, or -1 if wearing nothing
-Feat functions
change_feat
+
+optional<CallbackId> set_on_kill(int uid, function fun)
+Use entity:set_pre_kill
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right when an entity is eradicated, before the game applies any side effects.
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is nil on_kill(Entity self, Entity killer)
+set_on_damage
-Search script examples for change_feat
+Search script examples for set_on_damage
-nil change_feat(FEAT feat, bool hidden, string name, string description)
-Helper function to set the title and description strings for a FEAT with change_string, as well as the hidden state.
-get_feat
+
+optional<CallbackId> set_on_damage(int uid, function fun)
+Use entity:set_pre_damage
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right before an entity is damaged, return true
to skip the game's damage handling.
+Note that damage_dealer can be nil ! (long fall, ...)
+DO NOT CALL self:damage()
in the callback !
+Use this only when no other approach works, this call can be expensive if overused.
+The entity has to be of a Movable type.
+
The callback signature is bool on_damage(Entity self, Entity damage_dealer, int damage_amount, float vel_x, float vel_y, int stun_amount, int iframes)
+set_pre_floor_update
-Search script examples for get_feat
+Search script examples for set_pre_floor_update
-tuple<bool, bool, const string, const string> get_feat(FEAT feat)
-Check if the user has performed a feat (Real Steam achievement or a hooked one). Returns: bool unlocked, bool hidden, string name, string description
-get_feat_hidden
+
+optional<CallbackId> set_pre_floor_update(int uid, function fun)
+Use entity:set_pre_floor_update
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right before a floor is updated (by killed neighbor), return true
to skip the game's neighbor update handling.
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is bool pre_floor_update(Entity self)
+set_post_floor_update
-- Use FLOOR_GENERIC with textures from different themes that update correctly when destroyed.
+-- This lets you use the custom tile code 'floor_generic_tidepool'
+-- in the level editor to spawn tidepool floor in dwelling for example...
+define_tile_code("floor_generic_tidepool")
+set_pre_tile_code_callback(function(x, y, layer)
+ local uid = spawn_grid_entity(ENT_TYPE.FLOOR_GENERIC, x, y, layer)
+ set_post_floor_update(uid, function(me)
+ me:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TIDEPOOL_0)
+ for i,v in ipairs(entity_get_items_by(me.uid, ENT_TYPE.DECORATION_GENERIC, MASK.DECORATION)) do
+ local deco = get_entity(v)
+ deco:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TIDEPOOL_0)
+ end
+ end)
+ return true
+end, "floor_generic_tidepool")
+
+
+-- Fix quicksand decorations when not in temple
+set_post_entity_spawn(function(ent)
+ ent:set_post_floor_update(function(me)
+ me:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TEMPLE_0)
+ for i,v in ipairs(entity_get_items_by(me.uid, ENT_TYPE.DECORATION_GENERIC, MASK.DECORATION)) do
+ local deco = get_entity(v)
+ deco:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TEMPLE_0)
+ end
+ end)
+end, SPAWN_TYPE.ANY, MASK.FLOOR, ENT_TYPE.FLOOR_QUICKSAND)
+
+
-Search script examples for get_feat_hidden
+Search script examples for set_post_floor_update
-bool get_feat_hidden(FEAT feat)
-Get the visibility of a feat
-set_feat_hidden
+
+optional<CallbackId> set_post_floor_update(int uid, function fun)
+Use entity:set_post_floor_update
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right after a floor is updated (by killed neighbor).
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is nil post_floor_update(Entity self)
+set_on_open
-Search script examples for set_feat_hidden
+Search script examples for set_on_open
-nil set_feat_hidden(FEAT feat, bool hidden)
-Set the visibility of a feat
-Flag functions
clr_flag
+
+optional<CallbackId> set_on_open(int uid, function fun)
+Use entity:set_pre_trigger_action
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right when a container is opened by the player (up+whip)
+Use this only when no other approach works, this call can be expensive if overused.
+Check here to see whether you can use this callback on the entity type you intend to.
+
The callback signature is nil on_open(Entity entity_self, Entity opener)
+set_pre_collision1
-Search script examples for clr_flag
+Search script examples for set_pre_collision1
-Flags clr_flag(Flags flags, int bit)
-Clears the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
-flip_flag
+
+optional<CallbackId> set_pre_collision1(int uid, function fun)
+Use entity:set_pre_collision1
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right before the collision 1 event, return true
to skip the game's collision handling.
+Use this only when no other approach works, this call can be expensive if overused.
+Check here to see whether you can use this callback on the entity type you intend to.
+
The callback signature is bool pre_collision1(Entity entity_self, Entity collision_entity)
+set_pre_collision2
-Search script examples for flip_flag
+Search script examples for set_pre_collision2
-Flags flip_flag(Flags flags, int bit)
-Flips the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
-get_entity_flags
+
+optional<CallbackId> set_pre_collision2(int uid, function fun)
+Use entity:set_pre_collision2
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right before the collision 2 event, return true
to skip the game's collision handling.
+Use this only when no other approach works, this call can be expensive if overused.
+Check here to see whether you can use this callback on the entity type you intend to.
+
The callback signature is bool pre_collision12(Entity self, Entity collision_entity)
+set_pre_render
-Search script examples for get_entity_flags
+Search script examples for set_pre_render
-int get_entity_flags(int uid)
-Get the flags
field from entity by uid
-get_entity_flags2
+
+optional<CallbackId> set_pre_render(int uid, function fun)
+Use entity.rendering_info:set_pre_render
in combination with render_info:get_entity
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right after the entity is rendered.
+Return true
to skip the original rendering function and all later pre_render callbacks.
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is bool render(VanillaRenderContext render_ctx, Entity self)
+set_post_render
-Search script examples for get_entity_flags2
+Search script examples for set_post_render
-int get_entity_flags2(int uid)
-Get the more_flags
field from entity by uid
-get_level_flags
+
+optional<CallbackId> set_post_render(int uid, function fun)
+Use entity.rendering_info:set_post_render
in combination with render_info:get_entity
instead.
+Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
+Sets a callback that is called right after the entity is rendered.
+Use this only when no other approach works, this call can be expensive if overused.
+
The callback signature is nil post_render(VanillaRenderContext render_ctx, Entity self)
+generate_particles
-Search script examples for get_level_flags
+Search script examples for generate_particles
-int get_level_flags()
-Get state.level_flags
-set_entity_flags
+ParticleEmitterInfo generate_particles(int particle_emitter_id, int uid)
+Use generate_world_particles
+draw_line
-Search script examples for set_entity_flags
+Search script examples for draw_line
-nil set_entity_flags(int uid, int flags)
-Set the flags
field from entity by uid
-set_entity_flags2
+
+nil draw_line(float x1, float y1, float x2, float y2, float thickness, uColor color)
+Use GuiDrawContext.draw_line
instead
+draw_rect
-Search script examples for set_entity_flags2
+Search script examples for draw_rect
-nil set_entity_flags2(int uid, int flags)
-Set the more_flags
field from entity by uid
-set_flag
+
+nil draw_rect(float x1, float y1, float x2, float y2, float thickness, float rounding, uColor color)
+Use GuiDrawContext.draw_rect
instead
+draw_rect_filled
-Search script examples for set_flag
+Search script examples for draw_rect_filled
-Flags set_flag(Flags flags, int bit)
-Set the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
-set_level_flags
+
+nil draw_rect_filled(float x1, float y1, float x2, float y2, float rounding, uColor color)
+Use GuiDrawContext.draw_rect_filled
instead
+draw_circle
-Search script examples for set_level_flags
+Search script examples for draw_circle
-nil set_level_flags(int flags)
-Set state.level_flags
-test_flag
+
+nil draw_circle(float x, float y, float radius, float thickness, uColor color)
+Use GuiDrawContext.draw_circle
instead
+draw_circle_filled
-Search script examples for test_flag
+Search script examples for draw_circle_filled
-bool test_flag(Flags flags, int bit)
-Returns true if the nth bit is set in the number.
-Generic functions
activate_crush_elevator_hack
+
+nil draw_circle_filled(float x, float y, float radius, uColor color)
+Use GuiDrawContext.draw_circle_filled
instead
+draw_text
-Search script examples for activate_crush_elevator_hack
+Search script examples for draw_text
-nil activate_crush_elevator_hack(bool activate)
-Activate custom variables for speed and y coordinate limit for crushing elevator
-note: because those variables are custom and game does not initiate them, you need to do it yourself for each CrushElevator entity, recommending set_post_entity_spawn
-default game values are: speed = 0.0125, y_limit = 98.5
-activate_hundun_hack
+
+nil draw_text(float x, float y, float size, string text, uColor color)
+Use GuiDrawContext.draw_text
instead
+draw_image
-Search script examples for activate_hundun_hack
+Search script examples for draw_image
-nil activate_hundun_hack(bool activate)
-Activate custom variables for y coordinate limit for hundun and spawn of it's heads
-note: because those variables are custom and game does not initiate them, you need to do it yourself for each Hundun entity, recommending set_post_entity_spawn
-default game value are: y_limit = 98.5, rising_speed_x = 0, rising_speed_y = 0.0125, bird_head_spawn_y = 55, snake_head_spawn_y = 71
-change_poison_timer
+
+nil draw_image(IMAGE image, float x1, float y1, float x2, float y2, float uvx1, float uvy1, float uvx2, float uvy2, uColor color)
+Use GuiDrawContext.draw_image
instead
+draw_image_rotated
-Search script examples for change_poison_timer
+Search script examples for draw_image_rotated
-nil change_poison_timer(int frames)
-Change the amount of frames after the damage from poison is applied
-clear_cache
+
+nil draw_image_rotated(IMAGE image, float x1, float y1, float x2, float y2, float uvx1, float uvy1, float uvx2, float uvy2, uColor color, float angle, float px, float py)
+Use GuiDrawContext.draw_image_rotated
instead
+window
-Search script examples for clear_cache
+Search script examples for window
-nil clear_cache()
-Clear cache for a file path or the whole directory
-clr_mask
+
+nil window(string title, float x, float y, float w, float h, bool movable, function callback)
+Use GuiDrawContext.window
instead
+win_text
-Search script examples for clr_mask
+Search script examples for win_text
-Flags clr_mask(Flags flags, Flags mask)
-Clears a bitmask in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
-create_image
+
+nil win_text(string text)
+Use GuiDrawContext.win_text
instead
+win_separator
-Search script examples for create_image
+Search script examples for win_separator
-tuple<IMAGE, int, int> create_image(string path)
-Create image from file. Returns a tuple containing id, width and height.
-Depending on the image size, this can take a moment, preferably don't create them dynamically, rather create all you need in global scope so it will load them as soon as the game starts
-create_image_crop
+
+nil win_separator()
+Use GuiDrawContext.win_separator
instead
+win_inline
-Search script examples for create_image_crop
+Search script examples for win_inline
-tuple<IMAGE, int, int> create_image_crop(string path, int x, int y, int w, int h)
-Create image from file, cropped to the geometry provided. Returns a tuple containing id, width and height.
-Depending on the image size, this can take a moment, preferably don't create them dynamically, rather create all you need in global scope so it will load them as soon as the game starts
-disable_floor_embeds
+
+nil win_inline()
+Use GuiDrawContext.win_inline
instead
+win_sameline
-Search script examples for disable_floor_embeds
+Search script examples for win_sameline
-bool disable_floor_embeds(bool disable)
-Disable all crust item spawns, returns whether they were already disabled before the call
-flip_mask
+
+nil win_sameline(float offset, float spacing)
+Use GuiDrawContext.win_sameline
instead
+win_button
-Search script examples for flip_mask
+Search script examples for win_button
-Flags flip_mask(Flags flags, Flags mask)
-Flips the nth bit in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
-force_journal
+
+bool win_button(string text)
+Use GuiDrawContext.win_button
instead
+win_input_text
-Search script examples for force_journal
+Search script examples for win_input_text
-nil force_journal(int chapter, int entry)
-Force the journal to open on a chapter and entry# when pressing the journal button. Only use even entry numbers. Set chapter to JOURNALUI_PAGE_SHOWN.JOURNAL
to reset. (This forces the journal toggle to always read from game_manager.save_related.journal_popup_ui.entry_to_show
etc.)
-get_adventure_seed
+
+string win_input_text(string label, string value)
+Use GuiDrawContext.win_input_text
instead
+win_input_int
-Search script examples for get_adventure_seed
+Search script examples for win_input_int
-tuple<int, int> get_adventure_seed()
-Get the current adventure seed pair
-get_character_heart_color
+
+int win_input_int(string label, int value)
+Use GuiDrawContext.win_input_int
instead
+win_input_float
-Search script examples for get_character_heart_color
+Search script examples for win_input_float
-Color get_character_heart_color(ENT_TYPE type_id)
-Same as Player.get_heart_color
-get_frame
+
+float win_input_float(string label, float value)
+Use GuiDrawContext.win_input_float
instead
+win_slider_int
-Search script examples for get_frame
+Search script examples for win_slider_int
-int get_frame()
-Get the current global frame count since the game was started. You can use this to make some timers yourself, the engine runs at 60fps.
-get_id
+
+int win_slider_int(string label, int value, int min, int max)
+Use GuiDrawContext.win_slider_int
instead
+win_drag_int
-Search script examples for get_id
+Search script examples for win_drag_int
-string get_id()
-Get your sanitized script id to be used in import.
-get_level_config
+
+int win_drag_int(string label, int value, int min, int max)
+Use GuiDrawContext.win_drag_int
instead
+win_slider_float
-Search script examples for get_level_config
+Search script examples for win_slider_float
-int get_level_config(LEVEL_CONFIG config)
-Gets the value for the specified config
-get_local_prng
+
+float win_slider_float(string label, float value, float min, float max)
+Use GuiDrawContext.win_slider_float
instead
+win_drag_float
-Search script examples for get_local_prng
+Search script examples for win_drag_float
-nil get_local_prng()
-Get the thread-local version of prng
-get_local_state
+
+float win_drag_float(string label, float value, float min, float max)
+Use GuiDrawContext.win_drag_float
instead
+win_check
-Search script examples for get_local_state
+Search script examples for win_check
-nil get_local_state()
-Get the thread-local version of state
-get_ms
+
+bool win_check(string label, bool value)
+Use GuiDrawContext.win_check
instead
+win_combo
-Search script examples for get_ms
+Search script examples for win_combo
-nil get_ms()
-Get the current timestamp in milliseconds since the Unix Epoch.
-get_setting
+
+int win_combo(string label, int selected, string opts)
+Use GuiDrawContext.win_combo
instead
+win_pushid
-Search script examples for get_setting
+Search script examples for win_pushid
-optional<int> get_setting(GAME_SETTING setting)
-Gets the specified setting, values might need to be interpreted differently per setting
-god
+
+nil win_pushid(int id)
+Use GuiDrawContext.win_pushid
instead
+win_popid
-Search script examples for god
+Search script examples for win_popid
-nil god(bool g)
-Enable/disable godmode for players.
-god_companions
+
+nil win_popid()
+Use GuiDrawContext.win_popid
instead
+win_image
-Search script examples for god_companions
+Search script examples for win_image
-nil god_companions(bool g)
-Enable/disable godmode for companions.
-grow_chainandblocks
+
+nil win_image(IMAGE image, float width, float height)
+Use GuiDrawContext.win_image
instead
+Non-Entity types
Arena types
ArenaConfigArenas
+Used in ArenaState
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+dwelling_1
+
+
+
+bool
+dwelling_2
+
+
+
+bool
+dwelling_3
+
+
+
+bool
+dwelling_4
+
+
+
+bool
+dwelling_5
+
+
+
+bool
+jungle_1
+
+
+
+bool
+jungle_2
+
+
+
+bool
+jungle_3
+
+
+
+bool
+jungle_4
+
+
+
+bool
+jungle_5
+
+
+
+bool
+volcana_1
+
+
+
+bool
+volcana_2
+
+
+
+bool
+volcana_3
+
+
+
+bool
+volcana_4
+
+
+
+bool
+volcana_5
+
+
+
+bool
+tidepool_1
+
+
+
+bool
+tidepool_2
+
+
+
+bool
+tidepool_3
+
+
+
+bool
+tidepool_4
+
+
+
+bool
+tidepool_5
+
+
+
+bool
+temple_1
+
+
+
+bool
+temple_2
+
+
+
+bool
+temple_3
+
+
+
+bool
+temple_4
+
+
+
+bool
+temple_5
+
+
+
+bool
+icecaves_1
+
+
+
+bool
+icecaves_2
+
+
+
+bool
+icecaves_3
+
+
+
+bool
+icecaves_4
+
+
+
+bool
+icecaves_5
+
+
+
+bool
+neobabylon_1
+
+
+
+bool
+neobabylon_2
+
+
+
+bool
+neobabylon_3
+
+
+
+bool
+neobabylon_4
+
+
+
+bool
+neobabylon_5
+
+
+
+bool
+sunkencity_1
+
+
+
+bool
+sunkencity_2
+
+
+
+bool
+sunkencity_3
+
+
+
+bool
+sunkencity_4
+
+
+
+bool
+sunkencity_5
+
+
+
+ArenaConfigEquippedItems
+Used in ArenaState
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+paste
+
+
+
+bool
+climbing_gloves
+
+
+
+bool
+pitchers_mitt
+
+
+
+bool
+spike_shoes
+
+
+
+bool
+spring_shoes
+
+
+
+bool
+parachute
+
+
+
+bool
+kapala
+
+
+
+bool
+scepter
+
+
+
+ArenaConfigItems
+Used in ArenaState
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+rock
+
+
+
+bool
+pot
+
+
+
+bool
+bombbag
+
+
+
+bool
+bombbox
+
+
+
+bool
+ropepile
+
+
+
+bool
+pickup_12bag
+
+
+
+bool
+pickup_24bag
+
+
+
+bool
+cooked_turkey
+
+
+
+bool
+royal_jelly
+
+
+
+bool
+torch
+
+
+
+bool
+boomerang
+
+
+
+bool
+machete
+
+
+
+bool
+mattock
+
+
+
+bool
+crossbow
+
+
+
+bool
+webgun
+
+
+
+bool
+freezeray
+
+
+
+bool
+shotgun
+
+
+
+bool
+camera
+
+
+
+bool
+plasma_cannon
+
+
+
+bool
+wooden_shield
+
+
+
+bool
+metal_shield
+
+
+
+bool
+teleporter
+
+
+
+bool
+mine
+
+
+
+bool
+snaptrap
+
+
+
+bool
+paste
+
+
+
+bool
+climbing_gloves
+
+
+
+bool
+pitchers_mitt
+
+
+
+bool
+spike_shoes
+
+
+
+bool
+spring_shoes
+
+
+
+bool
+parachute
+
+
+
+bool
+cape
+
+
+
+bool
+vlads_cape
+
+
+
+bool
+jetpack
+
+
+
+bool
+hoverpack
+
+
+
+bool
+telepack
+
+
+
+bool
+powerpack
+
+
+
+bool
+excalibur
+
+
+
+bool
+scepter
+
+
+
+bool
+kapala
+
+
+
+bool
+true_crown
+
+
+
+ArenaState
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+int
+current_arena
+
+
+
+array<int, 4>
+player_teams
+
+
+
+int
+format
+
+
+
+int
+ruleset
+
+
+
+array<int, 4>
+player_lives
+
+
+
+array<int, 4>
+player_totalwins
+
+
+
+array<bool, 4>
+player_won
+
+
+
+int
+timer
+The menu selection for timer, default values 0..20 where 0 == 30 seconds, 19 == 10 minutes and 20 == infinite. Can go higher, although this will glitch the menu text. Actual time (seconds) = (state.arena.timer + 1) x 30
+
+
+int
+timer_ending
+
+
+
+int
+wins
+
+
+
+int
+lives
+
+
+
+int
+time_to_win
+
+
+
+array<int, 4>
+player_idolheld_countdown
+
+
+
+int
+health
+
+
+
+int
+bombs
+
+
+
+int
+ropes
+
+
+
+int
+stun_time
+
+
+
+int
+mount
+
+
+
+int
+arena_select
+
+
+
+ArenaConfigArenas
+arenas
+
+
+
+int
+dark_level_chance
+
+
+
+int
+crate_frequency
+
+
+
+ArenaConfigItems
+items_enabled
+
+
+
+ArenaConfigItems
+items_in_crate
+
+
+
+int
+held_item
+
+
+
+int
+equipped_backitem
+
+
+
+ArenaConfigEquippedItems
+equipped_items
+
+
+
+int
+whip_damage
+
+
+
+bool
+final_ghost
+
+
+
+int
+breath_cooldown
+
+
+
+bool
+punish_ball
+
+
+
+Callback context types
GuiDrawContext
-- Draw the level boundaries
+set_callback(function(draw_ctx)
+ local xmin, ymax, xmax, ymin = get_bounds()
+ local sx, sy = screen_position(xmin, ymax) -- top left
+ local sx2, sy2 = screen_position(xmax, ymin) -- bottom right
+ draw_ctx:draw_rect(sx, sy, sx2, sy2, 4, 0, rgba(255, 255, 255, 255))
+end, ON.GUIFRAME)
+
+
+Used in register_option_callback and set_callback with ON.GUIFRAME
+
+
+
+Type
+Name
+Description
+
+
+
+nil
+draw_line(float x1, float y1, float x2, float y2, float thickness, uColor color)
+Draws a line on screen
+
+
+nil
+draw_rect(float left, float top, float right, float bottom, float thickness, float rounding, uColor color)
+Draws a rectangle on screen from top-left to bottom-right.
+
+
+nil
+draw_rect(AABB rect, float thickness, float rounding, uColor color)
+Draws a rectangle on screen from top-left to bottom-right.
+
+
+nil
+draw_rect_filled(float left, float top, float right, float bottom, float rounding, uColor color)
+Draws a filled rectangle on screen from top-left to bottom-right.
+
+
+nil
+draw_rect_filled(AABB rect, float rounding, uColor color)
+Draws a filled rectangle on screen from top-left to bottom-right.
+
+
+nil
+draw_triangle(Vec2 p1, Vec2 p2, Vec2 p3, float thickness, uColor color)
+Draws a triangle on screen.
+
+
+nil
+draw_triangle_filled(Vec2 p1, Vec2 p2, Vec2 p3, uColor color)
+Draws a filled triangle on screen.
+
+
+nil
+draw_poly(array points, float thickness, uColor color)
+Draws a polyline on screen.
+
+
+nil
+draw_poly_filled(array points, uColor color)
+Draws a filled convex polyline on screen.
+
+
+nil
+draw_bezier_cubic(Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float thickness, uColor color)
+Draws a cubic bezier curve on screen.
+
+
+nil
+draw_bezier_quadratic(Vec2 p1, Vec2 p2, Vec2 p3, float thickness, uColor color)
+Draws a quadratic bezier curve on screen.
+
+
+nil
+draw_circle(float x, float y, float radius, float thickness, uColor color)
+Draws a circle on screen
+
+
+nil
+draw_circle_filled(float x, float y, float radius, uColor color)
+Draws a filled circle on screen
+
+
+nil
+draw_text(float x, float y, float size, string text, uColor color)
+Draws text in screen coordinates x
, y
, anchored top-left. Text size 0 uses the default 18.
+
+
+nil
+draw_image(IMAGE image, float left, float top, float right, float bottom, float uvx1, float uvy1, float uvx2, float uvy2, uColor color)
+Draws an image on screen from top-left to bottom-right. Use UV coordinates 0, 0, 1, 1
to just draw the whole image.
+
+
+nil
+draw_image(IMAGE image, AABB rect, AABB uv_rect, uColor color)
+Draws an image on screen from top-left to bottom-right. Use UV coordinates 0, 0, 1, 1
to just draw the whole image.
+
+
+nil
+draw_image_rotated(IMAGE image, float left, float top, float right, float bottom, float uvx1, float uvy1, float uvx2, float uvy2, uColor color, float angle, float px, float py)
+Same as draw_image
but rotates the image by angle in radians around the pivot offset from the center of the rect (meaning px=py=0
rotates around the center)
+
+
+nil
+draw_image_rotated(IMAGE image, AABB rect, AABB uv_rect, uColor color, float angle, float px, float py)
+Same as draw_image
but rotates the image by angle in radians around the pivot offset from the center of the rect (meaning px=py=0
rotates around the center)
+
+
+nil
+draw_layer(DRAW_LAYER layer)
+Draw on top of UI windows, including platform windows that may be outside the game area, or only in current widget window. Defaults to main viewport background.
+
+
+bool
+window(string title, float x, float y, float w, float h, bool movable, function callback)
+Create a new widget window. Put all win_ widgets inside the callback function. The window functions are just wrappers for the
ImGui widgets, so read more about them there. Use screen position and distance, or 0, 0, 0, 0
to
autosize in center. Use just a ##Label
as title to hide titlebar.
Important: Keep all your labels unique! If you need inputs with the same label, add ##SomeUniqueLabel
after the text, or use pushid to
give things unique ids. ImGui doesn't know what you clicked if all your buttons have the same text...
Returns false if the window was closed from the X.
The callback signature is nil win(GuiDrawContext ctx, Vec2 pos, Vec2 size)
+
+
+nil
+win_text(string text)
+Add some text to window, automatically wrapped
+
+
+nil
+win_separator()
+Add a separator line to window
+
+
+nil
+win_separator_text(string text)
+Add a separator text line to window
+
+
+nil
+win_inline()
+Add next thing on the same line. This is same as win_sameline(0, -1)
+
+
+nil
+win_sameline(float offset, float spacing)
+Add next thing on the same line, with an offset
+
+
+bool
+win_button(string text)
+Add a button
+
+
+string
+win_input_text(string label, string value)
+Add a text field
+
+
+int
+win_input_int(string label, int value)
+Add an integer field
+
+
+float
+win_input_float(string label, float value)
+Add a float field
+
+
+int
+win_slider_int(string label, int value, int min, int max)
+Add an integer slider
+
+
+int
+win_drag_int(string label, int value, int min, int max)
+Add an integer dragfield
+
+
+float
+win_slider_float(string label, float value, float min, float max)
+Add an float slider
+
+
+float
+win_drag_float(string label, float value, float min, float max)
+Add an float dragfield
+
+
+bool
+win_check(string label, bool value)
+Add a checkbox
+
+
+int
+win_combo(string label, int selected, string opts)
+Add a combo box
+
+
+nil
+win_pushid(int id)
+Add unique identifier to the stack, to distinguish identical inputs from each other. Put before the input.
+
+
+nil
+win_pushid(string id)
+Add unique identifier to the stack, to distinguish identical inputs from each other. Put before the input.
+
+
+nil
+win_popid()
+Pop unique identifier from the stack. Put after the input.
+
+
+nil
+win_image(IMAGE image, float width, float height)
+Draw image to window.
+
+
+bool
+win_imagebutton(string label, IMAGE image, float width, float height, float uvx1, float uvy1, float uvx2, float uvy2)
+Draw imagebutton to window.
+
+
+nil
+win_section(string title, function callback)
+Add a collapsing accordion section, put contents in the callback function.
+
+
+nil
+win_indent(float width)
+Indent contents, or unindent if negative
+
+
+nil
+win_width(float width)
+Sets next item width (width>1: width in pixels, width<0: to the right of window, -1<width<1: fractional, multiply by available window width)
+
+
+LoadContext
+Context received in ON.LOAD
+Used to load from save_{}.dat into a string
+
+
+
+Type
+Name
+Description
+
+
+
+string
+load()
+
+
+
+PostRoomGenerationContext
+Context received in ON.POST_ROOM_GENERATION.
+Used to change the room templates in the level and other shenanigans that affect level gen.
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+set_room_template(int x, int y, LAYER layer, ROOM_TEMPLATE room_template)
+Set the room template at the given index and layer, returns false
if the index is outside of the level.
+
+
+bool
+mark_as_machine_room_origin(int x, int y, LAYER layer)
+Marks the room as the origin of a machine room, should be the top-left corner of the machine room
Run this after setting the room template for the room, otherwise the machine room will not spawn correctly
+
+
+bool
+mark_as_set_room(int x, int y, LAYER layer)
+Marks the room as a set-room, a corresponding setroomy-x
template must be loaded, else the game will crash
+
+
+bool
+unmark_as_set_room(int x, int y, LAYER layer)
+Unmarks the room as a set-room
+
+
+bool
+set_shop_type(int x, int y, LAYER layer, int shop_type)
+Set the shop type for a specific room, does nothing if the room is not a shop
+
+
+bool
+set_procedural_spawn_chance(PROCEDURAL_CHANCE chance_id, int inverse_chance)
+Force a spawn chance for this level, has the same restrictions as specifying the spawn chance in the .lvl file.
Note that the actual chance to spawn is 1/inverse_chance
and that is also slightly skewed because of technical reasons.
Returns false
if the given chance is not defined.
+
+
+nil
+set_num_extra_spawns(int extra_spawn_id, int num_spawns_front_layer, int num_spawns_back_layer)
+Change the amount of extra spawns for the given extra_spawn_id
.
+
+
+optional<SHORT_TILE_CODE>
+define_short_tile_code(ShortTileCodeDef short_tile_code_def)
+Defines a new short tile code, automatically picks an unused character or returns a used one in case of an exact match
Returns nil
if all possible short tile codes are already in use
+
+
+nil
+change_short_tile_code(SHORT_TILE_CODE short_tile_code, ShortTileCodeDef short_tile_code_def)
+Overrides a specific short tile code, this means it will change for the whole level
+
+
+PreHandleRoomTilesContext
+Context received in ON.PRE_HANDLE_ROOM_TILES.
+Used to change the room data as well as add a backlayer room if none is set yet.
+
+
+
+Type
+Name
+Description
+
+
+
+optional<SHORT_TILE_CODE>
+get_short_tile_code(int tx, int ty, LAYER layer)
+Gets the tile code at the specified tile coordinate
Valid coordinates are 0 <= tx < CONST.ROOM_WIDTH
, 0 <= ty < CONST.ROOM_HEIGHT
and layer
in {LAYER.FRONT, LAYER.BACK}
Also returns nil
if layer == LAYER.BACK
and the room does not have a back layer
+
+
+bool
+set_short_tile_code(int tx, int ty, LAYER layer, SHORT_TILE_CODE short_tile_code)
+Sets the tile code at the specified tile coordinate
Valid coordinates are 0 <= tx < CONST.ROOM_WIDTH
, 0 <= ty < CONST.ROOM_HEIGHT
and layer
in {LAYER.FRONT, LAYER.BACK, LAYER.BOTH}
Also returns false
if layer == LAYER.BACK
and the room does not have a back layer
+
+
+array<tuple<int, int, LAYER>>
+find_all_short_tile_codes(LAYER layer, SHORT_TILE_CODE short_tile_code)
+Finds all places a short tile code is used in the room, layer
must be in {LAYER.FRONT, LAYER.BACK, LAYER.BOTH}
Returns an empty list if layer == LAYER.BACK
and the room does not have a back layer
+
+
+bool
+replace_short_tile_code(LAYER layer, SHORT_TILE_CODE short_tile_code, SHORT_TILE_CODE replacement_short_tile_code)
+Replaces all instances of short_tile_code
in the given layer with replacement_short_tile_code
, layer
must be in {LAYER.FRONT, LAYER.BACK, LAYER.BOTH}
Returns false
if layer == LAYER.BACK
and the room does not have a back layer
+
+
+bool
+has_back_layer()
+Check whether the room has a back layer
+
+
+nil
+add_empty_back_layer()
+Add a back layer filled with all 0
if there is no back layer yet
Does nothing if there already is a backlayer
+
+
+nil
+add_copied_back_layer()
+Add a back layer that is a copy of the front layer
Does nothing if there already is a backlayer
+
+
+PreLoadLevelFilesContext
+Context received in ON.PRE_LOAD_LEVEL_FILES, used for forcing specific .lvl
files to load.
+
+
+
+Type
+Name
+Description
+
+
+
+nil
+override_level_files(array levels)
+Block all loading .lvl
files and instead load the specified .lvl
files. This includes generic.lvl
so if you need it specify it here.
All .lvl
files are loaded relative to Data/Levels
, but they can be completely custom .lvl
files that ship with your mod so long as they are in said folder.
Use at your own risk, some themes/levels expect a certain level file to be loaded.
+
+
+nil
+add_level_files(array levels)
+Load additional levels files other than the ones that would usually be loaded. Stacks with override_level_files
if that was called first.
All .lvl
files are loaded relative to Data/Levels
, but they can be completely custom .lvl
files that ship with your mod so long as they are in said folder.
+
+
+SaveContext
+Context received in ON.SAVE
+Used to save a string to some form of save_{}.dat
+Future calls to this will override the save
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+save(string data)
+
+
+
+VanillaRenderContext
+Used in set_callback ON.RENDER_ callbacks, set_post_render, set_post_render_screen, set_pre_render, set_pre_render_screen
+
+
+
+Type
+Name
+Description
+
+
+
+nil
+draw_text(const string& text, float x, float y, float scale_x, float scale_y, Color color, VANILLA_TEXT_ALIGNMENT alignment, VANILLA_FONT_STYLE fontstyle)
+Draw text using the built-in renderer
Use in combination with ON.RENDER_✱ events. See vanilla_rendering.lua in the example scripts.
+
+
+nil
+draw_text(const TextRenderingInfo tri, Color color)
+
+
+
+tuple<float, float>
+draw_text_size(const string& text, float scale_x, float scale_y, int fontstyle)
+Measure the provided text using the built-in renderer
If you can, consider creating your own TextRenderingInfo instead
You can then use :text_size()
and draw_text
with that one object
draw_text_size
works by creating new TextRenderingInfo just to call :text_size()
, which is not very optimal
+
+
+nil
+draw_screen_texture(TEXTURE texture_id, int row, int column, float left, float top, float right, float bottom, Color color)
+Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_texture(TEXTURE texture_id, int row, int column, const AABB& rect, Color color)
+Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_texture(TEXTURE texture_id, int row, int column, const AABB& rect, Color color, float angle, float px, float py)
+Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer with angle, px/py is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_texture(TEXTURE texture_id, int row, int column, const Quad& dest, Color color)
+Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_texture(TEXTURE texture_id, const Quad& source, const Quad& dest, Color color)
+Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer. source
- the coordinates in the texture, dest
- the coordinates on the screen
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_texture(TEXTURE texture_id, TextureRenderingInfo tri, Color color)
+Draw a texture in screen coordinates using TextureRenderingInfo
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+set_corner_finish(CORNER_FINISH c)
+Set the prefered way of drawing corners for the non filled shapes
+
+
+nil
+draw_screen_line(const Vec2& A, const Vec2& B, float thickness, Color color)
+Draws a line on screen using the built-in renderer from point A
to point B
.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_rect(const AABB& rect, float thickness, Color color, optional angle, optional px, optional py)
+Draw rectangle in screen coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc. (corner from the AABB, not the visible one from adding the thickness
)
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_rect_filled(const AABB& rect, Color color, optional angle, optional px, optional py)
+Draw filled rectangle in screen coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_triangle(const Triangle& triangle, float thickness, Color color)
+Draw triangle in screen coordinates using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_triangle_filled(const Triangle& triangle, Color color)
+Draw filled triangle in screen coordinates using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_poly(array points, float thickness, Color color, bool closed)
+Draw a polyline on screen from points using the built-in renderer
Draws from the first to the last point, use closed
to connect first and last as well
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_poly(const Quad& points, float thickness, Color color, bool closed)
+Draw quadrilateral in screen coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_poly_filled(array points, Color color)
+Draw a convex polygon on screen from points using the built-in renderer
Can probably draw almost any polygon, but the convex one is guaranteed to look correct
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_screen_poly_filled(const Quad& points, Color color)
+Draw filled quadrilateral in screen coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+
+
+nil
+draw_world_texture(TEXTURE texture_id, int row, int column, float left, float top, float right, float bottom, Color color)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a Quad instead
+
+
+nil
+draw_world_texture(TEXTURE texture_id, int row, int column, const AABB& dest, Color color)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a Quad instead
+
+
+nil
+draw_world_texture(TEXTURE texture_id, int row, int column, const AABB& dest, Color color, float angle, float px, float py)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer with angle, px/py is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a Quad instead
+
+
+nil
+draw_world_texture(TEXTURE texture_id, int row, int column, const Quad& dest, Color color, WORLD_SHADER shader)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
The shader
parameter controls how to render the texture
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_texture(TEXTURE texture_id, int row, int column, const Quad& dest, Color color)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_texture(TEXTURE texture_id, const Quad& source, const Quad& dest, Color color, WORLD_SHADER shader)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer. source
- the coordinates in the texture, dest
- the coordinates on the screen
The shader
parameter controls how to render the texture
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_texture(TEXTURE texture_id, const Quad& source, const Quad& dest, Color color)
+Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer. source
- the coordinates in the texture, dest
- the coordinates on the screen
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_line(const Vec2& A, const Vec2& B, float thickness, Color color)
+Draws a line in world coordinates using the built-in renderer from point A
to point B
.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_rect(const AABB& rect, float thickness, Color color, optional angle, optional px, optional py)
+Draw rectangle in world coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc. (corner from the AABB, not the visible one from adding the thickness
)
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_rect_filled(const AABB& rect, Color color, optional angle, optional px, optional py)
+Draw rectangle in world coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_triangle(const Triangle& triangle, float thickness, Color color)
+Draw triangle in world coordinates using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_triangle_filled(const Triangle& triangle, Color color)
+Draw filled triangle in world coordinates using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_poly(array points, float thickness, Color color, bool closed)
+Draw a polyline in world coordinates from points using the built-in renderer
Draws from the first to the last point, use closed
to connect first and last as well
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_poly(const Quad& points, float thickness, Color color, bool closed)
+Draw quadrilateral in world coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_poly_filled(array points, Color color)
+Draw a convex polygon in world coordinates from points using the built-in renderer
Can probably draw almost any polygon, but the convex one is guaranteed to look correct
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+nil
+draw_world_poly_filled(const Quad& points, Color color)
+Draw filled quadrilateral in world coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+
+
+AABB
+bounding_box
+
+
+
+
+render_draw_depth
+
+
+
+Entity related types
Ai
+Used in Player
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+target
+
+
+
+int
+target_uid
+
+
+
+int
+timer
+
+
+
+int
+state
+AI state (patrol, sleep, attack, aggro...)
+
+
+int
+last_state
+
+
+
+int
+trust
+Levels completed with, 0..3
+
+
+int
+whipped
+Number of times whipped by player
+
+
+int
+walk_pause_timer
+positive: walking, negative: wating/idle
+
+
+Animation
+Used in EntityDB
+
+
+
+Type
+Name
+Description
+
+
+
+int
+id
+
+
+
+int
+first_tile
+
+
+
+int
+num_tiles
+
+
+
+int
+interval
+
+
+
+REPEAT_TYPE
+repeat_mode
+
+
+
+EntityDB
-Search script examples for grow_chainandblocks
+When cloning an entity type, remember to save it in the script for as long as you need it. Otherwise the memory will be freed immediately, which eventually leads to a crash when used or overwritten by other stuff:
-bool grow_chainandblocks()
bool grow_chainandblocks(int x, int y)
-Grow chains from ENT_TYPE_FLOOR_CHAIN_CEILING
and chain with blocks on it from ENT_TYPE_FLOOR_CHAINANDBLOCKS_CEILING
, it starts looking for the ceilings from the top left corner of a level.
-To limit it use the parameters, so x = 10 will only grow chains from ceilings with x < 10, with y = 10 it's ceilings that have y > (level bound top - 10)
-grow_poles
+-- Create a special fast snake type with weird animation
+special_snake = EntityDB:new(ENT_TYPE.MONS_SNAKE)
+special_snake.max_speed = 1
+special_snake.acceleration = 2
+special_snake.animations[2].num_tiles = 1
+
+set_post_entity_spawn(function(snake)
+ -- 50% chance to make snakes special
+ if prng:random_chance(2, PRNG_CLASS.PROCEDURAL_SPAWNS) then
+ -- Assign custom type
+ snake.type = special_snake
+ -- This is only really needed if types are changed during the level
+ snake.current_animation = special_snake.animations[2]
+ end
+end, SPAWN_TYPE.ANY, MASK.MONSTER, ENT_TYPE.MONS_SNAKE)
+
-Search script examples for grow_poles
+You can also use Entity.user_data to store the custom type:
-nil grow_poles(LAYER l, int max_lengh)
nil grow_poles(LAYER l, int max_lengh, AABB area, bool destroy_broken)
-Grow pole from GROWABLE_CLIMBING_POLE
entities in a level, area
default is whole level, destroy_broken
default is false
-grow_vines
+-- Custom player who is buffed a bit every level
+set_callback(function()
+ -- Doing this to include HH
+ for i,v in ipairs(get_entities_by_mask(MASK.PLAYER)) do
+ local player = get_entity(v)
+
+ -- Create new custom type on the first level, based on the original type
+ if not player.user_data then
+ player.user_data = {}
+ player.user_data.type = EntityDB:new(player.type.id)
+ end
+
+ -- Set the player entity type to the custom type every level
+ player.type = player.user_data.type
+
+ -- Buff the player every subsequent level
+ if state.level_count > 0 then
+ player.type.max_speed = player.type.max_speed * 1.1
+ player.type.acceleration = player.type.acceleration * 1.1
+ player.type.jump = player.type.jump * 1.1
+ end
+ end
+end, ON.POST_LEVEL_GENERATION)
+
-Search script examples for grow_vines
+Illegal bad example, don't do this:
-nil grow_vines(LAYER l, int max_lengh)
nil grow_vines(LAYER l, int max_lengh, AABB area, bool destroy_broken)
-Grow vines from GROWABLE_VINE
and VINE_TREE_TOP
entities in a level, area
default is whole level, destroy_broken
default is false
-http_get
+set_callback(function()
+ -- Nobody owns the new type and the memory is freed immediately, eventually leading to a crash
+ players[1].type = EntityDB:new(players[1].type)
+ players[1].type.max_speed = 2
+end, ON.POST_LEVEL_GENERATION)
+
+Used in Entity and get_type
+Stores static common data for an ENT_TYPE. You can also clone entity types with the copy constructor to create new custom entities with different common properties. This tool can be helpful when messing with the animations. The default values are also listed in entities.json.
+
+
+
+Type
+Name
+Description
+
+
+
+EntityDB
+new(EntityDB other)
+
+
+
+EntityDB
+new(ENT_TYPE)
+
+
+
+ENT_TYPE
+id
+
+
+
+int
+search_flags
+MASK
+
+
+float
+width
+
+
+
+float
+height
+
+
+
+float
+offsetx
+
+
+
+float
+offsety
+
+
+
+float
+hitboxx
+
+
+
+float
+hitboxy
+
+
+
+int
+draw_depth
+
+
+
+int
+collision2_mask
+MASK, will only call collision2 when colliding with entities that match this mask.
+
+
+int
+collision_mask
+MASK used for collision with floors.
+
+
+float
+friction
+
+
+
+float
+elasticity
+
+
+
+float
+weight
+
+
+
+float
+acceleration
+
+
+
+float
+max_speed
+
+
+
+float
+sprint_factor
+
+
+
+float
+jump
+
+
+
+float
+glow_red
+
+
+
+float
+glow_green
+
+
+
+float
+glow_blue
+
+
+
+float
+glow_alpha
+
+
+
+int
+damage
+
+
+
+int
+life
+
+
+
+int
+sacrifice_value
+Favor for sacrificing alive. Halved when dead (health == 0).
+
+
+int
+blood_content
+
+
+
+int
+texture
+
+
+
+map<int, Animation>
+animations
+
+
+
+int
+properties_flags
+
+
+
+int
+default_flags
+
+
+
+int
+default_more_flags
+
+
+
+bool
+leaves_corpse_behind
+
+
+
+int
+sound_killed_by_player
+
+
+
+int
+sound_killed_by_other
+
+
+
+STRINGID
+description
+
+
+
+int
+tilex
+
+
+
+int
+tiley
+
+
+
+HudInventory
+
+
+Type
+Name
+Description
+
+
+
+bool
+enabled
+
+
+
+int
+health
+
+
+
+int
+bombs
+
+
+
+int
+ropes
+
+
+
+bool
+ankh
+
+
+
+bool
+kapala
+
+
+
+int
+kapala_blood
+
+
+
+bool
+poison
+
+
+
+bool
+curse
+
+
+
+bool
+elixir
+
+
+
+ENT_TYPE
+crown
+Powerup type or 0
+
+
+int
+item_count
+Amount of generic pickup items at the bottom. Set to 0 to not draw them.
+
+
+Inventory
+Used in Player, PlayerGhost and Items
+
+
+
+Type
+Name
+Description
+
+
+
+int
+money
+Sum of the money collected in current level
+
+
+int
+bombs
+
+
+
+int
+ropes
+
+
+
+int
+player_slot
+
+
+
+int
+poison_tick_timer
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+bool
+cursed
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+bool
+elixir_buff
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+int
+health
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+int
+kapala_blood_amount
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+int
+time_of_death
+Is set to state.time_total when player dies in coop (to determinate who should be first to re-spawn from coffin)
+
+
+ENT_TYPE
+held_item
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+int
+held_item_metadata
+Metadata of the held item (health, is cursed etc.)
Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+ENT_TYPE
+mount_type
+Used to transfer information to transition/next level (player rading a mout). Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+int
+mount_metadata
+Metadata of the mount (health, is cursed etc.)
Used to transfer information to transition/next level (player rading a mout). Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+int
+kills_level
+
+
+
+int
+kills_total
+
+
+
+int
+collected_money_total
+Total money collected during previous levels (so excluding the current one)
+
+
+int
+collected_money_count
+Count/size for the collected_money
arrays
+
+
+array<ENT_TYPE, 512>
+collected_money
+Types of gold/gems collected during this level, used later to display during the transition
+
+
+array<int, 512>
+collected_money_values
+Values of gold/gems collected during this level, used later to display during the transition
+
+
+array<ENT_TYPE, 256>
+killed_enemies
+Types of enemies killed during this level, used later to display during the transition
+
+
+int
+companion_count
+Number of companions, it will determinate how many companions will be transfered to next level
Increments when player acquires new companion, decrements when one of them dies
+
+
+array<ENT_TYPE, 8>
+companions
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<ENT_TYPE, 8>
+companion_held_items
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<int, 8>
+companion_held_item_metadatas
+Metadata of items held by companions (health, is cursed etc.)
Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<int, 8>
+companion_trust
+(0..3) Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<int, 8>
+companion_health
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<int, 8>
+companion_poison_tick_timers
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<bool, 8>
+is_companion_cursed
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+array<ENT_TYPE, 30>
+acquired_powerups
+Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+
+
+Generic types
AABB
+Axis-Aligned-Bounding-Box, represents for example a hitbox of an entity or the size of a gui element
+
+
+
+Type
+Name
+Description
+
+
+
+AABB
+new()
+Create a new axis aligned bounding box - defaults to all zeroes
+
+
+AABB
+new(AABB)
+Copy an axis aligned bounding box
+
+
+AABB
+new(Vec2 top_left, Vec2 bottom_right)
+
+
+
+AABB
+new(float left_, float top_, float right_, float bottom_)
+Create a new axis aligned bounding box by specifying its values
+
+
+float
+left
+
+
+
+float
+bottom
+
+
+
+float
+right
+
+
+
+float
+top
+
+
+
+bool
+overlaps_with(const AABB& other)
+
+
+
+AABB&
+abs()
+Fixes the AABB if any of the sides have negative length
+
+
+AABB&
+extrude(float amount)
+Grows or shrinks the AABB by the given amount in all directions.
If amount < 0
and abs(amount) > right/top - left/bottom
the respective dimension of the AABB will become 0
.
+
+
+AABB&
+extrude(float amount_x, float amount_y)
+Grows or shrinks the AABB by the given amount in each direction.
If amount_x/y < 0
and abs(amount_x/y) > right/top - left/bottom
the respective dimension of the AABB will become 0
.
+
+
+AABB&
+offset(float off_x, float off_y)
+Offsets the AABB by the given offset.
+
+
+float
+area()
+Compute area of the AABB, can be zero if one dimension is zero or negative if one dimension is inverted.
+
+
+tuple<float, float>
+center()
+Short for (aabb.left + aabb.right) / 2.0f, (aabb.top + aabb.bottom) / 2.0f
.
+
+
+float
+width()
+Short for aabb.right - aabb.left
.
+
+
+float
+height()
+Short for aabb.top - aabb.bottom
.
+
+
+bool
+is_point_inside(const Vec2 p)
+Checks if point lies between left/right and top/bottom
+
+
+bool
+is_point_inside(float x, float y)
+
+
+
+tuple<float, float, float, float>
+split()
+
+
+
+BackgroundMusic
+Used in GameManager
+
+
+
+Type
+Name
+Description
+
+
+
+BackgroundSound
+game_startup
+
+
+
+BackgroundSound
+main_backgroundtrack
+
+
+
+BackgroundSound
+basecamp
+
+
+
+BackgroundSound
+win_scene
+
+
+
+BackgroundSound
+arena
+
+
+
+BackgroundSound
+arena_intro_and_win
+
+
+
+BackgroundSound
+level_gameplay
+
+
+
+BackgroundSound
+dark_level
+
+
+
+BackgroundSound
+level_transition
+
+
+
+BackgroundSound
+backlayer
+
+
+
+BackgroundSound
+shop
+
+
+
+BackgroundSound
+angered_shopkeeper
+
+
+
+BackgroundSound
+inside_sunken_city_pipe
+
+
+
+BackgroundSound
+pause_menu
+
+
+
+BackgroundSound
+death_transition
+
+
+
+Color
-- make a semi transparent red color and print it in different formats
+local color = Color:red()
+color.a = 0.5
+local r, g, b, a = color:get_rgba()
+prinspect(r, g, b, a) -- 255, 0, 0, 128
+prinspect(color.r, color.g, color.b, color.a) -- 1.0, 0.0, 0.0, 0.5
+prinspect(string.format("%x"), color:get_ucolor()) -- 800000ff
+
+
+
+
+Type
+Name
+Description
+
+
+
+Color
+new()
+Create a new color - defaults to black
+
+
+Color
+new(Color)
+
+
+
+Color
+new(float r_, float g_, float b_, float a_)
+Create a new color by specifying its values
+
+
+float
+r
+
+
+
+float
+g
+
+
+
+float
+b
+
+
+
+float
+a
+
+
+
+Color
+white()
+
+
+
+Color
+silver()
+
+
+
+Color
+gray()
+
+
+
+Color
+black()
+
+
+
+Color
+red()
+
+
+
+Color
+maroon()
+
+
+
+Color
+yellow()
+
+
+
+Color
+olive()
+
+
+
+Color
+lime()
+
+
+
+Color
+green()
+
+
+
+Color
+aqua()
+
+
+
+Color
+teal()
+
+
+
+Color
+blue()
+
+
+
+Color
+navy()
+
+
+
+Color
+fuchsia()
+
+
+
+Color
+purple()
+
+
+
+tuple<int, int, int, int>
+get_rgba()
+Returns RGBA colors in 0..255 range
+
+
+Color&
+set_rgba(int red, int green, int blue, int alpha)
+Changes color based on given RGBA colors in 0..255 range
+
+
+uColor
+get_ucolor()
+Returns the uColor
used in GuiDrawContext
drawing functions
+
+
+Color&
+set_ucolor(const uColor color)
+Changes color based on given uColor
+
+
+Hud
set_callback(function(ctx, hud)
+ -- draw on screen bottom but keep neat animations
+ if hud.y > 0 then hud.y = -hud.y end
+ -- spoof some values
+ hud.data.inventory[1].health = prng:random_int(1, 99, 0)
+ -- hide generic pickup items
+ hud.data.inventory[1].item_count = 0
+ -- hide money element
+ hud.data.money.opacity = 0
+ -- get real current opacity of p1 inventory element
+ prinspect(hud.data.players[1].opacity * hud.data.opacity * hud.opacity)
+end, ON.RENDER_PRE_HUD)
+
+
+
+
+Type
+Name
+Description
+
+
+
+float
+y
+
+
+
+float
+opacity
+
+
+
+HudData
+data
+
+
+
+HudData
+
+
+Type
+Name
+Description
+
+
+
+array<HudInventory, MAX_PLAYERS>
+inventory
+
+
+
+bool
+udjat
+
+
+
+int
+money_total
+
+
+
+int
+money_counter
+
+
+
+int
+time_total
+
+
+
+int
+time_level
+
+
+
+int
+world_num
+
+
+
+int
+level_num
+
+
+
+int
+seed
+
+
+
+float
+opacity
+
+
+
+array<HudPlayer, MAX_PLAYERS>
+players
+
+
+
+HudMoney
+money
+
+
+
+HudElement
+timer
+
+
+
+HudElement
+level
+
+
+
+HudElement
+
+
+Type
+Name
+Description
+
+
+
+bool
+dim
+Hide background and dim if using the auto adjust setting.
+
+
+float
+opacity
+Background will be drawn if this is not 0.5
+
+
+int
+time_dim
+Level time when element should dim again after hilighted, INT_MAX if dimmed on auto adjust. 0 on opaque.
+
+
+HudMoney
+Derived from HudElement
+
+
+
+Type
+Name
+Description
+
+
+
+int
+total
+
+
+
+int
+counter
+
+
+
+int
+timer
+
+
+
+HudPlayer
+Derived from HudElement
+
+
+
+Type
+Name
+Description
+
+
+
+int
+health
+
+
+
+int
+bombs
+
+
+
+int
+ropes
+
+
+
+ItemOwnerDetails
+Used in RoomOwnersInfo
+
+
+
+Type
+Name
+Description
+
+
+
+ENT_TYPE
+owner_type
+
+
+
+int
+owner_uid
+
+
+
+Letter
+
+
+Type
+Name
+Description
+
+
+
+Triangle
+bottom
+
+
+
+Triangle
+top
+
+
+
+Quad
+get_quad()
+Get the Quad of a letter (easier to work with compared to the two triangles)
This assumes that the triangles are in the correct 'touching each other' position
if the positions were altered the results may not end up as expected
+
+
+nil
+set_quad(Quad quad)
+Inverse of the get_quad
+
+
+Vec2
+center()
+Get's approximated center of a letter by finding the highest and lowest values, then finding the center of a rectangle build from those values
+
+
+MagmamanSpawnPosition
+Used in LogicList
+
+
+
+Type
+Name
+Description
+
+
+
+MagmamanSpawnPosition
+new(int x_, int y_)
+
+
+
+int
+x
+
+
+
+int
+y
+
+
+
+int
+timer
+
+
+
+MovableBehavior
+Opaque handle to a movable behavior used in some Movable functions
+
+
+
+Type
+Name
+Description
+
+
+
+int
+get_state_id()
+
+
+
+int
+get_state_id()
+Get the state_id
of a behavior, this is the id that needs to be returned from a behavior's
get_next_state_id
to enter this state, given that the behavior is added to the movable.
+
+
+PRNG
+PRNG (short for Pseudo-Random-Number-Generator) holds 10 128bit wide buffers of memory that are mutated on every generation of a random number.
+The game uses specific buffers for specific scenarios, for example the third buffer is used every time particles are spawned to determine a random velocity.
+The used buffer is determined by PRNG_CLASS. If you want to make a mod that does not affect level generation but still uses the prng then you want to stay away from specific buffers.
+If you don't care what part of the game you affect just use prng.random
.
+
+
+
+Type
+Name
+Description
+
+
+
+nil
+seed(int seed)
+Same as seed_prng
+
+
+float
+random_float(PRNG_CLASS type)
+Generate a random floating point number in the range [0, 1)
+
+
+bool
+random_chance(int inverse_chance, PRNG_CLASS type)
+Returns true with a chance of 1/inverse_chance
+
+
+optional<int>
+random_index(int i, PRNG_CLASS type)
+Generate a integer number in the range [1, i]
or nil
if i < 1
+
+
+optional<int>
+random_int(int min, int max, PRNG_CLASS type)
+Generate a integer number in the range [min, max]
or nil
if max < min
+
+
+float
+random()
+Drop-in replacement for math.random()
+
+
+optional<int>
+random(int i)
+Drop-in replacement for math.random(i)
+
+
+optional<int>
+random(int min, int max)
+Drop-in replacement for math.random(min, max)
+
+
+tuple<int, int>
+get_pair(PRNG_CLASS type)
+
+
+
+nil
+set_pair(PRNG_CLASS type, int first, int second)
+
+
+
+Quad
+
+
+Type
+Name
+Description
+
+
+
+Quad
+new()
+
+
+
+Quad
+new(Quad)
+
+
+
+Quad
+new(Vec2 bottom_left_, Vec2 bottom_right_, Vec2 top_right_, Vec2 top_left_)
+
+
+
+Quad
+new(float _bottom_left_x, float _bottom_left_y, float _bottom_right_x, float _bottom_right_y, float _top_right_x, float _top_right_y, float _top_left_x, float _top_left_y)
+
+
+
+Quad
+new(AABB aabb)
+
+
+
+float
+bottom_left_x
+
+
+
+float
+bottom_left_y
+
+
+
+float
+bottom_right_x
+
+
+
+float
+bottom_right_y
+
+
+
+float
+top_right_x
+
+
+
+float
+top_right_y
+
+
+
+float
+top_left_x
+
+
+
+float
+top_left_y
+
+
+
+AABB
+get_AABB()
+Returns the max/min values of the Quad
+
+
+Quad&
+offset(float off_x, float off_y)
+
+
+
+Quad&
+rotate(float angle, float px, float py)
+Rotates a Quad by an angle, px/py are not offsets, use :get_AABB():center()
to get approximated center for simetrical quadrangle
+
+
+Quad&
+flip_horizontally()
+
+
+
+Quad&
+flip_vertically()
+
+
+
+bool
+is_point_inside(Vec2 p, optional epsilon)
+Check if point lies inside of triangle
Because of the imprecise nature of floating point values, the epsilon
value is needed to compare the floats, the default value is 0.00001
+
+
+bool
+is_point_inside(float x, float y, optional epsilon)
+
+
+
+tuple<Vec2, Vec2, Vec2, Vec2>
+split()
+Returns the corners in order: bottom_left, bottom_right, top_right, top_left
+
+
+RenderInfo
-Search script examples for http_get
+For using a custom normal map:
-optional<string> http_get(string url)
-Send a synchronous HTTP GET request and return response as a string or nil on an error
-http_get_async
+set_post_entity_spawn(function(ent)
+ -- Doesn't really make sense with this texture, you can use your custom normal texture id here
+ ent.rendering_info:set_normal_map_texture(TEXTURE.DATA_TEXTURES_FLOORSTYLED_GOLD_NORMAL_0)
+ ent.rendering_info.shader = 30 -- Make sure to set the shader to one that uses normal map
+end, SPAWN_TYPE.LEVEL_GEN, MASK.FLOOR, ENT_TYPE.FLOORSTYLED_MINEWOOD)
+
-Search script examples for http_get_async
+Note: if using set_texture_num, make sure to have used set_second_texture/set_third_texture before, since not doing so can lead to crashes
-HttpRequest http_get_async(string url, function on_data)
-Send an asynchronous HTTP GET request and run the callback when done. If there is an error, response will be nil and vice versa.
-The callback signature is nil on_data(string response, string error)
-import
+
+Some information used to render the entity, can not be changed, used in Entity
+
+
+
+Type
+Name
+Description
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+WORLD_SHADER
+shader
+
+
+
+Quad
+source
+
+
+
+Quad
+destination
+
+
+
+float
+tilew
+
+
+
+float
+tileh
+
+
+
+bool
+facing_left
+
+
+
+bool
+render_inactive
+
+
+
+int
+texture_num
+
+
+
+class Entity
+get_entity()
+
+
+
+bool
+set_normal_map_texture(TEXTURE texture_id)
+Sets second_texture to the texture specified, then sets third_texture to SHINE_0 and texture_num to 3. You still have to change shader to 30 to render with normal map (same as COG normal maps)
+
+
+optional<TEXTURE>
+get_second_texture
+
+
+
+optional<TEXTURE>
+get_third_texture
+
+
+
+bool
+set_second_texture(TEXTURE texture_id)
+
+
+
+bool
+set_third_texture(TEXTURE texture_id)
+
+
+
+bool
+set_texture_num(int texture_id)
+Set the number of textures that may be used, need to have them set before for it to work
+
+
+CallbackId
+set_pre_virtual(RENDER_INFO_OVERRIDE entry, function fun)
+Hooks before the virtual function at index entry
.
+
+
+CallbackId
+set_post_virtual(RENDER_INFO_OVERRIDE entry, function fun)
+Hooks after the virtual function at index entry
.
+
+
+nil
+clear_virtual(CallbackId callback_id)
+Clears the hook given by callback_id
, alternatively use clear_callback()
inside the hook.
+
+
+CallbackId
+set_pre_dtor(function fun)
+Hooks before the virtual function.
The callback signature is nil dtor(RenderInfo self)
+
+
+CallbackId
+set_post_dtor(function fun)
+Hooks after the virtual function.
The callback signature is nil dtor(RenderInfo self)
+
+
+CallbackId
+set_pre_render(function fun)
+Hooks before the virtual function.
The callback signature is bool render(RenderInfo self, float float, VanillaRenderContext vanilla_render_context)
+
+
+CallbackId
+set_post_render(function fun)
+Hooks after the virtual function.
The callback signature is nil render(RenderInfo self, float float, VanillaRenderContext vanilla_render_context)
+
+
+RoomOwnerDetails
+Used in RoomOwnersInfo
+
+
+
+Type
+Name
+Description
+
+
+
+int
+layer
+
+
+
+int
+room_index
+
+
+
+int
+owner_uid
+
+
+
+RoomOwnersInfo
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+custom_map<int, ItemOwnerDetails>
+owned_items
+key/index is the uid of an item
+
+
+array<RoomOwnerDetails>
+owned_rooms
+
+
+
+ShortTileCodeDef
+Used in get_short_tile_code, get_short_tile_code_definition and PostRoomGenerationContext
+
+
+
+Type
+Name
+Description
+
+
+
+TILE_CODE
+tile_code
+Tile code that is used by default when this short tile code is encountered. Defaults to 0.
+
+
+int
+chance
+Chance in percent to pick tile_code
over alt_tile_code
, ignored if chance == 0
. Defaults to 100.
+
+
+TILE_CODE
+alt_tile_code
+Alternative tile code, ignored if chance == 100
. Defaults to 0.
+
+
+Triangle
+
+
+Type
+Name
+Description
+
+
+
+Triangle
+new()
+
+
+
+Triangle
+new(Triangle)
+
+
+
+Triangle
+new(Vec2 _a, Vec2 _b, Vec2 _c)
+
+
+
+Triangle
+new(float ax, float ay, float bx, float by, float cx, float cy)
+
+
+
+Vec2
+A
+
+
+
+Vec2
+B
+
+
+
+Vec2
+C
+
+
+
+Triangle&
+offset(const Vec2& off)
+
+
+
+Triangle&
+offset(float x, float y)
+
+
+
+Triangle&
+rotate(float angle, float px, float py)
+Rotate triangle by an angle, the px/py are just coordinates, not offset from the center
+
+
+Vec2
+center()
+Also known as centroid
+
+
+tuple<float, float, float>
+get_angles()
+Returns ABC, BCA, CAB angles in radians
+
+
+Triangle&
+scale(float scale)
+
+
+
+float
+area()
+
+
+
+bool
+is_point_inside(Vec2 p, optional epsilon)
+Check if point lies inside of triangle
Because of the imprecise nature of floating point values, the epsilon
value is needed to compare the floats, the default value is 0.0001
+
+
+bool
+is_point_inside(float x, float y, optional epsilon)
+
+
+
+tuple<Vec2, Vec2, Vec2>
+split()
+Returns the corner points
+
+
+Vec2
+Simple object to hold pair of coordinates
+
+
+
+Type
+Name
+Description
+
+
+
+Vec2
+new()
+
+
+
+Vec2
+new(Vec2)
+
+
+
+Vec2
+new(float x_, float y_)
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+Vec2&
+rotate(float angle, float px, float py)
+
+
+
+float
+distance_to(const Vec2 other)
+Just simple pythagoras theorem
+
+
+tuple<float, float>
+split()
+
+
+
+Input types
Gamepad
+Used in ImGuiIO
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+enabled
+
+
+
+GAMEPAD
+buttons
+
+
+
+float
+lt
+
+
+
+float
+rt
+
+
+
+float
+lx
+
+
+
+float
+ly
+
+
+
+float
+rx
+
+
+
+float
+ry
+
+
+
+ImGuiIO
+Used in get_io
+
+
+
+Type
+Name
+Description
+
+
+
+Vec2
+displaysize
+
+
+
+float
+framerate
+
+
+
+bool
+wantkeyboard
+
+
+
+bool
+keysdown[ImGuiKey_COUNT]
+
+
+
+
+keydown
+bool keydown(int keycode)
bool keydown(char key)
+
+
+
+keypressed
+bool keypressed(int keycode, bool repeat = false)
bool keypressed(char key, bool repeat = false)
+
+
+
+keyreleased
+bool keyreleased(int keycode)
bool keyreleased(char key)
+
+
+bool
+keyctrl
+
+
+
+bool
+keyshift
+
+
+
+bool
+keyalt
+
+
+
+bool
+keysuper
+
+
+
+bool
+wantmouse
+
+
+
+Vec2
+mousepos
+
+
+
+bool
+mousedown[5]
+
+
+
+bool
+mouseclicked[5]
+
+
+
+bool
+mousedoubleclicked[5]
+
+
+
+float
+mousewheel
+
+
+
+Gamepad
+gamepad
+
+
+
+
+gamepads
+Gamepad gamepads(int index)
This is the XInput index 1..4, might not be the same as the player slot.
+
+
+bool
+showcursor
+
+
+
+InputMapping
+Used in PlayerSlot
+
+
+
+Type
+Name
+Description
+
+
+
+int
+jump
+
+
+
+int
+attack
+
+
+
+int
+bomb
+
+
+
+int
+rope
+
+
+
+int
+walk_run
+
+
+
+int
+use_door_buy
+
+
+
+int
+pause_menu
+
+
+
+int
+journal
+
+
+
+int
+left
+
+
+
+int
+right
+
+
+
+int
+up
+
+
+
+int
+down
+
+
+
+PlayerInputs
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+array<PlayerSlot, MAX_PLAYERS>
+player_slots
+
+
+
+PlayerSlot
+player_slot_1
+
+
+
+PlayerSlot
+player_slot_2
+
+
+
+PlayerSlot
+player_slot_3
+
+
+
+PlayerSlot
+player_slot_4
+
+
+
+array<PlayerSlotSettings, MAX_PLAYERS>
+player_settings
+
+
+
+PlayerSlotSettings
+player_slot_1_settings
+
+
+
+PlayerSlotSettings
+player_slot_2_settings
+
+
+
+PlayerSlotSettings
+player_slot_3_settings
+
+
+
+PlayerSlotSettings
+player_slot_4_settings
+
+
+
+Journal types
JournalPage
+Used in set_callback with ON.RENDER_POST_JOURNAL_PAGE
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+background
+
+
+
+int
+page_number
+
+
+
+bool
+is_right_side_page()
+background.x < 0
+
+
+JOURNAL_PAGE_TYPE
+get_type()
+
+
+
+JournalPageBestiary
+Derived from JournalPage JournalPageDiscoverable
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+monster_background
+
+
+
+TextureRenderingInfo
+monster_icon
+
+
+
+TextureRenderingInfo
+defeated_killedby_black_bars
+
+
+
+TextRenderingInfo
+defeated_text_info
+
+
+
+TextRenderingInfo
+defeated_value_text_info
+
+
+
+TextRenderingInfo
+killedby_text_info
+
+
+
+TextRenderingInfo
+killedby_value_text_info
+
+
+
+JournalPageDeathCause
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+TextRenderingInfo
+death_cause_text_info
+
+
+
+JournalPageDeathMenu
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+int
+selected_menu_index
+
+
+
+TextRenderingInfo
+game_over_text_info
+
+
+
+TextRenderingInfo
+level_text_info
+
+
+
+TextRenderingInfo
+level_value_text_info
+
+
+
+TextRenderingInfo
+money_text_info
+
+
+
+TextRenderingInfo
+money_value_text_info
+
+
+
+TextRenderingInfo
+time_text_info
+
+
+
+TextRenderingInfo
+time_value_text_info
+
+
+
+JournalPageDiscoverable
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+show_main_image
+
+
+
+TextRenderingInfo
+title_text_info
+
+
+
+TextRenderingInfo
+entry_text_info
+
+
+
+TextRenderingInfo
+chapter_title_text_info
+
+
+
+JournalPageFeats
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+TextRenderingInfo
+chapter_title_text_info
+
+
+
+TextureRenderingInfo
+feat_icons
+
+
+
+JournalPageItems
+Derived from JournalPage JournalPageDiscoverable
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+item_icon
+
+
+
+TextureRenderingInfo
+item_background
+
+
+
+JournalPageJournalMenu
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+int
+selected_menu_index
+
+
+
+TextRenderingInfo
+journal_text_info
+
+
+
+TextureRenderingInfo
+completion_badge
+
+
+
+JournalPageLastGamePlayed
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+main_image
+
+
+
+TextRenderingInfo
+last_game_played_text_info
+
+
+
+TextRenderingInfo
+level_text_info
+
+
+
+TextRenderingInfo
+level_value_text_info
+
+
+
+TextRenderingInfo
+money_text_info
+
+
+
+TextRenderingInfo
+money_value_text_info
+
+
+
+TextRenderingInfo
+time_text_info
+
+
+
+TextRenderingInfo
+time_value_text_info
+
+
+
+int
+sticker_count
+
+
+
+array<TextureRenderingInfo, 20>
+stickers
+
+
+
+JournalPagePeople
+Derived from JournalPage JournalPageDiscoverable
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+character_background
+
+
+
+TextureRenderingInfo
+character_icon
+
+
+
+TextureRenderingInfo
+character_drawing
+
+
+
+JournalPagePlaces
+Derived from JournalPage JournalPageDiscoverable
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+main_image
+
+
+
+JournalPagePlayerProfile
+Derived from JournalPage
+
+JournalPageProgress
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+coffeestain_top
+
+
+
+JournalPageRecap
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+JournalPageStory
+Derived from JournalPage
+
+
+
+Type
+Name
+Description
+
+
+
+JournalPageTraps
+Derived from JournalPage JournalPageDiscoverable
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+trap_icon
+
+
+
+TextureRenderingInfo
+trap_background
+
+
+
+Levelgen types
DoorCoords
+Deprecated
+ kept for backward compatibility, don't use, check LevelGenSystem.exit_doors
+
+
+
+Type
+Name
+Description
+
+
+
+float
+door1_x
+
+
+
+float
+door1_y
+
+
+
+float
+door2_x
+door2 only valid when there are two in the level, like Volcana drill, Olmec, ...
+
+
+float
+door2_y
+
+
+
+LevelGenSystem
+Data relating to level generation, changing anything in here from ON.LEVEL or later will likely have no effect, used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+ShopType
+shop_type
+
+
+
+ShopType
+backlayer_shop_type
+
+
+
+int
+shop_music
+
+
+
+int
+backlayer_shop_music
+
+
+
+float
+spawn_x
+
+
+
+float
+spawn_y
+
+
+
+int
+spawn_room_x
+
+
+
+int
+spawn_room_y
+
+
+
+custom_array<Vec2>
+exit_doors
+
+
+
+ThemeInfo
+themes[18]
+
+
+
+Lighting types
Illumination
+Generic obcject for lights in the game, you can make your own with create_illumination
+Used in StateMemory, Player, PlayerGhost, BurningRopeEffect ...
+
+
+
+Type
+Name
+Description
+
+
+
+array<LightParams, 4>
+lights
+Table of light1, light2, ... etc.
+
+
+LightParams
+light1
+
+
+
+LightParams
+light2
+
+
+
+LightParams
+light3
+
+
+
+LightParams
+light4
+It's rendered on objects around, not as an actual bright spot
+
+
+float
+brightness
+
+
+
+float
+brightness_multiplier
+
+
+
+float
+light_pos_x
+
+
+
+float
+light_pos_y
+
+
+
+float
+offset_x
+
+
+
+float
+offset_y
+
+
+
+float
+distortion
+
+
+
+int
+entity_uid
+
+
+
+int
+flags
+see flags.hpp illumination_flags
+
+
+int
+type_flags
+Only one can be set: 1 - Follow camera, 2 - Follow Entity, 3 - Rectangle, full brightness
Rectangle always uses light1, even when it's disabled in flags
+
+
+bool
+enabled
+
+
+
+int
+layer
+
+
+
+LightParams
+Used in Illumination
+
+
+
+Type
+Name
+Description
+
+
+
+float
+red
+
+
+
+float
+green
+
+
+
+float
+blue
+
+
+
+float
+size
+
+
+
+Liquid types
LiquidPhysics
+Use LIQUID_POOL enum for the index
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+array<LiquidPool, 5>
+pools
+
+
+
+LiquidPhysicsEngine
+Used in LiquidPool
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+pause
+
+
+
+float
+gravity
+
+
+
+float
+cohesion
+
+
+
+float
+elasticity
+
+
+
+float
+size
+
+
+
+float
+weight
+
+
+
+int
+count
+
+
+
+LiquidPhysicsParams
+Used in LiquidPool
+
+
+
+Type
+Name
+Description
+
+
+
+float
+gravity
+
+
+
+float
+cohesion
+
+
+
+float
+elasticity
+
+
+
+LiquidPool
+Used in LiquidPhysics
+
+
+
+Type
+Name
+Description
+
+
+
+LiquidPhysicsParams
+default
+
+
+
+LiquidPhysicsEngine
+engine
+
+
+
+Logic types
Logic
+Used in LogicList
+
+
+
+Type
+Name
+Description
+
+
+
+int
+logic_index
+
+
+
+LogicDiceShop
+Used in LogicList
+Derived from Logic
+
+
+
+Type
+Name
+Description
+
+
+
+int
+bet_machine
+
+
+
+int
+die1
+
+
+
+int
+die2
+
+
+
+int
+die_1_value
+
+
+
+int
+die_2_value
+
+
+
+int
+prize_dispenser
+
+
+
+int
+prize
+
+
+
+int
+forcefield
+
+
+
+bool
+bet_active
+
+
+
+bool
+forcefield_deactivated
+
+
+
+bool
+boss_angry
+
+
+
+int
+result_announcement_timer
+
+
+
+int
+won_prizes_count
+
+
+
+int
+balance
+
+
+
+LogicList
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+LogicOlmecCutscene
+olmec_cutscene
+
+
+
+LogicTiamatCutscene
+tiamat_cutscene
+
+
+
+LogicMagmamanSpawn
+magmaman_spawn
+
+
+
+LogicDiceShop
+diceshop
+
+
+
+LogicOlmecCutscene
+Used in LogicList
+Derived from Logic
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+olmec
+
+
+
+Entity
+player
+
+
+
+Entity
+cinematic_anchor
+
+
+
+int
+timer
+
+
+
+LogicTiamatCutscene
+Used in LogicList
+Derived from Logic
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+tiamat
+
+
+
+Entity
+player
+
+
+
+Entity
+cinematic_anchor
+
+
+
+int
+timer
+
+
+
+LogicVolcana
+Derived from Logic
+
+
+
+Type
+Name
+Description
+
+
+
+custom_array<MagmamanSpawnPosition>
+magmaman_positions
+
+
+
+Online types
Online
+Can be accessed via global online
+
+
+
+Type
+Name
+Description
+
+
+
+array<OnlinePlayer, 4>
+online_players
+
+
+
+OnlinePlayer
+local_player
+
+
+
+OnlineLobby
+lobby
+
+
+
+OnlineLobby
+Used in Online
+
+
+
+Type
+Name
+Description
+
+
+
+int
+code
+
+
+
+int
+local_player_slot
+
+
+
+string
+get_code()
+Gets the string equivalent of the code
+
+
+OnlinePlayer
+Used in Online
+
+
+
+Type
+Name
+Description
+
+
+
+int
+ready_state
+
+
+
+int
+character
+
+
+
+string
+player_name
+
+
+
+Particle types
Particle
+Used in ParticleEmitterInfo
+
+
+
+Type
+Name
+Description
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+float
+velocityx
+
+
+
+float
+velocityy
+
+
+
+uColor
+color
+
+
+
+float
+width
+
+
+
+float
+height
+
+
+
+int
+lifetime
+
+
+
+int
+max_lifetime
+
+
+
+ParticleDB
+Used in ParticleDB, get_particle_type
+
+
+
+Type
+Name
+Description
+
+
+
+int
+id
+
+
+
+int
+spawn_count_min
+
+
+
+int
+spawn_count
+
+
+
+int
+lifespan_min
+
+
+
+int
+lifespan
+
+
+
+int
+sheet_id
+
+
+
+int
+animation_sequence_length
+
+
+
+float
+spawn_interval
+
+
+
+float
+shrink_growth_factor
+
+
+
+float
+rotation_speed
+
+
+
+float
+opacity
+
+
+
+float
+hor_scattering
+
+
+
+float
+ver_scattering
+
+
+
+float
+scale_x_min
+
+
+
+float
+scale_x
+
+
+
+float
+scale_y_min
+
+
+
+float
+scale_y
+
+
+
+float
+hor_deflection_1
+
+
+
+float
+ver_deflection_1
+
+
+
+float
+hor_deflection_2
+
+
+
+float
+ver_deflection_2
+
+
+
+float
+hor_velocity
+
+
+
+float
+ver_velocity
+
+
+
+int
+red
+
+
+
+int
+green
+
+
+
+int
+blue
+
+
+
+bool
+permanent
+
+
+
+bool
+invisible
+
+
+
+int
+get_texture()
+
+
+
+bool
+set_texture(int texture_id)
+
+
+
+ParticleEmitterInfo
+Generic type for creating particles in the game, you can make your own with generate_world_particles or generate_screen_particles
+Used in ScreenCharacterSelect, ScreenTitle, CursedEffect, OnFireEffect, PoisonedEffect ...
+
+
+
+Type
+Name
+Description
+
+
+
+ParticleDB
+particle_type
+
+
+
+int
+particle_count
+
+
+
+int
+particle_count_back_layer
+
+
+
+int
+entity_uid
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+float
+offset_x
+
+
+
+float
+offset_y
+
+
+
+array<Particle>
+emitted_particles
+
+
+
+array<Particle>
+emitted_particles_back_layer
+
+
+
+Savegame types
Constellation
+
+
+Type
+Name
+Description
+
+
+
+int
+star_count
+
+
+
+array<ConstellationStar, 45>
+stars
+
+
+
+float
+scale
+
+
+
+int
+line_count
+
+
+
+array<ConstellationLine, 90>
+lines
+
+
+
+float
+line_red_intensity
+
+
+
+ConstellationLine
+
+
+Type
+Name
+Description
+
+
+
+int
+from
+
+
+
+int
+to
+
+
+
+ConstellationStar
+
+
+Type
+Name
+Description
+
+
+
+int
+type
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+float
+size
+
+
+
+float
+red
+
+
+
+float
+green
+
+
+
+float
+blue
+
+
+
+float
+alpha
+
+
+
+float
+halo_red
+
+
+
+float
+halo_green
+
+
+
+float
+halo_blue
+
+
+
+float
+halo_alpha
+
+
+
+bool
+canis_ring
+
+
+
+bool
+fidelis_ring
+
+
+
+SaveData
+
+
+Type
+Name
+Description
+
+
+
+array<bool, 16>
+places
+
+
+
+array<bool, 78>
+bestiary
+
+
+
+array<bool, 38>
+people
+
+
+
+array<bool, 54>
+items
+
+
+
+array<bool, 24>
+traps
+
+
+
+string
+last_daily
+
+
+
+int
+characters
+20bit bitmask of unlocked characters
+
+
+int
+tutorial_state
+Tutorial state 0..4. Changes the camp layout, camera and lighting. (0=nothing, 1=journal got, 2=key spawned, 3=door unlocked, 4=complete)
+
+
+int
+shortcuts
+Terra quest state 0..10 (0=not met ... 10=complete)
+
+
+array<int, 78>
+bestiary_killed
+
+
+
+array<int, 78>
+bestiary_killed_by
+
+
+
+array<int, 38>
+people_killed
+
+
+
+array<int, 38>
+people_killed_by
+
+
+
+int
+plays
+
+
+
+int
+deaths
+
+
+
+int
+wins_normal
+
+
+
+int
+wins_hard
+
+
+
+int
+wins_special
+
+
+
+int
+score_total
+
+
+
+int
+score_top
+
+
+
+int
+deepest_area
+
+
+
+int
+deepest_level
+
+
+
+int
+time_best
+
+
+
+int
+time_total
+
+
+
+int
+time_tutorial
+
+
+
+array<int, 20>
+character_deaths
+
+
+
+array<int, 3>
+pets_rescued
+
+
+
+bool
+completed_normal
+
+
+
+bool
+completed_ironman
+
+
+
+bool
+completed_hard
+
+
+
+bool
+profile_seen
+
+
+
+bool
+seeded_unlocked
+
+
+
+int
+world_last
+
+
+
+int
+level_last
+
+
+
+int
+theme_last
+
+
+
+int
+score_last
+
+
+
+int
+time_last
+
+
+
+array<ENT_TYPE, 20>
+stickers
+
+
+
+array<int, 4>
+players
+
+
+
+Constellation
+constellation
+
+
+
+Screen types
FlyingThing
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+texture_info
+
+
+
+ENT_TYPE
+entity_type
+
+
+
+float
+spritesheet_column
+
+
+
+float
+spritesheet_row
+
+
+
+float
+spritesheet_animation_length
+
+
+
+float
+velocity_x
+
+
+
+float
+amplitude
+
+
+
+float
+frequency
+
+
+
+float
+sinewave_angle
+
+
+
+JournalPopupUI
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+wiggling_page_icon
+
+
+
+TextureRenderingInfo
+black_background
+
+
+
+TextureRenderingInfo
+button_icon
+
+
+
+float
+wiggling_page_angle
+
+
+
+int
+chapter_to_show
+
+
+
+int
+entry_to_show
+
+
+
+int
+timer
+
+
+
+float
+slide_position
+
+
+
+JournalUI
+
+
+Type
+Name
+Description
+
+
+
+int
+state
+
+
+
+JOURNALUI_PAGE_SHOWN
+chapter_shown
+
+
+
+int
+current_page
+
+
+
+int
+flipping_to_page
+
+
+
+int
+max_page_count
+
+
+
+TextureRenderingInfo
+book_background
+
+
+
+TextureRenderingInfo
+arrow_left
+
+
+
+TextureRenderingInfo
+arrow_right
+
+
+
+TextureRenderingInfo
+unknown23
+
+
+
+TextureRenderingInfo
+entire_book
+
+
+
+int
+page_timer
+
+
+
+int
+fade_timer
+
+
+
+int
+opacity
+
+
+
+custom_array<JournalPage>
+pages
+Stores pages loaded into memeory. It's not cleared after the journal is closed or when you go back to the main (menu) page.
Use :get_type()
to chcek page type and cast it correctly (see ON.RENDER_POST_DRAW_DEPTH)
+
+
+PauseUI
+
+
+Type
+Name
+Description
+
+
+
+float
+menu_slidein_progress
+
+
+
+TextureRenderingInfo
+blurred_background
+
+
+
+TextureRenderingInfo
+woodpanel_left
+
+
+
+TextureRenderingInfo
+woodpanel_middle
+
+
+
+TextureRenderingInfo
+woodpanel_right
+
+
+
+TextureRenderingInfo
+woodpanel_top
+
+
+
+TextureRenderingInfo
+scroll
+
+
+
+TextureRenderingInfo
+confirmation_panel
+
+
+
+int
+previously_selected_menu_index
+
+
+
+int
+visibility
+
+
+
+SaveRelated
+
+
+Type
+Name
+Description
+
+
+
+JournalPopupUI
+journal_popup_ui
+
+
+
+Screen
+
+
+Type
+Name
+Description
+
+
+
+float
+render_timer
+
+
+
+ScreenArenaIntro
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+players
+
+
+
+TextureRenderingInfo
+background_colors
+
+
+
+TextureRenderingInfo
+vertical_lines
+
+
+
+TextureRenderingInfo
+vertical_line_electricity_effect
+
+
+
+TextureRenderingInfo
+unknown_all_forced
+
+
+
+TextureRenderingInfo
+left_scroll
+
+
+
+TextureRenderingInfo
+right_scroll
+
+
+
+float
+scroll_unfurl_timer
+
+
+
+bool
+waiting
+
+
+
+float
+names_opacity
+
+
+
+float
+line_electricity_effect_timer
+
+
+
+int
+state
+
+
+
+int
+countdown
+
+
+
+ScreenArenaItems
+Derived from Screen
+
+ScreenArenaLevel
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+get_ready
+
+
+
+TextureRenderingInfo
+get_ready_gray_background
+
+
+
+TextureRenderingInfo
+get_ready_outline
+
+
+
+ScreenArenaMenu
+Derived from Screen
+
+ScreenArenaScore
+Derived from Screen
+
+ScreenArenaStagesSelect
+Derived from Screen
+
+ScreenCamp
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+int
+buttons
+
+
+
+ScreenCharacterSelect
+Derived from Screen
+
+ScreenConstellation
-- forces any level transition to immediately go to constellation ending with custom text
+set_callback(function()
+ if state.screen_next == SCREEN.TRANSITION then
+ if state.level_count == 0 then state.level_count = 1 end -- no /0
+ state.win_state = WIN_STATE.COSMIC_OCEAN_WIN
+ state.screen_next = SCREEN.CONSTELLATION
+ state.world_next = 8
+ state.level_next = 99
+ state.theme_next = THEME.COSMIC_OCEAN
+ state.level_gen.themes[THEME.COSMIC_OCEAN].sub_theme = state.level_gen.themes[state.theme]
+ state:force_current_theme(THEME.COSMIC_OCEAN)
+ set_global_interval(function()
+ if state.screen_constellation.sequence_state == 2 then
+ state.screen_constellation.constellation_text = "Lol u stars now"
+ clear_callback()
+ end
+ end, 1)
+ end
+ end, ON.PRE_LOAD_SCREEN)
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+sequence_state
+
+
+
+int
+animation_timer
+
+
+
+float
+constellation_text_opacity
+
+
+
+float
+constellation_text
+
+
+
+ScreenCredits
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+bg_music_info
+
+
+
+ScreenDeath
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+ScreenIntro
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+unknown4
+
+
+
+float
+darkness
+
+
+
+bool
+active
+ends the intro immediately if set to false
+
+
+bool
+skip_prologue
+skips prologue and goes straight to the title screen after the intro
+
+
+ScreenLeaderboards
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+ScreenLevel
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+int
+buttons
+
+
+
+ScreenLogo
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+logo_mossmouth
+
+
+
+TextureRenderingInfo
+logo_blitworks
+
+
+
+TextureRenderingInfo
+logo_fmod
+
+
+
+ScreenMenu
+Derived from Screen
+
+ScreenOnlineLoading
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+ouroboros
+
+
+
+float
+ouroboros_angle
+
+
+
+ScreenOnlineLobby
+Derived from Screen
+
+ScreenOptions
+Derived from Screen
+
+ScreenPlayerProfile
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+ScreenPrologue
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+STRINGID
+line1
+
+
+
+STRINGID
+line2
+
+
+
+STRINGID
+line3
+
+
+
+float
+line1_alpha
+
+
+
+float
+line2_alpha
+
+
+
+float
+line3_alpha
+
+
+
+ScreenRecap
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+ScreenScores
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+int
+animation_state
+
+
+
+TextureRenderingInfo
+woodpanel1
+
+
+
+TextureRenderingInfo
+woodpanel2
+
+
+
+TextureRenderingInfo
+woodpanel3
+
+
+
+TextureRenderingInfo
+woodpanel_cutout
+
+
+
+TextureRenderingInfo
+dollarsign
+
+
+
+TextureRenderingInfo
+hourglass
+
+
+
+int
+animation_timer
+
+
+
+float
+woodpanel_slidedown_timer
+
+
+
+ScreenSeedInput
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+float
+bottom_woodpanel_slideup_timer
+
+
+
+float
+bottom_woodpanel_y
+
+
+
+TextureRenderingInfo
+bottom_woodpanel
+
+
+
+STRINGID
+buttons_text_id
+
+
+
+float
+topleft_woodpanel_esc_slidein_timer
+
+
+
+STRINGID
+scroll_text_id
+
+
+
+STRINGID
+start_text_id
+
+
+
+TextureRenderingInfo
+main_woodpanel_left_border
+
+
+
+TextureRenderingInfo
+main_woodpanel_center
+
+
+
+TextureRenderingInfo
+main_woodpanel_right_border
+
+
+
+TextureRenderingInfo
+seed_letter_cutouts
+
+
+
+TextureRenderingInfo
+topleft_woodpanel_esc
+
+
+
+TextureRenderingInfo
+start_sidepanel
+
+
+
+float
+start_sidepanel_slidein_timer
+
+
+
+ScreenTeamSelect
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+ana_carrying_torch
+
+
+
+TextureRenderingInfo
+scroll_bottom_left
+
+
+
+TextureRenderingInfo
+scrollend_bottom_left
+
+
+
+TextureRenderingInfo
+four_ropes
+
+
+
+TextureRenderingInfo
+unknown4
+
+
+
+TextureRenderingInfo
+four_characters
+
+
+
+TextureRenderingInfo
+left_arrow
+
+
+
+TextureRenderingInfo
+right_arrow
+
+
+
+TextureRenderingInfo
+start_panel
+
+
+
+float
+start_panel_slide_timer
+
+
+
+float
+pulsating_arrows_timer
+
+
+
+int
+selected_player
+
+
+
+int
+buttons
+
+
+
+bool
+ready
+
+
+
+ScreenTitle
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+TextureRenderingInfo
+logo_spelunky2
+
+
+
+TextureRenderingInfo
+ana
+
+
+
+TextureRenderingInfo
+ana_right_eyeball_torch_reflection
+
+
+
+TextureRenderingInfo
+ana_left_eyeball_torch_reflection
+
+
+
+ParticleEmitterInfo
+particle_torchflame_smoke
+
+
+
+ParticleEmitterInfo
+particle_torchflame_backflames
+
+
+
+ParticleEmitterInfo
+particle_torchflame_flames
+
+
+
+ParticleEmitterInfo
+particle_torchflame_backflames_animated
+
+
+
+ParticleEmitterInfo
+particle_torchflame_flames_animated
+
+
+
+ParticleEmitterInfo
+particle_torchflame_ash
+
+
+
+SoundMeta
+music
+
+
+
+SoundMeta
+torch_sound
+
+
+
+ScreenTransition
+Derived from Screen
+
+ScreenWin
+Derived from Screen
+
+
+
+Type
+Name
+Description
+
+
+
+int
+sequence_timer
+
+
+
+int
+frame_timer
+
+
+
+int
+animation_state
+
+
+
+Entity
+rescuing_ship_entity
+
+
+
+ScreenZoomAnimation
+
+
+Type
+Name
+Description
+
+
+
+float
+zoom_target
+
+
+
+Sound types
BackgroundSound
+Derived from SoundMeta
+
+
+
+Type
+Name
+Description
+
+
+
+CustomSound
+Handle to a loaded sound, can be used to play the sound and receive a PlayingSound
for more control
+It is up to you to not release this as long as any sounds returned by CustomSound:play()
are still playing
+
+
+
+Type
+Name
+Description
+
+
+
+PlayingSound
+play()
+
+
+
+PlayingSound
+play(bool paused)
+
+
+
+PlayingSound
+play(bool paused, SOUND_TYPE sound_type)
+
+
+
+map<VANILLA_SOUND_PARAM, string>
+get_parameters()
+
+
+
+PlayingSound
+Handle to a playing sound, start the sound paused to make sure you can apply changes before playing it
+You can just discard this handle if you do not need extended control anymore
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+is_playing()
+
+
+
+bool
+stop()
+
+
+
+bool
+set_pause(bool pause)
+
+
+
+bool
+set_mute(bool mute)
+
+
+
+bool
+set_pitch(float pitch)
+
+
+
+bool
+set_pan(float pan)
+
+
+
+bool
+set_volume(float volume)
+
+
+
+bool
+set_looping(SOUND_LOOP_MODE loop_mode)
+
+
+
+bool
+set_callback(SoundCallbackFunction callback)
+
+
+
+map<VANILLA_SOUND_PARAM, string>
+get_parameters()
+
+
+
+optional<float>
+get_parameter(VANILLA_SOUND_PARAM parameter_index)
+
+
+
+bool
+set_parameter(VANILLA_SOUND_PARAM parameter_index, float value)
+
+
+
+SoundMeta
+
+
+Type
+Name
+Description
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+array<float, 38>
+left_channel
+
+
+
+array<float, 38>
+right_channel
+
+
+
+bool
+start_over
+when false, current track starts from the beginning, is immediately set back to true
+
+
+bool
+playing
+set to false to turn off
+
+
+State types
Camera
+
+
+Type
+Name
+Description
+
+
+
+float
+bounds_left
+
+
+
+float
+bounds_right
+
+
+
+float
+bounds_bottom
+
+
+
+float
+bounds_top
+
+
+
+float
+calculated_focus_x
+
+
+
+float
+calculated_focus_y
+
+
+
+float
+adjusted_focus_x
+
+
+
+float
+adjusted_focus_y
+
+
+
+float
+focus_offset_x
+
+
+
+float
+focus_offset_y
+
+
+
+float
+focus_x
+
+
+
+float
+focus_y
+
+
+
+float
+vertical_pan
+
+
+
+int
+shake_countdown_start
+
+
+
+int
+shake_countdown
+
+
+
+float
+shake_amplitude
+
+
+
+float
+shake_multiplier_x
+
+
+
+float
+shake_multiplier_y
+
+
+
+bool
+uniform_shake
+
+
+
+int
+focused_entity_uid
+
+
+
+float
+inertia
+
+
+
+GameManager
+Can be accessed via global game_manager
+
+
+
+Type
+Name
+Description
+
+
+
+BackgroundMusic
+music
+
+
+
+GameProps
+game_props
+
+
+
+ScreenLogo
+screen_logo
+
+
+
+ScreenIntro
+screen_intro
+
+
+
+ScreenPrologue
+screen_prologue
+
+
+
+ScreenTitle
+screen_title
+
+
+
+ScreenMenu
+screen_menu
+
+
+
+ScreenOptions
+screen_options
+
+
+
+ScreenPlayerProfile
+screen_player_profile
+
+
+
+ScreenLeaderboards
+screen_leaderboards
+
+
+
+ScreenSeedInput
+screen_seed_input
+
+
+
+ScreenCamp
+screen_camp
+
+
+
+ScreenLevel
+screen_level
+
+
+
+ScreenOnlineLoading
+screen_online_loading
+
+
+
+ScreenOnlineLobby
+screen_online_lobby
+
+
+
+PauseUI
+pause_ui
+
+
+
+JournalUI
+journal_ui
+
+
+
+SaveRelated
+save_related
+
+
+
+GameProps
+
+
+Type
+Name
+Description
+
+
+
+int
+buttons
+
+
+
+bool
+game_has_focus
+
+
+
+Items
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+int
+player_count
+
+
+
+int
+saved_pets_count
+
+
+
+array<ENT_TYPE, 4>
+saved_pets
+Pet information for level transition
+
+
+array<bool, 4>
+is_pet_cursed
+
+
+
+array<bool, 4>
+is_pet_poisoned
+
+
+
+int
+leader
+Index of leader player in coop
+
+
+array<Inventory, MAX_PLAYERS>
+player_inventory
+
+
+
+array<SelectPlayerSlot, MAX_PLAYERS>
+player_select
+
+
+
+JournalProgressStainSlot
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+float
+angle
+
+
+
+float
+scale
+
+
+
+int
+texture_column
+
+
+
+int
+texture_row
+
+
+
+int
+texture_range
+
+
+
+JournalProgressStickerSlot
+Used in StateMemory
+
+
+
+Type
+Name
+Description
+
+
+
+int
+theme
+
+
+
+int
+grid_position
+
+
+
+ENT_TYPE
+entity_type
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+float
+angle
+
+
+
+PlayerSlot
+
+
+Type
+Name
+Description
+
+
+
+INPUTS
+buttons_gameplay
+
+
+
+INPUTS
+buttons
+
+
+
+InputMapping
+input_mapping_keyboard
+
+
+
+InputMapping
+input_mapping_controller
+
+
+
+int
+player_id
+
+
+
+bool
+is_participating
+
+
+
+PlayerSlotSettings
+
+
+Type
+Name
+Description
+
+
+
+bool
+controller_vibration
+
+
+
+bool
+auto_run_enabled
+
+
+
+bool
+controller_right_stick
+
+
+
+QuestsInfo
+
+
+Type
+Name
+Description
+
+
+
+int
+yang_state
+
+
+
+int
+jungle_sisters_flags
+
+
+
+int
+van_horsing_state
+
+
+
+int
+sparrow_state
+
+
+
+int
+madame_tusk_state
+
+
+
+int
+beg_state
+
+
+
+SelectPlayerSlot
+Used in Items
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+activated
+
+
+
+ENT_TYPE
+character
+
+
+
+int
+texture
+
+
+
+StateMemory
+Can be accessed via global state
+
+
+
+Type
+Name
+Description
+
+
+
+int
+screen_last
+Previous SCREEN, used to check where we're coming from when loading another SCREEN
+
+
+int
+screen
+Current SCREEN, generally read-only or weird things will happen
+
+
+int
+screen_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
.
+
+
+int
+ingame
+Is 1 when you in a game, is set to 0 or 1 in main menu, can't be trusted there, normally in a level is 1 unless you go to the options
+
+
+int
+playing
+Is 1 when you are in a level, but going to options sets it to 0 and does not set it back to 1 after the way back, don't trust it
+
+
+PAUSE
+pause
+8bit flags, multiple might be active at the same time
1: Menu: Pauses the level timer and engine. Can't set, controller 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.
+
+
+int
+width
+level width in rooms (number of rooms horizontally)
+
+
+int
+height
+level height in rooms (number of rooms vertically)
+
+
+int
+kali_favor
+
+
+
+int
+kali_status
+
+
+
+int
+kali_altars_destroyed
+Also affects if the player has punish ball, if the punish ball is destroyed it is set to -1
+
+
+int
+kali_gifts
+0 - none, 1 - item, 3 - kapala
+
+
+int
+seed
+Current seed in seeded mode, just set to a funny value and does nothing in adventure mode
+
+
+int
+time_total
+Total frames of current run, equal to the final game time on win
+
+
+int
+world
+Current world number, shown in hud and used by some game logic like choosing the next level on transition
+
+
+int
+world_next
+Next world number, used when loading a new level or transition
+
+
+int
+world_start
+World number to start new runs in
+
+
+int
+level
+Current level number, shown in hud and used by some game logic like choosing the next level on transition
+
+
+int
+level_next
+Next level number, used when loading a new level or transition
+
+
+int
+level_start
+Level number to start new runs in
+
+
+THEME
+theme
+Current THEME number, used to pick the music and by some game logic like choosing the next level on transition
+
+
+THEME
+theme_next
+Next THEME number, used when loading a new level or transition
+
+
+int
+theme_start
+THEME to start new runs in
+
+
+ThemeInfo
+current_theme
+Points to the current ThemeInfo
+
+
+nil
+force_current_theme(int t)
+This function should only be used in a very specific circumstance (forcing the exiting theme when manually transitioning). Will crash the game if used inappropriately!
+
+
+int
+shoppie_aggro
+Current shoppie aggro
+
+
+int
+shoppie_aggro_next
+Shoppie aggro to use in the next level
+
+
+int
+outposts_spawned
+
+
+
+int
+merchant_aggro
+Tun aggro
+
+
+int
+kills_npc
+
+
+
+int
+level_count
+Current zero-based level count, or number of levels completed
+
+
+int
+damage_taken
+Total amount of damage taken, excluding cause of death
+
+
+JOURNAL_FLAG
+journal_flags
+
+
+
+int
+time_last_level
+Level time of previous level in frames, used by game logic to decide dark levels etc
+
+
+int
+time_level
+Level time of current level in frames, show on the hud
+
+
+int
+level_flags
+
+
+
+int
+loading
+Shows the current loading state (0=Not loading, 1=Fadeout, 2=Loading, 3=Fadein). Writing 1 or 2 will trigger a screen load to screen_next
.
+
+
+QUEST_FLAG
+quest_flags
+32bit flags, can be written to trigger a run reset on next level load etc.
+
+
+PRESENCE_FLAG
+presence_flags
+
+
+
+float
+fadevalue
+Current fade-to-black amount (0.0 = all visible; 1.0 = all black). Manipulated by the loading routine when loading > 0.
+
+
+int
+fadeout
+Amount of frames the fadeout should last when loading
+
+
+int
+fadein
+Amount of frames the fadein should last when loading
+
+
+int
+loading_black_screen_timer
+if state.loading is 1, this timer counts down to 0 while the screen is black (used after Ouroboros, in credits etc.)
+
+
+int
+saved_dogs
+Run totals
+
+
+int
+saved_cats
+
+
+
+int
+saved_hamsters
+
+
+
+int
+win_state
+0 = no win 1 = tiamat win 2 = hundun win 3 = CO win; set this and next doorway leads to victory scene
+
+
+Illumination
+illumination
+The global level illumination, very big and bright.
+
+
+int
+money_last_levels
+
+
+
+int
+money_shop_total
+Total negative amount spent in shops during the run
The total money currently available (in single player) is players[1].inventory.money + players[1].inventory.collected_money_total + state.money_shop_total
+
+
+PlayerInputs
+player_inputs
+Access the player inputs even when no player entities are available
+
+
+QuestsInfo
+quests
+NPC quest states
+
+
+Camera
+camera
+Camera bounds and position
+
+
+int
+special_visibility_flags
+
+
+
+CAUSE_OF_DEATH
+cause_of_death
+
+
+
+ENT_TYPE
+cause_of_death_entity_type
+
+
+
+int
+toast_timer
+
+
+
+int
+speechbubble_timer
+
+
+
+int
+speechbubble_owner
+
+
+
+LevelGenSystem
+level_gen
+Entrance and exit coordinates, shop types and all themes
+
+
+int
+correct_ushabti
+See get_correct_ushabti
. == anim_frame - (2 floor(anim_frame/12))
+
+
+Items
+items
+Has the current player count, player inventories and character selections
+
+
+int
+camera_layer
+The currently drawn layer, can't be changed
+
+
+int
+layer_transition_timer
+
+
+
+ScreenTeamSelect
+screen_team_select
+
+
+
+ScreenCharacterSelect
+screen_character_select
+
+
+
+ScreenTransition
+screen_transition
+
+
+
+ScreenDeath
+screen_death
+
+
+
+ScreenWin
+screen_win
+
+
+
+ScreenCredits
+screen_credits
+
+
+
+ScreenScores
+screen_scores
+
+
+
+ScreenConstellation
+screen_constellation
+
+
+
+ScreenRecap
+screen_recap
+
+
+
+ScreenArenaStagesSelect
+screen_arena_stages_select
+
+
+
+ScreenArenaIntro
+screen_arena_intro
+
+
+
+ScreenArenaLevel
+screen_arena_level
+
+
+
+ScreenArenaScore
+screen_arena_score
+
+
+
+ScreenArenaMenu
+screen_arena_menu
+
+
+
+ScreenArenaItems
+screen_arena_items
+
+
+
+int
+get_correct_ushabti()
+Returns animation_frame of the correct ushabti
+
+
+nil
+set_correct_ushabti(int animation_frame)
+
+
+
+ArenaState
+arena
+
+
+
+ENT_TYPE
+speedrun_character
+Who administers the tutorial speedrun in base camp
+
+
+bool
+speedrun_activation_trigger
+must transition from true to false to activate it
+
+
+ENT_TYPE
+end_spaceship_character
+Who pops out the spaceship for a tiamat/hundun win, this is set upon the spaceship door open
+
+
+bool
+world2_coffin_spawned
+
+
+
+bool
+world4_coffin_spawned
+
+
+
+bool
+world6_coffin_spawned
+
+
+
+ENT_TYPE
+first_damage_cause
+
+
+
+int
+first_damage_world
+
+
+
+int
+first_damage_level
+
+
+
+int
+time_speedrun
+
+
+
+ENT_TYPE
+coffin_contents
+the contents of the special coffin that will be spawned during levelgen
+
+
+int
+screen_change_counter
+
+
+
+int
+time_startup
+Number of frames since the game was launched
+
+
+int
+storage_uid
+entity uid of the first floor_storage entity
+
+
+array<ENT_TYPE, 99>
+waddler_storage
+
+
+
+array<int, 99>
+waddler_metadata
+
+
+
+int
+journal_progress_sticker_count
+
+
+
+array<JournalProgressStickerSlot, 40>
+journal_progress_sticker_slots
+stickers for notable items and entities in journal progress page
+
+
+int
+journal_progress_stain_count
+
+
+
+array<JournalProgressStainSlot, 30>
+journal_progress_stain_slots
+blood splats and paw prints in journal progress page
+
+
+int
+journal_progress_theme_count
+
+
+
+array<int, 9>
+journal_progress_theme_slots
+visited themes in journal progress page
+
+
+ThemeInfo
+theme_info
+Points to the current ThemeInfo
+
+
+LogicList
+logic
+Level logic like dice game and cutscenes
+
+
+LiquidPhysics
+liquid
+
+
+
+int
+next_entity_uid
+Next entity spawned will have this uid
+
+
+RoomOwnersInfo
+room_owners
+Holds info about owned rooms and items (shops, challenge rooms, vault etc.)
+
+
+Texture types
TextRenderingInfo
+
+
+Type
+Name
+Description
+
+
+
+
+new
+TextRenderingInfo:new(string text, float scale_x, float scale_y, VANILLA_TEXT_ALIGNMENT alignment, VANILLA_FONT_STYLE fontstyle)
TextRenderingInfo:new(string text, float x, float y, float scale_x, float scale_y, VANILLA_TEXT_ALIGNMENT alignment, VANILLA_FONT_STYLE fontstyle)
Creates new TextRenderingInfo that can be used in VanillaRenderContext draw_text
For static text, it is better to use one object and call draw_text with it, instead of relaying on draw_text creating this object for you
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+int
+text_length
+You can also just use #
operator on the whole object to get the text lenght
+
+
+float
+width
+
+
+
+float
+height
+
+
+
+int
+special_texture_id
+Used to draw buttons and stuff, default is -1 wich uses the buttons texture
+
+
+Texture
+font
+
+
+
+array<Letter>
+get_dest()
+Returns refrence to the letter coordinates relative to the x,y position
+
+
+array<Letter>
+get_source()
+Returns refrence to the letter coordinates in the texture
+
+
+tuple<float, float>
+text_size()
+{width, height}, is only updated when you set/change the text. This is equivalent to draw_text_size
+
+
+nil
+rotate(float angle, optional px, optional py)
+Rotates the text around the pivot point (default 0), pivot is relative to the text position (x, y), use px and py to offset it
+
+
+nil
+set_text(const string text, float scale_x, float scale_y, VANILLA_TEXT_ALIGNMENT alignment, VANILLA_FONT_STYLE fontstyle)
+Changes the text, only position stays the same, everything else (like rotation) is reset or set according to the parameters
+
+
+TextureDefinition
+Use TextureDefinition.new()
to get a new instance to this and pass it to define_entity_texture.
+width
and height
always have to be the size of the image file. They should be divisible by tile_width
and tile_height
respectively.
+tile_width
and tile_height
define the size of a single tile, the image will automatically be divided into these tiles.
+Tiles are labeled in sequence starting at the top left, going right and down at the end of the image (you know, like sentences work in the English language). Use those numbers in Entity::animation_frame
.
+sub_image_offset_x
, sub_image_offset_y
, sub_image_width
and sub_image_height
can be used if only a part of the image should be used. Leave them at zero to ignore this.
+
+
+
+Type
+Name
+Description
+
+
+
+string
+texture_path
+
+
+
+int
+width
+
+
+
+int
+height
+
+
+
+int
+tile_width
+
+
+
+int
+tile_height
+
+
+
+int
+sub_image_offset_x
+
+
+
+int
+sub_image_offset_y
+
+
+
+int
+sub_image_width
+
+
+
+int
+sub_image_height
+
+
+
+TextureRenderingInfo
+
+
+Type
+Name
+Description
+
+
+
+
+new
+
+
+
+float
+x
+
+
+
+float
+y
+
+
+
+float
+destination_bottom_left_x
+destination is relative to the x,y centerpoint
+
+
+float
+destination_bottom_left_y
+
+
+
+float
+destination_bottom_right_x
+
+
+
+float
+destination_bottom_right_y
+
+
+
+float
+destination_top_left_x
+
+
+
+float
+destination_top_left_y
+
+
+
+float
+destination_top_right_x
+
+
+
+float
+destination_top_right_y
+
+
+
+nil
+set_destination(const AABB& bbox)
+
+
+
+Quad
+dest_get_quad()
+
+
+
+nil
+dest_set_quad(const Quad& quad)
+
+
+
+float
+source_bottom_left_x
+
+
+
+float
+source_bottom_left_y
+
+
+
+float
+source_bottom_right_x
+
+
+
+float
+source_bottom_right_y
+
+
+
+float
+source_top_left_x
+
+
+
+float
+source_top_left_y
+
+
+
+float
+source_top_right_x
+
+
+
+float
+source_top_right_y
+
+
+
+Quad
+source_get_quad()
+
+
+
+nil
+source_set_quad(const Quad& quad)
+
+
+
+Theme types
CustomTheme
+
+Very basic example how to use a CustomTheme in the procedural levels. Search the examples or check Eternal Flame of Gehenna for custom levels.
+
+-- create a new theme based on dwelling
+local my_theme = CustomTheme:new()
+-- get some ember effects from volcana
+my_theme:override(THEME_OVERRIDE.SPAWN_EFFECTS, THEME.VOLCANA)
+-- change level size
+my_theme:post(THEME_OVERRIDE.INIT_LEVEL, function()
+ state.width = 5
+ state.height = 15
+end)
+-- set floor textures to eggy
+my_theme.textures[DYNAMIC_TEXTURE.FLOOR] = TEXTURE.DATA_TEXTURES_FLOOR_EGGPLANT_0
+set_callback(function(ctx)
+ -- use the level gen from ice caves
+ ctx:override_level_files({"generic.lvl", "icecavesarea.lvl"})
+ -- force our theme instead of the default
+ force_custom_theme(my_theme)
+end, ON.PRE_LOAD_LEVEL_FILES)
+
-Search script examples for import
+You can call theme functions from other themes, for example to make all growable tile codes work in your theme:
-table import(string id, string version = "", bool optional = false)
-Load another script by id "author/name" and import its exports
table. Returns:
+local custom = CustomTheme:new()
+custom:post(THEME_OVERRIDE.SPAWN_LEVEL, function()
+ state.level_gen.themes[THEME.VOLCANA]:spawn_traps()
+ state.level_gen.themes[THEME.TIDE_POOL]:spawn_traps()
+ state.level_gen.themes[THEME.JUNGLE]:spawn_traps()
+end)
+
+Customizable ThemeInfo with ability to override certain theming functions from different themes or write custom functions. Check ThemeInfo for some notes on the vanilla theme functions. Warning: We WILL change these function names, especially the unknown ones, when you figure out what they do.
+Derived from ThemeInfo
+
+
+
+Type
+Name
+Description
+
+
+
+CustomTheme
+new(int theme_id_, int base_theme_, bool defaults)
+Create a new theme with an id and base theme, overriding defaults. Check theme functions that are default enabled here.
+
+
+CustomTheme
+new(int theme_id_, int base_theme_)
+Create a new theme with defaults.
+
+
+CustomTheme
+new()
+Create a new theme with base dwelling and id 100.
+
+
+string
+level_file
+Level file to load. Probably doesn't do much in custom themes, especially if you're forcing them in PRE_LOAD_LEVEL_FILES.
+
+
+int
+theme
+Theme index. Probably shouldn't collide with the vanilla ones. Purpose unknown.
+
+
+int
+base_theme
+Base THEME to load enabled functions from, when no other theme is specified.
+
+
+map<DYNAMIC_TEXTURE, int>
+textures
+Add TEXTUREs here to override different dynamic textures.
+
+
+
+override
+override(THEME_OVERRIDE override, bool enabled)
To disable or enable theme functions using the base_theme.
override(THEME_OVERRIDE override, THEME theme)
To override a theme function with another theme.
override(THEME_OVERRIDE override, function func)
To override a theme function with a lua function.
+
+
+nil
+pre(THEME_OVERRIDE index, function func_)
+Set a callback to be called before this theme function.
+
+
+nil
+post(THEME_OVERRIDE index, function func_)
+Set a callback to be called after this theme function, to fix some changes it did for example.
+
+
+nil
+reset_theme_flags()
+
+
+
+nil
+init_flags()
+
+
+
+nil
+init_level()
+
+
+
+nil
+init_rooms()
+
+
+
+nil
+generate_path(bool reset)
+
+
+
+nil
+add_special_rooms()
+
+
+
+nil
+add_player_coffin()
+
+
+
+nil
+add_dirk_coffin()
+
+
+
+nil
+add_idol()
+
+
+
+nil
+add_vault()
+
+
+
+nil
+add_coffin()
+
+
+
+
+add_feeling
+
+
+
+nil
+spawn_level()
+
+
+
+nil
+spawn_border()
+
+
+
+nil
+post_process_level()
+
+
+
+nil
+spawn_traps()
+
+
+
+nil
+post_process_entities()
+
+
+
+nil
+spawn_procedural()
+
+
+
+nil
+spawn_background()
+
+
+
+nil
+spawn_lights()
+
+
+
+nil
+spawn_transition()
+
+
+
+nil
+post_transition()
+
+
+
+nil
+spawn_players()
+
+
+
+nil
+spawn_effects()
+
+
+
+string
+get_level_file()
+
+
+
+int
+get_theme_id()
+
+
+
+int
+get_base_id()
+
+
+
+int
+get_floor_spreading_type()
+
+
+
+int
+get_floor_spreading_type2()
+
+
+
+bool
+get_transition_styled_floor()
+
+
+
+int
+get_transition_floor_modifier()
+
+
+
+int
+get_transition_styled_floor_type()
+
+
+
+int
+get_backwall_type()
+
+
+
+int
+get_border_type()
+
+
+
+int
+get_critter_type()
+
+
+
+float
+get_liquid_gravity()
+
+
+
+bool
+get_player_damage()
+
+
+
+bool
+get_explosion_soot()
+
+
+
+int
+get_backlayer_lut()
+
+
+
+float
+get_backlayer_light_level()
+
+
+
+bool
+get_loop()
+
+
+
+int
+get_vault_level()
+
+
+
+bool
+get_theme_flag(int index)
+
+
+
+int
+get_dynamic_texture(int texture_id)
+Add TEXTUREs to textures
to override different dynamic textures easily.
+
+
+nil
+pre_transition()
+
+
+
+int
+get_exit_room_y_level()
+
+
+
+int
+get_shop_chance()
+
+
+
+nil
+spawn_decoration()
+
+
+
+nil
+spawn_decoration2()
+
+
+
+nil
+spawn_extra()
+
+
+
+nil
+do_procedural_spawn(SpawnInfo info)
+
+
+
+ThemeInfo
-- When hell freezes over: Examples for hooking ThemeInfo virtuals
+
+state.level_gen.themes[THEME.VOLCANA]:set_pre_texture_dynamic(function(theme, id)
+ -- change volcana floor to ice floor
+ if id == DYNAMIC_TEXTURE.FLOOR then
+ return TEXTURE.DATA_TEXTURES_FLOOR_ICE_0
+ end
+end)
+
+state.level_gen.themes[THEME.VOLCANA]:set_pre_spawn_effects(function(theme)
+ -- run the effects function from another theme to get cool ice particle effects
+ for i=1,50 do
+ state.level_gen.themes[THEME.ICE_CAVES]:spawn_effects()
+ end
+ -- then we run this to fix the weird camera bounds set by ice caves
+ state.level_gen.themes[THEME.DWELLING]:spawn_effects()
+ -- don't spawn volcanic effects
+ return true
+end)
+
+-- make players cold
+state.level_gen.themes[THEME.VOLCANA]:set_post_spawn_players(function(theme)
+ for i,p in pairs(get_local_players()) do
+ spawn_over(ENT_TYPE.LOGICAL_FROST_BREATH, p.uid, 0, 0)
+ end
+end)
+
+-- make vlads bluish
+state.level_gen.themes[THEME.VOLCANA]:set_pre_texture_backlayer_lut(function(theme)
+ return TEXTURE.DATA_TEXTURES_LUT_ICECAVES_0
+end)
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+unknown3
+
+
+
+int
+unknown4
+
+
+
+int
+theme
+
+
+
+bool
+allow_beehive
+
+
+
+bool
+allow_leprechaun
+
+
+
+ThemeInfo
+sub_theme
+
+
+
+nil
+reset_theme_flags()
+Sets the beehive and leprechaun flags
+
+
+nil
+init_flags()
+Initializes some flags in the LevelGenSystem, also dark level flag in state.level_flags.
+
+
+nil
+init_level()
+Adds the entrance room and sets spawn_room_x/y. Sets the level size and toast for echoes feeling. Sets some other level_flags, shop related flags and shop_type.
+
+
+nil
+init_rooms()
+
+
+
+nil
+generate_path(bool reset)
+Generates and adds the path rooms and exit room
Params: reset to start over from the beginning if other rooms didn't fit
+
+
+nil
+add_special_rooms()
+Adds rooms related to udjat, black market, castle etc
+
+
+nil
+add_player_coffin()
+Adds a player revival coffin room
+
+
+nil
+add_dirk_coffin()
+Adds a Dirk coffin room
+
+
+nil
+add_idol()
+Adds an idol room
+
+
+nil
+add_vault()
+Adds a vault room
+
+
+nil
+add_coffin()
+Adds a character unlock coffin room
+
+
+nil
+add_special_feeling()
+Adds the metal clanking or oppression rooms
+
+
+nil
+spawn_level()
+Calls many other theme functions to spawn the floor, enemies, items etc, but not background and players. (Disable this to only spawn background and players.)
+
+
+nil
+spawn_border()
+Spawns the border entities (some floor or teleportingborder)
+
+
+nil
+post_process_level()
+Theme specific specialties like randomizing ushabti and Coco coffin location, spawns impostor lakes
+
+
+nil
+spawn_traps()
+Spawns theme specific random traps, pushblocks and critters. Sets special exit doors.
+
+
+nil
+post_process_entities()
+Fixes textures on pleasure palace ladders, adds some decorations
+
+
+nil
+spawn_procedural()
+Adds legs under platforms, random pots, goldbars, monsters, compass indicator, random shadows...
+
+
+nil
+spawn_background()
+Adds the main level background , e.g. CO stars / Duat moon / Plain backwall for other themes
+
+
+nil
+spawn_lights()
+Adds room lights to udjat chest room or black market
+
+
+nil
+spawn_transition()
+Spawns the transition tunnel and players in it
+
+
+nil
+post_transition()
+Handles loading the next level screen from a transition screen
+
+
+nil
+spawn_players()
+Spawns the players with inventory at state.level_gen.spawn_x/y
. Also shop and kali background and probably other stuff for some stupid reason.
+
+
+nil
+spawn_effects()
+Sets the camera bounds and position. Spawns jelly and orbs and the flag in coop. Sets timers/conditions for more jellies and ghosts. Enables the special fog/ember/ice etc particle effects.
+
+
+string
+get_level_file()
+Returns: The .lvl file to load (e.g. dwelling = dwellingarea.lvl except when level == 4 (cavebossarea.lvl))
+
+
+int
+get_theme_id()
+Returns: THEME, or subtheme in CO
+
+
+int
+get_base_id()
+Returns: THEME, or logical base THEME for special levels (Abzu->Tide Pool etc)
+
+
+int
+get_floor_spreading_type()
+Returns: ENT_TYPE used for floor spreading (generic or one of the styled floors)
+
+
+int
+get_floor_spreading_type2()
+Returns: ENT_TYPE used for floor spreading (stone or one of the styled floors)
+
+
+bool
+get_transition_styled_floor()
+Returns: true if transition should use styled floor
+
+
+int
+get_transition_floor_modifier()
+Determines the types of FLOOR_TUNNEL_NEXT/CURRENT (depending on where you are transitioning from/to)
Returns: 85 by default, except for: olmec: 15, cog: 23
+
+
+int
+get_transition_styled_floor_type()
+Returns: ENT_TYPE used for the transition floor
+
+
+int
+get_backwall_type()
+Returns: ENT_TYPE used for the backwall (BG_LEVEL_BACKWALL by default)
+
+
+int
+get_border_type()
+Returns: ENT_TYPE to use for the border tiles
+
+
+int
+get_critter_type()
+Returns: ENT_TYPE for theme specific critter
+
+
+float
+get_liquid_gravity()
+Returns: gravity used to initialize liquid pools (-1..1)
+
+
+bool
+get_player_damage()
+Returns: false to disable most player damage and the usage of bombs and ropes. Enabled in parts of base camp.
+
+
+bool
+get_explosion_soot()
+Returns: true if explosions should spawn background soot
+
+
+int
+get_backlayer_lut()
+Returns: TEXTURE for the LUT to be applied to the special back layer, e.g. vlad's castle
+
+
+float
+get_backlayer_light_level()
+Returns: dynamic backlayer light level (0..1)
+
+
+bool
+get_loop()
+Returns: true if the loop rendering should be enabled (Combine with the right get_border_type)
+
+
+int
+get_vault_level()
+Returns: highest y-level a vault can spawn
+
+
+bool
+get_theme_flag(int index)
+Returns: allow_beehive or allow_leprechaun flag
Params: index: 0 or 1
+
+
+int
+get_dynamic_texture(int texture_id)
+Returns: TEXTURE based on texture_id
Params: DYNAMIC_TEXTURE texture_id
+
+
+nil
+pre_transition()
+Sets state.level_next, world_next and theme_next (or state.win_state) based on level number. Runs when exiting a level.
+
+
+int
+get_exit_room_y_level()
+Returns: usually state.height - 1. For special levels fixed heights are returned.
+
+
+int
+get_shop_chance()
+Returns: inverse shop chance
+
+
+nil
+spawn_decoration()
+Spawns some specific decoration, e.g. Vlad's big banner
+
+
+nil
+spawn_decoration2()
+Spawns some other specific decorations, e.g. grass, flowers, udjat room decal
+
+
+nil
+spawn_extra()
+Spawns specific extra entities and decorations, like gold key, seaweed, lanterns, banners, signs, wires...
+
+
+nil
+do_procedural_spawn(SpawnInfo info)
+Spawns a single procedural entity, used in spawn_procedural
+
+
+CallbackId
+set_pre_virtual(THEME_OVERRIDE entry, function fun)
+Hooks before the virtual function at index entry
.
+
+
+CallbackId
+set_post_virtual(THEME_OVERRIDE entry, function fun)
+Hooks after the virtual function at index entry
.
+
+
+nil
+clear_virtual(CallbackId callback_id)
+Clears the hook given by callback_id
, alternatively use clear_callback()
inside the hook.
+
+
+CallbackId
+set_pre_dtor(function fun)
+Hooks before the virtual function.
The callback signature is nil dtor(ThemeInfo self)
+
+
+CallbackId
+set_post_dtor(function fun)
+Hooks after the virtual function.
The callback signature is nil dtor(ThemeInfo self)
+
+
+CallbackId
+set_pre_reset_theme_flags(function fun)
+Hooks before the virtual function.
The callback signature is bool reset_theme_flags(ThemeInfo self)
Virtual function docs:
Sets the beehive and leprechaun flags
+
+
+CallbackId
+set_post_reset_theme_flags(function fun)
+Hooks after the virtual function.
The callback signature is nil reset_theme_flags(ThemeInfo self)
Virtual function docs:
Sets the beehive and leprechaun flags
+
+
+CallbackId
+set_pre_init_flags(function fun)
+Hooks before the virtual function.
The callback signature is bool init_flags(ThemeInfo self)
Virtual function docs:
Initializes some flags in the LevelGenSystem, also dark level flag in state.level_flags.
+
+
+CallbackId
+set_post_init_flags(function fun)
+Hooks after the virtual function.
The callback signature is nil init_flags(ThemeInfo self)
Virtual function docs:
Initializes some flags in the LevelGenSystem, also dark level flag in state.level_flags.
+
+
+CallbackId
+set_pre_init_level(function fun)
+Hooks before the virtual function.
The callback signature is bool init_level(ThemeInfo self)
Virtual function docs:
Adds the entrance room and sets spawn_room_x/y. Sets the level size and toast for echoes feeling. Sets some other level_flags, shop related flags and shop_type.
+
+
+CallbackId
+set_post_init_level(function fun)
+Hooks after the virtual function.
The callback signature is nil init_level(ThemeInfo self)
Virtual function docs:
Adds the entrance room and sets spawn_room_x/y. Sets the level size and toast for echoes feeling. Sets some other level_flags, shop related flags and shop_type.
+
+
+CallbackId
+set_pre_init_rooms(function fun)
+Hooks before the virtual function.
The callback signature is bool init_rooms(ThemeInfo self)
+
+
+CallbackId
+set_post_init_rooms(function fun)
+Hooks after the virtual function.
The callback signature is nil init_rooms(ThemeInfo self)
+
+
+CallbackId
+set_pre_generate_path(function fun)
+Hooks before the virtual function.
The callback signature is bool generate_path(ThemeInfo self, bool reset)
Virtual function docs:
Generates and adds the path rooms and exit room
Params: reset to start over from the beginning if other rooms didn't fit
+
+
+CallbackId
+set_post_generate_path(function fun)
+Hooks after the virtual function.
The callback signature is nil generate_path(ThemeInfo self, bool reset)
Virtual function docs:
Generates and adds the path rooms and exit room
Params: reset to start over from the beginning if other rooms didn't fit
+
+
+CallbackId
+set_pre_special_rooms(function fun)
+Hooks before the virtual function.
The callback signature is bool special_rooms(ThemeInfo self)
+
+
+CallbackId
+set_post_special_rooms(function fun)
+Hooks after the virtual function.
The callback signature is nil special_rooms(ThemeInfo self)
+
+
+CallbackId
+set_pre_player_coffin(function fun)
+Hooks before the virtual function.
The callback signature is bool player_coffin(ThemeInfo self)
+
+
+CallbackId
+set_post_player_coffin(function fun)
+Hooks after the virtual function.
The callback signature is nil player_coffin(ThemeInfo self)
+
+
+CallbackId
+set_pre_dirk_coffin(function fun)
+Hooks before the virtual function.
The callback signature is bool dirk_coffin(ThemeInfo self)
+
+
+CallbackId
+set_post_dirk_coffin(function fun)
+Hooks after the virtual function.
The callback signature is nil dirk_coffin(ThemeInfo self)
+
+
+CallbackId
+set_pre_idol(function fun)
+Hooks before the virtual function.
The callback signature is bool idol(ThemeInfo self)
+
+
+CallbackId
+set_post_idol(function fun)
+Hooks after the virtual function.
The callback signature is nil idol(ThemeInfo self)
+
+
+CallbackId
+set_pre_vault(function fun)
+Hooks before the virtual function.
The callback signature is bool vault(ThemeInfo self)
+
+
+CallbackId
+set_post_vault(function fun)
+Hooks after the virtual function.
The callback signature is nil vault(ThemeInfo self)
+
+
+CallbackId
+set_pre_coffin(function fun)
+Hooks before the virtual function.
The callback signature is bool coffin(ThemeInfo self)
+
+
+CallbackId
+set_post_coffin(function fun)
+Hooks after the virtual function.
The callback signature is nil coffin(ThemeInfo self)
+
+
+CallbackId
+set_pre_feeling(function fun)
+Hooks before the virtual function.
The callback signature is bool feeling(ThemeInfo self)
+
+
+CallbackId
+set_post_feeling(function fun)
+Hooks after the virtual function.
The callback signature is nil feeling(ThemeInfo self)
+
+
+CallbackId
+set_pre_spawn_level(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_level(ThemeInfo self)
Virtual function docs:
Calls many other theme functions to spawn the floor, enemies, items etc, but not background and players. (Disable this to only spawn background and players.)
+
+
+CallbackId
+set_post_spawn_level(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_level(ThemeInfo self)
Virtual function docs:
Calls many other theme functions to spawn the floor, enemies, items etc, but not background and players. (Disable this to only spawn background and players.)
+
+
+CallbackId
+set_pre_spawn_border(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_border(ThemeInfo self)
Virtual function docs:
Spawns the border entities (some floor or teleportingborder)
+
+
+CallbackId
+set_post_spawn_border(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_border(ThemeInfo self)
Virtual function docs:
Spawns the border entities (some floor or teleportingborder)
+
+
+CallbackId
+set_pre_post_process_level(function fun)
+Hooks before the virtual function.
The callback signature is bool post_process_level(ThemeInfo self)
Virtual function docs:
Theme specific specialties like randomizing ushabti and Coco coffin location, spawns impostor lakes
+
+
+CallbackId
+set_post_post_process_level(function fun)
+Hooks after the virtual function.
The callback signature is nil post_process_level(ThemeInfo self)
Virtual function docs:
Theme specific specialties like randomizing ushabti and Coco coffin location, spawns impostor lakes
+
+
+CallbackId
+set_pre_spawn_traps(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_traps(ThemeInfo self)
Virtual function docs:
Spawns theme specific random traps, pushblocks and critters. Sets special exit doors.
+
+
+CallbackId
+set_post_spawn_traps(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_traps(ThemeInfo self)
Virtual function docs:
Spawns theme specific random traps, pushblocks and critters. Sets special exit doors.
+
+
+CallbackId
+set_pre_post_process_entities(function fun)
+Hooks before the virtual function.
The callback signature is bool post_process_entities(ThemeInfo self)
Virtual function docs:
Fixes textures on pleasure palace ladders, adds some decorations
+
+
+CallbackId
+set_post_post_process_entities(function fun)
+Hooks after the virtual function.
The callback signature is nil post_process_entities(ThemeInfo self)
Virtual function docs:
Fixes textures on pleasure palace ladders, adds some decorations
+
+
+CallbackId
+set_pre_spawn_procedural(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_procedural(ThemeInfo self)
Virtual function docs:
Adds legs under platforms, random pots, goldbars, monsters, compass indicator, random shadows...
+
+
+CallbackId
+set_post_spawn_procedural(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_procedural(ThemeInfo self)
Virtual function docs:
Adds legs under platforms, random pots, goldbars, monsters, compass indicator, random shadows...
+
+
+CallbackId
+set_pre_spawn_background(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_background(ThemeInfo self)
Virtual function docs:
Adds the main level background , e.g. CO stars / Duat moon / Plain backwall for other themes
+
+
+CallbackId
+set_post_spawn_background(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_background(ThemeInfo self)
Virtual function docs:
Adds the main level background , e.g. CO stars / Duat moon / Plain backwall for other themes
+
+
+CallbackId
+set_pre_spawn_lights(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_lights(ThemeInfo self)
Virtual function docs:
Adds room lights to udjat chest room or black market
+
+
+CallbackId
+set_post_spawn_lights(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_lights(ThemeInfo self)
Virtual function docs:
Adds room lights to udjat chest room or black market
+
+
+CallbackId
+set_pre_spawn_transition(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_transition(ThemeInfo self)
Virtual function docs:
Spawns the transition tunnel and players in it
+
+
+CallbackId
+set_post_spawn_transition(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_transition(ThemeInfo self)
Virtual function docs:
Spawns the transition tunnel and players in it
+
+
+CallbackId
+set_pre_post_transition(function fun)
+Hooks before the virtual function.
The callback signature is bool post_transition(ThemeInfo self)
Virtual function docs:
Handles loading the next level screen from a transition screen
+
+
+CallbackId
+set_post_post_transition(function fun)
+Hooks after the virtual function.
The callback signature is nil post_transition(ThemeInfo self)
Virtual function docs:
Handles loading the next level screen from a transition screen
+
+
+CallbackId
+set_pre_spawn_players(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_players(ThemeInfo self)
Virtual function docs:
Spawns the players with inventory at state.level_gen.spawn_x/y
. Also shop and kali background and probably other stuff for some stupid reason.
+
+
+CallbackId
+set_post_spawn_players(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_players(ThemeInfo self)
Virtual function docs:
Spawns the players with inventory at state.level_gen.spawn_x/y
. Also shop and kali background and probably other stuff for some stupid reason.
+
+
+CallbackId
+set_pre_spawn_effects(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_effects(ThemeInfo self)
Virtual function docs:
Sets the camera bounds and position. Spawns jelly and orbs and the flag in coop. Sets timers/conditions for more jellies and ghosts. Enables the special fog/ember/ice etc particle effects.
+
+
+CallbackId
+set_post_spawn_effects(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_effects(ThemeInfo self)
Virtual function docs:
Sets the camera bounds and position. Spawns jelly and orbs and the flag in coop. Sets timers/conditions for more jellies and ghosts. Enables the special fog/ember/ice etc particle effects.
+
+
+CallbackId
+set_pre_theme_id(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> theme_id(ThemeInfo self)
+
+
+CallbackId
+set_post_theme_id(function fun)
+Hooks after the virtual function.
The callback signature is nil theme_id(ThemeInfo self)
+
+
+CallbackId
+set_pre_base_id(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> base_id(ThemeInfo self)
+
+
+CallbackId
+set_post_base_id(function fun)
+Hooks after the virtual function.
The callback signature is nil base_id(ThemeInfo self)
+
+
+CallbackId
+set_pre_ent_floor_spreading(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> ent_floor_spreading(ThemeInfo self)
+
+
+CallbackId
+set_post_ent_floor_spreading(function fun)
+Hooks after the virtual function.
The callback signature is nil ent_floor_spreading(ThemeInfo self)
+
+
+CallbackId
+set_pre_ent_floor_spreading2(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> ent_floor_spreading2(ThemeInfo self)
+
+
+CallbackId
+set_post_ent_floor_spreading2(function fun)
+Hooks after the virtual function.
The callback signature is nil ent_floor_spreading2(ThemeInfo self)
+
+
+CallbackId
+set_pre_transition_styled_floor(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> transition_styled_floor(ThemeInfo self)
+
+
+CallbackId
+set_post_transition_styled_floor(function fun)
+Hooks after the virtual function.
The callback signature is nil transition_styled_floor(ThemeInfo self)
+
+
+CallbackId
+set_pre_transition_modifier(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> transition_modifier(ThemeInfo self)
+
+
+CallbackId
+set_post_transition_modifier(function fun)
+Hooks after the virtual function.
The callback signature is nil transition_modifier(ThemeInfo self)
+
+
+CallbackId
+set_pre_ent_transition_styled_floor(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> ent_transition_styled_floor(ThemeInfo self)
+
+
+CallbackId
+set_post_ent_transition_styled_floor(function fun)
+Hooks after the virtual function.
The callback signature is nil ent_transition_styled_floor(ThemeInfo self)
+
+
+CallbackId
+set_pre_ent_backwall(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> ent_backwall(ThemeInfo self)
+
+
+CallbackId
+set_post_ent_backwall(function fun)
+Hooks after the virtual function.
The callback signature is nil ent_backwall(ThemeInfo self)
+
+
+CallbackId
+set_pre_ent_border(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> ent_border(ThemeInfo self)
+
+
+CallbackId
+set_post_ent_border(function fun)
+Hooks after the virtual function.
The callback signature is nil ent_border(ThemeInfo self)
+
+
+CallbackId
+set_pre_ent_critter(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> ent_critter(ThemeInfo self)
+
+
+CallbackId
+set_post_ent_critter(function fun)
+Hooks after the virtual function.
The callback signature is nil ent_critter(ThemeInfo self)
+
+
+CallbackId
+set_pre_gravity(function fun)
+Hooks before the virtual function.
The callback signature is optional<float> gravity(ThemeInfo self)
+
+
+CallbackId
+set_post_gravity(function fun)
+Hooks after the virtual function.
The callback signature is nil gravity(ThemeInfo self)
+
+
+CallbackId
+set_pre_player_damage(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> player_damage(ThemeInfo self)
+
+
+CallbackId
+set_post_player_damage(function fun)
+Hooks after the virtual function.
The callback signature is nil player_damage(ThemeInfo self)
+
+
+CallbackId
+set_pre_soot(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> soot(ThemeInfo self)
+
+
+CallbackId
+set_post_soot(function fun)
+Hooks after the virtual function.
The callback signature is nil soot(ThemeInfo self)
+
+
+CallbackId
+set_pre_texture_backlayer_lut(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> texture_backlayer_lut(ThemeInfo self)
+
+
+CallbackId
+set_post_texture_backlayer_lut(function fun)
+Hooks after the virtual function.
The callback signature is nil texture_backlayer_lut(ThemeInfo self)
+
+
+CallbackId
+set_pre_backlayer_light_level(function fun)
+Hooks before the virtual function.
The callback signature is optional<float> backlayer_light_level(ThemeInfo self)
+
+
+CallbackId
+set_post_backlayer_light_level(function fun)
+Hooks after the virtual function.
The callback signature is nil backlayer_light_level(ThemeInfo self)
+
+
+CallbackId
+set_pre_loop(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> loop(ThemeInfo self)
+
+
+CallbackId
+set_post_loop(function fun)
+Hooks after the virtual function.
The callback signature is nil loop(ThemeInfo self)
+
+
+CallbackId
+set_pre_vault_level(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> vault_level(ThemeInfo self)
+
+
+CallbackId
+set_post_vault_level(function fun)
+Hooks after the virtual function.
The callback signature is nil vault_level(ThemeInfo self)
+
+
+CallbackId
+set_pre_theme_flag(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> theme_flag(ThemeInfo self, int)
+
+
+CallbackId
+set_post_theme_flag(function fun)
+Hooks after the virtual function.
The callback signature is nil theme_flag(ThemeInfo self, int)
+
+
+CallbackId
+set_pre_texture_dynamic(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> texture_dynamic(ThemeInfo self, int)
+
+
+CallbackId
+set_post_texture_dynamic(function fun)
+Hooks after the virtual function.
The callback signature is nil texture_dynamic(ThemeInfo self, int)
+
+
+CallbackId
+set_pre_pre_transition(function fun)
+Hooks before the virtual function.
The callback signature is bool pre_transition(ThemeInfo self)
Virtual function docs:
Sets state.level_next, world_next and theme_next (or state.win_state) based on level number. Runs when exiting a level.
+
+
+CallbackId
+set_post_pre_transition(function fun)
+Hooks after the virtual function.
The callback signature is nil pre_transition(ThemeInfo self)
Virtual function docs:
Sets state.level_next, world_next and theme_next (or state.win_state) based on level number. Runs when exiting a level.
+
+
+CallbackId
+set_pre_exit_room_y_level(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> exit_room_y_level(ThemeInfo self)
+
+
+CallbackId
+set_post_exit_room_y_level(function fun)
+Hooks after the virtual function.
The callback signature is nil exit_room_y_level(ThemeInfo self)
+
+
+CallbackId
+set_pre_shop_chance(function fun)
+Hooks before the virtual function.
The callback signature is optional<int> shop_chance(ThemeInfo self)
+
+
+CallbackId
+set_post_shop_chance(function fun)
+Hooks after the virtual function.
The callback signature is nil shop_chance(ThemeInfo self)
+
+
+CallbackId
+set_pre_spawn_decoration(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_decoration(ThemeInfo self)
Virtual function docs:
Spawns some specific decoration, e.g. Vlad's big banner
+
+
+CallbackId
+set_post_spawn_decoration(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_decoration(ThemeInfo self)
Virtual function docs:
Spawns some specific decoration, e.g. Vlad's big banner
+
+
+CallbackId
+set_pre_spawn_decoration2(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_decoration2(ThemeInfo self)
Virtual function docs:
Spawns some other specific decorations, e.g. grass, flowers, udjat room decal
+
+
+CallbackId
+set_post_spawn_decoration2(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_decoration2(ThemeInfo self)
Virtual function docs:
Spawns some other specific decorations, e.g. grass, flowers, udjat room decal
+
+
+CallbackId
+set_pre_spawn_extra(function fun)
+Hooks before the virtual function.
The callback signature is bool spawn_extra(ThemeInfo self)
Virtual function docs:
Spawns specific extra entities and decorations, like gold key, seaweed, lanterns, banners, signs, wires...
+
+
+CallbackId
+set_post_spawn_extra(function fun)
+Hooks after the virtual function.
The callback signature is nil spawn_extra(ThemeInfo self)
Virtual function docs:
Spawns specific extra entities and decorations, like gold key, seaweed, lanterns, banners, signs, wires...
+
+
+CallbackId
+set_pre_do_procedural_spawn(function fun)
+Hooks before the virtual function.
The callback signature is bool do_procedural_spawn(ThemeInfo self, SpawnInfo info)
Virtual function docs:
Spawns a single procedural entity, used in spawn_procedural
+
+
+CallbackId
+set_post_do_procedural_spawn(function fun)
+Hooks after the virtual function.
The callback signature is nil do_procedural_spawn(ThemeInfo self, SpawnInfo info)
Virtual function docs:
Spawns a single procedural entity, used in spawn_procedural
+
+
+Entity types
Background entities
BGBackLayerDoor
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+illumination1
+
+
+
+Illumination
+illumination2
+
+
+
+BGEggshipRoom
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+Entity
+fx_shell
+
+
+
+Entity
+fx_door
+
+
+
+Entity
+platform_left
+
+
+
+Entity
+platform_middle
+
+
+
+Entity
+platform_right
+
+
+
+bool
+player_in
+
+
+
+BGFloatingDebris
+Derived from Entity BGSurfaceLayer
+
+
+
+Type
+Name
+Description
+
+
+
+float
+distance
+Distance it travels up and down from spawn position
+
+
+float
+speed
+
+
+
+float
+sine_angle
+
+
+
+BGMovingStar
+Derived from Entity BGSurfaceStar
+
+
+
+Type
+Name
+Description
+
+
+
+float
+falling_speed
+Can make it rise if set to negative
+
+
+BGRelativeElement
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+float
+relative_x
+
+
+
+float
+relative_y
+
+
+
+BGShootingStar
+Derived from Entity BGRelativeElement
+
+
+
+Type
+Name
+Description
+
+
+
+float
+x_increment
+
+
+
+float
+y_increment
+
+
+
+int
+timer
+
+
+
+int
+max_timer
+
+
+
+float
+size
+Gets smaller as the timer gets close to the max_timer
+
+
+BGShopEntrence
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+on_entering
+
+
+
+BGShopKeeperPrime
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+float
+normal_y
+
+
+
+float
+sine_pos
+
+
+
+int
+bubbles_timer
+
+
+
+bool
+bubble_spawn_trigger
+
+
+
+int
+bubble_spawn_delay
+
+
+
+BGSurfaceLayer
+Derived from Entity BGRelativeElement
+
+
+
+Type
+Name
+Description
+
+
+
+float
+relative_offset_x
+
+
+
+float
+relative_offset_y
+
+
+
+BGSurfaceStar
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+blink_timer
+
+
+
+float
+relative_x
+
+
+
+float
+relative_y
+
+
+
+BGTutorialSign
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+is_shown
+
+
+
+DestructibleBG
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+Effect entities
BurningRopeEffect
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+illumination
+
+
+
+SoundMeta
+sound
+
+
+
+CursedEffect
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+SoundMeta
+sound
+
+
+
+FrostBreathEffect
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+OnFireEffect
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+ParticleEmitterInfo
+particle_smoke
+
+
+
+ParticleEmitterInfo
+particle_flame
+
+
+
+Illumination
+illumination
+
+
+
+PoisonedEffect
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+ParticleEmitterInfo
+particle_burst
+
+
+
+ParticleEmitterInfo
+particle_base
+
+
+
+int
+burst_timer
+
+
+
+bool
+burst_active
+If forced to false, it will not play the sound or spawn burst particles
+
+
+WetEffect
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+Floor entities
Altar
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+for normal altar: counts from 0 to 20 then 0, then 1 then 0 and sacrifice happens
+
+
+Arrowtrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+arrow_shot
+
+
+
+nil
+rearm()
+
+
+
+nil
+trigger(int who_uid)
+The uid must be movable entity for ownership transfers
+
+
+BigSpearTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+spear_uid
+
+
+
+bool
+left_part
+setting the left part to 0 or right part to 1 destroys the trap
+
+
+nil
+trigger(int who_uid, bool left)
+The uid must be movable entity for ownership transfers, has to be called on the left part of the trap,
+
+
+CityOfGoldDoor
+Derived from Entity Floor Door ExitDoor DecoratedDoor
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+unlocked
+
+
+
+ConveyorBelt
+Derived from Entity Floor TransferFloor
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+DecoratedDoor
+Derived from Entity Floor Door ExitDoor
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+special_bg
+
+
+
+Door
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+counter
+
+
+
+Entity
+fx_button
+
+
+
+int
+enter(Entity who)
+
+
+
+bool
+is_unlocked()
+Will alwyas return true
for exits, layers and others that the game never locks, even if you lock it with unlock
function
+
+
+nil
+unlock(bool unlock)
+Lock/Unlock doors
+
+
+EggShipDoor
+Derived from Entity Floor Door
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+EggShipDoorS
+Derived from Entity Floor Door EggShipDoor
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+entered
+
+
+
+ExitDoor
+Derived from Entity Floor Door
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+entered
+if true entering it does not load the transition
+
+
+bool
+special_door
+use provided world/level/theme
+
+
+int
+level
+
+
+
+int
+timer
+
+
+
+int
+world
+
+
+
+int
+theme
+
+
+
+Floor
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+deco_top
+
+
+
+int
+deco_bottom
+
+
+
+int
+deco_left
+
+
+
+int
+deco_right
+
+
+
+nil
+fix_border_tile_animation()
+Sets animation_frame
of the floor for types FLOOR_BORDERTILE
, FLOOR_BORDERTILE_METAL
and FLOOR_BORDERTILE_OCTOPUS
.
+
+
+nil
+fix_decorations(bool fix_also_neighbors, bool fix_styled_floor)
+Used to add decoration to a floor entity after it was spawned outside of level gen, is not necessary when spawning during level gen.
Set fix_also_neighbours
to true
to fix the neighbouring floor tile decorations on the border of the two tiles.
Set fix_styled_floor
to true
to fix decorations on FLOORSTYLED_
entities, those usually only have decorations when broken.
+
+
+nil
+add_decoration(FLOOR_SIDE side)
+Explicitly add a decoration on the given side. Corner decorations only exist for FLOOR_BORDERTILE
and FLOOR_BORDERTILE_OCTOPUS
.
+
+
+nil
+remove_decoration(FLOOR_SIDE side)
+Explicitly remove a decoration on the given side. Corner decorations only exist for FLOOR_BORDERTILE
and FLOOR_BORDERTILE_OCTOPUS
.
+
+
+nil
+decorate_internal()
+
+
+
+ENT_TYPE
+get_floor_type()
+Returns it's ENT_TYPE except for FLOOR_PEN (returns FLOORSTYLED_MINEWOOD) and FLOOR_QUICKSAND, FLOOR_TOMB, FLOOR_EMPRESS_GRAVE which return FLOOR_GENERIC
+
+
+CallbackId
+set_pre_virtual(ENTITY_OVERRIDE entry, function fun)
+Hooks before the virtual function at index entry
.
+
+
+CallbackId
+set_post_virtual(ENTITY_OVERRIDE entry, function fun)
+Hooks after the virtual function at index entry
.
+
+
+nil
+clear_virtual(CallbackId callback_id)
+Clears the hook given by callback_id
, alternatively use clear_callback()
inside the hook.
+
+
+CallbackId
+set_pre_floor_update(function fun)
+Hooks before the virtual function.
The callback signature is bool floor_update(Floor self)
+
+
+CallbackId
+set_post_floor_update(function fun)
+Hooks after the virtual function.
The callback signature is nil floor_update(Floor self)
+
+
+ForceField
+
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+first_item_beam
+
+
+
+Entity
+fx
+
+
+
+SoundMeta
+sound
+
+
+
+Illumination
+emitted_light
+
+
+
+bool
+is_on
+
+
+
+nil
+activate_laserbeam(bool turn_on)
+
+
+
+Generator
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+spawned_uid
+
+
+
+int
+set_timer
+
+
+
+int
+timer
+
+
+
+int
+start_counter
+works only for star challenge
+
+
+bool
+on_off
+works only for star challenge
+
+
+HorizontalForceField
+
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+first_item_beam
+
+
+
+Entity
+fx
+
+
+
+SoundMeta
+sound
+
+
+
+int
+timer
+
+
+
+bool
+is_on
+
+
+
+JungleSpearTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+nil
+trigger(int who_uid, int direction)
+The uid must be movable entity for ownership transfers, direction: 1 = left, 2 = right, 3 = up, 4 = down
+
+
+LaserTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+int
+timer
+counts up from 0 after triggering, cannot shoot again until 360
+
+
+nil
+trigger(int who_uid)
+The uid must be movable entity for ownership transfers
+
+
+LockedDoor
+Derived from Entity Floor Door
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+unlocked
+
+
+
+MainExit
+Derived from Entity Floor Door ExitDoor
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+Entity
+door_blocker
+Normally FX_MAIN_EXIT_DOOR
but setting any entity here will block the door
+
+
+MotherStatue
+
+
+
+
+Type
+Name
+Description
+
+
+
+array<bool, 4>
+players_standing
+Table of player1_standing, player2_standing, ... etc.
+
+
+bool
+player1_standing
+
+
+
+bool
+player2_standing
+
+
+
+bool
+player3_standing
+
+
+
+bool
+player4_standing
+
+
+
+array<bool, 4>
+players_health_received
+Table of player1_health_received, player2_health_received, ... etc.
+
+
+bool
+player1_health_received
+
+
+
+bool
+player2_health_received
+
+
+
+bool
+player3_health_received
+
+
+
+bool
+player4_health_received
+
+
+
+array<int, 4>
+players_health_timer
+Table of player1_health_timer, player2_health_timer, ... etc.
+
+
+int
+player1_health_timer
+
+
+
+int
+player2_health_timer
+
+
+
+int
+player3_health_timer
+
+
+
+int
+player4_health_timer
+
+
+
+int
+eggplantchild_timer
+
+
+
+bool
+eggplantchild_detected
+
+
+
+Pipe
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+direction_type
+3 - straight_horizontal, 4 - blocked, 5 - down_left_turn, 6 - down_right_turn, 8 - blocked, 9 - up_left_turn, 10 - up_right_turn, 12 - straight_vertical
+
+
+bool
+end_pipe
+
+
+
+PoleDeco
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+deco_up
+
+
+
+int
+deco_down
+
+
+
+QuickSand
+
+
+
+
+Type
+Name
+Description
+
+
+
+SlidingWallCeiling
+
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+attached_piece
+
+
+
+int
+active_floor_part_uid
+
+
+
+int
+state
+1 - going up / is at the top, 2 - pause
+
+
+SoundMeta
+ball_rise
+
+
+
+SoundMeta
+ball_drop
+
+
+
+SparkTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+int
+spark_uid
+
+
+
+SpikeballTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+Entity
+chain
+
+
+
+Entity
+end_piece
+
+
+
+int
+state
+0 - none, 1 - start, 2 - going_down, 3 - going_up, 4 - pause; going_up is only right when timer is 0, otherwise it just sits at the bottom
+
+
+int
+timer
+for the start and retract
+
+
+StickyTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+attached_piece_uid
+
+
+
+int
+ball_uid
+
+
+
+int
+state
+0 - none, 1 - start, 2 - going down, 3 - is at the bottom, 4 - going up, 5 - pause
+
+
+int
+timer
+
+
+
+TeleportingBorder
+
-
-table
if the script has exports
-nil
if the script was found but has no exports
-false
if the script was not found but optional is set to true
-- an error if the script was not found and the optional argument was not set
-
-intersection
-
-Search script examples for intersection
-
-Vec2 intersection(const Vec2 A, const Vec2 B, const Vec2 C, const Vec2 D)
-Find intersection point of two lines [A, B] and [C, D], returns INFINITY if the lines don't intersect each other [parallel]
-is_character_female
-
-Search script examples for is_character_female
-
-bool is_character_female(ENT_TYPE type_id)
-Same as Player.is_female
-list_char_mods
-
-Search script examples for list_char_mods
-
-nil list_char_mods()
-List all char.png files recursively from Mods/Packs. Returns table of file paths.
-list_dir
-
-Search script examples for list_dir
-
-nil list_dir(string dir)
-List files in directory relative to the script root. Returns table of file/directory names or nil if not found.
-load_death_screen
-
-Search script examples for load_death_screen
-
-nil load_death_screen()
-Immediately ends the run with the death screen, also calls the save_progress
-load_screen
-
-Search script examples for load_screen
-
-nil load_screen()
-Immediately load a screen based on state.screen_next and stuff
-lowbias32
-
-Search script examples for lowbias32
-
-int lowbias32(int x)
-Some random hash function
-lowbias32_r
-
-Search script examples for lowbias32_r
-
-int lowbias32_r(int x)
-Reverse of some random hash function
-pause
-
-Search script examples for pause
-
-nil pause(bool p)
-Pause/unpause the game.
-This is just short for state.pause == 32
, but that produces an audio bug
-I suggest state.pause == 2
, but that won't run any callback, state.pause == 16
will do the same but set_global_interval will still work
-register_console_command
-
-Search script examples for register_console_command
-
-nil register_console_command(string name, function cmd)
-Adds a command that can be used in the console.
-rgba
-
-Search script examples for rgba
-
-uColor rgba(int r, int g, int b, int a)
-Converts a color to int to be used in drawing functions. Use values from 0..255
.
-save_progress
-
-Search script examples for save_progress
-
-bool save_progress()
-Saves the game to savegame.sav, unless game saves are blocked in the settings. Also runs the ON.SAVE callback. Fails and returns false, if you're trying to save too often (2s).
-save_script
-
-Search script examples for save_script
-
-bool save_script()
-Runs the ON.SAVE callback. Fails and returns false, if you're trying to save too often (2s).
-script_enabled
-
-Search script examples for script_enabled
-
-bool script_enabled(string id, string version = "")
-Check if another script is enabled by id "author/name". You should probably check this after all the other scripts have had a chance to load.
-seed_prng
-
-Search script examples for seed_prng
-
-nil seed_prng(int seed)
-Seed the game prng.
-set_adventure_seed
-
-Search script examples for set_adventure_seed
-
-nil set_adventure_seed(int first, int second)
-Set the current adventure seed pair
-set_character_heart_color
-
-Search script examples for set_character_heart_color
-
-nil set_character_heart_color(ENT_TYPE type_id, Color color)
-Same as Player.set_heart_color
-set_ending_unlock
-- change character unlocked by endings to pilot
-set_ending_unlock(ENT_TYPE.CHAR_PILOT)
+
+
+Type
+Name
+Description
+
+
+
+int
+direction
+0 - right, 1 - left, 2 - bottom, 3 - top, 4 - disable
+
+
+TentacleBottom
+
+
+
+
+Type
+Name
+Description
+
+
+
+int
+attached_piece_uid
+
+
+
+int
+tentacle_uid
+
+
+
+int
+state
+0 - none, 1 - start, 2 - moving up, 3 - at the top, 4 - moving down 5 - pause
+
+
+TimedForceField
+Derived from Entity Floor ForceField
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+bool
+pause
+
+
+
+TotemTrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+ENT_TYPE
+spawn_entity_type
+
+
+
+int
+first_sound_id
+
+
+
+nil
+trigger(int who_uid, bool left)
+The uid must be movable entity for ownership transfers
+
+
+TransferFloor
+
+
+
+
+Type
+Name
+Description
+
+
+
+map<int, int>
+transferred_entities
+Index is the uid, value is frame the entity entered the floor (time_level), use pairs
to loop thru
+
+
+Generic entities
BoulderSpawner
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+Can be set negative for longer time period, spawns boulder at 150, setting it higher with count to overflow
+
+
+SoundMeta
+sound
+
+
+
+CameraFlash
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+illumination1
+
+
+
+Illumination
+illumination2
+
+
+
+int
+timer
+
+
+
+CinematicAnchor
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+blackbar_top
+
+
+
+Entity
+blackbar_bottom
+
+
+
+float
+roll_in
+0.0 to 1.0
+
+
+CrossBeam
+Derived from Entity
--- change texture of the actual savior in endings to pilot
-set_callback(function()
- set_post_entity_spawn(function(ent)
- if state.screen == SCREEN.WIN then
- ent:set_texture(TEXTURE.DATA_TEXTURES_CHAR_PINK_0)
- end
- clear_callback()
- end, SPAWN_TYPE.SYSTEMIC, MASK.PLAYER)
-end, ON.WIN)
+
+
+Type
+Name
+Description
+
+
+
+int
+attached_to_side_uid
+
+
+
+int
+attached_to_top_uid
+
+
+
+DMAlienBlast
+Derived from Entity
-
-
-Search script examples for set_ending_unlock
-
-nil set_ending_unlock(ENT_TYPE type)
-Force the character unlocked in either ending to ENT_TYPE. Set to 0 to reset to the default guys. Does not affect the texture of the actual savior. (See example)
-set_journal_enabled
-
-Search script examples for set_journal_enabled
-
-nil set_journal_enabled(bool b)
-Enables or disables the journal
-set_level_config
-
-Search script examples for set_level_config
-
-nil set_level_config(LEVEL_CONFIG config, int value)
-Set the value for the specified config
-set_mask
-
-Search script examples for set_mask
-
-Flags set_mask(Flags flags, Flags mask)
-Set a bitmask in a number. This doesn't actually change the variable you pass, it just returns the new value you can use.
-set_seed
-
-Search script examples for set_seed
-
-nil set_seed(int seed)
-Set seed and reset run.
-set_setting
-- set some visual settings needed by your mod
--- doing this here will reapply these after visiting the options, which would reset them to real values
+
+
+Type
+Name
+Description
+
+
+
+int
+owner_uid
+
+
+
+int
+timer
+
+
+
+SoundMeta
+sound
+
+
+
+Entity
+reticule_internal
+
+
+
+Entity
+reticule_external
+
+
+
+DMSpawning
+Derived from Entity
-set_callback(function()
- if state.screen_next == SCREEN.LEVEL then
- -- use the secret tiny hud size
- set_setting(GAME_SETTING.HUD_SIZE, 3)
- -- force opaque textboxes
- set_setting(GAME_SETTING.TEXTBOX_OPACITY, 0)
- end
-end, ON.PRE_LOAD_SCREEN)
+
+
+Type
+Name
+Description
+
+
+
+float
+spawn_x
+
+
+
+float
+spawn_y
+
+
+
+float
+sine_pos
+
+
+
+int
+timer
+
+
+
+DecoRegeneratingBlock
+Derived from Entity
-
-
-Search script examples for set_setting
-
-bool set_setting(GAME_SETTING setting, int value)
-Sets the specified setting temporarily. These values are not saved and might reset to the users real settings if they visit the options menu. (Check example.) All settings are available in unsafe mode and only a smaller subset SAFE_SETTING by default for Hud and other visuals. Returns false, if setting failed.
-set_storage_layer
-- Sets the right layer when using the vanilla tile code if waddler is still happy,
--- otherwise spawns the floor to the left of this tile.
--- Manually spawning FLOOR_STORAGE pre-tilecode doesn't seem to work as expected,
--- so we destroy it post-tilecode.
-set_post_tile_code_callback(function(x, y, layer)
- if not test_flag(state.quest_flags, 10) then
- -- Just set the layer and let the vanilla tilecode handle the floor
- set_storage_layer(layer)
- else
- local floor = get_entity(get_grid_entity_at(x, y, layer))
- if floor then
- floor:destroy()
- end
- if get_grid_entity_at(x - 1, y, layer) ~= -1 then
- local left = get_entity(get_grid_entity_at(x - 1, y, layer))
- spawn_grid_entity(left.type.id, x, y, layer)
- end
- end
-end, "storage_floor")
+
+
+Type
+Name
+Description
+
+
+
+DustWallApep
+Derived from Entity
--- This fixes a bug in the game that breaks storage on transition.
--- The old storage_uid is not cleared after every level for some reason.
-set_callback(function()
- state.storage_uid = -1
-end, ON.TRANSITION)
+
+
+Type
+Name
+Description
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+EggplantThrower
+Derived from Entity
--- Having a waddler is completely optional for storage,
--- but this makes a nice waddler room if he still likes you.
-define_tile_code("waddler")
-set_pre_tile_code_callback(function(x, y, layer)
- if not test_flag(state.quest_flags, 10) then
- local uid = spawn_roomowner(ENT_TYPE.MONS_STORAGEGUY, x + 0.5, y, layer, ROOM_TEMPLATE.WADDLER)
- set_on_kill(uid, function()
- -- Disable current level storage if you kill waddler
- state.storage_uid = -1
- end)
- end
- return true
-end, "waddler")
+
+
+Type
+Name
+Description
+
+
+
+Entity
+
+
+Type
+Name
+Description
+
+
+
+EntityDB
+type
+Type of the entity, contains special properties etc. If you want to edit them just for this entity look at the EntityDB
+
+
+Entity
+overlay
+
+
+
+ENT_FLAG
+flags
+see flags.hpp entity_flags
+
+
+ENT_MORE_FLAG
+more_flags
+see flags.hpp more_flags
+
+
+int
+uid
+Unique id of the entity, save it to variable to check this entity later (don't use the whole Entity type as it will be replaced with a different one when this is destroyed)
+
+
+int
+animation_frame
+Number (id) of the sprite in the texture
+
+
+int
+draw_depth
+Depth level that this entity is drawn on.
Don't edit this directly, use set_draw_depth
function
+
+
+float
+x
+Position of the entity in the world, or relative to overlay if attached to something. Use get_position to get real position of anything in the game world.
+
+
+float
+y
+Position of the entity in the world, or relative to overlay if attached to something. Use get_position to get real position of anything in the game world.
+
+
+float
+abs_x
+Absolute position in the world, even if overlaid. Should be the same as get_position. Read only.
+
+
+float
+abs_y
+Absolute position in the world, even if overlaid. Should be the same as get_position. Read only.
+
+
+int
+layer
+Use set_layer
to change
+
+
+float
+width
+Width of the sprite
+
+
+float
+height
+Height of the sprite
+
+
+float
+special_offsetx
+Special offset used for entities attached to others (or picked by others) that need to flip to the other side when the parent flips sides
+
+
+float
+special_offsety
+Special offset used for entities attached to others (or picked by others) that need to flip to the other side when the parent flips sides
+
+
+float
+tile_width
+Size of the sprite in the texture
+
+
+float
+tile_height
+Size of the sprite in the texture
+
+
+float
+angle
+
+
+
+Color
+color
+
+
+
+float
+hitboxx
+Half of the width of the hitbox
+
+
+float
+hitboxy
+Half of the height of the hitbox
+
+
+SHAPE
+shape
+
+
+
+bool
+hitbox_enabled
+
+
+
+float
+offsetx
+Offset of the hitbox in relation to the entity position
+
+
+float
+offsety
+Offset of the hitbox in relation to the entity position
+
+
+RenderInfo
+rendering_info
+
+
+
+any
+user_data
+You can put any arbitrary lua object here for custom entities or player stats, which is then saved across level transitions for players and carried items, mounts etc... This field is local to the script and multiple scripts can write different things in the same entity. The data is saved right before ON.PRE_LOAD_SCREEN from a level and loaded right before ON.POST_LOAD_SCREEN to a level or transition. It is not available yet in post_entity_spawn, but that is a good place to initialize it for new custom entities. See example for more.
+
+
+Entity
+topmost()
+
+
+
+Entity
+topmost_mount()
+
+
+
+bool
+overlaps_with(AABB hitbox)
+
+
+
+bool
+overlaps_with(float rect_left, float rect_bottom, float rect_right, float rect_top)
+Deprecated
Use overlaps_with(AABB hitbox)
instead
+
+
+bool
+overlaps_with(Entity other)
+
+
+
+TEXTURE
+get_texture()
+
+
+
+bool
+set_texture(TEXTURE texture_id)
+Changes the entity texture, check the textures.txt for available vanilla textures or use define_texture to make custom one
+
+
+nil
+set_draw_depth(int draw_depth)
+
+
+
+nil
+set_enable_turning(bool enabled)
+
+
+
+nil
+liberate_from_shop()
+
+
+
+Entity
+get_held_entity()
+
+
+
+nil
+set_layer(LAYER layer)
+Moves the entity to specified layer, nothing else happens, so this does not emulate a door transition
+
+
+nil
+remove()
+Moves the entity to the limbo-layer where it can later be retrieved from again via respawn
+
+
+nil
+respawn(LAYER layer)
+Moves the entity from the limbo-layer (where it was previously put by remove
) to layer
+
+
+nil
+kill(bool destroy_corpse, Entity responsible)
+Kills the entity, you can set responsible to nil
to ignore it
+
+
+nil
+destroy()
+Completely removes the entity from existence
+
+
+nil
+activate(Entity activator)
+Activates a button prompt (with the Use door/Buy button), e.g. buy shop item, activate drill, read sign, interact in camp, ... get_entity(<udjat socket uid>):activate(players[1])
(make sure player 1 has the udjat eye though)
+
+
+nil
+perform_teleport(int delta_x, int delta_y)
+Performs a teleport as if the entity had a teleporter and used it. The delta coordinates are where you want the entity to teleport to relative to its current position, in tiles (so integers, not floats). Positive numbers = to the right and up, negative left and down.
+
+
+bool
+trigger_action(Entity user)
+Triggers weapons and other held items like teleportter, mattock etc. You can check the virtual-availability.md, if entity has open
in the on_open
you can use this function, otherwise it does nothing. Returns false if action could not be performed (cooldown is not 0, no arrow loaded in etc. the animation could still be played thou)
+
+
+int
+get_metadata()
+e.g. for turkey: stores health, poison/curse state, for mattock: remaining swings (returned value is transferred)
+
+
+nil
+apply_metadata(int metadata)
+
+
+
+nil
+set_invisible(bool value)
+
+
+
+array<int>
+get_items()
+
+
+
+bool
+is_in_liquid()
+Returns true if entity is in water/lava
+
+
+bool
+is_cursed()
+
+
+
+CallbackId
+set_pre_virtual(ENTITY_OVERRIDE entry, function fun)
+Hooks before the virtual function at index entry
.
+
+
+CallbackId
+set_post_virtual(ENTITY_OVERRIDE entry, function fun)
+Hooks after the virtual function at index entry
.
+
+
+nil
+clear_virtual(CallbackId callback_id)
+Clears the hook given by callback_id
, alternatively use clear_callback()
inside the hook.
+
+
+CallbackId
+set_pre_dtor(function fun)
+Hooks before the virtual function.
The callback signature is nil dtor(Entity self)
+
+
+CallbackId
+set_post_dtor(function fun)
+Hooks after the virtual function.
The callback signature is nil dtor(Entity self)
+
+
+CallbackId
+set_pre_create_rendering_info(function fun)
+Hooks before the virtual function.
The callback signature is bool create_rendering_info(Entity self)
+
+
+CallbackId
+set_post_create_rendering_info(function fun)
+Hooks after the virtual function.
The callback signature is nil create_rendering_info(Entity self)
+
+
+CallbackId
+set_pre_update_state_machine(function fun)
+Hooks before the virtual function.
The callback signature is bool update_state_machine(Entity self)
+
+
+CallbackId
+set_post_update_state_machine(function fun)
+Hooks after the virtual function.
The callback signature is nil update_state_machine(Entity self)
+
+
+CallbackId
+set_pre_kill(function fun)
+Hooks before the virtual function.
The callback signature is bool kill(Entity self, bool destroy_corpse, Entity responsible)
Virtual function docs:
Kills the entity, you can set responsible to nil
to ignore it
+
+
+CallbackId
+set_post_kill(function fun)
+Hooks after the virtual function.
The callback signature is nil kill(Entity self, bool destroy_corpse, Entity responsible)
Virtual function docs:
Kills the entity, you can set responsible to nil
to ignore it
+
+
+CallbackId
+set_pre_on_collision1(function fun)
+Hooks before the virtual function.
The callback signature is bool on_collision1(Entity self, Entity other_entity)
+
+
+CallbackId
+set_post_on_collision1(function fun)
+Hooks after the virtual function.
The callback signature is nil on_collision1(Entity self, Entity other_entity)
+
+
+CallbackId
+set_pre_destroy(function fun)
+Hooks before the virtual function.
The callback signature is bool destroy(Entity self)
Virtual function docs:
Completely removes the entity from existence
+
+
+CallbackId
+set_post_destroy(function fun)
+Hooks after the virtual function.
The callback signature is nil destroy(Entity self)
Virtual function docs:
Completely removes the entity from existence
+
+
+CallbackId
+set_pre_can_be_pushed(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> can_be_pushed(Entity self)
+
+
+CallbackId
+set_post_can_be_pushed(function fun)
+Hooks after the virtual function.
The callback signature is nil can_be_pushed(Entity self)
+
+
+CallbackId
+set_pre_is_in_liquid(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> is_in_liquid(Entity self)
Virtual function docs:
Returns true if entity is in water/lava
+
+
+CallbackId
+set_post_is_in_liquid(function fun)
+Hooks after the virtual function.
The callback signature is nil is_in_liquid(Entity self)
Virtual function docs:
Returns true if entity is in water/lava
+
+
+CallbackId
+set_pre_set_invisible(function fun)
+Hooks before the virtual function.
The callback signature is bool set_invisible(Entity self, bool value)
+
+
+CallbackId
+set_post_set_invisible(function fun)
+Hooks after the virtual function.
The callback signature is nil set_invisible(Entity self, bool value)
+
+
+CallbackId
+set_pre_friction(function fun)
+Hooks before the virtual function.
The callback signature is optional<float> friction(Entity self)
+
+
+CallbackId
+set_post_friction(function fun)
+Hooks after the virtual function.
The callback signature is nil friction(Entity self)
+
+
+CallbackId
+set_pre_get_held_entity(function fun)
+Hooks before the virtual function.
The callback signature is optional<Entity> get_held_entity(Entity self)
+
+
+CallbackId
+set_post_get_held_entity(function fun)
+Hooks after the virtual function.
The callback signature is nil get_held_entity(Entity self)
+
+
+CallbackId
+set_pre_trigger_action(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> trigger_action(Entity self, Entity user)
Virtual function docs:
Triggers weapons and other held items like teleportter, mattock etc. You can check the virtual-availability.md, if entity has open
in the on_open
you can use this function, otherwise it does nothing. Returns false if action could not be performed (cooldown is not 0, no arrow loaded in etc. the animation could still be played thou)
+
+
+CallbackId
+set_post_trigger_action(function fun)
+Hooks after the virtual function.
The callback signature is nil trigger_action(Entity self, Entity user)
Virtual function docs:
Triggers weapons and other held items like teleportter, mattock etc. You can check the virtual-availability.md, if entity has open
in the on_open
you can use this function, otherwise it does nothing. Returns false if action could not be performed (cooldown is not 0, no arrow loaded in etc. the animation could still be played thou)
+
+
+CallbackId
+set_pre_activate(function fun)
+Hooks before the virtual function.
The callback signature is bool activate(Entity self, Entity activator)
Virtual function docs:
Activates a button prompt (with the Use door/Buy button), e.g. buy shop item, activate drill, read sign, interact in camp, ... get_entity(<udjat socket uid>):activate(players[1])
(make sure player 1 has the udjat eye though)
+
+
+CallbackId
+set_post_activate(function fun)
+Hooks after the virtual function.
The callback signature is nil activate(Entity self, Entity activator)
Virtual function docs:
Activates a button prompt (with the Use door/Buy button), e.g. buy shop item, activate drill, read sign, interact in camp, ... get_entity(<udjat socket uid>):activate(players[1])
(make sure player 1 has the udjat eye though)
+
+
+CallbackId
+set_pre_on_collision2(function fun)
+Hooks before the virtual function.
The callback signature is bool on_collision2(Entity self, Entity other_entity)
+
+
+CallbackId
+set_post_on_collision2(function fun)
+Hooks after the virtual function.
The callback signature is nil on_collision2(Entity self, Entity other_entity)
+
+
+CallbackId
+set_pre_walked_on(function fun)
+Hooks before the virtual function.
The callback signature is bool walked_on(Entity self, Entity*)
+
+
+CallbackId
+set_post_walked_on(function fun)
+Hooks after the virtual function.
The callback signature is nil walked_on(Entity self, Entity*)
+
+
+CallbackId
+set_pre_walked_off(function fun)
+Hooks before the virtual function.
The callback signature is bool walked_off(Entity self, Entity*)
+
+
+CallbackId
+set_post_walked_off(function fun)
+Hooks after the virtual function.
The callback signature is nil walked_off(Entity self, Entity*)
+
+
+CallbackId
+set_pre_ledge_grab(function fun)
+Hooks before the virtual function.
The callback signature is bool ledge_grab(Entity self, Entity*)
+
+
+CallbackId
+set_post_ledge_grab(function fun)
+Hooks after the virtual function.
The callback signature is nil ledge_grab(Entity self, Entity*)
+
+
+CallbackId
+set_pre_stood_on(function fun)
+Hooks before the virtual function.
The callback signature is bool stood_on(Entity self, Entity*)
+
+
+CallbackId
+set_post_stood_on(function fun)
+Hooks after the virtual function.
The callback signature is nil stood_on(Entity self, Entity*)
+
+
+CallbackId
+set_pre_init(function fun)
+Hooks before the virtual function.
The callback signature is bool init(Entity self)
+
+
+CallbackId
+set_post_init(function fun)
+Hooks after the virtual function.
The callback signature is nil init(Entity self)
+
+
+IceSlidingSound
+Derived from Entity LogicalSound
-
-
-Search script examples for set_storage_layer
-
-nil set_storage_layer(LAYER layer)
-Set layer to search for storage items on
-set_tiamat_cutscene_enabled
-
-Search script examples for set_tiamat_cutscene_enabled
-
-nil set_tiamat_cutscene_enabled(bool enable)
-Tiamat cutscene is also responsible for locking the exit door
-So you may need to close it yourself if you still want to be required to kill Tiamat
-show_journal
-
-Search script examples for show_journal
-
-nil show_journal(JOURNALUI_PAGE_SHOWN chapter, int page)
-Open the journal on a chapter and page. The main Journal spread is pages 0..1, so most chapters start at 2. Use even page numbers only.
-test_mask
-
-Search script examples for test_mask
-
-bool test_mask(Flags flags, Flags mask)
-Returns true if a bitmask is set in the number.
-toggle_journal
-
-Search script examples for toggle_journal
-
-nil toggle_journal()
-Open or close the journal as if pressing the journal button. Will respect visible journal popups and force_journal.
-two_lines_angle
-
-Search script examples for two_lines_angle
-
-float two_lines_angle(Vec2 A, Vec2 common, Vec2 B)
-Mesures angle between two lines with one common point
-float two_lines_angle(Vec2 line1_A, Vec2 line1_B, Vec2 line2_A, Vec2 line2_B)
-Gets line1_A, intersection point and line2_B and calls the 3 parameter version of this function
-update_liquid_collision_at
-
-Search script examples for update_liquid_collision_at
-
-nil update_liquid_collision_at(float x, float y, bool add)
-Updates the floor collisions used by the liquids, set add to false to remove tile of collision, set to true to add one
-warp
-
-Search script examples for warp
-
-nil warp(int w, int l, int t)
-Warp to a level immediately.
-Input functions
get_io
-
-Search script examples for get_io
-
-ImGuiIO get_io()
-Returns: ImGuiIO for raw keyboard, mouse and xinput gamepad stuff.
+
+
+Type
+Name
+Description
+
+
+
+JungleTrapTrigger
+Derived from Entity LogicalTrapTrigger
-
-- Note: The clicked/pressed actions only make sense in
ON.GUIFRAME
.
-- Note: Lua starts indexing at 1, you need
keysdown[string.byte('A') + 1]
to find the A key.
-- Note: Overlunky/etc will eat all keys it is currently configured to use, your script will only get leftovers.
-- Note: Gamepad is basically XINPUT_GAMEPAD but variables are renamed and values are normalized to -1.0..1.0 range.
-
-mouse_position
-
-Search script examples for mouse_position
-
-tuple<float, float> mouse_position()
-Current mouse cursor position in screen coordinates.
-return_input
-
-Search script examples for return_input
-
-nil return_input(int uid)
-Return input previously stolen with steal_input
-send_input
-
-Search script examples for send_input
-
-nil send_input(int uid, INPUTS buttons)
-Send input to entity, has to be previously stolen with steal_input
-steal_input
-
-Search script examples for steal_input
-
-nil steal_input(int uid)
-Steal input from a Player, HiredHand or PlayerGhost
-Lighting functions
create_illumination
-
-Search script examples for create_illumination
-
-Illumination create_illumination(Color color, float size, float x, float y)
Illumination create_illumination(Color color, float size, int uid)
-Creates a new Illumination. Don't forget to continuously call refresh_illumination, otherwise your light emitter fades out! Check out the illumination.lua script for an example
-refresh_illumination
-
-Search script examples for refresh_illumination
-
-nil refresh_illumination(Illumination illumination)
-Refreshes an Illumination, keeps it from fading out
-Message functions
cancel_speechbubble
-
-Search script examples for cancel_speechbubble
-
-nil cancel_speechbubble()
cancel_toast
-
-Search script examples for cancel_toast
-
-nil cancel_toast()
console_prinspect
-
-Search script examples for console_prinspect
-
-nil console_prinspect(variadic_args objects)
-Prinspect to ingame console.
-console_print
-
-Search script examples for console_print
-
-nil console_print(string message)
-Print a log message to ingame console.
-log_print
-
-Search script examples for log_print
-
-nil log_print(string message)
-Log to spelunky.log
-lua_print
-
-Search script examples for lua_print
-
-nil lua_print()
-Standard lua print function, prints directly to the terminal but not to the game
-message
-
-Search script examples for message
-
-nil message(string message)
-Same as print
-messpect
-
-Search script examples for messpect
-
-nil messpect(variadic_args objects)
-Same as prinspect
-prinspect
prinspect(state.level, state.level_next)
-local some_stuff_in_a_table = {
- some = state.time_total,
- stuff = state.world
-}
-prinspect(some_stuff_in_a_table)
+
+
+Type
+Name
+Description
+
+
+
+Lava
+
-
-
-Search script examples for prinspect
-
-nil prinspect(variadic_args objects)
-Prints any type of object by first funneling it through inspect
, no need for a manual tostring
or inspect
.
-print
-
-Search script examples for print
-
-nil print(string message)
-Print a log message on screen.
-printf
-
-Search script examples for printf
-
-nil printf()
-Short for print(string.format(...))
-say
-
-Search script examples for say
-
-nil say(int entity_uid, string message, int sound_type, bool top)
-Show a message coming from an entity
-speechbubble_visible
-
-Search script examples for speechbubble_visible
-
-bool speechbubble_visible()
toast
-
-Search script examples for toast
-
-nil toast(string message)
-Show a message that looks like a level feeling.
-toast_visible
-
-Search script examples for toast_visible
-
-bool toast_visible()
Movable Behavior functions
make_custom_behavior
-
-Search script examples for make_custom_behavior
-
-CustomMovableBehavior make_custom_behavior(string_view behavior_name, int state_id, VanillaMovableBehavior base_behavior)
-Make a CustomMovableBehavior
, if base_behavior
is nil
you will have to set all of the
-behavior functions. If a behavior with behavior_name
already exists for your script it will
-be returned instead.
-Network functions
udp_listen
-
-Search script examples for udp_listen
-
-UdpServer udp_listen(string host, in_port_t port, function cb)
-Start an UDP server on specified address and run callback when data arrives. Return a string from the callback to reply. Requires unsafe mode.
-The server will be closed once the handle is released.
-udp_send
-
-Search script examples for udp_send
-
-nil udp_send(string host, in_port_t port, string msg)
-Send data to specified UDP address. Requires unsafe mode.
-Option functions
register_option_bool
register_option_bool("bomb_bag", "BombBag", "Spawn bomb bag at the start of every level", false)
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+LimbAnchor
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+move_timer
+
+
+
+bool
+flip_vertical
+
+
+
+Liquid
+Derived from Entity
-set_callback(function()
- if options.bomb_bag then
- -- Spawn the bomb bag at player location thanks to the LAYER.PLAYER1
- spawn_entity_snapped_to_floor(ENT_TYPE.ITEM_PICKUP_BOMBBAG, 0, 0, LAYER.PLAYER1)
- end
-end, ON.LEVEL)
+
+
+Type
+Name
+Description
+
+
+
+Entity
+fx_surface
+
+
+
+int
+get_liquid_flags()
+
+
+
+nil
+set_liquid_flags(int flags)
+
+
+
+MummyFliesSound
+Derived from Entity LogicalSound
-
-
-Search script examples for register_option_bool
-
-nil register_option_bool(string name, string desc, string long_desc, bool value)
-Add a boolean option that the user can change in the UI. Read with options.name
, value
is the default.
-register_option_button
-
-Search script examples for register_option_button
-
-nil register_option_button(string name, string desc, string long_desc, function on_click)
-Add a button that the user can click in the UI. Sets the timestamp of last click on value and runs the callback function.
-register_option_callback
-
-Search script examples for register_option_callback
-
-nil register_option_callback(string name, object value, function on_render)
-Add custom options using the window drawing functions. Everything drawn in the callback will be rendered in the options window and the return value saved to options[name]
or overwriting the whole options
table if using and empty name.
-value
is the default value, and pretty important because anything defined in the callback function will only be defined after the options are rendered. See the example for details.
-
The callback signature is optional on_render(GuiDrawContext draw_ctx)
-register_option_combo
-
-Search script examples for register_option_combo
-
-nil register_option_combo(string name, string desc, string long_desc, string opts, int value)
-Add a combobox option that the user can change in the UI. Read the int index of the selection with options.name
. Separate opts
with \0
,
-with a double \0\0
at the end. value
is the default index 1..n.
-register_option_float
-
-Search script examples for register_option_float
-
-nil register_option_float(string name, string desc, string long_desc, float value, float min, float max)
-Add a float option that the user can change in the UI. Read with options.name
, value
is the default. Keep in mind these are just soft
-limits, you can override them in the UI with double click.
-register_option_int
-
-Search script examples for register_option_int
-
-nil register_option_int(string name, string desc, string long_desc, int value, int min, int max)
-Add an integer option that the user can change in the UI. Read with options.name
, value
is the default. Keep in mind these are just soft
-limits, you can override them in the UI with double click.
-register_option_string
-
-Search script examples for register_option_string
-
-nil register_option_string(string name, string desc, string long_desc, string value)
-Add a string option that the user can change in the UI. Read with options.name
, value
is the default.
-unregister_option
-
-Search script examples for unregister_option
-
-nil unregister_option(string name)
-Removes an option by name. To make complicated conditionally visible options you should probably just use register_option_callback though.
-Particle functions
advance_screen_particles
-
-Search script examples for advance_screen_particles
-
-nil advance_screen_particles(ParticleEmitterInfo particle_emitter)
-Advances the state of the screen particle emitter (simulates the next positions, ... of all the particles in the emitter). Only used with screen particle emitters. See the particles.lua
example script for more details.
-extinguish_particles
-
-Search script examples for extinguish_particles
-
-nil extinguish_particles(ParticleEmitterInfo particle_emitter)
-Extinguish a particle emitter (use the return value of generate_world_particles
or generate_screen_particles
as the parameter in this function)
-generate_screen_particles
-
-Search script examples for generate_screen_particles
-
-ParticleEmitterInfo generate_screen_particles(int particle_emitter_id, float x, float y)
-Generate particles of the specified type at a certain screen coordinate (use e.g. local emitter = generate_screen_particles(PARTICLEEMITTER.CHARSELECTOR_TORCHFLAME_FLAMES, 0.0, 0.0)
). See the particles.lua
example script for more details.
-generate_world_particles
-
-Search script examples for generate_world_particles
-
-ParticleEmitterInfo generate_world_particles(int particle_emitter_id, int uid)
-Generate particles of the specified type around the specified entity uid (use e.g. local emitter = generate_world_particles(PARTICLEEMITTER.PETTING_PET, players[1].uid)
). You can then decouple the emitter from the entity with emitter.entity_uid = -1
and freely move it around. See the particles.lua
example script for more details.
-get_particle_type
-
-Search script examples for get_particle_type
-
-ParticleDB get_particle_type(int id)
-Get the ParticleDB details of the specified ID
-render_screen_particles
-
-Search script examples for render_screen_particles
-
-nil render_screen_particles(ParticleEmitterInfo particle_emitter)
-Renders the particles to the screen. Only used with screen particle emitters. See the particles.lua
example script for more details.
-Position functions
activate_tiamat_position_hack
activate_tiamat_position_hack(true);
+
+
+Type
+Name
+Description
+
+
+
+int
+mummy_uid
+
+
+
+int
+flies
+Numbers of flies spawned
+
+
+OuroboroCameraAnchor
+Derived from Entity
-set_post_entity_spawn(function(ent)
+
+
+Type
+Name
+Description
+
+
+
+float
+target_x
+
+
+
+float
+target_y
+
+
+
+float
+velocity_x
+
+
+
+float
+velocity_y
+
+
+
+OuroboroCameraZoomin
+Derived from Entity
- -- make them same as in the game, but relative to the tiamat entity
- ent.attack_x = ent.x - 1
- ent.attack_y = ent.y + 2
+
+
+Type
+Name
+Description
+
+
+
+float
+zoomin_level
+Can be set to negative, seams to trigger the warp at some value
+
+
+PalaceSign
+Derived from Entity
-end, SPAWN_TYPE.ANY, 0, ENT_TYPE.MONS_TIAMAT)
-
-
-Search script examples for activate_tiamat_position_hack
-
-nil activate_tiamat_position_hack(bool activate)
-Activate custom variables for position used for detecting the player (normally hardcoded)
-note: because those variables are custom and game does not initiate them, you need to do it yourself for each Tiamat entity, recommending set_post_entity_spawn
-default game values are: attack_x = 17.5 attack_y = 62.5
-distance
-
-Search script examples for distance
-
-float distance(int uid_a, int uid_b)
-Calculate the tile distance of two entities by uid
-draw_text_size
-- draw text
-set_callback(function(draw_ctx)
- -- get a random color
- local color = math.random(0, 0xffffffff)
- -- zoom the font size based on frame
- local size = (get_frame() % 199)+1
- local text = 'Awesome!'
- -- calculate size of text
- local w, h = draw_text_size(size, text)
- -- draw to the center of screen
- draw_ctx:draw_text(0-w/2, 0-h/2, size, text, color)
-end, ON.GUIFRAME)
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+The neon buzz sound
+
+
+Illumination
+illumination
+
+
+
+Illumination
+arrow_illumination
+
+
+
+int
+arrow_change_timer
+
+
+
+PipeTravelerSound
+Derived from Entity LogicalSound
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+enter_exit
+
+
+
+Portal
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+int
+transition_timer
+
+
+
+int
+level
+
+
+
+int
+world
+
+
+
+int
+theme
+
+
+
+int
+timer
+
+
+
+QuickSandSound
+Derived from Entity LogicalSound
-
-
-Search script examples for draw_text_size
-
-tuple<float, float> draw_text_size(float size, string text)
-Calculate the bounding box of text, so you can center it etc. Returns width
, height
in screen distance.
-fix_liquid_out_of_bounds
-- call this in ON.FRAME if needed in your custom level
-set_callback(fix_liquid_out_of_bounds, ON.FRAME)
+
+
+Type
+Name
+Description
+
+
+
+RoomLight
+Derived from Entity
-
-
-Search script examples for fix_liquid_out_of_bounds
-
-nil fix_liquid_out_of_bounds()
-Removes all liquid that is about to go out of bounds, which crashes the game.
-game_position
-
-Search script examples for game_position
-
-tuple<float, float> game_position(float x, float y)
-Get the game coordinates at the screen position (x
, y
)
-get_aabb_bounds
-
-Search script examples for get_aabb_bounds
-
-AABB get_aabb_bounds()
-Same as get_bounds but returns AABB struct instead of loose floats
-get_bounds
-- Draw the level boundaries
-set_callback(function(draw_ctx)
- local xmin, ymax, xmax, ymin = get_bounds()
- local sx, sy = screen_position(xmin, ymax) -- top left
- local sx2, sy2 = screen_position(xmax, ymin) -- bottom right
- draw_ctx:draw_rect(sx, sy, sx2, sy2, 4, 0, rgba(255, 255, 255, 255))
-end, ON.GUIFRAME)
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+illumination
+
+
+
+ShootingStarSpawner
+Derived from Entity
-
-
-Search script examples for get_bounds
-
-tuple<float, float, float, float> get_bounds()
-Basically gets the absolute coordinates of the area inside the unbreakable bedrock walls, from wall to wall. Every solid entity should be
-inside these boundaries. The order is: left x, top y, right x, bottom y
-get_camera_position
-
-Search script examples for get_camera_position
-
-tuple<float, float> get_camera_position()
-Gets the current camera position in the level
-get_hitbox
-
-Search script examples for get_hitbox
-
-AABB get_hitbox(int uid, optional extrude, optional offsetx, optional offsety)
-Gets the hitbox of an entity, use extrude
to make the hitbox bigger/smaller in all directions and offset
to offset the hitbox in a given direction
-get_hud_position
-
-Search script examples for get_hud_position
-
-AABB get_hud_position(int index)
-Approximate bounding box of the player hud element for player index 1..4 based on user settings and player count
-get_image_size
-
-Search script examples for get_image_size
-
-tuple<int, int> get_image_size(string path)
-Get image size from file. Returns a tuple containing width and height.
-get_position
-
-Search script examples for get_position
-
-tuple<float, float, int> get_position(int uid)
-Get position x, y, layer
of entity by uid. Use this, don't use Entity.x/y
because those are sometimes just the offset to the entity
-you're standing on, not real level coordinates.
-get_render_hitbox
-
-Search script examples for get_render_hitbox
-
-AABB get_render_hitbox(int uid, optional extrude, optional offsetx, optional offsety)
-Same as get_hitbox
but based on get_render_position
-get_render_position
-
-Search script examples for get_render_position
-
-tuple<float, float, int> get_render_position(int uid)
-Get interpolated render position x, y, layer
of entity by uid. This gives smooth hitboxes for 144Hz master race etc...
-get_velocity
-
-Search script examples for get_velocity
-
-tuple<float, float> get_velocity(int uid)
-Get velocity vx, vy
of an entity by uid. Use this, don't use Entity.velocityx/velocityy
because those are relative to Entity.overlay
.
-get_window_size
-
-Search script examples for get_window_size
-
-tuple<int, int> get_window_size()
-Gets the resolution (width and height) of the screen
-get_zoom_level
-
-Search script examples for get_zoom_level
-
-float get_zoom_level()
-Get the current set zoom level
-position_is_valid
-
-Search script examples for position_is_valid
-
-bool position_is_valid(float x, float y, LAYER layer, POS_TYPE flags)
-Check if position satifies the given POS_TYPE flags, to be used in a custom is_valid function procedural for spawns.
-screen_aabb
-
-Search script examples for screen_aabb
-
-AABB screen_aabb(AABB box)
-Convert an AABB
to a screen AABB
that can be directly passed to draw functions
-screen_distance
-
-Search script examples for screen_distance
-
-float screen_distance(float x)
-Translate a distance of x
tiles to screen distance to be be used in drawing functions
-screen_position
-
-Search script examples for screen_position
-
-tuple<float, float> screen_position(float x, float y)
-Translate an entity position to screen position to be used in drawing functions
-set_camp_camera_bounds_enabled
-
-Search script examples for set_camp_camera_bounds_enabled
-
-nil set_camp_camera_bounds_enabled(bool b)
-Enables or disables the default position based camp camera bounds, to set them manually yourself
-zoom
-
-Search script examples for zoom
-
-nil zoom(float level)
-Set the zoom level used in levels and shops. 13.5 is the default.
-Room functions
define_room_template
-
-Search script examples for define_room_template
-
-int define_room_template(string room_template, ROOM_TEMPLATE_TYPE type)
-Define a new room template to use with set_room_template
-get_room_index
-
-Search script examples for get_room_index
-
-tuple<int, int> get_room_index(float x, float y)
-Transform a position to a room index to be used in get_room_template
and PostRoomGenerationContext.set_room_template
-get_room_pos
-
-Search script examples for get_room_pos
-
-tuple<float, float> get_room_pos(int x, int y)
-Transform a room index into the top left corner position in the room
-get_room_template
-
-Search script examples for get_room_template
-
-optional<int> get_room_template(int x, int y, LAYER layer)
-Get the room template given a certain index, returns nil
if coordinates are out of bounds
-get_room_template_name
-
-Search script examples for get_room_template_name
-
-string_view get_room_template_name(int room_template)
-For debugging only, get the name of a room template, returns 'invalid'
if room template is not defined
-is_machine_room_origin
-
-Search script examples for is_machine_room_origin
-
-bool is_machine_room_origin(int x, int y)
-Get whether a room is the origin of a machine room
-is_room_flipped
-
-Search script examples for is_room_flipped
-
-bool is_room_flipped(int x, int y)
-Get whether a room is flipped at the given index, returns false
if coordinates are out of bounds
-set_room_template_size
-
-Search script examples for set_room_template_size
-
-bool set_room_template_size(int room_template, int width, int height)
-Set the size of room template in tiles, the template must be of type ROOM_TEMPLATE_TYPE.MACHINE_ROOM
.
-spawn_roomowner
-- spawns waddler selling pets
--- all the aggro etc mechanics from a normal shop still apply
-local x, y, l = get_position(get_player(1).uid)
-local owner = spawn_roomowner(ENT_TYPE.MONS_STORAGEGUY, x+1, y, l, ROOM_TEMPLATE.SHOP)
-add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_DOG, x-1, y, l), owner)
-add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_CAT, x-2, y, l), owner)
-add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_HAMSTER, x-3, y, l), owner)
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+SplashBubbleGenerator
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+Logical entities
LogicalAnchovyFlock
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+float
+current_speed
+Increases until max_speed reached
+
+
+float
+max_speed
+
+
+
+int
+timer
+
+
+
+LogicalConveyorbeltSound
+Derived from Entity LogicalSound
--- use in a tile code to add shops to custom levels
--- this may spawn some shop related decorations too
-define_tile_code("pet_shop_boys")
-set_pre_tile_code_callback(function(x, y, layer)
- local owner = spawn_roomowner(ENT_TYPE.MONS_YANG, x, y, layer, ROOM_TEMPLATE.SHOP)
- -- another dude for the meme, this has nothing to do with the shop
- spawn_on_floor(ENT_TYPE.MONS_BODYGUARD, x+1, y, layer)
- add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_HAMSTER, x+2, y, layer), owner)
- return true
-end, "pet_shop_boys")
+
+
+Type
+Name
+Description
+
+
+
+LogicalDoor
+Derived from Entity
-
-
-Search script examples for spawn_roomowner
-
-int spawn_roomowner(ENT_TYPE owner_type, float x, float y, LAYER layer, ROOM_TEMPLATE room_template = -1)
-Spawn a RoomOwner (or a few other like CavemanShopkeeper) in the coordinates and make them own the room, optionally changing the room template. Returns the RoomOwner uid.
-Shop functions
add_item_to_shop
-
-Search script examples for add_item_to_shop
-
-nil add_item_to_shop(int item_uid, int shop_owner_uid)
-Adds entity as shop item, has to be of Purchasable type, check the entity hierarchy list to find all the Purchasable entity types.
-Adding other entities will result in not obtainable items or game crash
-change_diceshop_prizes
-
-Search script examples for change_diceshop_prizes
-
-nil change_diceshop_prizes(array<ENT_TYPE> ent_types)
-Change ENT_TYPE's spawned in dice shops (Madame Tusk as well), by default there are 25:
-{ITEM_PICKUP_BOMBBAG, ITEM_PICKUP_BOMBBOX, ITEM_PICKUP_ROPEPILE, ITEM_PICKUP_COMPASS, ITEM_PICKUP_PASTE, ITEM_PICKUP_PARACHUTE, ITEM_PURCHASABLE_CAPE, ITEM_PICKUP_SPECTACLES, ITEM_PICKUP_CLIMBINGGLOVES, ITEM_PICKUP_PITCHERSMITT,
-ENT_TYPE_ITEM_PICKUP_SPIKESHOES, ENT_TYPE_ITEM_PICKUP_SPRINGSHOES, ITEM_MACHETE, ITEM_BOOMERANG, ITEM_CROSSBOW, ITEM_SHOTGUN, ITEM_FREEZERAY, ITEM_WEBGUN, ITEM_CAMERA, ITEM_MATTOCK, ITEM_PURCHASABLE_JETPACK, ITEM_PURCHASABLE_HOVERPACK,
-ITEM_TELEPORTER, ITEM_PURCHASABLE_TELEPORTER_BACKPACK, ITEM_PURCHASABLE_POWERPACK}
-Min 6, Max 255, if you want less then 6 you need to write some of them more then once (they will have higher "spawn chance").
-If you use this function in the level with diceshop in it, you have to update item_ids
in the ITEM_DICE_PRIZE_DISPENSER.
-Use empty table as argument to reset to the game default
-is_inside_active_shop_room
-
-Search script examples for is_inside_active_shop_room
-
-bool is_inside_active_shop_room(float x, float y, LAYER layer)
-Checks whether a coordinate is inside a room containing an active shop. This function checks whether the shopkeeper is still alive.
-is_inside_shop_zone
-
-Search script examples for is_inside_shop_zone
-
-bool is_inside_shop_zone(float x, float y, LAYER layer)
-Checks whether a coordinate is inside a shop zone, the rectangle where the camera zooms in a bit. Does not check if the shop is still active!
-spawn_shopkeeper
-- spawns a shopkeeper selling a shotgun next to you
--- converts the current room to a ROOM_TEMPLATE.SHOP with shop music and zoom effect
-local x, y, l = get_position(get_player(1).uid)
-local owner = spawn_shopkeeper(x+1, y, l)
-add_item_to_shop(spawn_on_floor(ENT_TYPE.ITEM_SHOTGUN, x-1, y, l), owner)
+
+
+Type
+Name
+Description
+
+
+
+ENT_TYPE
+door_type
+
+
+
+ENT_TYPE
+platform_type
+
+
+
+bool
+visible
+
+
+
+bool
+platform_spawned
+Is set true when you bomb the door, no matter what door, can't be reset
+
+
+LogicalDrain
+Derived from Entity
--- spawns a shopkeeper selling a puppy next to you
--- also converts the room to a shop, but after the shopkeeper is spawned
--- this enables the safe zone for moving items, but disables shop music and zoom for whatever reason
-local x, y, l = get_position(get_player(1).uid)
-local owner = spawn_shopkeeper(x+1, y, l, ROOM_TEMPLATE.SIDE)
-add_item_to_shop(spawn_on_floor(ENT_TYPE.MONS_PET_DOG, x-1, y, l), owner)
-local ctx = PostRoomGenerationContext:new()
-local rx, ry = get_room_index(x, y)
-ctx:set_room_template(rx, ry, l, ROOM_TEMPLATE.SHOP)
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+Little delay between pulling blob of liquid thru
+
+
+LogicalLiquidStreamSound
+Derived from Entity LogicalSound LogicalStaticSound
-
-
-Search script examples for spawn_shopkeeper
-
-int spawn_shopkeeper(float x, float y, LAYER layer, ROOM_TEMPLATE room_template = ROOM_TEMPLATE.SHOP)
-Spawn a Shopkeeper in the coordinates and make the room their shop. Returns the Shopkeeper uid. Also see spawn_roomowner.
-Sound functions
create_sound
-
-Search script examples for create_sound
-
-optional<CustomSound> create_sound(string path)
-Loads a sound from disk relative to this script, ownership might be shared with other code that loads the same file. Returns nil if file can't be found
-get_sound
-
-Search script examples for get_sound
-
-optional<CustomSound> get_sound(string path_or_vanilla_sound)
-Gets an existing sound, either if a file at the same path was already loaded or if it is already loaded by the game
-play_sound
-
-Search script examples for play_sound
-
-SoundMeta play_sound(VANILLA_SOUND sound, int source_uid)
Spawn functions
change_altar_damage_spawns
-
-Search script examples for change_altar_damage_spawns
-
-nil change_altar_damage_spawns(array<ENT_TYPE> ent_types)
-Change ENT_TYPE's spawned when you damage the altar, by default there are 6:
-{MONS_BAT, MONS_BEE, MONS_SPIDER, MONS_JIANGSHI, MONS_FEMALE_JIANGSHI, MONS_VAMPIRE}
-Max 255 types.
-Use empty table as argument to reset to the game default
-change_sunchallenge_spawns
-
-Search script examples for change_sunchallenge_spawns
-
-nil change_sunchallenge_spawns(array<ENT_TYPE> ent_types)
-Change ENT_TYPE's spawned by FLOOR_SUNCHALLENGE_GENERATOR
, by default there are 4:
-{MONS_WITCHDOCTOR, MONS_VAMPIRE, MONS_SORCERESS, MONS_NECROMANCER}
-Because of the game logic number of entity types has to be a power of 2: (1, 2, 4, 8, 16, 32), if you want say 30 types, you need to write two entities two times (they will have higher "spawn chance").
-Use empty table as argument to reset to the game default
-default_spawn_is_valid
-
-Search script examples for default_spawn_is_valid
-
-bool default_spawn_is_valid(float x, float y, LAYER layer)
-Default function in spawn definitions to check whether a spawn is valid or not
-define_extra_spawn
-
-Search script examples for define_extra_spawn
-
-int define_extra_spawn(function do_spawn, function is_valid, int num_spawns_frontlayer, int num_spawns_backlayer)
-Define a new extra spawn, these are semi-guaranteed level gen spawns with a fixed upper bound.
-The function nil do_spawn(float x, float y, LAYER layer)
contains your code to spawn the thing, whatever it is.
-The function bool is_valid(float x, float y, LAYER layer)
determines whether the spawn is legal in the given position and layer.
-Use for example when you can spawn only on the ceiling, under water or inside a shop.
-Set is_valid
to nil
in order to use the default rule (aka. on top of floor and not obstructed).
-To change the number of spawns use PostRoomGenerationContext:set_num_extra_spawns
during ON.POST_ROOM_GENERATION
-No name is attached to the extra spawn since it is not modified from level files, instead every call to this function will return a new uniqe id.
-define_procedural_spawn
-
-Search script examples for define_procedural_spawn
-
-PROCEDURAL_CHANCE define_procedural_spawn(string procedural_spawn, function do_spawn, function is_valid)
-Define a new procedural spawn, the function nil do_spawn(float x, float y, LAYER layer)
contains your code to spawn the thing, whatever it is.
-The function bool is_valid(float x, float y, LAYER layer)
determines whether the spawn is legal in the given position and layer.
-Use for example when you can spawn only on the ceiling, under water or inside a shop.
-Set is_valid
to nil
in order to use the default rule (aka. on top of floor and not obstructed).
-If a user disables your script but still uses your level mod nothing will be spawned in place of your procedural spawn.
-door
-
-Search script examples for door
-
-int door(float x, float y, LAYER layer, int w, int l, int t)
-Short for spawn_door.
-get_missing_extra_spawns
-
-Search script examples for get_missing_extra_spawns
-
-tuple<int, int> get_missing_extra_spawns(int extra_spawn_chance_id)
-Use to query whether any of the requested spawns could not be made, usually because there were not enough valid spaces in the level.
-Returns missing spawns in the front layer and missing spawns in the back layer in that order.
-The value only makes sense after level generation is complete, aka after ON.POST_LEVEL_GENERATION
has run.
-get_procedural_spawn_chance
-
-Search script examples for get_procedural_spawn_chance
-
-int get_procedural_spawn_chance(PROCEDURAL_CHANCE chance_id)
-Get the inverse chance of a procedural spawn for the current level.
-A return value of 0 does not mean the chance is infinite, it means the chance is zero.
-layer_door
-
-Search script examples for layer_door
-
-nil layer_door(float x, float y)
-Short for spawn_layer_door.
-set_ghost_spawn_times
-
-Search script examples for set_ghost_spawn_times
-
-nil set_ghost_spawn_times(int normal = 10800, int cursed = 9000)
-Determines when the ghost appears, either when the player is cursed or not
-spawn
-- spawn a jetpack next to the player
-spawn(ENT_TYPE.ITEM_JETPACK, 1, 0, LAYER.PLAYER, 0, 0)
+
+
+Type
+Name
+Description
+
+
+
+LogicalMiniGame
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+Delay between spwning ufo
+
+
+LogicalRegeneratingBlock
+Derived from Entity
+
+
+
+Type
+Name
+Description
+
+
+
+int
+timer
+
+
+
+LogicalSound
+Derived from Entity
-
-
-Search script examples for spawn
-
-int spawn(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
-Short for spawn_entity.
-spawn_apep
-
-Search script examples for spawn_apep
-
-int spawn_apep(float x, float y, LAYER layer, bool right)
-Spawns apep with the choice if it going left or right, if you want the game to choose use regular spawn functions with ENT_TYPE.MONS_APEP_HEAD
-spawn_companion
-
-Search script examples for spawn_companion
-
-int spawn_companion(ENT_TYPE companion_type, float x, float y, LAYER layer)
-Spawn a companion (hired hand, player character, eggplant child)
-spawn_critical
-
-Search script examples for spawn_critical
-
-int spawn_critical(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
-Short for spawn_entity_nonreplaceable.
-spawn_door
-
-Search script examples for spawn_door
-
-int spawn_door(float x, float y, LAYER layer, int w, int l, int t)
-Spawn a door to another world, level and theme and return the uid of spawned entity.
-Uses level coordinates with LAYER.FRONT and LAYER.BACK, but player-relative coordinates with LAYER.PLAYERn
-spawn_entity
-- spawn megajelly on top of player using absolute coordinates on level start
-set_callback(function()
- local x, y, layer = get_position(players[1].uid)
- spawn_entity(ENT_TYPE.MONS_MEGAJELLYFISH, x, y+3, layer, 0, 0)
-end, ON.LEVEL)
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+LogicalStaticSound
+Derived from Entity LogicalSound
--- spawn clover next to player using player-relative coordinates
-set_callback(function()
- spawn(ENT_TYPE.ITEM_PICKUP_CLOVER, 1, 0, LAYER.PLAYER1, 0, 0)
-end, ON.LEVEL)
+
+
+Type
+Name
+Description
+
+
+
+LogicalTrapTrigger
+Derived from Entity
-
-
-Search script examples for spawn_entity
-
-int spawn_entity(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
-Spawn an entity in position with some velocity and return the uid of spawned entity.
-Uses level coordinates with LAYER.FRONT and LAYER.BACK, but player-relative coordinates with LAYER.PLAYER(n), where (n) is a player number (1-4).
-spawn_entity_nonreplaceable
-
-Search script examples for spawn_entity_nonreplaceable
-
-int spawn_entity_nonreplaceable(ENT_TYPE entity_type, float x, float y, LAYER layer, float vx, float vy)
-Same as spawn_entity
but does not trigger any pre-entity-spawn callbacks, so it will not be replaced by another script
-spawn_entity_over
-
-Search script examples for spawn_entity_over
-
-int spawn_entity_over(ENT_TYPE entity_type, int over_uid, float x, float y)
-Spawn an entity of entity_type
attached to some other entity over_uid
, in offset x
, y
-spawn_entity_snapped_to_floor
-
-Search script examples for spawn_entity_snapped_to_floor
-
-int spawn_entity_snapped_to_floor(ENT_TYPE entity_type, float x, float y, LAYER layer)
-Spawns an entity directly on the floor below the tile at the given position.
-Use this to avoid the little fall that some entities do when spawned during level gen callbacks.
-spawn_grid_entity
-
-Search script examples for spawn_grid_entity
-
-int spawn_grid_entity(ENT_TYPE entity_type, float x, float y, LAYER layer)
-Spawn a grid entity, such as floor or traps, that snaps to the grid.
-spawn_layer_door
-
-Search script examples for spawn_layer_door
-
-nil spawn_layer_door(float x, float y)
-Spawn a door to backlayer.
-spawn_liquid
-
-Search script examples for spawn_liquid
-
-nil spawn_liquid(ENT_TYPE entity_type, float x, float y)
nil spawn_liquid(ENT_TYPE entity_type, float x, float y, float velocityx, float velocityy, int liquid_flags, int amount, float blobs_separation)
-Spawn liquids, always spawns in the front layer, will have fun effects if entity_type
is not a liquid (only the short version, without velocity etc.).
-Don't overuse this, you are still restricted by the liquid pool sizes and thus might crash the game.
-liquid_flags
- not much known about, 2 - will probably crash the game, 3 - pause_physics, 6-12 is probably agitation, surface_tension etc. set to 0 to ignore
-amount
- it will spawn amount x amount (so 1 = 1, 2 = 4, 3 = 6 etc.), blobs_separation
is optional
-spawn_mushroom
-
-Search script examples for spawn_mushroom
-
-int spawn_mushroom(float x, float y, LAYER l)
int spawn_mushroom(float x, float y, LAYER l, int height)
-Spawns and grows mushroom, height relates to the trunk, without it, it will roll the game default 3-5 height
-Regardless, if there is not enough space, it will spawn shorter one or if there is no space even for the smallest one, it will just not spawn at all
-Returns uid of the base or -1 if it wasn't able to spawn
-spawn_on_floor
-
-Search script examples for spawn_on_floor
-
-int spawn_on_floor(ENT_TYPE entity_type, float x, float y, LAYER layer)
-Short for spawn_entity_snapped_to_floor.
-spawn_over
-
-Search script examples for spawn_over
-
-int spawn_over(ENT_TYPE entity_type, int over_uid, float x, float y)
-Short for spawn_entity_over
-spawn_player
-
-Search script examples for spawn_player
-
-nil spawn_player(int player_slot, float x, float y)
-Spawn a player in given location, if player of that slot already exist it will spawn clone, the game may crash as this is very unexpected situation
-If you want to respawn a player that is a ghost, set in his Inventory health
to above 0, and time_of_death
to 0 and call this function, the ghost entity will be removed automatically
-spawn_playerghost
-
-Search script examples for spawn_playerghost
-
-int spawn_playerghost(ENT_TYPE char_type, float x, float y, LAYER layer)
-Spawn the PlayerGhost entity, it will not move and not be connected to any player, you can then use steal_input and send_input to controll it
-or change it's player_inputs
to the input
of real player so he can control it directly
-spawn_tree
-
-Search script examples for spawn_tree
-
-int spawn_tree(float x, float y, LAYER layer)
int spawn_tree(float x, float y, LAYER layer, int height)
-Spawns and grows a tree
-spawn_unrolled_player_rope
-
-Search script examples for spawn_unrolled_player_rope
-
-int spawn_unrolled_player_rope(float x, float y, LAYER layer, TEXTURE texture)
int spawn_unrolled_player_rope(float x, float y, LAYER layer, TEXTURE texture, int max_length)
-Spawns an already unrolled rope as if created by player
-String functions
add_custom_name
-
-Search script examples for add_custom_name
-
-nil add_custom_name(int uid, string name)
-Adds custom name to the item by uid used in the shops
-This is better alternative to add_string
but instead of changing the name for entity type, it changes it for this particular entity
-add_string
-
-Search script examples for add_string
-
-STRINGID add_string(string str)
-Add custom string, currently can only be used for names of shop items (Entitydb->description)
-Returns STRINGID of the new string
-change_string
-
-Search script examples for change_string
-
-nil change_string(STRINGID id, string str)
-Change string at the given id (don't use stringid diretcly for vanilla string, use hash_to_stringid
first)
-This edits custom string and in game strings but changing the language in settings will reset game strings
-clear_custom_name
-
-Search script examples for clear_custom_name
-
-nil clear_custom_name(int uid)
-Clears the name set with add_custom_name
-enum_get_mask_names
-
-Search script examples for enum_get_mask_names
-
-table<string> enum_get_mask_names(table enum, int value)
-Return the matching names for a bitmask in an enum table of masks
-enum_get_name
-
-Search script examples for enum_get_name
-
-string enum_get_name(table enum, int value)
-Return the name of the first matching number in an enum table
-enum_get_names
-
-Search script examples for enum_get_names
-
-table<string> enum_get_names(table enum, int value)
-Return all the names of a number in an enum table
-get_character_name
-
-Search script examples for get_character_name
-
-string get_character_name(ENT_TYPE type_id)
-Same as Player.get_name
-get_character_short_name
-
-Search script examples for get_character_short_name
-
-string get_character_short_name(ENT_TYPE type_id)
-Same as Player.get_short_name
-get_string
-
-Search script examples for get_string
-
-const string get_string(STRINGID string_id)
-Get string behind STRINGID, don't use stringid diretcly for vanilla string, use hash_to_stringid first
-Will return the string of currently choosen language
-hash_to_stringid
-
-Search script examples for hash_to_stringid
-
-STRINGID hash_to_stringid(int hash)
-Convert the hash to stringid
-Check strings00_hashed.str for the hash values, or extract assets with modlunky and check those.
-set_level_string
-- set the level string shown in hud, journal and game over
--- also change the one used in transitions for consistency
-set_callback(function()
- if state.screen_next == SCREEN.LEVEL then
- local level_str = "test" .. tostring(state.level_count)
- set_level_string(level_str)
- change_string(hash_to_stringid(0xda7c0c5b), F"{level_str} COMPLETED!")
- end
-end, ON.PRE_LOAD_SCREEN)
+
+
+Type
+Name
+Description
+
+
+
+int
+min_empty_distance
+Used in BigSpearTrap when it has to have minimum 2 free spaces to be able to trigger, value in tiles
+
+
+int
+trigger_distance
+Value in tiles
+
+
+bool
+vertical
+
+
+
+Monsters, Inc.
Alien
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+int
+jump_timer
+
+
+
+Ammit
+Derived from Entity Movable PowerupCapable Monster
-
-
-Search script examples for set_level_string
-
-nil set_level_string(string str)
-Set the level number shown in the hud and journal to any string. This is reset to the default "%d-%d" automatically just before PRE_LOAD_SCREEN to a level or main menu, so use in PRE_LOAD_SCREEN, POST_LEVEL_GENERATION or similar for each level.
-Use "%d-%d" to reset to default manually. Does not affect the "...COMPLETED!" message in transitions or lines in "Dear Journal", you need to edit them separately with change_string.
-Texture functions
define_texture
-
-Search script examples for define_texture
-
-TEXTURE define_texture(TextureDefinition texture_data)
-Defines a new texture that can be used in Entity::set_texture
-If a texture with the same definition already exists the texture will be reloaded from disk.
-get_texture
-
-Search script examples for get_texture
-
-optional<TEXTURE> get_texture(TextureDefinition texture_data)
-Gets a texture with the same definition as the given, if none exists returns nil
-get_texture_definition
-
-Search script examples for get_texture_definition
-
-TextureDefinition get_texture_definition(TEXTURE texture_id)
-Gets a TextureDefinition
for equivalent to the one used to define the texture with id
-reload_texture
-
-Search script examples for reload_texture
-
-nil reload_texture(string texture_path)
-Reloads a texture from disk, use this only as a development tool for example in the console
-Note that define_texture will also reload the texture if it already exists
-replace_texture
-
-Search script examples for replace_texture
-
-bool replace_texture(TEXTURE vanilla_id, TEXTURE custom_id)
-Replace a vanilla texture definition with a custom texture definition and reload the texture.
-replace_texture_and_heart_color
-
-Search script examples for replace_texture_and_heart_color
-
-bool replace_texture_and_heart_color(TEXTURE vanilla_id, TEXTURE custom_id)
-Replace a vanilla texture definition with a custom texture definition and reload the texture. Set corresponding character heart color to the pixel in the center of the player indicator arrow in that texture. (448,1472)
-reset_lut
-
-Search script examples for reset_lut
-
-nil reset_lut(LAYER layer)
-Same as set_lut(nil, layer)
-reset_texture
-
-Search script examples for reset_texture
-
-nil reset_texture(TEXTURE vanilla_id)
-Reset a replaced vanilla texture to the original and reload the texture.
-set_lut
-
-Search script examples for set_lut
-
-nil set_lut(optional<TEXTURE> texture_id, LAYER layer)
-Force the LUT texture for the given layer (or both) until it is reset.
-Pass nil
in the first parameter to reset
-Theme functions
force_co_subtheme
-
-Search script examples for force_co_subtheme
-
-nil force_co_subtheme(COSUBTHEME subtheme)
-Forces the theme of the next cosmic ocean level(s) (use e.g. force_co_subtheme(COSUBTHEME.JUNGLE)
. Use COSUBTHEME.RESET to reset to default random behaviour)
-force_custom_subtheme
-
-Search script examples for force_custom_subtheme
-
-nil force_custom_subtheme(customtheme)
-Force current subtheme used in the CO theme. You can pass a CustomTheme, ThemeInfo or THEME. Not to be confused with force_co_subtheme.
-force_custom_theme
-
-Search script examples for force_custom_theme
-
-nil force_custom_theme(customtheme)
-Force a theme in PRE_LOAD_LEVEL_FILES, POST_ROOM_GENERATION or PRE_LEVEL_GENERATION to change different aspects of the levelgen. You can pass a CustomTheme, ThemeInfo or THEME.
-get_co_subtheme
-
-Search script examples for get_co_subtheme
-
-COSUBTHEME get_co_subtheme()
-Gets the sub theme of the current cosmic ocean level, returns COSUBTHEME.NONE if the current level is not a CO level.
-Tile code functions
define_tile_code
-
-Search script examples for define_tile_code
-
-TILE_CODE define_tile_code(string tile_code)
-Define a new tile code, to make this tile code do anything you have to use either set_pre_tile_code_callback or set_post_tile_code_callback.
-If a user disables your script but still uses your level mod nothing will be spawned in place of your tile code.
-get_short_tile_code
-
-Search script examples for get_short_tile_code
-
-optional<int> get_short_tile_code(ShortTileCodeDef short_tile_code_def)
-Gets a short tile code based on definition, returns nil
if it can't be found
-get_short_tile_code_definition
-
-Search script examples for get_short_tile_code_definition
-
-optional<ShortTileCodeDef> get_short_tile_code_definition(SHORT_TILE_CODE short_tile_code)
-Gets the definition of a short tile code (if available), will vary depending on which file is loaded
-set_post_tile_code_callback
-
-Search script examples for set_post_tile_code_callback
-
-CallbackId set_post_tile_code_callback(function cb, string tile_code)
-Add a callback for a specific tile code that is called after the game handles the tile code.
-Use this to affect what the game or other scripts spawned in this position.
-This is received even if a previous pre-tile-code-callback has returned true
-
The callback signature is nil post_tile_code(float x, float y, int layer, ROOM_TEMPLATE room_template)
-set_pre_tile_code_callback
-
-Search script examples for set_pre_tile_code_callback
-
-CallbackId set_pre_tile_code_callback(function cb, string tile_code)
-Add a callback for a specific tile code that is called before the game handles the tile code.
-Return true in order to stop the game or scripts loaded after this script from handling this tile code.
-For example, when returning true in this callback set for "floor"
then no floor will spawn in the game (unless you spawn it yourself)
-
The callback signature is bool pre_tile_code(float x, float y, int layer, ROOM_TEMPLATE room_template)
-Deprecated functions
-
-on_frame
-Use set_callback(function, ON.FRAME)
instead
-on_camp
-Use set_callback(function, ON.CAMP)
instead
-on_level
-Use set_callback(function, ON.LEVEL)
instead
-on_start
-Use set_callback(function, ON.START)
instead
-on_transition
-Use set_callback(function, ON.TRANSITION)
instead
-on_death
-Use set_callback(function, ON.DEATH)
instead
-on_win
-Use set_callback(function, ON.WIN)
instead
-on_screen
-Use set_callback(function, ON.SCREEN)
instead
-on_guiframe
-Use set_callback(function, ON.GUIFRAME)
instead
-load_script
-
-Search script examples for load_script
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+Anubis
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+float
+spawn_x
+
+
+
+float
+spawn_y
+
+
+
+float
+attack_proximity_y
+
+
+
+float
+attack_proximity_x
+
+
+
+int
+ai_timer
+
+
+
+int
+next_attack_timer
+
+
+
+int
+psychic_orbs_counter
+
+
+
+bool
+awake
+
+
+
+ApepHead
+Derived from Entity Movable PowerupCapable Monster ApepPart
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound1
+
+
+
+SoundMeta
+sound2
+
+
+
+float
+distance_traveled
+
+
+
+int
+tail_uid
+
+
+
+int
+fx_mouthpiece1_uid
+
+
+
+int
+fx_mouthpiece2_uid
+
+
+
+ApepPart
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+float
+y_pos
+
+
+
+float
+sine_angle
+
+
+
+int
+sync_timer
+or pause timer, used to sync the body parts moving up and down
+
+
+Axolotl
+Derived from Entity Movable PowerupCapable Mount
-nil load_script()
-Same as import().
-read_prng
-
-Search script examples for read_prng
-
+
+
+Type
+Name
+Description
+
+
+
+int
+attack_cooldown
+
+
+
+bool
+can_teleport
+
+
+
+Bat
+Derived from Entity Movable PowerupCapable Monster
-array<int> read_prng()
-Read the game prng state. Use prng:get_pair() instead.
-force_dark_level
-- forces any level to be dark, even bosses
-set_callback(function()
- state.level_flags = set_flag(state.level_flags, 18)
-end, ON.POST_ROOM_GENERATION)
+
+
+Type
+Name
+Description
+
+
+
+float
+spawn_x
+
+
+
+float
+spawn_y
+
+
+
+Bee
+Derived from Entity Movable PowerupCapable Monster
-
-
-Search script examples for force_dark_level
-
+
+
+Type
+Name
+Description
+
+
+
+bool
+can_rest
+
+
+
+SoundMeta
+sound
+
+
+
+int
+fly_hang_timer
+
+
+
+int
+targeting_timer
+
+
+
+int
+walk_start_time
+
+
+
+int
+walk_end_time
+
+
+
+float
+wobble_x
+
+
+
+float
+wobble_y
+
+
+
+Beg
+Derived from Entity Movable PowerupCapable Monster NPC
-nil force_dark_level(bool g)
-Set level flag 18 on post room generation instead, to properly force every level to dark
-get_entities
-
-Search script examples for get_entities
-
-array<int> get_entities()
-Use get_entities_by(0, MASK.ANY, LAYER.BOTH)
instead
-get_entities_by_mask
-
-Search script examples for get_entities_by_mask
-
-array<int> get_entities_by_mask(int mask)
-Use get_entities_by(0, mask, LAYER.BOTH)
instead
-get_entities_by_layer
-
-Search script examples for get_entities_by_layer
-
-array<int> get_entities_by_layer(LAYER layer)
-Use get_entities_by(0, MASK.ANY, layer)
instead
-get_entities_overlapping
-
-Search script examples for get_entities_overlapping
-
-array<int> get_entities_overlapping(array<ENT_TYPE> entity_types, int mask, float sx, float sy, float sx2, float sy2, LAYER layer)
array<int> get_entities_overlapping(ENT_TYPE entity_type, int mask, float sx, float sy, float sx2, float sy2, LAYER layer)
-Use get_entities_overlapping_hitbox
instead
-get_entity_ai_state
-
-Search script examples for get_entity_ai_state
-
-int get_entity_ai_state(int uid)
-As the name is misleading. use entity move_state
field instead
-set_arrowtrap_projectile
-
-Search script examples for set_arrowtrap_projectile
-
-nil set_arrowtrap_projectile(ENT_TYPE regular_entity_type, ENT_TYPE poison_entity_type)
-Use replace_drop(DROP.ARROWTRAP_WOODENARROW, new_arrow_type) and replace_drop(DROP.POISONEDARROWTRAP_WOODENARROW, new_arrow_type) instead
-set_blood_multiplication
-
-Search script examples for set_blood_multiplication
-
-nil set_blood_multiplication(int default_multiplier, int vladscape_multiplier)
-This function never worked properly as too many places in the game individually check for vlads cape and calculate the blood multiplication
-default_multiplier
doesn't do anything due to some changes in last game updates, vladscape_multiplier
only changes the multiplier to some entities death's blood spit
-set_camera_position
-
-Search script examples for set_camera_position
-
-nil set_camera_position(float cx, float cy)
-this doesn't actually work at all. See State -> Camera the for proper camera handling
-setflag
-
-Search script examples for setflag
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+int
+disappear_timer
+
+
+
+Bodyguard
+Derived from Entity Movable PowerupCapable Monster NPC
+
+
+
+Type
+Name
+Description
+
+
+
+int
+position_state
+0 - none, 1 - Tusk dice shop, 2 - Entrence to pleasure palace, 3 - Basement entrance to pleasure palace
+
+
+bool
+message_shown
+
+
+
+CatMummy
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+int
+ai_state
+
+
+
+int
+attack_timer
+
+
+
+Caveman
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
+
+Type
+Name
+Description
+
+
+
+int
+wake_up_timer
+
+
+
+int
+can_pick_up_timer
+0 = can pick something up, when holding forced to 179, after tripping and regaining consciousness counts down to 0
+
+
+int
+aggro_timer
+keeps resetting when angry and a player is nearby
+
+
+CavemanShopkeeper
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
+
+Type
+Name
+Description
+
+
+
+bool
+tripping
+
+
+
+bool
+shop_entered
+
+
+
+Cobra
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+int
+spit_timer
+
+
+
+Crabman
+Derived from Entity Movable PowerupCapable Monster
-nil setflag()
-clrflag
-
-Search script examples for clrflag
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+int
+invincibility_timer
+
+
+
+int
+poison_attack_timer
+
+
+
+int
+attacking_claw_uid
+
+
+
+bool
+at_maximum_attack
+
+
+
+Critter
+Derived from Entity Movable PowerupCapable Monster
-nil clrflag()
-testflag
-
-Search script examples for testflag
-
+
+
+Type
+Name
+Description
+
+
+
+int
+last_picked_up_by_uid
+
+
+
+int
+holding_state
+
+
+
+CritterBeetle
+Derived from Entity Movable PowerupCapable Monster Critter
-nil testflag()
-read_input
-
-Search script examples for read_input
-
+
+
+Type
+Name
+Description
+
+
+
+bool
+pause
+used when he's getting eaten
+
+
+CritterButterfly
+Derived from Entity Movable PowerupCapable Monster Critter
-INPUTS read_input(int uid)
-Use players[1].input.buttons_gameplay
for only the inputs during the game, or .buttons
for all the inputs, even during the pause menu
-Of course, you can get the Player by other mean, it doesn't need to be the players
table
-You can only read inputs from actual players, HH don't have any inputs
-read_stolen_input
-
-Search script examples for read_stolen_input
-
+
+
+Type
+Name
+Description
+
+
+
+int
+change_direction_timer
+
+
+
+int
+vertical_flight_direction
+
+
+
+CritterCrab
+Derived from Entity Movable PowerupCapable Monster Critter
-INPUTS read_stolen_input(int uid)
-Read input that has been previously stolen with steal_input
-Use state.player_inputs.player_slots[player_slot].buttons_gameplay
for only the inputs during the game, or .buttons
for all the inputs, even during the pause menu
-clear_entity_callback
-
-Search script examples for clear_entity_callback
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+bool
+walking_left
+
+
+
+bool
+unfriendly
+moves away from its target instead of towards it
+
+
+CritterDrone
+Derived from Entity Movable PowerupCapable Monster Critter
-nil clear_entity_callback(int uid, CallbackId cb_id)
-Use entity.clear_virtual
instead.
-Clears a callback that is specific to an entity.
-set_pre_statemachine
-
-Search script examples for set_pre_statemachine
-
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+SoundMeta
+sound
+
+
+
+float
+applied_hor_momentum
+
+
+
+float
+applied_ver_momentum
+
+
+
+bool
+unfriendly
+moves away from its target instead of towards it
+
+
+int
+move_timer
+
+
+
+CritterFirefly
+Derived from Entity Movable PowerupCapable Monster Critter
-optional<CallbackId> set_pre_statemachine(int uid, function fun)
-Use entity:set_pre_update_state_machine
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-uid
has to be the uid of a Movable
or else stuff will break.
-Sets a callback that is called right before the statemachine, return true
to skip the statemachine update.
-Use this only when no other approach works, this call can be expensive if overused.
-Check here to see whether you can use this callback on the entity type you intend to.
-
The callback signature is bool statemachine(Entity self)
-set_post_statemachine
-
-Search script examples for set_post_statemachine
-
+
+
+Type
+Name
+Description
+
+
+
+float
+sine_amplitude
+
+
+
+float
+sine_frequency
+
+
+
+float
+sine_angle
+
+
+
+int
+change_direction_timer
+
+
+
+int
+sit_timer
+
+
+
+int
+sit_cooldown_timer
+
+
+
+CritterFish
+Derived from Entity Movable PowerupCapable Monster Critter
-optional<CallbackId> set_post_statemachine(int uid, function fun)
-Use entity:set_post_update_state_machine
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-uid
has to be the uid of a Movable
or else stuff will break.
-Sets a callback that is called right after the statemachine, so you can override any values the satemachine might have set (e.g. animation_frame
).
-Use this only when no other approach works, this call can be expensive if overused.
-Check here to see whether you can use this callback on the entity type you intend to.
-
The callback signature is nil statemachine(Entity self)
-set_on_destroy
-
-Search script examples for set_on_destroy
-
+
+
+Type
+Name
+Description
+
+
+
+int
+swim_pause_timer
+
+
+
+bool
+player_in_proximity
+
+
+
+CritterLocust
+Derived from Entity Movable PowerupCapable Monster Critter
-optional<CallbackId> set_on_destroy(int uid, function fun)
-Use entity:set_pre_destroy
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right when an entity is destroyed, e.g. as if by Entity.destroy()
before the game applies any side effects.
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is nil on_destroy(Entity self)
-set_on_kill
-
-Search script examples for set_on_kill
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+jump_timer
+
+
+
+CritterPenguin
+Derived from Entity Movable PowerupCapable Monster Critter
-optional<CallbackId> set_on_kill(int uid, function fun)
-Use entity:set_pre_kill
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right when an entity is eradicated, before the game applies any side effects.
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is nil on_kill(Entity self, Entity killer)
-set_on_damage
-
-Search script examples for set_on_damage
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+int
+jump_timer
+
+
+
+CritterSlime
+Derived from Entity Movable PowerupCapable Monster Critter
-optional<CallbackId> set_on_damage(int uid, function fun)
-Use entity:set_pre_damage
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right before an entity is damaged, return true
to skip the game's damage handling.
-Note that damage_dealer can be nil ! (long fall, ...)
-DO NOT CALL self:damage()
in the callback !
-Use this only when no other approach works, this call can be expensive if overused.
-The entity has to be of a Movable type.
-
The callback signature is bool on_damage(Entity self, Entity damage_dealer, int damage_amount, float vel_x, float vel_y, int stun_amount, int iframes)
-set_pre_floor_update
-
-Search script examples for set_pre_floor_update
-
+
+
+Type
+Name
+Description
+
+
+
+float
+x_direction
+
+
+
+float
+y_direction
+
+
+
+float
+pos_x
+
+
+
+float
+pos_y
+
+
+
+float
+rotation_center_x
+
+
+
+float
+rotation_center_y
+
+
+
+float
+rotation_angle
+
+
+
+float
+rotation_speed
+
+
+
+int
+walk_pause_timer
+
+
+
+CritterSnail
+Derived from Entity Movable PowerupCapable Monster Critter
-optional<CallbackId> set_pre_floor_update(int uid, function fun)
-Use entity:set_pre_floor_update
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right before a floor is updated (by killed neighbor), return true
to skip the game's neighbor update handling.
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is bool pre_floor_update(Entity self)
-set_post_floor_update
-- Use FLOOR_GENERIC with textures from different themes that update correctly when destroyed.
--- This lets you use the custom tile code 'floor_generic_tidepool'
--- in the level editor to spawn tidepool floor in dwelling for example...
-define_tile_code("floor_generic_tidepool")
-set_pre_tile_code_callback(function(x, y, layer)
- local uid = spawn_grid_entity(ENT_TYPE.FLOOR_GENERIC, x, y, layer)
- set_post_floor_update(uid, function(me)
- me:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TIDEPOOL_0)
- for i,v in ipairs(entity_get_items_by(me.uid, ENT_TYPE.DECORATION_GENERIC, MASK.DECORATION)) do
- local deco = get_entity(v)
- deco:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TIDEPOOL_0)
- end
- end)
- return true
-end, "floor_generic_tidepool")
+
+
+Type
+Name
+Description
+
+
+
+float
+x_direction
+
+
+
+float
+y_direction
+
+
+
+float
+pos_x
+
+
+
+float
+pos_y
+
+
+
+float
+rotation_center_x
+
+
+
+float
+rotation_center_y
+
+
+
+float
+rotation_angle
+
+
+
+float
+rotation_speed
+
+
+
+Crocman
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
+Type
+Name
+Description
+
+
+
+int
+teleport_cooldown
+
+
+
+EggplantMinister
+Derived from Entity Movable PowerupCapable Monster
--- Fix quicksand decorations when not in temple
-set_post_entity_spawn(function(ent)
- ent:set_post_floor_update(function(me)
- me:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TEMPLE_0)
- for i,v in ipairs(entity_get_items_by(me.uid, ENT_TYPE.DECORATION_GENERIC, MASK.DECORATION)) do
- local deco = get_entity(v)
- deco:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TEMPLE_0)
- end
- end)
-end, SPAWN_TYPE.ANY, MASK.FLOOR, ENT_TYPE.FLOOR_QUICKSAND)
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+walk_pause_timer
+
+
+
+int
+squish_timer
+
+
+
+FireFrog
+Derived from Entity Movable PowerupCapable Monster Frog
-
-
-Search script examples for set_post_floor_update
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+Firebug
+Derived from Entity Movable PowerupCapable Monster
-optional<CallbackId> set_post_floor_update(int uid, function fun)
-Use entity:set_post_floor_update
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right after a floor is updated (by killed neighbor).
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is nil post_floor_update(Entity self)
-set_on_open
-
-Search script examples for set_on_open
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+fire_timer
+
+
+
+bool
+going_up
+
+
+
+bool
+detached_from_chain
+
+
+
+FirebugUnchained
+Derived from Entity Movable PowerupCapable Monster
-optional<CallbackId> set_on_open(int uid, function fun)
-Use entity:set_pre_trigger_action
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right when a container is opened by the player (up+whip)
-Use this only when no other approach works, this call can be expensive if overused.
-Check here to see whether you can use this callback on the entity type you intend to.
-
The callback signature is nil on_open(Entity entity_self, Entity opener)
-set_pre_collision1
-
-Search script examples for set_pre_collision1
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+float
+max_flight_height
+
+
+
+int
+ai_timer
+
+
+
+int
+walking_timer
+
+
+
+Fish
+Derived from Entity Movable PowerupCapable Monster
-optional<CallbackId> set_pre_collision1(int uid, function fun)
-Use entity:set_pre_collision1
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right before the collision 1 event, return true
to skip the game's collision handling.
-Use this only when no other approach works, this call can be expensive if overused.
-Check here to see whether you can use this callback on the entity type you intend to.
-
The callback signature is bool pre_collision1(Entity entity_self, Entity collision_entity)
-set_pre_collision2
-
-Search script examples for set_pre_collision2
-
+
+
+Type
+Name
+Description
+
+
+
+int
+change_direction_timer
+
+
+
+ForestSister
+Derived from Entity Movable PowerupCapable Monster NPC
-optional<CallbackId> set_pre_collision2(int uid, function fun)
-Use entity:set_pre_collision2
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right before the collision 2 event, return true
to skip the game's collision handling.
-Use this only when no other approach works, this call can be expensive if overused.
-Check here to see whether you can use this callback on the entity type you intend to.
-
The callback signature is bool pre_collision12(Entity self, Entity collision_entity)
-set_pre_render
-
-Search script examples for set_pre_render
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+Frog
+Derived from Entity Movable PowerupCapable Monster
-optional<CallbackId> set_pre_render(int uid, function fun)
-Use entity.rendering_info:set_pre_render
in combination with render_info:get_entity
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right after the entity is rendered.
-Return true
to skip the original rendering function and all later pre_render callbacks.
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is bool render(VanillaRenderContext render_ctx, Entity self)
-set_post_render
-
-Search script examples for set_post_render
-
+
+
+Type
+Name
+Description
+
+
+
+int
+grub_being_eaten_uid
+
+
+
+int
+jump_timer
+
+
+
+bool
+pause
+
+
+
+Ghist
+Derived from Entity Movable PowerupCapable Monster
-optional<CallbackId> set_post_render(int uid, function fun)
-Use entity.rendering_info:set_post_render
in combination with render_info:get_entity
instead.
-Returns unique id for the callback to be used in clear_entity_callback or nil
if uid is not valid.
-Sets a callback that is called right after the entity is rendered.
-Use this only when no other approach works, this call can be expensive if overused.
-
The callback signature is nil post_render(VanillaRenderContext render_ctx, Entity self)
-generate_particles
-
-Search script examples for generate_particles
-
-ParticleEmitterInfo generate_particles(int particle_emitter_id, int uid)
-Use generate_world_particles
-draw_line
-
-Search script examples for draw_line
-
+
+
+Type
+Name
+Description
+
+
+
+int
+body_uid
+
+
+
+int
+idle_timer
+
+
+
+SoundMeta
+sound
+
+
+
+int
+transparency
+
+
+
+int
+fadeout
+
+
+
+Ghost
+Derived from Entity Movable PowerupCapable Monster
-nil draw_line(float x1, float y1, float x2, float y2, float thickness, uColor color)
-Use GuiDrawContext.draw_line
instead
-draw_rect
-
-Search script examples for draw_rect
-
+
+
+Type
+Name
+Description
+
+
+
+int
+split_timer
+for SMALL_HAPPY this is also the sequence timer of its various states
+
+
+int
+wobble_timer
+
+
+
+int
+pace_timer
+Controls ghost pacing when all players are dead.
+
+
+float
+velocity_multiplier
+
+
+
+GHOST_BEHAVIOR
+ghost_behaviour
+
+
+
+Illumination
+emitted_light
+
+
+
+Entity
+linked_ghost
+
+
+
+SoundMeta
+sound
+
+
+
+bool
+blown_by_player
+
+
+
+bool
+happy_dancing_clockwise
+
+
+
+float
+target_dist_visibility_factor
+
+
+
+float
+target_layer_visibility_factor
+
+
+
+GiantFish
+Derived from Entity Movable PowerupCapable Monster
-nil draw_rect(float x1, float y1, float x2, float y2, float thickness, float rounding, uColor color)
-Use GuiDrawContext.draw_rect
instead
-draw_rect_filled
-
-Search script examples for draw_rect_filled
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+change_direction_timer
+when bouncing into a wall
+
+
+int
+lose_interest_timer
+delay in-between attacks
+
+
+GiantFly
+Derived from Entity Movable PowerupCapable Monster
-nil draw_rect_filled(float x1, float y1, float x2, float y2, float rounding, uColor color)
-Use GuiDrawContext.draw_rect_filled
instead
-draw_circle
-
-Search script examples for draw_circle
-
+
+
+Type
+Name
+Description
+
+
+
+Entity
+head_entity
+
+
+
+SoundMeta
+sound
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+float
+sine_amplitude
+
+
+
+float
+sine_frequency
+
+
+
+float
+delta_y_angle
+
+
+
+int
+sine_counter
+
+
+
+GiantFrog
+Derived from Entity Movable PowerupCapable Monster
-nil draw_circle(float x, float y, float radius, float thickness, uColor color)
-Use GuiDrawContext.draw_circle
instead
-draw_circle_filled
-
-Search script examples for draw_circle_filled
-
+
+
+Type
+Name
+Description
+
+
+
+Entity
+door_front_layer
+
+
+
+Entity
+door_back_layer
+
+
+
+Entity
+platform
+
+
+
+int
+attack_timer
+
+
+
+int
+frogs_ejected_in_cycle
+
+
+
+int
+invincibility_timer
+
+
+
+int
+mouth_close_timer
+
+
+
+bool
+mouth_open_trigger
+opens the mouth and starts mouth_close_timer, used when detecting grub in the mouth area
+
+
+GoldMonkey
+Derived from Entity Movable PowerupCapable Monster
-nil draw_circle_filled(float x, float y, float radius, uColor color)
-Use GuiDrawContext.draw_circle_filled
instead
-draw_text
-
-Search script examples for draw_text
-
+
+
+Type
+Name
+Description
+
+
+
+int
+jump_timer
+
+
+
+int
+poop_timer
+
+
+
+int
+poop_count
+
+
+
+Grub
+Derived from Entity Movable PowerupCapable Monster
-nil draw_text(float x, float y, float size, string text, uColor color)
-Use GuiDrawContext.draw_text
instead
-draw_image
-
-Search script examples for draw_image
-
+
+
+Type
+Name
+Description
+
+
+
+float
+rotation_delta
+
+
+
+bool
+drop
+
+
+
+int
+looking_for_new_direction_timer
+used when he touches floor/wall/ceiling
+
+
+int
+walk_pause_timer
+
+
+
+int
+turn_into_fly_timer
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+SoundMeta
+sound
+
+
+
+HangSpider
+Derived from Entity Movable PowerupCapable Monster
-nil draw_image(IMAGE image, float x1, float y1, float x2, float y2, float uvx1, float uvy1, float uvx2, float uvy2, uColor color)
-Use GuiDrawContext.draw_image
instead
-draw_image_rotated
-
-Search script examples for draw_image_rotated
-
+
+
+Type
+Name
+Description
+
+
+
+int
+dangle_jump_timer
+
+
+
+float
+ceiling_pos_x
+
+
+
+float
+ceiling_pos_y
+
+
+
+Hermitcrab
+Derived from Entity Movable PowerupCapable Monster
-nil draw_image_rotated(IMAGE image, float x1, float y1, float x2, float y2, float uvx1, float uvy1, float uvx2, float uvy2, uColor color, float angle, float px, float py)
-Use GuiDrawContext.draw_image_rotated
instead
-window
-
-Search script examples for window
-
+
+
+Type
+Name
+Description
+
+
+
+ENT_TYPE
+carried_entity_type
+
+
+
+int
+carried_entity_uid
+
+
+
+int
+walk_spit_timer
+
+
+
+bool
+is_active
+whether it is hidden behind the carried block or not, if true you can damage him
+
+
+bool
+is_inactive
+
+
+
+bool
+spawn_new_carried_item
+defaults to true, when toggled to false, a new carried item spawns
+
+
+HornedLizard
+Derived from Entity Movable PowerupCapable Monster
-nil window(string title, float x, float y, float w, float h, bool movable, function callback)
-Use GuiDrawContext.window
instead
-win_text
-
-Search script examples for win_text
-
+
+
+Type
+Name
+Description
+
+
+
+int
+eaten_uid
+dungbeetle being eaten
+
+
+int
+walk_pause_timer
+alternates between walking and pausing when timer reaches zero
+
+
+int
+attack_cooldown_timer
+won't attack until timer reaches zero
+
+
+int
+blood_squirt_timer
+
+
+
+SoundMeta
+sound
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+Hundun
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+float
+applied_hor_velocity
+
+
+
+float
+applied_ver_velocity
+
+
+
+int
+birdhead_entity_uid
+
+
+
+int
+snakehead_entity_uid
+
+
+
+float
+y_level
+current floor level
+
+
+int
+bounce_timer
+
+
+
+int
+fireball_timer
+
+
+
+bool
+birdhead_defeated
+
+
+
+bool
+snakehead_defeated
+
+
+
+int
+hundun_flags
+1: Will move to the left, 2: Birdhead emerged, 3: Snakehead emerged, 4: Top level arena reached, 5: Birdhead shot last - to alternate the heads shooting fireballs
+
+
+float
+y_limit
+This is custom variable, you need activate_hundun_hack to use it
+
+
+float
+rising_speed_x
+This is custom variable, you need activate_hundun_hack to use it
+
+
+float
+rising_speed_y
+This is custom variable, you need activate_hundun_hack to use it
+
+
+float
+bird_head_spawn_y
+This is custom variable, you need activate_hundun_hack to use it
+
+
+float
+snake_head_spawn_y
+This is custom variable, you need activate_hundun_hack to use it
+
+
+HundunHead
+Derived from Entity Movable PowerupCapable Monster
-nil win_text(string text)
-Use GuiDrawContext.win_text
instead
-win_separator
-
-Search script examples for win_separator
-
+
+
+Type
+Name
+Description
+
+
+
+float
+attack_position_x
+Posiotion where the head will move on attack
+
+
+float
+attack_position_y
+
+
+
+int
+egg_crack_effect_uid
+
+
+
+int
+targeted_player_uid
+
+
+
+int
+looking_for_target_timer
+also cooldown before attack
+
+
+int
+invincibility_timer
+
+
+
+Imp
+Derived from Entity Movable PowerupCapable Monster
-nil win_separator()
-Use GuiDrawContext.win_separator
instead
-win_inline
-
-Search script examples for win_inline
-
+
+
+Type
+Name
+Description
+
+
+
+int
+carrying_uid
+
+
+
+float
+patrol_y_level
+
+
+
+Jiangshi
+Derived from Entity Movable PowerupCapable Monster
-nil win_inline()
-Use GuiDrawContext.win_inline
instead
-win_sameline
-
-Search script examples for win_sameline
-
+
+
+Type
+Name
+Description
+
+
+
+int
+wait_timer
+wait time between jumps
+
+
+int
+jump_counter
+only female aka assassin: when 0 will jump up into ceiling
+
+
+bool
+on_ceiling
+only female aka assassin
+
+
+JumpDog
+Derived from Entity Movable PowerupCapable Monster
-nil win_sameline(float offset, float spacing)
-Use GuiDrawContext.win_sameline
instead
-win_button
-
-Search script examples for win_button
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+
+
+int
+squish_timer
+
+
+
+Kingu
+Derived from Entity Movable PowerupCapable Monster
-bool win_button(string text)
-Use GuiDrawContext.win_button
instead
-win_input_text
-
-Search script examples for win_input_text
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound1
+initialized when breaking the shell (sliding down sound maybe?)
+
+
+SoundMeta
+sound2
+Turning into stone sound
+
+
+float
+climb_direction_x
+
+
+
+float
+climb_direction_y
+
+
+
+int
+climb_pause_timer
+
+
+
+int
+shell_invincibility_timer
+
+
+
+int
+monster_spawn_timer
+
+
+
+int
+initial_shell_health
+excalibur wipes out immediately, bombs take off 11 points, when 0 vulnerable to whip
+
+
+bool
+player_seen_by_kingu
+
+
+
+Lahamu
+Derived from Entity Movable PowerupCapable Monster
-string win_input_text(string label, string value)
-Use GuiDrawContext.win_input_text
instead
-win_input_int
-
-Search script examples for win_input_int
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+Entity
+eyeball
+
+
+
+int
+attack_cooldown_timer
+
+
+
+Lamassu
+Derived from Entity Movable PowerupCapable Monster
-int win_input_int(string label, int value)
-Use GuiDrawContext.win_input_int
instead
-win_input_float
-
-Search script examples for win_input_float
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+Entity
+attack_effect_entity
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+Illumination
+emitted_light
+
+
+
+int
+walk_pause_timer
+
+
+
+int
+flight_timer
+
+
+
+int
+attack_timer
+
+
+
+float
+attack_angle
+
+
+
+Lavamander
+Derived from Entity Movable PowerupCapable Monster
-float win_input_float(string label, float value)
-Use GuiDrawContext.win_input_float
instead
-win_slider_int
-
-Search script examples for win_slider_int
-
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+int
+shoot_lava_timer
+when this timer reaches zero, it appears on the surface/shoots lava, triggers on player proximity
+
+
+int
+jump_pause_timer
+
+
+
+int
+lava_detection_timer
+
+
+
+bool
+is_hot
+
+
+
+int
+player_detect_state
+0 - didnt_saw_player, 1 - saw_player, 2 - spited_lava; probably used so he won't spit imminently after seeing the player
+
+
+Leprechaun
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
-int win_slider_int(string label, int value, int min, int max)
-Use GuiDrawContext.win_slider_int
instead
-win_drag_int
-
-Search script examples for win_drag_int
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+hump_timer
+
+
+
+int
+target_in_sight_timer
+
+
+
+int
+gold
+amount of gold he picked up, will be drooped on death
+
+
+int
+timer_after_humping
+
+
+
+MagmaMan
+Derived from Entity Movable PowerupCapable Monster
-int win_drag_int(string label, int value, int min, int max)
-Use GuiDrawContext.win_drag_int
instead
-win_slider_float
-
-Search script examples for win_slider_float
-
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
+
+
+
+SoundMeta
+sound
+
+
+
+ParticleEmitterInfo
+particle
+
+
+
+int
+jump_timer
+
+
+
+int
+alive_timer
+
+
+
+Mantrap
+Derived from Entity Movable PowerupCapable Monster
-float win_slider_float(string label, float value, float min, float max)
-Use GuiDrawContext.win_slider_float
instead
-win_drag_float
-
-Search script examples for win_drag_float
-
+
+
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+alternates between walking and pausing every time it reaches zero
+
+
+int
+eaten_uid
+the uid of the entity the mantrap has eaten, in case it can break out, like a shopkeeper
+
+
+Mech
+Derived from Entity Movable PowerupCapable Mount
-float win_drag_float(string label, float value, float min, float max)
-Use GuiDrawContext.win_drag_float
instead
-win_check
-
-Search script examples for win_check
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+crouch_walk_sound
+
+
+
+SoundMeta
+explosion_sound
+
+
+
+int
+gun_cooldown
+
+
+
+bool
+walking
+
+
+
+bool
+breaking_wall
+
+
+
+MegaJellyfish
+Derived from Entity Movable PowerupCapable Monster
-bool win_check(string label, bool value)
-Use GuiDrawContext.win_check
instead
-win_combo
-
-Search script examples for win_combo
-
+
+
+Type
+Name
+Description
+
+
+
+Entity
+flipper1
+
+
+
+Entity
+flipper2
+
+
+
+SoundMeta
+sound
+
+
+
+int
+orb_uid
+game checks if this uid, and two following exist, if not, the Jellyfish starts chasing player
+
+
+int
+tail_bg_uid
+
+
+
+float
+applied_velocity
+
+
+
+float
+wagging_tail_counter
+
+
+
+int
+flipper_distance
+only applies to door-blocking one
+
+
+int
+velocity_application_timer
+
+
+
+Mole
+Derived from Entity Movable PowerupCapable Monster
-int win_combo(string label, int selected, string opts)
-Use GuiDrawContext.win_combo
instead
-win_pushid
-
-Search script examples for win_pushid
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+burrowing_sound
+
+
+
+SoundMeta
+nonburrowing_sound
+
+
+
+ParticleEmitterInfo
+burrowing_particle
+
+
+
+float
+burrow_dir_x
+
+
+
+float
+burrow_dir_y
+
+
+
+int
+burrowing_in_uid
+stores the last uid as well
+
+
+int
+counter_burrowing
+
+
+
+int
+counter_nonburrowing
+
+
+
+int
+countdown_for_appearing
+
+
+
+int
+digging_state
+0 - non_burrowed, 1 - unknown, 2 - burrowed, 3 - state_change
+
+
+Monkey
+Derived from Entity Movable PowerupCapable Monster
-nil win_pushid(int id)
-Use GuiDrawContext.win_pushid
instead
-win_popid
-
-Search script examples for win_popid
-
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+
+
+
+int
+jump_timer
+
+
+
+bool
+on_vine
+
+
+
+Monster
+Derived from Entity Movable PowerupCapable
-nil win_popid()
-Use GuiDrawContext.win_popid
instead
-win_image
-
-Search script examples for win_image
-
+
+
+Type
+Name
+Description
+
+
+
+int
+chased_target_uid
+
+
+
+int
+target_selection_timer
+
+
+
+Mosquito
+Derived from Entity Movable PowerupCapable Monster
-nil win_image(IMAGE image, float width, float height)
-Use GuiDrawContext.win_image
instead
-Non-Entity types
Arena types
ArenaConfigArenas
-Used in ArenaState
+
+
+Type
+Name
+Description
+
+
+
+float
+direction_x
+
+
+
+float
+direction_y
+
+
+
+float
+stuck_rel_pos_x
+
+
+
+float
+stuck_rel_pos_y
+
+
+
+SoundMeta
+sound
+
+
+
+int
+timer
+
+
+
+Mount
+Derived from Entity Movable PowerupCapable
@@ -5093,208 +21593,392 @@ Non-Entity types
Arena types<
-bool
-dwelling_1
+int
+rider_uid
-bool
-dwelling_2
+SoundMeta
+sound
bool
-dwelling_3
+can_doublejump
bool
-dwelling_4
+tamed
-bool
-dwelling_5
+int
+walk_pause_timer
-bool
-jungle_1
+int
+taming_timer
bool
-jungle_2
+used_double_jump()
-bool
-jungle_3
+nil
+remove_rider()
-bool
-jungle_4
+nil
+carry(Movable rider)
-bool
-jungle_5
+nil
+tame(bool value)
+
+Mummy
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-volcana_1
+Type
+Name
+Description
+
+
+
+int
+walk_pause_timer
+
+NPC
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-volcana_2
+Type
+Name
+Description
+
+
+
+float
+climb_direction
-bool
-volcana_3
+int
+target_in_sight_timer
-bool
-volcana_4
+int
+ai_state
bool
-volcana_5
+aggro
+for bodyguard and shopkeeperclone it spawns a weapon as well
+
+
+Necromancer
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
-bool
-tidepool_1
+float
+red_skeleton_spawn_x
-bool
-tidepool_2
+float
+red_skeleton_spawn_y
-bool
-tidepool_3
+int
+resurrection_uid
-bool
-tidepool_4
+int
+resurrection_timer
+
+Octopus
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
+
+Type
+Name
+Description
+
+
+
+Olmite
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
+
+Type
+Name
+Description
+
+
bool
-tidepool_5
+armor_on
bool
-temple_1
-
+in_stack
+disables the attack, stun, lock's looking left flag between stack
bool
-temple_2
+in_stack2
+is set to false couple frame after being detached from stack
+
+
+int
+on_top_uid
-bool
-temple_3
+float
+y_offset
-bool
-temple_4
+int
+attack_cooldown_timer
+
+OsirisHand
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-temple_5
+Type
+Name
+Description
+
+
+
+int
+attack_cooldown_timer
+
+OsirisHead
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
-bool
-icecaves_1
+int
+right_hand_uid
+right from his perspective
+
+
+int
+left_hand_uid
bool
-icecaves_2
+moving_left
-bool
-icecaves_3
+int
+targeting_timer
-bool
-icecaves_4
-
+int
+invincibility_timer
+
+
+
+Pet
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
+
+
+Entity
+fx_button
+
+
+
+int
+petting_by_uid
+person whos petting it, only in the camp
+
+
+int
+yell_counter
+counts up to 400 (6.6 sec), when 0 the pet yells out
+
+
+int
+func_timer
+used when free running in the camp
+
+
+int
+active_state
+-1 = sitting and yelling, 0 = either running, dead or picked up
+
+
+int
+petted_counter
+number of times petted in the camp
+
+
+Player
+Derived from Entity Movable PowerupCapable
+
+
+
+Type
+Name
+Description
+
+
+
+Inventory
+inventory
+
+
+
+Illumination
+emitted_light
+
+
+
+int
+linked_companion_parent
+entity uid
+
+
+int
+linked_companion_child
+entity uid
+
+
+Ai
+ai
+
+
+
+PlayerSlot
+input
+
+
+
+Entity
+basecamp_button_entity
+Used in base camp to talk with the NPC's
+
+
+int
+jump_lock_timer
+Increases when holding jump button in the air, set to max while jumping. If this isn't 0, a jump will only be
registered if the jump button was not held on the previous frame.
-bool
-icecaves_5
-
+int
+coyote_timer
+can jump while airborne if greater than 0
-bool
-neobabylon_1
-
+int
+swim_timer
+Timer between strokes when holding jump button in water.
-bool
-neobabylon_2
-
+int
+hired_hand_name
+0-25 alphabetical index of hired hand names.
-bool
-neobabylon_3
+nil
+set_jetpack_fuel(int fuel)
-bool
-neobabylon_4
+int
+kapala_blood_amount()
-bool
-neobabylon_5
-
+string
+get_name()
+Get the full name of the character, this will be the modded name not only the vanilla name.
-bool
-sunkencity_1
-
+string
+get_short_name()
+Get the short name of the character, this will be the modded name not only the vanilla name.
-bool
-sunkencity_2
-
+Color
+get_heart_color()
+Get the heart color of the character, this will be the modded heart color not only the vanilla heart color.
bool
-sunkencity_3
-
+is_female()
+Check whether the character is female, will be true
if the character was modded to be female as well.
-bool
-sunkencity_4
-
+nil
+set_heart_color(Color hcolor)
+Set the heart color the character.
-bool
-sunkencity_5
-
+nil
+let_go()
+Drops from ladders, ropes and ledge grabs
-ArenaConfigEquippedItems
-Used in ArenaState
+PowerupCapable
+
@@ -5304,48 +21988,38 @@ ArenaConfigEquippedItems
-bool
-paste
-
-
-
-bool
-climbing_gloves
-
-
-
-bool
-pitchers_mitt
-
+nil
+remove_powerup(ENT_TYPE powerup_type)
+Removes a currently applied powerup. Specify ENT_TYPE.ITEM_POWERUP_xxx
, not ENT_TYPE.ITEM_PICKUP_xxx
! Removing the Eggplant crown does not seem to undo the throwing of eggplants, the other powerups seem to work.
-bool
-spike_shoes
-
+nil
+give_powerup(ENT_TYPE powerup_type)
+Gives the player/monster the specified powerup. Specify ENT_TYPE.ITEM_POWERUP_xxx
, not ENT_TYPE.ITEM_PICKUP_xxx
! Giving true crown to a monster crashes the game.
bool
-spring_shoes
-
+has_powerup(ENT_TYPE powerup_type)
+Checks whether the player/monster has a certain powerup
-bool
-parachute
-
+array<ENT_TYPE>
+get_powerups()
+Return all powerups that the entity has
-bool
-kapala
-
+nil
+unequip_backitem()
+Unequips the currently worn backitem
-bool
-scepter
-
+int
+worn_backitem()
+Returns the uid of the currently worn backitem, or -1 if wearing nothing
-ArenaConfigItems
-Used in ArenaState
+ProtoShopkeeper
+Derived from Entity Movable PowerupCapable Monster
@@ -5355,208 +22029,262 @@ ArenaConfigItems
-bool
-rock
-
+int
+movement_state
+1: "Headpulse/explosion related, 2: Walking, 3: Headpulse/explosion related, 4: Crawling, 6: Headpulse/explosion related
-bool
-pot
+int
+walk_pause_explode_timer
-bool
-bombbag
-
+int
+walking_speed
+0 = slow, 4 = fast
+
+Qilin
+Derived from Entity Movable PowerupCapable Mount
+
+
-bool
-bombbox
-
+Type
+Name
+Description
+
-bool
-ropepile
+SoundMeta
+fly_gallop_sound
-bool
-pickup_12bag
+int
+attack_cooldown
+
+Quillback
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
-bool
-pickup_24bag
-
+Type
+Name
+Description
+
-bool
-cooked_turkey
+SoundMeta
+sound
-bool
-royal_jelly
+ParticleEmitterInfo
+particle
bool
-torch
+seen_player
+
+Robot
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
-bool
-boomerang
-
+Type
+Name
+Description
+
-bool
-machete
+SoundMeta
+sound
-bool
-mattock
+Illumination
+emitted_light_explosion
+
+Rockdog
+Derived from Entity Movable PowerupCapable Mount
+
+
-bool
-crossbow
-
+Type
+Name
+Description
+
-bool
-webgun
+int
+attack_cooldown
+
+RoomOwner
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-freezeray
-
+Type
+Name
+Description
+
-bool
-shotgun
+int
+room_index
-bool
-camera
+float
+climb_y_direction
-bool
-plasma_cannon
+int
+ai_state
-bool
-wooden_shield
+int
+patrol_timer
-bool
-metal_shield
+int
+lose_interest_timer
-bool
-teleporter
-
+int
+countdown_timer
+can't shot when the timer is running
bool
-mine
+is_patrolling
bool
-snaptrap
-
+aggro_trigger
+setting this makes him angry, if it's shopkeeper you get 2 agrro points
bool
-paste
-
+was_hurt
+also is set true if you set aggro to true, get's trigger even when whiping
+
+Scarab
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-climbing_gloves
-
+Type
+Name
+Description
+
-bool
-pitchers_mitt
+SoundMeta
+sound
-bool
-spike_shoes
+Illumination
+emitted_light
-bool
-spring_shoes
-
+int
+timer
+how long to stay in current position
+
+Scorpion
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-parachute
-
+Type
+Name
+Description
+
-bool
-cape
+int
+walk_pause_timer
-bool
-vlads_cape
+int
+jump_cooldown_timer
+
+Shopkeeper
+Derived from Entity Movable PowerupCapable Monster RoomOwner
+
+
-bool
-jetpack
-
+Type
+Name
+Description
+
-bool
-hoverpack
-
+int
+name
+0 - Ali, 1 - Bob, 2 - Comso ... and so one, anything above 28 is just random string, can crash the game
-bool
-telepack
-
+int
+shotgun_attack_delay
+can't shot when the timer is running
bool
-powerpack
-
+has_key
+will drop key after stun/kill
bool
-excalibur
+is_ear
bool
-scepter
+shop_owner
+
+Skeleton
+Derived from Entity Movable PowerupCapable Monster
+
+
-bool
-kapala
-
+Type
+Name
+Description
+
-bool
-true_crown
-
+int
+explosion_timer
+-1 = never explodes
-ArenaState
-Used in StateMemory
+Sorceress
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
@@ -5567,170 +22295,191 @@ ArenaState
int
-current_arena
-
-
-
-array<int, 4>
-player_teams
+inbetween_attack_timer
-int
-format
+float
+in_air_timer
-int
-ruleset
+Illumination
+halo_emitted_light
-array<int, 4>
-player_lives
+Entity
+fx_entity
-array<int, 4>
-player_totalwins
+SoundMeta
+sound
-array<bool, 4>
-player_won
+int
+hover_timer
+
+Spider
+Derived from Entity Movable PowerupCapable Monster
+
+
-int
-timer
-The menu selection for timer, default values 0..20 where 0 == 30 seconds, 19 == 10 minutes and 20 == infinite. Can go higher, although this will glitch the menu text. Actual time (seconds) = (state.arena.timer + 1) x 30
+Type
+Name
+Description
+
-int
-timer_ending
+float
+ceiling_pos_x
-int
-wins
+float
+ceiling_pos_y
int
-lives
-
+jump_timer
+For the giant spider, some times he shot web instead of jumping
-int
-time_to_win
-
+float
+trigger_distance
+only in the x coord
+
+Tadpole
+Derived from Entity Movable PowerupCapable Monster
+
+
-array<int, 4>
-player_idolheld_countdown
-
+Type
+Name
+Description
+
int
-health
+acceleration_timer
-int
-bombs
+bool
+player_spotted
+
+Terra
+Derived from Entity Movable PowerupCapable Monster
+
+
-int
-ropes
-
+Type
+Name
+Description
+
-int
-stun_time
+Entity
+fx_button
-int
-mount
+float
+x_pos
int
-arena_select
+abuse_speechbubble_timer
+
+Tiamat
+Derived from Entity Movable PowerupCapable Monster
+
+
-ArenaConfigArenas
-arenas
-
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
+Turning into stone sound
int
-dark_level_chance
+fx_tiamat_head
int
-crate_frequency
+fx_tiamat_arm_right1
-ArenaConfigItems
-items_enabled
+int
+fx_tiamat_arm_right2
-ArenaConfigItems
-items_in_crate
+int
+frown_timer
int
-held_item
+damage_timer
int
-equipped_backitem
+attack_timer
-ArenaConfigEquippedItems
-equipped_items
+float
+tail_angle
-int
-whip_damage
+float
+tail_radian
-bool
-final_ghost
+float
+tail_move_speed
-int
-breath_cooldown
+float
+right_arm_angle
-bool
-punish_ball
-
+float
+attack_x
+This is custom variable, you need activate_tiamat_position_hack to use it
+
+
+float
+attack_y
+This is custom variable, you need activate_tiamat_position_hack to use it
-Callback context types
GuiDrawContext
-- Draw the level boundaries
-set_callback(function(draw_ctx)
- local xmin, ymax, xmax, ymin = get_bounds()
- local sx, sy = screen_position(xmin, ymax) -- top left
- local sx2, sy2 = screen_position(xmax, ymin) -- bottom right
- draw_ctx:draw_rect(sx, sy, sx2, sy2, 4, 0, rgba(255, 255, 255, 255))
-end, ON.GUIFRAME)
-
-
-Used in register_option_callback and set_callback with ON.GUIFRAME
+Tun
+Derived from Entity Movable PowerupCapable Monster RoomOwner
@@ -5740,224 +22489,256 @@ Callback context types
UFO
+Derived from Entity Movable PowerupCapable Monster
+
+
-nil
-draw_poly(array points, float thickness, uColor color)
-Draws a polyline on screen.
+Type
+Name
+Description
+
-nil
-draw_poly_filled(array points, uColor color)
-Draws a filled convex polyline on screen.
+SoundMeta
+sound
+
-nil
-draw_bezier_cubic(Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float thickness, uColor color)
-Draws a cubic bezier curve on screen.
+int
+patrol_distance
+
-nil
-draw_bezier_quadratic(Vec2 p1, Vec2 p2, Vec2 p3, float thickness, uColor color)
-Draws a quadratic bezier curve on screen.
+int
+attack_cooldown_timer
+
-nil
-draw_circle(float x, float y, float radius, float thickness, uColor color)
-Draws a circle on screen
+bool
+is_falling
+
+
+Vampire
+Derived from Entity Movable PowerupCapable Monster
+
+
-nil
-draw_circle_filled(float x, float y, float radius, uColor color)
-Draws a filled circle on screen
+Type
+Name
+Description
+
-nil
-draw_text(float x, float y, float size, string text, uColor color)
-Draws text in screen coordinates x
, y
, anchored top-left. Text size 0 uses the default 18.
+float
+jump_trigger_distance_x
+
-nil
-draw_image(IMAGE image, float left, float top, float right, float bottom, float uvx1, float uvy1, float uvx2, float uvy2, uColor color)
-Draws an image on screen from top-left to bottom-right. Use UV coordinates 0, 0, 1, 1
to just draw the whole image.
+float
+jump_trigger_distance_y
+
-nil
-draw_image(IMAGE image, AABB rect, AABB uv_rect, uColor color)
-Draws an image on screen from top-left to bottom-right. Use UV coordinates 0, 0, 1, 1
to just draw the whole image.
+float
+sleep_pos_x
+
-nil
-draw_image_rotated(IMAGE image, float left, float top, float right, float bottom, float uvx1, float uvy1, float uvx2, float uvy2, uColor color, float angle, float px, float py)
-Same as draw_image
but rotates the image by angle in radians around the pivot offset from the center of the rect (meaning px=py=0
rotates around the center)
+float
+sleep_pos_y
+
-nil
-draw_image_rotated(IMAGE image, AABB rect, AABB uv_rect, uColor color, float angle, float px, float py)
-Same as draw_image
but rotates the image by angle in radians around the pivot offset from the center of the rect (meaning px=py=0
rotates around the center)
+int
+walk_pause_timer
+
+
+VanHorsing
+Derived from Entity Movable PowerupCapable Monster NPC
+
+
-nil
-draw_layer(DRAW_LAYER layer)
-Draw on top of UI windows, including platform windows that may be outside the game area, or only in current widget window. Defaults to main viewport background.
+Type
+Name
+Description
+
bool
-window(string title, float x, float y, float w, float h, bool movable, function callback)
-Create a new widget window. Put all win_ widgets inside the callback function. The window functions are just wrappers for the
ImGui widgets, so read more about them there. Use screen position and distance, or 0, 0, 0, 0
to
autosize in center. Use just a ##Label
as title to hide titlebar.
Important: Keep all your labels unique! If you need inputs with the same label, add ##SomeUniqueLabel
after the text, or use pushid to
give things unique ids. ImGui doesn't know what you clicked if all your buttons have the same text...
Returns false if the window was closed from the X.
The callback signature is nil win(GuiDrawContext ctx, Vec2 pos, Vec2 size)
-
-
-nil
-win_text(string text)
-Add some text to window, automatically wrapped
-
-
-nil
-win_separator()
-Add a separator line to window
-
-
-nil
-win_separator_text(string text)
-Add a separator text line to window
-
-
-nil
-win_inline()
-Add next thing on the same line. This is same as win_sameline(0, -1)
-
-
-nil
-win_sameline(float offset, float spacing)
-Add next thing on the same line, with an offset
+show_text
+if set to true, he will say 'i've been hunting this fiend a long time!' when on screen
bool
-win_button(string text)
-Add a button
+special_message_shown
+one way door message has been shown
+
+Vlad
+Derived from Entity Movable PowerupCapable Monster Vampire
+
+
-string
-win_input_text(string label, string value)
-Add a text field
+Type
+Name
+Description
+
int
-win_input_int(string label, int value)
-Add an integer field
+teleport_timer
+triggers when Vlad teleports, when timer running he can't teleport and will stun when hit
-float
-win_input_float(string label, float value)
-Add a float field
+bool
+aggro
+or is awake
+
+Waddler
+Derived from Entity Movable PowerupCapable Monster RoomOwner
+
+
-int
-win_slider_int(string label, int value, int min, int max)
-Add an integer slider
+Type
+Name
+Description
+
+
+
+bool
+player_detected
+
+
+
+bool
+on_the_ground
+
int
-win_drag_int(string label, int value, int min, int max)
-Add an integer dragfield
+air_timer
+
+
+WalkingMonster
+Derived from Entity Movable PowerupCapable Monster
+
+
-float
-win_slider_float(string label, float value, float min, float max)
-Add an float slider
+Type
+Name
+Description
+
-float
-win_drag_float(string label, float value, float min, float max)
-Add an float dragfield
+int
+chatting_to_uid
+
-bool
-win_check(string label, bool value)
-Add a checkbox
+int
+walk_pause_timer
+alternates between walking and pausing every time it reaches zero
int
-win_combo(string label, int selected, string opts)
-Add a combo box
+cooldown_timer
+used for chatting with other monsters, attack cooldowns etc.
+
+WitchDoctor
+Derived from Entity Movable PowerupCapable Monster WalkingMonster
+
+
-nil
-win_pushid(int id)
-Add unique identifier to the stack, to distinguish identical inputs from each other. Put before the input.
+Type
+Name
+Description
+
-nil
-win_pushid(string id)
-Add unique identifier to the stack, to distinguish identical inputs from each other. Put before the input.
+SoundMeta
+sound
+
-nil
-win_popid()
-Pop unique identifier from the stack. Put after the input.
+int
+skull_regen_timer
+
+
+WitchDoctorSkull
+Derived from Entity Movable PowerupCapable Monster
+
+
-nil
-win_image(IMAGE image, float width, float height)
-Draw image to window.
+Type
+Name
+Description
+
-bool
-win_imagebutton(string label, IMAGE image, float width, float height, float uvx1, float uvy1, float uvx2, float uvy2)
-Draw imagebutton to window.
+int
+witch_doctor_uid
+
-nil
-win_section(string title, function callback)
-Add a collapsing accordion section, put contents in the callback function.
+Illumination
+emitted_light
+
-nil
-win_indent(float width)
-Indent contents, or unindent if negative
+SoundMeta
+sound
+
-nil
-win_width(float width)
-Sets next item width (width>1: width in pixels, width<0: to the right of window, -1<width<1: fractional, multiply by available window width)
+float
+rotation_angle
+
-LoadContext
-Context received in ON.LOAD
-Used to load from save_{}.dat into a string
+Yama
+Derived from Entity Movable PowerupCapable Monster
@@ -5967,14 +22748,13 @@ LoadContext
-string
-load()
+bool
+message_shown
-PostRoomGenerationContext
-Context received in ON.POST_ROOM_GENERATION.
-Used to change the room templates in the level and other shenanigans that affect level gen.
+Yang
+Derived from Entity Movable PowerupCapable Monster RoomOwner
@@ -5984,54 +22764,64 @@ PostRoomGenerationContext
-bool
-set_room_template(int x, int y, LAYER layer, ROOM_TEMPLATE room_template)
-Set the room template at the given index and layer, returns false
if the index is outside of the level.
+set<int>
+turkeys_in_den
+Table of uid's of the turkeys, goes only up to 3, is nil when yang is angry
bool
-mark_as_machine_room_origin(int x, int y, LAYER layer)
-Marks the room as the origin of a machine room, should be the top-left corner of the machine room
Run this after setting the room template for the room, otherwise the machine room will not spawn correctly
+first_message_shown
+I'm looking for turkeys, wanna help?
bool
-mark_as_set_room(int x, int y, LAYER layer)
-Marks the room as a set-room, a corresponding setroomy-x
template must be loaded, else the game will crash
+quest_incomplete
+Is set to false when the quest is over (Yang dead or second turkey delivered)
bool
-unmark_as_set_room(int x, int y, LAYER layer)
-Unmarks the room as a set-room
+special_message_shown
+Tusk palace/black market/one way door - message shown
+
+
+YetiKing
+Derived from Entity Movable PowerupCapable Monster
+
+
+
+Type
+Name
+Description
+
-bool
-set_shop_type(int x, int y, LAYER layer, int shop_type)
-Set the shop type for a specific room, does nothing if the room is not a shop
+int
+walk_pause_timer
+
-bool
-set_procedural_spawn_chance(PROCEDURAL_CHANCE chance_id, int inverse_chance)
-Force a spawn chance for this level, has the same restrictions as specifying the spawn chance in the .lvl file.
Note that the actual chance to spawn is 1/inverse_chance
and that is also slightly skewed because of technical reasons.
Returns false
if the given chance is not defined.
+Illumination
+emitted_light
+
-nil
-set_num_extra_spawns(int extra_spawn_id, int num_spawns_front_layer, int num_spawns_back_layer)
-Change the amount of extra spawns for the given extra_spawn_id
.
+ParticleEmitterInfo
+particle_fog
+
-optional<SHORT_TILE_CODE>
-define_short_tile_code(ShortTileCodeDef short_tile_code_def)
-Defines a new short tile code, automatically picks an unused character or returns a used one in case of an exact match
Returns nil
if all possible short tile codes are already in use
+ParticleEmitterInfo
+particle_dust
+
-nil
-change_short_tile_code(SHORT_TILE_CODE short_tile_code, ShortTileCodeDef short_tile_code_def)
-Overrides a specific short tile code, this means it will change for the whole level
+ParticleEmitterInfo
+particle_sparkles
+
-PreHandleRoomTilesContext
-Context received in ON.PRE_HANDLE_ROOM_TILES.
-Used to change the room data as well as add a backlayer room if none is set yet.
+YetiQueen
+Derived from Entity Movable PowerupCapable Monster
@@ -6041,43 +22831,39 @@ PreHandleRoomTilesContext
-optional<SHORT_TILE_CODE>
-get_short_tile_code(int tx, int ty, LAYER layer)
-Gets the tile code at the specified tile coordinate
Valid coordinates are 0 <= tx < CONST.ROOM_WIDTH
, 0 <= ty < CONST.ROOM_HEIGHT
and layer
in {LAYER.FRONT, LAYER.BACK}
Also returns nil
if layer == LAYER.BACK
and the room does not have a back layer
-
-
-bool
-set_short_tile_code(int tx, int ty, LAYER layer, SHORT_TILE_CODE short_tile_code)
-Sets the tile code at the specified tile coordinate
Valid coordinates are 0 <= tx < CONST.ROOM_WIDTH
, 0 <= ty < CONST.ROOM_HEIGHT
and layer
in {LAYER.FRONT, LAYER.BACK, LAYER.BOTH}
Also returns false
if layer == LAYER.BACK
and the room does not have a back layer
-
-
-array<tuple<int, int, LAYER>>
-find_all_short_tile_codes(LAYER layer, SHORT_TILE_CODE short_tile_code)
-Finds all places a short tile code is used in the room, layer
must be in {LAYER.FRONT, LAYER.BACK, LAYER.BOTH}
Returns an empty list if layer == LAYER.BACK
and the room does not have a back layer
+int
+walk_pause_timer
+
+
+Movable entities
AcidBubble
+
+
+
-bool
-replace_short_tile_code(LAYER layer, SHORT_TILE_CODE short_tile_code, SHORT_TILE_CODE replacement_short_tile_code)
-Replaces all instances of short_tile_code
in the given layer with replacement_short_tile_code
, layer
must be in {LAYER.FRONT, LAYER.BACK, LAYER.BOTH}
Returns false
if layer == LAYER.BACK
and the room does not have a back layer
+Type
+Name
+Description
+
-bool
-has_back_layer()
-Check whether the room has a back layer
+float
+speed_x
+
-nil
-add_empty_back_layer()
-Add a back layer filled with all 0
if there is no back layer yet
Does nothing if there already is a backlayer
+float
+speed_y
+
-nil
-add_copied_back_layer()
-Add a back layer that is a copy of the front layer
Does nothing if there already is a backlayer
+float
+float_counter
+
-PreLoadLevelFilesContext
-Context received in ON.PRE_LOAD_LEVEL_FILES, used for forcing specific .lvl
files to load.
+AnkhPowerup
+Derived from Entity Movable Powerup
@@ -6087,20 +22873,43 @@ PreLoadLevelFilesContext
-nil
-override_level_files(array levels)
-Block all loading .lvl
files and instead load the specified .lvl
files. This includes generic.lvl
so if you need it specify it here.
All .lvl
files are loaded relative to Data/Levels
, but they can be completely custom .lvl
files that ship with your mod so long as they are in said folder.
Use at your own risk, some themes/levels expect a certain level file to be loaded.
+SoundMeta
+sound
+
-nil
-add_level_files(array levels)
-Load additional levels files other than the ones that would usually be loaded. Stacks with override_level_files
if that was called first.
All .lvl
files are loaded relative to Data/Levels
, but they can be completely custom .lvl
files that ship with your mod so long as they are in said folder.
+Entity
+player
+
+
+
+Entity
+fx_glow
+
+
+
+int
+timer1
+
+
+
+int
+timer2
+
+
+
+int
+timer3
+
+
+
+bool
+music_on_off
+
-SaveContext
-Context received in ON.SAVE
-Used to save a string to some form of save_{}.dat
-Future calls to this will override the save
+Arrow
+Derived from Entity Movable Purchasable
@@ -6110,13 +22919,38 @@ SaveContext
+int
+flame_uid
+
+
+
bool
-save(string data)
+is_on_fire
+
+
+
+bool
+is_poisoned
+
+
+
+bool
+shot_from_trap
+
+
+
+nil
+poison_arrow(bool poisoned)
+
+
+
+nil
+light_up(bool lit)
-VanillaRenderContext
-Used in set_callback ON.RENDER_ callbacks, set_post_render, set_post_render_screen, set_pre_render, set_pre_render_screen
+AxolotlShot
+Derived from Entity Movable Projectile
@@ -6126,193 +22960,231 @@ VanillaRenderContext
-nil
-draw_text(const string& text, float x, float y, float scale_x, float scale_y, Color color, VANILLA_TEXT_ALIGNMENT alignment, VANILLA_FONT_STYLE fontstyle)
-Draw text using the built-in renderer
Use in combination with ON.RENDER_✱ events. See vanilla_rendering.lua in the example scripts.
-
-
-nil
-draw_text(const TextRenderingInfo tri, Color color)
+int
+trapped_uid
-tuple<float, float>
-draw_text_size(const string& text, float scale_x, float scale_y, int fontstyle)
-Measure the provided text using the built-in renderer
If you can, consider creating your own TextRenderingInfo instead
You can then use :text_size()
and draw_text
with that one object
draw_text_size
works by creating new TextRenderingInfo just to call :text_size()
, which is not very optimal
-
-
-nil
-draw_screen_texture(TEXTURE texture_id, int row, int column, float left, float top, float right, float bottom, Color color)
-Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+float
+size
+
-nil
-draw_screen_texture(TEXTURE texture_id, int row, int column, const AABB& rect, Color color)
-Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+float
+swing
+
-nil
-draw_screen_texture(TEXTURE texture_id, int row, int column, const AABB& rect, Color color, float angle, float px, float py)
-Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer with angle, px/py is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+float
+swing_periodicity
+
-nil
-draw_screen_texture(TEXTURE texture_id, int row, int column, const Quad& dest, Color color)
-Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+float
+distance_after_capture
+
+
+Backpack
+
+
+
-nil
-draw_screen_texture(TEXTURE texture_id, const Quad& source, const Quad& dest, Color color)
-Draw a texture in screen coordinates from top-left to bottom-right using the built-in renderer. source
- the coordinates in the texture, dest
- the coordinates on the screen
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+Type
+Name
+Description
+
-nil
-draw_screen_texture(TEXTURE texture_id, TextureRenderingInfo tri, Color color)
-Draw a texture in screen coordinates using TextureRenderingInfo
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+bool
+explosion_trigger
+More like on fire trigger, the explosion happens when the timer reaches > 29
-nil
-set_corner_finish(CORNER_FINISH c)
-Set the prefered way of drawing corners for the non filled shapes
+int
+explosion_timer
+
nil
-draw_screen_line(const Vec2& A, const Vec2& B, float thickness, Color color)
-Draws a line on screen using the built-in renderer from point A
to point B
.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+trigger_explosion()
+
+
+Birdies
+
+
+
-nil
-draw_screen_rect(const AABB& rect, float thickness, Color color, optional angle, optional px, optional py)
-Draw rectangle in screen coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc. (corner from the AABB, not the visible one from adding the thickness
)
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+Type
+Name
+Description
+
+
+Bomb
+
+
+
-nil
-draw_screen_rect_filled(const AABB& rect, Color color, optional angle, optional px, optional py)
-Draw filled rectangle in screen coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+Type
+Name
+Description
+
-nil
-draw_screen_triangle(const Triangle& triangle, float thickness, Color color)
-Draw triangle in screen coordinates using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+SoundMeta
+sound
+
-nil
-draw_screen_triangle_filled(const Triangle& triangle, Color color)
-Draw filled triangle in screen coordinates using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+float
+scale_hor
+1.25 = default regular bomb, 1.875 = default giant bomb, > 1.25 generates ENT_TYPE_FX_POWEREDEXPLOSION
-nil
-draw_screen_poly(array points, float thickness, Color color, bool closed)
-Draw a polyline on screen from points using the built-in renderer
Draws from the first to the last point, use closed
to connect first and last as well
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+float
+scale_ver
+
-nil
-draw_screen_poly(const Quad& points, float thickness, Color color, bool closed)
-Draw quadrilateral in screen coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+bool
+is_big_bomb
+is bomb from powerpack
+
+BoneBlock
+
+
+
-nil
-draw_screen_poly_filled(array points, Color color)
-Draw a convex polygon on screen from points using the built-in renderer
Can probably draw almost any polygon, but the convex one is guaranteed to look correct
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+Type
+Name
+Description
+
+
+Boombox
+
+
+
-nil
-draw_screen_poly_filled(const Quad& points, Color color)
-Draw filled quadrilateral in screen coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
+Type
+Name
+Description
+
-nil
-draw_world_texture(TEXTURE texture_id, int row, int column, float left, float top, float right, float bottom, Color color)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a Quad instead
+Entity
+fx_button
+
-nil
-draw_world_texture(TEXTURE texture_id, int row, int column, const AABB& dest, Color color)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a Quad instead
+ParticleEmitterInfo
+music_note1
+
-nil
-draw_world_texture(TEXTURE texture_id, int row, int column, const AABB& dest, Color color, float angle, float px, float py)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer with angle, px/py is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
For more control use the version taking a Quad instead
+ParticleEmitterInfo
+music_note2
+
-nil
-draw_world_texture(TEXTURE texture_id, int row, int column, const Quad& dest, Color color, WORLD_SHADER shader)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
The shader
parameter controls how to render the texture
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+float
+spawn_y
+
-nil
-draw_world_texture(TEXTURE texture_id, int row, int column, const Quad& dest, Color color)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+int
+station
+
-nil
-draw_world_texture(TEXTURE texture_id, const Quad& source, const Quad& dest, Color color, WORLD_SHADER shader)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer. source
- the coordinates in the texture, dest
- the coordinates on the screen
The shader
parameter controls how to render the texture
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+int
+station_change_delay
+
-nil
-draw_world_texture(TEXTURE texture_id, const Quad& source, const Quad& dest, Color color)
-Draw a texture in world coordinates from top-left to bottom-right using the built-in renderer. source
- the coordinates in the texture, dest
- the coordinates on the screen
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+int
+jump_timer
+
-nil
-draw_world_line(const Vec2& A, const Vec2& B, float thickness, Color color)
-Draws a line in world coordinates using the built-in renderer from point A
to point B
.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+int
+jump_state
+
+
+Boomerang
+Derived from Entity Movable Purchasable
+
+
-nil
-draw_world_rect(const AABB& rect, float thickness, Color color, optional angle, optional px, optional py)
-Draw rectangle in world coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc. (corner from the AABB, not the visible one from adding the thickness
)
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+Type
+Name
+Description
+
-nil
-draw_world_rect_filled(const AABB& rect, Color color, optional angle, optional px, optional py)
-Draw rectangle in world coordinates from top-left to bottom-right using the built-in renderer with optional angle
.
px
/py
is pivot for the rotatnion where 0,0 is center 1,1 is top right corner etc.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+SoundMeta
+sound
+
-nil
-draw_world_triangle(const Triangle& triangle, float thickness, Color color)
-Draw triangle in world coordinates using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+ParticleEmitterInfo
+trail
+
-nil
-draw_world_triangle_filled(const Triangle& triangle, Color color)
-Draw filled triangle in world coordinates using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+float
+distance
+
-nil
-draw_world_poly(array points, float thickness, Color color, bool closed)
-Draw a polyline in world coordinates from points using the built-in renderer
Draws from the first to the last point, use closed
to connect first and last as well
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+float
+rotation
+
-nil
-draw_world_poly(const Quad& points, float thickness, Color color, bool closed)
-Draw quadrilateral in world coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+int
+returns_to_uid
+
+
+Boulder
+
+
+
-nil
-draw_world_poly_filled(array points, Color color)
-Draw a convex polygon in world coordinates from points using the built-in renderer
Can probably draw almost any polygon, but the convex one is guaranteed to look correct
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+Type
+Name
+Description
+
-nil
-draw_world_poly_filled(const Quad& points, Color color)
-Draw filled quadrilateral in world coordinates from top-left to bottom-right using the built-in renderer.
Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
+int
+is_rolling
+is set to 1 when the boulder first hits the ground
+
+Bow
+Derived from Entity Movable Purchasable
+
+
-AABB
-bounding_box
-
+Type
+Name
+Description
+
-
-render_draw_depth
+float
+get_arrow_special_offset()
-Entity related types
Ai
-Used in Player
+Bullet
+Derived from Entity Movable Projectile
@@ -6321,49 +23193,61 @@ Entity related types
Ai
Description
+
+Button
+
+
+
-Entity
-target
-
+Type
+Name
+Description
+
int
-target_uid
-
+button_sprite
+Only one can be set:
1 - pad: A, key: Z
2 - pad: X, key: X
4 - pad: B, key: C
8 - pad: Y, key: D
16 - pad: LB, key: L Shift
32 - pad: RB, key: A
64 - pad: menu?, key: (none)
128 - pad: copy?, key: Tab
-int
-timer
+float
+visibility
-int
-state
-AI state (patrol, sleep, attack, aggro...)
+bool
+is_visible
+It's false for selldialog used in shops
-int
-last_state
-
+bool
+player_trigger
+It's set true even if player does not see the button, like the drill or COG door
int
-trust
-Levels completed with, 0..3
+seen
+
-1 - hasn't been seen
0 - last seen by player 1
1 - last seen by player 2
2 - last seen by player 3
3 - last seen by player 4
+
+Cape
+Derived from Entity Movable Backpack
+
+
-int
-whipped
-Number of times whipped by player
+Type
+Name
+Description
-
-int
-walk_pause_timer
-positive: walking, negative: wating/idle
+
+
+bool
+floating_down
+
-Animation
-Used in EntityDB
+Chain
+
@@ -6374,88 +23258,33 @@ Animation
int
-id
-
-
-
-int
-first_tile
+attached_to_uid
int
-num_tiles
+timer
+
+ChainedPushBlock
+Derived from Entity Movable PushBlock
+
+
-int
-interval
-
+Type
+Name
+Description
+
-REPEAT_TYPE
-repeat_mode
+bool
+is_chained
-EntityDB
-
-When cloning an entity type, remember to save it in the script for as long as you need it. Otherwise the memory will be freed immediately, which eventually leads to a crash when used or overwritten by other stuff:
-
--- Create a special fast snake type with weird animation
-special_snake = EntityDB:new(ENT_TYPE.MONS_SNAKE)
-special_snake.max_speed = 1
-special_snake.acceleration = 2
-special_snake.animations[2].num_tiles = 1
-
-set_post_entity_spawn(function(snake)
- -- 50% chance to make snakes special
- if prng:random_chance(2, PRNG_CLASS.PROCEDURAL_SPAWNS) then
- -- Assign custom type
- snake.type = special_snake
- -- This is only really needed if types are changed during the level
- snake.current_animation = special_snake.animations[2]
- end
-end, SPAWN_TYPE.ANY, MASK.MONSTER, ENT_TYPE.MONS_SNAKE)
-
-
-You can also use Entity.user_data to store the custom type:
-
--- Custom player who is buffed a bit every level
-set_callback(function()
- -- Doing this to include HH
- for i,v in ipairs(get_entities_by_mask(MASK.PLAYER)) do
- local player = get_entity(v)
-
- -- Create new custom type on the first level, based on the original type
- if not player.user_data then
- player.user_data = {}
- player.user_data.type = EntityDB:new(player.type.id)
- end
-
- -- Set the player entity type to the custom type every level
- player.type = player.user_data.type
-
- -- Buff the player every subsequent level
- if state.level_count > 0 then
- player.type.max_speed = player.type.max_speed * 1.1
- player.type.acceleration = player.type.acceleration * 1.1
- player.type.jump = player.type.jump * 1.1
- end
- end
-end, ON.POST_LEVEL_GENERATION)
-
-
-Illegal bad example, don't do this:
-
-set_callback(function()
- -- Nobody owns the new type and the memory is freed immediately, eventually leading to a crash
- players[1].type = EntityDB:new(players[1].type)
- players[1].type.max_speed = 2
-end, ON.POST_LEVEL_GENERATION)
-
-Used in Entity and get_type
-Stores static common data for an ENT_TYPE. You can also clone entity types with the copy constructor to create new custom entities with different common properties. This tool can be helpful when messing with the animations. The default values are also listed in entities.json.
+Chest
+
@@ -6465,202 +23294,306 @@ EntityDB
-EntityDB
-new(EntityDB other)
+bool
+leprechaun
-EntityDB
-new(ENT_TYPE)
-
+bool
+bomb
+size of the bomb is random, if set both true only leprechaun spawns
+
+
+ClamBase
+
+
+
+
+Type
+Name
+Description
+
ENT_TYPE
-id
+treasure_type
int
-search_flags
-MASK
+treasure_uid
+
float
-width
+treasure_x_pos
float
-height
+treasure_y_pos
-float
-offsetx
+int
+top_part_uid
+
+Claw
+
+
+
+
+Type
+Name
+Description
+
+
-float
-offsety
+int
+crabman_uid
float
-hitboxx
+spawn_x
float
-hitboxy
+spawn_y
+
+ClimbableRope
+
+
+
-int
-draw_depth
-
+Type
+Name
+Description
+
int
-collision2_mask
-MASK, will only call collision2 when colliding with entities that match this mask.
+segment_nr_inverse
+
int
-collision_mask
-MASK used for collision with floors.
+burn_timer
+entity is killed after 20
-float
-friction
+Entity
+above_part
-float
-elasticity
+Entity
+below_part
-float
-weight
+int
+segment_nr
+
+CloneGunShot
+Derived from Entity Movable Projectile LightShot
+
+
-float
-acceleration
-
+Type
+Name
+Description
+
-float
-max_speed
+int
+timer
float
-sprint_factor
+spawn_y
+
+Coffin
+
+
+
-float
-jump
-
+Type
+Name
+Description
+
-float
-glow_red
+ENT_TYPE
+inside
-float
-glow_green
+int
+timer
-float
-glow_blue
+bool
+player_respawn
+
+Coin
+
+
+
-float
-glow_alpha
-
+Type
+Name
+Description
+
int
-damage
+nominal_price
+
+Container
+
+
+
-int
-life
+Type
+Name
+Description
+
+
+
+ENT_TYPE
+inside
+
+CookFire
+Derived from Entity Movable Torch
+
+
-int
-sacrifice_value
-Favor for sacrificing alive. Halved when dead (health == 0).
+Type
+Name
+Description
+
-int
-blood_content
+Illumination
+emitted_light
-int
-texture
+ParticleEmitterInfo
+particles_smoke
-map<int, Animation>
-animations
+ParticleEmitterInfo
+particles_flames
-int
-properties_flags
+ParticleEmitterInfo
+particles_warp
-int
-default_flags
+SoundMeta
+sound
+
+CrushElevator
+
+
+
-int
-default_more_flags
+Type
+Name
+Description
+
+
+
+float
+y_limit
+This is custom variable, you need activate_crush_elevator_hack to use it
+
+
+float
+speed
+This is custom variable, you need activate_crush_elevator_hack to use it
+
+
+Crushtrap
+
+
+
+
+Type
+Name
+Description
+
+
+
+float
+dirx
-bool
-leaves_corpse_behind
+float
+diry
int
-sound_killed_by_player
-
+timer
+counts from 30 to 0 before moving, after it stops, counts from 60 to 0 before it can be triggered again
int
-sound_killed_by_other
-
+bounce_back_timer
+counts from 7 to 0 after it hits the wall and moves away until the timer hits 0, then moves back and counts from 255 until it hits the wall again, if needed it will start the counter again for another bounce
+
+CursedPot
+
+
+
-STRINGID
-description
-
+Type
+Name
+Description
+
-int
-tilex
+ParticleEmitterInfo
+smoke
-int
-tiley
+ParticleEmitterInfo
+smoke2
-HudInventory
+CustomMovableBehavior
+Opaque handle to a custom movable behavior from a script mod
+Derived from MovableBehavior
+
Type
@@ -6669,68 +23602,101 @@ HudInventory
-bool
-enabled
+VanillaMovableBehavior
+base_behavior
-int
-health
-
+nil
+set_force_state(function force_state)
+Set the force_state
function of a CustomMovableBehavior
, this will be called every frame when
the movable is updated. If an force_state
is already set it will be overridden. The signature
of the function is bool force_state(Movable movable, function base_fun)
, when the function returns true
the movable will
enter this behavior. If no base behavior is set base_fun
will be nil
.
-int
-bombs
-
+nil
+set_on_enter(function on_enter)
+Set the on_enter
function of a CustomMovableBehavior
, this will be called when the movable
enters the state. If an on_enter
is already set it will be overridden. The signature of the
function is nil on_enter(Movable movable, function base_fun))
. If no base behavior is set base_fun
will be nil
.
-int
-ropes
-
+nil
+set_on_exit(function on_exit)
+Set the on_exit
function of a CustomMovableBehavior
, this will be called when the movable
leaves the state. If an on_exit
is already set it will be overridden. The signature of the
function is nil on_exit(Movable movable, function base_fun))
. If no base behavior is set base_fun
will be nil
.
-bool
-ankh
-
+nil
+set_update_logic(function update_logic)
+Set the update_logic
function of a CustomMovableBehavior
, this will be called every frame when
the movable is updated. If an update_logic
is already set it will be overridden. The signature
of the function is nil update_logic(Movable movable, function base_fun))
, use it to change the color, texture,
some timers, etc. of the movable. If no base behavior is set base_fun
will be nil
.
-bool
-kapala
-
+nil
+set_update_world(function update_world)
+Set the update_world
function of a CustomMovableBehavior
, this will be called every frame when
the movable is updated. If an update_world
is already set it will be overridden. The signature
of the function is nil update_world(Movable movable, function base_fun))
, use this to update the move, velocity,
current_animation, etc. of the movable, then call mov:generic_update_world
to update the movable. If no
base behavior is set base_fun
will be nil
.
-int
-kapala_blood
+nil
+set_get_next_state_id(function get_next_state_id)
+Set the get_next_state_id
function of a CustomMovableBehavior
, this will be called every frame when
the movable is updated. If an get_next_state_id
is already set it will be overridden. The signature
of the function is int get_next_state_id(Movable movable, function base_fun))
, use this to move to another state, return nil
.
or this behaviors state_id
to remain in this behavior. If no base behavior is set base_fun
will be nil
.
+
+
+Drill
+
+
+
+
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound1
-bool
-poison
+SoundMeta
+sound2
-bool
-curse
+Entity
+top_chain_piece
-bool
-elixir
+nil
+trigger()
+
+DummyPurchasableEntity
+Derived from Entity Movable Purchasable
+
+
-ENT_TYPE
-crown
-Powerup type or 0
+Type
+Name
+Description
+
+
+
+EggSac
+
+
+
+
+Type
+Name
+Description
+
int
-item_count
-Amount of generic pickup items at the bottom. Set to 0 to not draw them.
+timer
+
-Inventory
-Used in Player, PlayerGhost and Items
+EggshipCenterJetFlame
+
@@ -6740,158 +23706,240 @@ Inventory
-int
-money
-Sum of the money collected in current level
+SoundMeta
+sound
+
-int
-bombs
+Illumination
+emitted_light
-int
-ropes
+ParticleEmitterInfo
+particle
-int
-player_slot
+bool
+smoke_on
+
+
+
+Elevator
+
+
+
+
+Type
+Name
+Description
+
+
+
+Illumination
+emitted_light
int
-poison_tick_timer
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+timer
+pause timer, counts down 60 to 0
bool
-cursed
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+moving_up
+
+
+EmpressGrave
+
+
+
-bool
-elixir_buff
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
-int
-health
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Entity
+fx_button
+
-int
-kapala_blood_amount
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Entity
+ghost
+
+
+Excalibur
+
+
+
-int
-time_of_death
-Is set to state.time_total when player dies in coop (to determinate who should be first to re-spawn from coffin)
+Type
+Name
+Description
+
-ENT_TYPE
-held_item
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+bool
+in_stone
+
+
+Explosion
+
+
+
-int
-held_item_metadata
-Metadata of the held item (health, is cursed etc.)
Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
-ENT_TYPE
-mount_type
-Used to transfer information to transition/next level (player rading a mout). Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Illumination
+emitted_light
+
+
+FallingPlatform
+
+
+
-int
-mount_metadata
-Metadata of the mount (health, is cursed etc.)
Used to transfer information to transition/next level (player rading a mout). Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
int
-kills_level
+timer
-int
-kills_total
+float
+shaking_factor
-int
-collected_money_total
-Total money collected during previous levels (so excluding the current one)
+float
+y_pos
+
+
+Fireball
+Derived from Entity Movable Projectile LightShot SoundShot
+
+
-int
-collected_money_count
-Count/size for the collected_money
arrays
+Type
+Name
+Description
+
-array<ENT_TYPE, 512>
-collected_money
-Types of gold/gems collected during this level, used later to display during the transition
+ParticleEmitterInfo
+particle
+
+
+Flame
+
+
+
-array<int, 512>
-collected_money_values
-Values of gold/gems collected during this level, used later to display during the transition
+Type
+Name
+Description
+
-array<ENT_TYPE, 256>
-killed_enemies
-Types of enemies killed during this level, used later to display during the transition
+SoundMeta
+sound
+
-int
-companion_count
-Number of companions, it will determinate how many companions will be transfered to next level
Increments when player acquires new companion, decrements when one of them dies
+Illumination
+emitted_light
+
+
+FlameSize
+Derived from Entity Movable Flame
+
+
-array<ENT_TYPE, 8>
-companions
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
-array<ENT_TYPE, 8>
-companion_held_items
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+float
+flame_size
+if changed, gradually goes down (0.03 per frame) to the default size
+
+Fly
+
+
+
-array<int, 8>
-companion_held_item_metadatas
-Metadata of items held by companions (health, is cursed etc.)
Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
-array<int, 8>
-companion_trust
-(0..3) Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+int
+timer
+
+
+FlyHead
+
+
+
-array<int, 8>
-companion_health
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
-array<int, 8>
-companion_poison_tick_timers
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+int
+vored_entity_uid
+
+
+FrozenLiquid
+
+
+
-array<bool, 8>
-is_companion_cursed
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
+
+FxAlienBlast
+
+
+
-array<ENT_TYPE, 30>
-acquired_powerups
-Used to transfer information to transition/next level. Is not updated during a level
You can use ON.PRE_LEVEL_GENERATION
to access/edit this
+Type
+Name
+Description
+
-Generic types
AABB
-Axis-Aligned-Bounding-Box, represents for example a hitbox of an entity or the size of a gui element
+FxAnkhBrokenPiece
+
@@ -6900,109 +23948,155 @@ Generic types
AABB
Description
+
+FxAnkhRotatingSpark
+
+
+
-AABB
-new()
-Create a new axis aligned bounding box - defaults to all zeroes
+Type
+Name
+Description
+
-AABB
-new(AABB)
-Copy an axis aligned bounding box
+float
+radius
+
-AABB
-new(Vec2 top_left, Vec2 bottom_right)
+float
+inclination
-AABB
-new(float left_, float top_, float right_, float bottom_)
-Create a new axis aligned bounding box by specifying its values
+float
+speed
+0 - 1.0
float
-left
+sine_angle
float
-bottom
+size
+
+FxCompass
+
+
+
+
+Type
+Name
+Description
+
+
float
-right
-
+sine_angle
+Counts form 0 to 2pi, responsible for moving back and forth
float
-top
+visibility
bool
-overlaps_with(const AABB& other)
-
+is_active
+Player has compass
+
+FxEmpress
+
+
+
-AABB&
-abs()
-Fixes the AABB if any of the sides have negative length
+Type
+Name
+Description
+
-AABB&
-extrude(float amount)
-Grows or shrinks the AABB by the given amount in all directions.
If amount < 0
and abs(amount) > right/top - left/bottom
the respective dimension of the AABB will become 0
.
+float
+sine_angle
+
+
+FxFireflyLight
+
+
+
-AABB&
-extrude(float amount_x, float amount_y)
-Grows or shrinks the AABB by the given amount in each direction.
If amount_x/y < 0
and abs(amount_x/y) > right/top - left/bottom
the respective dimension of the AABB will become 0
.
+Type
+Name
+Description
+
-AABB&
-offset(float off_x, float off_y)
-Offsets the AABB by the given offset.
+Illumination
+illumination
+
-float
-area()
-Compute area of the AABB, can be zero if one dimension is zero or negative if one dimension is inverted.
+int
+light_timer
+
-tuple<float, float>
-center()
-Short for (aabb.left + aabb.right) / 2.0f, (aabb.top + aabb.bottom) / 2.0f
.
+int
+cooldown_timer
+Timer between light flashes
+
+FxHundunNeckPiece
+
+
+
-float
-width()
-Short for aabb.right - aabb.left
.
+Type
+Name
+Description
+
-float
-height()
-Short for aabb.top - aabb.bottom
.
+int
+kill_timer
+Short timer after the head is dead
+
+
+FxJellyfishStar
+
+
+
+
+Type
+Name
+Description
+
-bool
-is_point_inside(const Vec2 p)
-Checks if point lies between left/right and top/bottom
+float
+rotation_angle
+
-bool
-is_point_inside(float x, float y)
+float
+radius
-tuple<float, float, float, float>
-split()
+float
+speed
-BackgroundMusic
-Used in GameManager
+FxJetpackFlame
+
@@ -7012,90 +24106,151 @@ BackgroundMusic
-BackgroundSound
-game_startup
+ParticleEmitterInfo
+particle_smoke
-BackgroundSound
-main_backgroundtrack
+ParticleEmitterInfo
+particle_flame
-BackgroundSound
-basecamp
+SoundMeta
+sound
-BackgroundSound
-win_scene
+Illumination
+illumination
+
+FxKinguSliding
+
+
+
-BackgroundSound
-arena
-
+Type
+Name
+Description
+
-BackgroundSound
-arena_intro_and_win
+ParticleEmitterInfo
+particle
+
+FxLamassuAttack
+
+
+
-BackgroundSound
-level_gameplay
-
+Type
+Name
+Description
+
-BackgroundSound
-dark_level
+float
+attack_angle
+
+FxMainExitDoor
+
+
+
-BackgroundSound
-level_transition
-
+Type
+Name
+Description
+
-BackgroundSound
-backlayer
+Illumination
+emitted_light
-BackgroundSound
-shop
+int
+timer
+When breaking open in tutorial
+
+
+FxNecromancerANKH
+
+
+
+
+Type
+Name
+Description
+
+
+
+FxOuroboroDragonPart
+
+
+
+
+Type
+Name
+Description
+
+
+
+float
+speed
-BackgroundSound
-angered_shopkeeper
+int
+timer
-BackgroundSound
-inside_sunken_city_pipe
+ParticleEmitterInfo
+particle
+
+FxOuroboroOccluder
+
+
+
-BackgroundSound
-pause_menu
+Type
+Name
+Description
+
+
+
+FxPickupEffect
+
+
+
+
+Type
+Name
+Description
+
+
+
+float
+spawn_y
-BackgroundSound
-death_transition
+float
+visibility
-Color
-- make a semi transparent red color and print it in different formats
-local color = Color:red()
-color.a = 0.5
-local r, g, b, a = color:get_rgba()
-prinspect(r, g, b, a) -- 255, 0, 0, 128
-prinspect(color.r, color.g, color.b, color.a) -- 1.0, 0.0, 0.0, 0.5
-prinspect(string.format("%x"), color:get_ucolor()) -- 800000ff
+FxPlayerIndicator
+
-
Type
@@ -7104,155 +24259,161 @@ Color
Color
-new()
-Create a new color - defaults to black
-
-
-Color
-new(Color)
-
-
-
-Color
-new(float r_, float g_, float b_, float a_)
-Create a new color by specifying its values
-
-
-float
-r
+int
+attached_to
float
-g
+pos_x
float
-b
+pos_y
+
+FxQuickSand
+
+
+
-float
-a
-
+Type
+Name
+Description
+
+
+FxSaleContainer
+
+
+
-Color
-white()
-
+Type
+Name
+Description
+
-Color
-silver()
+Entity
+fx_value
-Color
-gray()
+Entity
+fx_icon
-Color
-black()
+Entity
+fx_button
-Color
-red()
-
+float
+shake_amplitude
+For effect when you don't have enough money
-Color
-maroon()
-
+bool
+sound_trigger
+Also sound_played, keeps re-triggering from time to time
-Color
-yellow()
+int
+pop_in_out_procentage
+
+FxShotgunBlast
+
+
+
-Color
-olive()
-
+Type
+Name
+Description
+
-Color
-lime()
+Illumination
+illumination
+
+FxSorceressAttack
+
+
+
-Color
-green()
-
+Type
+Name
+Description
+
-Color
-aqua()
+float
+size
+
+FxSparkSmall
+
+
+
-Color
-teal()
-
+Type
+Name
+Description
+
-Color
-blue()
+int
+timer
+
+FxSpringtrapRing
+
+
+
-Color
-navy()
-
+Type
+Name
+Description
+
-Color
-fuchsia()
+int
+timer
-Color
-purple()
+Illumination
+illumination
+
+FxTiamatHead
+
+
+
-tuple<int, int, int, int>
-get_rgba()
-Returns RGBA colors in 0..255 range
-
-
-Color&
-set_rgba(int red, int green, int blue, int alpha)
-Changes color based on given RGBA colors in 0..255 range
-
-
-uColor
-get_ucolor()
-Returns the uColor
used in GuiDrawContext
drawing functions
+Type
+Name
+Description
+
-Color&
-set_ucolor(const uColor color)
-Changes color based on given uColor
+int
+timer
+
-Hud
set_callback(function(ctx, hud)
- -- draw on screen bottom but keep neat animations
- if hud.y > 0 then hud.y = -hud.y end
- -- spoof some values
- hud.data.inventory[1].health = prng:random_int(1, 99, 0)
- -- hide generic pickup items
- hud.data.inventory[1].item_count = 0
- -- hide money element
- hud.data.money.opacity = 0
- -- get real current opacity of p1 inventory element
- prinspect(hud.data.players[1].opacity * hud.data.opacity * hud.opacity)
-end, ON.RENDER_PRE_HUD)
+FxTiamatTail
+
-
Type
@@ -7262,21 +24423,23 @@ Hud
<
float
-y
-
+angle_two
+Added _two just to not shadow angle in entity, it's angle but the pivot point is at the edge
float
-opacity
+x_pos
-HudData
-data
+float
+y_pos
-HudData
+FxTiamatTorso
+
+
Type
@@ -7285,77 +24448,82 @@ HudData
-array<HudInventory, MAX_PLAYERS>
-inventory
-
-
-
-bool
-udjat
-
-
-
int
-money_total
+timer
-int
-money_counter
-
+float
+torso_target_size
+Slowly increases/decreases to the given value
+
+FxTornJournalPage
+
+
+
-int
-time_total
-
+Type
+Name
+Description
+
int
-time_level
-
+page_number
+Only in tutorial
+
+FxUnderwaterBubble
+
+
+
-int
-world_num
-
+Type
+Name
+Description
+
int
-level_num
+bubble_source_uid
int
-seed
-
-
-
-float
-opacity
-
+direction
+1 / -1
-array<HudPlayer, MAX_PLAYERS>
-players
-
+bool
+pop
+Setting it true makes it disappear/fade away
-HudMoney
-money
+bool
+inverted
+
+FxVatBubble
+
+
+
-HudElement
-timer
-
+Type
+Name
+Description
+
-HudElement
-level
+float
+max_y
-HudElement
+FxWaterDrop
+
+
Type
@@ -7365,22 +24533,17 @@ HudElement
bool
-dim
-Hide background and dim if using the auto adjust setting.
-
-
-float
-opacity
-Background will be drawn if this is not 0.5
+inverted
+
int
-time_dim
-Level time when element should dim again after hilighted, INT_MAX if dimmed on auto adjust. 0 on opaque.
+droplet_source_uid
+
-HudMoney
-Derived from HudElement
+FxWebbedEffect
+
@@ -7390,23 +24553,13 @@ HudMoney
-int
-total
-
-
-
-int
-counter
-
-
-
-int
-timer
+bool
+visible
-HudPlayer
-Derived from HudElement
+FxWitchdoctorHint
+
@@ -7415,24 +24568,30 @@ HudPlayer
Description
+
+GhostBreath
+Derived from Entity Movable Projectile
+
+
-int
-health
-
+Type
+Name
+Description
+
int
-bombs
+timer
-int
-ropes
+bool
+big_cloud
-ItemOwnerDetails
-Used in RoomOwnersInfo
+GiantClamTop
+
@@ -7442,17 +24601,19 @@ ItemOwnerDetails
-ENT_TYPE
-owner_type
+int
+close_timer
int
-owner_uid
+open_timer
-Letter
+Goldbar
+
+
Type
@@ -7460,34 +24621,9 @@ Letter
Description
-
-Triangle
-bottom
-
-
-
-Triangle
-top
-
-
-
-Quad
-get_quad()
-Get the Quad of a letter (easier to work with compared to the two triangles)
This assumes that the triangles are in the correct 'touching each other' position
if the positions were altered the results may not end up as expected
-
-
-nil
-set_quad(Quad quad)
-Inverse of the get_quad
-
-
-Vec2
-center()
-Get's approximated center of a letter by finding the highest and lowest values, then finding the center of a rectangle build from those values
-
-MagmamanSpawnPosition
-Used in LogicList
+Gun
+Derived from Entity Movable Purchasable
@@ -7497,28 +24633,28 @@ MagmamanSpawnPosition
-MagmamanSpawnPosition
-new(int x_, int y_)
+int
+cooldown
int
-x
-
+shots
+used only for webgun
int
-y
-
+shots2
+used only for clonegun
int
-timer
-
+in_chamber
+Only for webgun, uid of the webshot entity
-MovableBehavior
-Opaque handle to a movable behavior used in some Movable functions
+HangAnchor
+
@@ -7529,20 +24665,12 @@ MovableBehavior
int
-get_state_id()
+spider_uid
-
-int
-get_state_id()
-Get the state_id
of a behavior, this is the id that needs to be returned from a behavior's
get_next_state_id
to enter this state, given that the behavior is added to the movable.
-
-PRNG
-PRNG (short for Pseudo-Random-Number-Generator) holds 10 128bit wide buffers of memory that are mutated on every generation of a random number.
-The game uses specific buffers for specific scenarios, for example the third buffer is used every time particles are spawned to determine a random velocity.
-The used buffer is determined by PRNG_CLASS. If you want to make a mod that does not affect level generation but still uses the prng then you want to stay away from specific buffers.
-If you don't care what part of the game you affect just use prng.random
.
+HangStrand
+
@@ -7552,57 +24680,51 @@ PRNG
-nil
-seed(int seed)
-Same as seed_prng
-
-
float
-random_float(PRNG_CLASS type)
-Generate a random floating point number in the range [0, 1)
-
-
-bool
-random_chance(int inverse_chance, PRNG_CLASS type)
-Returns true with a chance of 1/inverse_chance
-
-
-optional<int>
-random_index(int i, PRNG_CLASS type)
-Generate a integer number in the range [1, i]
or nil
if i < 1
-
-
-optional<int>
-random_int(int min, int max, PRNG_CLASS type)
-Generate a integer number in the range [min, max]
or nil
if max < min
+start_pos_y
+
+
+Honey
+
+
+
-float
-random()
-Drop-in replacement for math.random()
+Type
+Name
+Description
+
-optional<int>
-random(int i)
-Drop-in replacement for math.random(i)
+int
+wiggle_timer
+
+
+Hoverpack
+Derived from Entity Movable Backpack
+
+
-optional<int>
-random(int min, int max)
-Drop-in replacement for math.random(min, max)
+Type
+Name
+Description
+
-tuple<int, int>
-get_pair(PRNG_CLASS type)
+SoundMeta
+sound
-nil
-set_pair(PRNG_CLASS type, int first, int second)
+bool
+is_on
-Quad
+HundunChest
+Derived from Entity Movable Treasure
+
Type
@@ -7611,126 +24733,134 @@ Quad
-Quad
-new()
-
-
-
-Quad
-new(Quad)
+int
+timer
+
+Idol
+
+
+
-Quad
-new(Vec2 bottom_left_, Vec2 bottom_right_, Vec2 top_right_, Vec2 top_left_)
-
+Type
+Name
+Description
+
-Quad
-new(float _bottom_left_x, float _bottom_left_y, float _bottom_right_x, float _bottom_right_y, float _top_right_x, float _top_right_y, float _top_left_x, float _top_left_y)
-
+bool
+trap_triggered
+if you set it to true for the ice caves or volcano idol, the trap won't trigger
-Quad
-new(AABB aabb)
-
+int
+touch
+changes to 0 when first picked up by player and back to -1 if HH picks it up
float
-bottom_left_x
+spawn_x
float
-bottom_left_y
+spawn_y
+
+Jetpack
+Derived from Entity Movable Backpack
+
+
-float
-bottom_right_x
-
+Type
+Name
+Description
+
-float
-bottom_right_y
+bool
+flame_on
-float
-top_right_x
+int
+fuel
+
+JungleSpearCosmetic
+
+
+
-float
-top_right_y
-
+Type
+Name
+Description
+
float
-top_left_x
+move_x
float
-top_left_y
+move_y
+
+KapalaPowerup
+Derived from Entity Movable Powerup
+
+
-AABB
-get_AABB()
-Returns the max/min values of the Quad
+Type
+Name
+Description
+
-Quad&
-offset(float off_x, float off_y)
+int
+amount_of_blood
+
+LampFlame
+Derived from Entity Movable Flame
+
+
-Quad&
-rotate(float angle, float px, float py)
-Rotates a Quad by an angle, px/py are not offsets, use :get_AABB():center()
to get approximated center for simetrical quadrangle
-
-
-Quad&
-flip_horizontally()
-
+Type
+Name
+Description
+
-Quad&
-flip_vertically()
+ParticleEmitterInfo
+flame_particle
+
+Landmine
+Derived from Entity Movable LightEmitter
+
+
-bool
-is_point_inside(Vec2 p, optional epsilon)
-Check if point lies inside of triangle
Because of the imprecise nature of floating point values, the epsilon
value is needed to compare the floats, the default value is 0.00001
-
-
-bool
-is_point_inside(float x, float y, optional epsilon)
-
+Type
+Name
+Description
+
-tuple<Vec2, Vec2, Vec2, Vec2>
-split()
-Returns the corners in order: bottom_left, bottom_right, top_right, top_left
+int
+timer
+explodes at 57, if you set it to 58 will count to overflow
-RenderInfo
-
-For using a custom normal map:
-
-set_post_entity_spawn(function(ent)
- -- Doesn't really make sense with this texture, you can use your custom normal texture id here
- ent.rendering_info:set_normal_map_texture(TEXTURE.DATA_TEXTURES_FLOORSTYLED_GOLD_NORMAL_0)
- ent.rendering_info.shader = 30 -- Make sure to set the shader to one that uses normal map
-end, SPAWN_TYPE.LEVEL_GEN, MASK.FLOOR, ENT_TYPE.FLOORSTYLED_MINEWOOD)
-
-
-Note: if using set_texture_num, make sure to have used set_second_texture/set_third_texture before, since not doing so can lead to crashes
-
-
-Some information used to render the entity, can not be changed, used in Entity
+LaserBeam
+
@@ -7740,128 +24870,134 @@ RenderInfo
-float
-x
-
-
-
-float
-y
-
-
-
-WORLD_SHADER
-shader
-
-
-
-Quad
-source
+ParticleEmitterInfo
+sparks
-Quad
-destination
+Illumination
+emitted_light
+
+Leaf
+
+
+
-float
-tilew
-
+Type
+Name
+Description
+
float
-tileh
-
+fade_away_counter
+counts to 100.0 then the leaf fades away
-bool
-facing_left
+int
+swing_direction
bool
-render_inactive
+fade_away_trigger
+
+LightArrow
+Derived from Entity Movable Purchasable Arrow
+
+
-int
-texture_num
-
+Type
+Name
+Description
+
-class Entity
-get_entity()
+Illumination
+emitted_light
+
+LightArrowPlatform
+
+
+
-bool
-set_normal_map_texture(TEXTURE texture_id)
-Sets second_texture to the texture specified, then sets third_texture to SHINE_0 and texture_num to 3. You still have to change shader to 30 to render with normal map (same as COG normal maps)
-
-
-optional<TEXTURE>
-get_second_texture
-
+Type
+Name
+Description
+
-optional<TEXTURE>
-get_third_texture
+Illumination
+emitted_light
+
+LightEmitter
+
+
+
-bool
-set_second_texture(TEXTURE texture_id)
-
+Type
+Name
+Description
+
-bool
-set_third_texture(TEXTURE texture_id)
+Illumination
+emitted_light
+
+LightShot
+Derived from Entity Movable Projectile
+
+
-bool
-set_texture_num(int texture_id)
-Set the number of textures that may be used, need to have them set before for it to work
-
-
-CallbackId
-set_pre_virtual(RENDER_INFO_OVERRIDE entry, function fun)
-Hooks before the virtual function at index entry
.
-
-
-CallbackId
-set_post_virtual(RENDER_INFO_OVERRIDE entry, function fun)
-Hooks after the virtual function at index entry
.
+Type
+Name
+Description
+
-nil
-clear_virtual(CallbackId callback_id)
-Clears the hook given by callback_id
, alternatively use clear_callback()
inside the hook.
+Illumination
+emitted_light
+
+
+LiquidSurface
+
+
+
-CallbackId
-set_pre_dtor(function fun)
-Hooks before the virtual function.
The callback signature is nil dtor(RenderInfo self)
+Type
+Name
+Description
+
-CallbackId
-set_post_dtor(function fun)
-Hooks after the virtual function.
The callback signature is nil dtor(RenderInfo self)
+float
+glow_radius
+
-CallbackId
-set_pre_render(function fun)
-Hooks before the virtual function.
The callback signature is bool render(RenderInfo self, float float, VanillaRenderContext vanilla_render_context)
+float
+sine_pos
+
-CallbackId
-set_post_render(function fun)
-Hooks after the virtual function.
The callback signature is nil render(RenderInfo self, float float, VanillaRenderContext vanilla_render_context)
+float
+sine_pos_increment
+
-RoomOwnerDetails
-Used in RoomOwnersInfo
+Mattock
+Derived from Entity Movable Purchasable
@@ -7872,22 +25008,28 @@ RoomOwnerDetails
int
-layer
+remaining
+
+MegaJellyfishEye
+
+
+
-int
-room_index
-
+Type
+Name
+Description
+
int
-owner_uid
+timer
-RoomOwnersInfo
-Used in StateMemory
+MiniGameAsteroid
+
@@ -7897,18 +25039,13 @@ RoomOwnersInfo
-custom_map<int, ItemOwnerDetails>
-owned_items
-key/index is the uid of an item
-
-
-array<RoomOwnerDetails>
-owned_rooms
+float
+spin_speed
-ShortTileCodeDef
-Used in get_short_tile_code, get_short_tile_code_definition and PostRoomGenerationContext
+MiniGameShip
+
@@ -7918,22 +25055,34 @@ ShortTileCodeDef
-TILE_CODE
-tile_code
-Tile code that is used by default when this short tile code is encountered. Defaults to 0.
+SoundMeta
+sound
+
-int
-chance
-Chance in percent to pick tile_code
over alt_tile_code
, ignored if chance == 0
. Defaults to 100.
+float
+velocity_x
+
-TILE_CODE
-alt_tile_code
-Alternative tile code, ignored if chance == 100
. Defaults to 0.
+float
+velocity_y
+
+
+
+float
+swing
+
+
+
+float
+up_down_normal
+0.0 - down, 1.0 - up, 0.5 - idle
-Triangle
+MiniGameShipOffset
+
+
Type
@@ -7942,377 +25091,400 @@ Triangle
-Triangle
-new()
+float
+offset_x
-Triangle
-new(Triangle)
+float
+offset_y
-Triangle
-new(Vec2 _a, Vec2 _b, Vec2 _c)
-
+float
+normal_y_offset
+Is added to offset_y
+
+Movable
+Derived from Entity
+
+
-Triangle
-new(float ax, float ay, float bx, float by, float cx, float cy)
-
+Type
+Name
+Description
+
Vec2
-A
-
+move
+{movex, movey}
-Vec2
-B
-
+float
+movex
+Move directions (-1.0 to 1.0) that represent in whit direction the entity want's to move
-Vec2
-C
-
+float
+movey
+Move directions (-1.0 to 1.0) that represent in whit direction the entity want's to move
-Triangle&
-offset(const Vec2& off)
+BUTTON
+buttons
-Triangle&
-offset(float x, float y)
+BUTTON
+buttons_previous
-Triangle&
-rotate(float angle, float px, float py)
-Rotate triangle by an angle, the px/py are just coordinates, not offset from the center
+int
+stand_counter
+
-Vec2
-center()
-Also known as centroid
+float
+jump_height_multiplier
+EntityDB.jump gets multiplied by this to get the jump
-tuple<float, float, float>
-get_angles()
-Returns ABC, BCA, CAB angles in radians
+int
+owner_uid
+
-Triangle&
-scale(float scale)
+int
+last_owner_uid
-float
-area()
+Animation
+current_animation
-bool
-is_point_inside(Vec2 p, optional epsilon)
-Check if point lies inside of triangle
Because of the imprecise nature of floating point values, the epsilon
value is needed to compare the floats, the default value is 0.0001
+int
+idle_counter
+
-bool
-is_point_inside(float x, float y, optional epsilon)
+int
+standing_on_uid
-tuple<Vec2, Vec2, Vec2>
-split()
-Returns the corner points
+float
+velocityx
+speed, can be relative to the platform you standing on (pushblocks, elevators), use get_velocity to get accurate speed in the game world
-
-Vec2
-Simple object to hold pair of coordinates
-
-
-Type
-Name
-Description
+float
+velocityy
+speed, can be relative to the platform you standing on (pushblocks, elevators), use get_velocity to get accurate speed in the game world
+
+
+int
+holding_uid
+
-
-Vec2
-new()
+int
+state
-Vec2
-new(Vec2)
+int
+last_state
-Vec2
-new(float x_, float y_)
+int
+move_state
-float
-x
+int
+health
-float
-y
+int
+stun_timer
-Vec2&
-rotate(float angle, float px, float py)
+int
+stun_state
-float
-distance_to(const Vec2 other)
-Just simple pythagoras theorem
+int
+lock_input_timer
+Related to taking damage, also drops you from ladder/rope, can't be set while on the ground unless you're on a mount
-tuple<float, float>
-split()
+int
+wet_effect_timer
-
-Input types
Gamepad
-Used in ImGuiIO
-
-
-Type
-Name
-Description
+int
+poison_tick_timer
+Used to apply damage from poison, can be set to -1 to cure poison, to set poison use poison_entity
-
-bool
-enabled
+int
+falling_timer
-GAMEPAD
-buttons
+bool
+is_poisoned()
-float
-lt
+int
+dark_shadow_timer
-float
-rt
+int
+onfire_effect_timer
-float
-lx
+int
+exit_invincibility_timer
-float
-ly
+int
+invincibility_frames_timer
-float
-rx
+int
+frozen_timer
-float
-ry
+bool
+is_button_pressed(BUTTON button)
-
-ImGuiIO
-Used in get_io
-
-
-Type
-Name
-Description
+bool
+is_button_held(BUTTON button)
+
-
-Vec2
-displaysize
+bool
+is_button_released(BUTTON button)
-float
-framerate
+int
+price
-bool
-wantkeyboard
+nil
+stun(int framecount)
-bool
-keysdown[ImGuiKey_COUNT]
+nil
+freeze(int framecount)
-
-keydown
-bool keydown(int keycode)
bool keydown(char key)
+nil
+light_on_fire(int time)
+Does not damage entity
+nil
+set_cursed(bool b)
-keypressed
-bool keypressed(int keycode, bool repeat = false)
bool keypressed(char key, bool repeat = false)
+nil
+drop(Entity entity_to_drop)
-keyreleased
-bool keyreleased(int keycode)
bool keyreleased(char key)
-bool
-keyctrl
+nil
+pick_up(Entity entity_to_pick_up)
bool
-keyshift
+can_jump()
-bool
-keyalt
+Entity
+standing_on()
+nil
+add_money(int money)
+Adds or subtracts the specified amount of money to the movable's (player's) inventory. Shows the calculation animation in the HUD.
+
+
bool
-keysuper
+is_on_fire()
bool
-wantmouse
-
+damage(int damage_dealer_uid, int damage_amount, int stun_time, float velocity_x, float velocity_y, int iframes)
+Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities
Returns: true if entity was affected, damage_dealer should break etc. false if the event should be ignored by damage_dealer?
-Vec2
-mousepos
-
+array<int>
+get_all_behaviors()
+Get all avaible behavior ids
bool
-mousedown[5]
-
+set_behavior(int behavior_id)
+Set behavior, this is more than just state as it's an active function, for example climbing ladder is a behavior and it doesn't actually need ladder/rope entity
Returns false if entity doesn't have this behavior id
-bool
-mouseclicked[5]
-
+int
+get_behavior()
+Get the current behavior id
-bool
-mousedoubleclicked[5]
-
+nil
+set_gravity(float gravity)
+Force the gravity for this entity. Will override anything set by special states like swimming too, unless you reset it. Default 1.0
-float
-mousewheel
-
+nil
+reset_gravity()
+Remove the gravity hook and reset to defaults
-Gamepad
-gamepad
-
+nil
+set_position(float to_x, float to_y)
+Set the absolute position of an entity and offset all rendering related things accordingly to teleport without any interpolation or graphical glitches. If the camera is focused on the entity, it is also moved.
-
-gamepads
-Gamepad gamepads(int index)
This is the XInput index 1..4, might not be the same as the player slot.
+VanillaMovableBehavior
+get_base_behavior(int state_id)
+Gets a vanilla behavior from this movable, needs to be called before clear_behaviors
but the returned values are still valid after a call to clear_behaviors
-bool
-showcursor
-
+nil
+add_behavior(MovableBehavior behavior)
+Add a behavior to this movable, can be either a VanillaMovableBehavior
or a
CustomMovableBehavior
-
-InputMapping
-Used in PlayerSlot
-
-
-Type
-Name
-Description
+nil
+clear_behavior(MovableBehavior behavior)
+Clear a specific behavior of this movable, can be either a VanillaMovableBehavior
or a
CustomMovableBehavior
, a behavior with this behaviors state_id
may be required to
run this movables statemachine without crashing, so add a new one if you are not sure
-
-int
-jump
-
+nil
+clear_behaviors()
+Clears all behaviors of this movable, need to call add_behavior
to avoid crashing
-int
-attack
-
+nil
+generic_update_world()
+Move a movable according to its velocity, update physics, gravity, etc.
Will also update movable.animation_frame
and various timers and counters
-int
-bomb
-
+nil
+generic_update_world(bool disable_gravity)
+Move a movable according to its velocity, can disable gravity
Will also update movable.animation_frame
and various timers and counters
-int
-rope
-
+nil
+generic_update_world(Vec2 move, float sprint_factor, bool disable_gravity, bool on_rope)
+Move a movable according to its velocity and move
, if the movables BUTTON.RUN
is
held apply sprint_factor
on move.x
, can disable gravity or lock its horizontal
movement via on_rope
. Use this for example to update a custom enemy type.
Will also update movable.animation_frame
and various timers and counters
-int
-walk_run
-
+CallbackId
+set_pre_virtual(ENTITY_OVERRIDE entry, function fun)
+Hooks before the virtual function at index entry
.
-int
-use_door_buy
-
+CallbackId
+set_post_virtual(ENTITY_OVERRIDE entry, function fun)
+Hooks after the virtual function at index entry
.
-int
-pause_menu
-
+nil
+clear_virtual(CallbackId callback_id)
+Clears the hook given by callback_id
, alternatively use clear_callback()
inside the hook.
-int
-journal
-
+CallbackId
+set_pre_damage(function fun)
+Hooks before the virtual function.
The callback signature is optional<bool> damage(Movable self, int damage_dealer_uid, int damage_amount, int stun_time, float velocity_x, float velocity_y, int iframes)
Virtual function docs:
Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities
Returns: true if entity was affected, damage_dealer should break etc. false if the event should be ignored by damage_dealer?
-int
-left
-
+CallbackId
+set_post_damage(function fun)
+Hooks after the virtual function.
The callback signature is nil damage(Movable self, int damage_dealer_uid, int damage_amount, int stun_time, float velocity_x, float velocity_y, int iframes)
Virtual function docs:
Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities
Returns: true if entity was affected, damage_dealer should break etc. false if the event should be ignored by damage_dealer?
-int
-right
-
+CallbackId
+set_pre_apply_movement(function fun)
+Hooks before the virtual function.
The callback signature is bool apply_movement(Movable self)
-int
-up
-
+CallbackId
+set_post_apply_movement(function fun)
+Hooks after the virtual function.
The callback signature is nil apply_movement(Movable self)
+
+
+CallbackId
+set_pre_check_is_falling(function fun)
+Hooks before the virtual function.
The callback signature is bool check_is_falling(Movable self)
+
+
+CallbackId
+set_post_check_is_falling(function fun)
+Hooks after the virtual function.
The callback signature is nil check_is_falling(Movable self)
+
+
+CallbackId
+set_pre_process_input(function fun)
+Hooks before the virtual function.
The callback signature is bool process_input(Movable self)
+
+
+CallbackId
+set_post_process_input(function fun)
+Hooks after the virtual function.
The callback signature is nil process_input(Movable self)
+
+
+MovingIcon
+
+
+
+
+Type
+Name
+Description
+
int
-down
-
+movement_timer
+Used to move it up and down in sync with others
-PlayerInputs
-Used in StateMemory
+Olmec
+
@@ -8322,58 +25494,58 @@ PlayerInputs
-array<PlayerSlot, MAX_PLAYERS>
-player_slots
+SoundMeta
+sound
-PlayerSlot
-player_slot_1
+int
+target_uid
-PlayerSlot
-player_slot_2
-
+int
+attack_phase
+0 = stomp, 1 = bombs, 2 = stomp+ufos, 3 = in lava
-PlayerSlot
-player_slot_3
-
+int
+attack_timer
+in phase 0/2: time spent looking for player, in phase 1: time between bomb salvo
-PlayerSlot
-player_slot_4
-
+int
+ai_timer
+general timer that counts down whenever olmec is active
-array<PlayerSlotSettings, MAX_PLAYERS>
-player_settings
-
+int
+move_direction
+-1 = left, 0 = down, 1 = right, phase 0/2: depends on target, phase 1: travel direction
-PlayerSlotSettings
-player_slot_1_settings
+int
+jump_timer
-PlayerSlotSettings
-player_slot_2_settings
+int
+phase1_amount_of_bomb_salvos
-PlayerSlotSettings
-player_slot_3_settings
+int
+unknown_attack_state
-
-PlayerSlotSettings
-player_slot_4_settings
+
+int
+broken_floaters()
-Journal types
JournalPage
-Used in set_callback with ON.RENDER_POST_JOURNAL_PAGE
+OlmecCannon
+
@@ -8383,28 +25555,18 @@ Journal types
JournalPage
-TextureRenderingInfo
-background
-
-
-
int
-page_number
+timer
-bool
-is_right_side_page()
-background.x < 0
-
-
-JOURNAL_PAGE_TYPE
-get_type()
+int
+bombs_left
-JournalPageBestiary
-Derived from JournalPage JournalPageDiscoverable
+OlmecFloater
+
@@ -8414,43 +25576,54 @@ JournalPageBestiary
-TextureRenderingInfo
-monster_background
+bool
+both_floaters_intact
-TextureRenderingInfo
-monster_icon
+bool
+on_breaking
+
+OlmecShip
+
+
+
-TextureRenderingInfo
-defeated_killedby_black_bars
+Type
+Name
+Description
+
+
+
+SoundMeta
+sound
-TextRenderingInfo
-defeated_text_info
+Entity
+door_fx
-TextRenderingInfo
-defeated_value_text_info
+ParticleEmitterInfo
+smoke
-TextRenderingInfo
-killedby_text_info
+int
+flight_time
-TextRenderingInfo
-killedby_value_text_info
+bool
+has_spawned_jetflames
-JournalPageDeathCause
-Derived from JournalPage
+Orb
+
@@ -8460,13 +25633,18 @@ JournalPageDeathCause
-TextRenderingInfo
-death_cause_text_info
+SoundMeta
+sound
+
+
+
+int
+timer
-JournalPageDeathMenu
-Derived from JournalPage
+ParachutePowerup
+Derived from Entity Movable Powerup
@@ -8477,47 +25655,53 @@ JournalPageDeathMenu
int
-selected_menu_index
-
+falltime_deploy
+this gets compared with entity's falling_timer
-TextRenderingInfo
-game_over_text_info
+bool
+deployed
-TextRenderingInfo
-level_text_info
+nil
+deploy()
-TextRenderingInfo
-level_value_text_info
-
+int
+gold_timer
+Timer for spawning a single gold nugget.
-TextRenderingInfo
-money_text_info
-
+int
+gold_spawning_time
+Time until gold nuggets stop spawning.
+
+PlayerBag
+
+
+
-TextRenderingInfo
-money_value_text_info
-
+Type
+Name
+Description
+
-TextRenderingInfo
-time_text_info
+int
+bombs
-TextRenderingInfo
-time_value_text_info
+int
+ropes
-JournalPageDiscoverable
-Derived from JournalPage
+PlayerGhost
+Derived from Entity Movable LightEmitter
@@ -8527,49 +25711,43 @@ JournalPageDiscoverable
-bool
-show_main_image
+ParticleEmitterInfo
+sparkles_particle
-TextRenderingInfo
-title_text_info
+PlayerSlot
+player_inputs
-TextRenderingInfo
-entry_text_info
+Inventory
+inventory
-TextRenderingInfo
-chapter_title_text_info
+SoundMeta
+sound
-
-JournalPageFeats
-Derived from JournalPage
-
-
-Type
-Name
-Description
+int
+body_uid
+Is not set to -1 when crushed
-
-TextRenderingInfo
-chapter_title_text_info
+int
+shake_timer
-TextureRenderingInfo
-feat_icons
+int
+boost_timer
-JournalPageItems
-Derived from JournalPage JournalPageDiscoverable
+Pot
+Derived from Entity Movable Purchasable
@@ -8579,18 +25757,18 @@ JournalPageItems
-TextureRenderingInfo
-item_icon
+ENT_TYPE
+inside
-TextureRenderingInfo
-item_background
+bool
+dont_transfer_dmg
-JournalPageJournalMenu
-Derived from JournalPage
+Powerup
+
@@ -8599,24 +25777,25 @@ JournalPageJournalMenu
Description
+
+Present
+Derived from Entity Movable Purchasable
+
+
-int
-selected_menu_index
-
-
-
-TextRenderingInfo
-journal_text_info
-
+Type
+Name
+Description
+
-TextureRenderingInfo
-completion_badge
+ENT_TYPE
+inside
-JournalPageLastGamePlayed
-Derived from JournalPage
+PrizeDispenser
+
@@ -8626,58 +25805,71 @@ JournalPageLastGamePlayed
-TextureRenderingInfo
-main_image
-
-
-
-TextRenderingInfo
-last_game_played_text_info
-
+array<int, 6>
+item_ids
+Id's of the items (not types), by default 0-24, look at change_diceshop_prizes for the list of default prizes
so for example: id 0 equals ITEM_PICKUP_BOMBBAG, id 1 equals ITEM_PICKUP_BOMBBOX etc. Game generates 6 but uses max 5 for Tusk dice shop
-TextRenderingInfo
-level_text_info
+int
+prizes_spawned
+
+Projectile
+
+
+
-TextRenderingInfo
-level_value_text_info
-
+Type
+Name
+Description
+
+
+PunishBall
+
+
+
-TextRenderingInfo
-money_text_info
-
+Type
+Name
+Description
+
-TextRenderingInfo
-money_value_text_info
+int
+attached_to_uid
-TextRenderingInfo
-time_text_info
-
+int
+timer
+counts down from 20 while the ball is eligible to break a floor and tries to break it at 0
-TextRenderingInfo
-time_value_text_info
+float
+x_pos
-int
-sticker_count
+float
+y_pos
+
+Purchasable
+
+
+
-array<TextureRenderingInfo, 20>
-stickers
-
+Type
+Name
+Description
+
-JournalPagePeople
-Derived from JournalPage JournalPageDiscoverable
+PushBlock
+
@@ -8687,23 +25879,23 @@ JournalPagePeople
-TextureRenderingInfo
-character_background
+SoundMeta
+sound
-TextureRenderingInfo
-character_icon
+ParticleEmitterInfo
+dust_particle
-TextureRenderingInfo
-character_drawing
+float
+dest_pos_x
-JournalPagePlaces
-Derived from JournalPage JournalPageDiscoverable
+RegenBlock
+
@@ -8713,13 +25905,13 @@ JournalPagePlaces
-TextureRenderingInfo
-main_image
+bool
+on_breaking
-JournalPagePlayerProfile
-Derived from JournalPage
+RollingItem
+Derived from Entity Movable Purchasable
@@ -8729,123 +25921,117 @@ JournalPagePlayerProfile
-TextureRenderingInfo
-player_icon
-
-
-
-int
-player_icon_id
-
-
-
-TextRenderingInfo
-player_profile_text_info
-
-
-
-TextRenderingInfo
-plays_text_info
-
-
-
-TextRenderingInfo
-plays_value_text_info
-
-
-
-TextRenderingInfo
-wins_text_info
-
-
-
-TextRenderingInfo
-wins_value_text_info
+float
+roll_speed
+
+Rubble
+
+
+
-TextRenderingInfo
-deaths_text_info
-
+Type
+Name
+Description
+
+
+ScepterShot
+Derived from Entity Movable LightEmitter
+
+
-TextRenderingInfo
-deaths_value_text_info
-
+Type
+Name
+Description
+
-TextRenderingInfo
-win_pct_text_info
+SoundMeta
+sound
-TextRenderingInfo
-win_pct_value_text_info
+float
+speed
-TextRenderingInfo
-average_score_text_info
-
+int
+idle_timer
+short timer before it goes after target
+
+Shield
+Derived from Entity Movable Purchasable
+
+
-TextRenderingInfo
-average_score_value_text_info
-
+Type
+Name
+Description
+
-TextRenderingInfo
-top_score_text_info
+float
+shake
+
+SkullDropTrap
+
+
+
-TextRenderingInfo
-top_score_value_text_info
-
+Type
+Name
+Description
+
-TextRenderingInfo
-deepest_level_text_info
+SoundMeta
+sound
-TextRenderingInfo
-deepest_level_value_text_info
+int
+left_skull_uid
-TextRenderingInfo
-deadliest_level_text_info
+int
+middle_skull_uid
-TextRenderingInfo
-deadliest_level_value_text_info
+int
+right_skull_uid
-TextRenderingInfo
-average_time_text_info
+int
+left_skull_drop_time
-TextRenderingInfo
-average_time_value_text_info
+int
+middle_skull_drop_time
-TextRenderingInfo
-best_time_text_info
+int
+right_skull_drop_time
-TextRenderingInfo
-best_time_value_text_info
-
+int
+timer
+counts from 60 to 0, 3 times, the last time dropping the skulls, then random longer timer for reset
-JournalPageProgress
-Derived from JournalPage
+SleepBubble
+
@@ -8855,13 +26041,13 @@ JournalPageProgress
-TextureRenderingInfo
-coffeestain_top
+int
+show_hide_timer
-JournalPageRecap
-Derived from JournalPage
+SnapTrap
+
@@ -8870,20 +26056,19 @@ JournalPageRecap
Description
-
-JournalPageStory
-Derived from JournalPage
-
-
-Type
-Name
-Description
+int
+bait_uid
+
+
+
+int
+reload_timer
+
-
-JournalPageTraps
-Derived from JournalPage JournalPageDiscoverable
+SoundShot
+Derived from Entity Movable Projectile LightShot
@@ -8893,19 +26078,13 @@ JournalPageTraps
-TextureRenderingInfo
-trap_icon
-
-
-
-TextureRenderingInfo
-trap_background
+SoundMeta
+sound
-Levelgen types
DoorCoords
-Deprecated
- kept for backward compatibility, don't use, check LevelGenSystem.exit_doors
+Spark
+Derived from Entity Movable Flame
@@ -8915,90 +26094,100 @@ Levelgen types
DoorCoords
-float
-door1_x
+ParticleEmitterInfo
+particle
-float
-door1_y
+Entity
+fx_entity
float
-door2_x
-door2 only valid when there are two in the level, like Volcana drill, Olmec, ...
+rotation_center_x
+
float
-door2_y
+rotation_center_y
-
-LevelGenSystem
-Data relating to level generation, changing anything in here from ON.LEVEL or later will likely have no effect, used in StateMemory
-
-
-Type
-Name
-Description
+float
+rotation_angle
+
-
-ShopType
-shop_type
-
+float
+size
+slowly goes down to default 1.0, is 0.0 when not on screen
-ShopType
-backlayer_shop_type
-
+float
+size_multiply
+0.0 when not on screen
-int
-shop_music
-
+float
+next_size
+width and height will be set to next_size size_multiply
next frame
int
-backlayer_shop_music
-
+size_change_timer
+very short timer before next size change, giving a pulsing effect
float
-spawn_x
-
+speed
+This is custom variable, you need activate_sparktraps_hack to use it
float
-spawn_y
-
+distance
+This is custom variable, you need activate_sparktraps_hack to use it
+
+Spear
+
+
+
-int
-spawn_room_x
-
+Type
+Name
+Description
+
int
-spawn_room_y
+sound_id
+
+SpecialShot
+Derived from Entity Movable LightEmitter
+
+
-custom_array<Vec2>
-exit_doors
+Type
+Name
+Description
+
+
+
+float
+target_x
-ThemeInfo
-themes[18]
+float
+target_y
-Lighting types
Illumination
-Generic obcject for lights in the game, you can make your own with create_illumination
-Used in StateMemory, Player, PlayerGhost, BurningRopeEffect ...
+StretchChain
+
@@ -9008,93 +26197,112 @@ Lighting types
Illumination
-array<LightParams, 4>
-lights
-Table of light1, light2, ... etc.
-
-
-LightParams
-light1
+int
+at_end_of_chain_uid
-LightParams
-light2
+float
+dot_offset
-LightParams
-light3
+int
+position_in_chain
-LightParams
-light4
-It's rendered on objects around, not as an actual bright spot
+int
+inverse_doubled_position_in_chain
+
-float
-brightness
+bool
+is_dot_hidden
+
+Switch
+
+
+
-float
-brightness_multiplier
-
+Type
+Name
+Description
+
-float
-light_pos_x
+int
+timer
+
+TV
+
+
+
-float
-light_pos_y
-
+Type
+Name
+Description
+
-float
-offset_x
+SoundMeta
+sound
-float
-offset_y
+Entity
+fx_button
-float
-distortion
+Illumination
+emitted_light
int
-entity_uid
+station
+
+Teleporter
+Derived from Entity Movable Purchasable
+
+
-int
-flags
-see flags.hpp illumination_flags
+Type
+Name
+Description
+
int
-type_flags
-Only one can be set: 1 - Follow camera, 2 - Follow Entity, 3 - Rectangle, full brightness
Rectangle always uses light1, even when it's disabled in flags
+teleport_number
+
+
+TeleporterBackpack
+Derived from Entity Movable Backpack
+
+
-bool
-enabled
-
+Type
+Name
+Description
+
int
-layer
+teleport_number
-LightParams
-Used in Illumination
+Telescope
+
@@ -9104,29 +26312,23 @@ LightParams
-float
-red
-
-
-
-float
-green
+Entity
+fx_button
-float
-blue
+Entity
+camera_anchor
-float
-size
+int
+looked_through_by_uid
-Liquid types
LiquidPhysics
-Use LIQUID_POOL enum for the index
-Used in StateMemory
+Tentacle
+Derived from Entity Movable Chain
@@ -9136,13 +26338,13 @@ Liquid types
LiquidPhysics
-array<LiquidPool, 5>
-pools
+Entity
+bottom
-LiquidPhysicsEngine
-Used in LiquidPool
+ThinIce
+
@@ -9152,43 +26354,61 @@ LiquidPhysicsEngine
-bool
-pause
-
+int
+strength
+counts down when standing on, maximum is 134 as based of this value it changes animation_frame, and above that value it changes to wrong sprite
+
+TiamatShot
+Derived from Entity Movable LightEmitter
+
+
-float
-gravity
-
+Type
+Name
+Description
+
-float
-cohesion
+SoundMeta
+sound
+
+TimedPowderkeg
+Derived from Entity Movable PushBlock
+
+
-float
-elasticity
-
+Type
+Name
+Description
+
-float
-size
-
+int
+timer
+timer till explosion, -1 = pause, counts down
+
+TimedShot
+Derived from Entity Movable Projectile LightShot
+
+
-float
-weight
-
+Type
+Name
+Description
+
int
-count
+timer
-LiquidPhysicsParams
-Used in LiquidPool
+Torch
+
@@ -9198,23 +26418,28 @@ LiquidPhysicsParams
-float
-gravity
+int
+flame_uid
-float
-cohesion
+bool
+is_lit
+It's used just to check, to light/extinguish use light_up
function
+
+
+nil
+light_up(bool lit)
-float
-elasticity
+ENT_TYPE
+get_flame_type()
-LiquidPool
-Used in LiquidPhysics
+TorchFlame
+Derived from Entity Movable Flame
@@ -9224,18 +26449,28 @@ LiquidPool
-LiquidPhysicsParams
-default
+ParticleEmitterInfo
+smoke_particle
-LiquidPhysicsEngine
-engine
+ParticleEmitterInfo
+flame_particle
+
+
+
+ParticleEmitterInfo
+warp_particle
+
+
+
+float
+flame_size
-Logic types
Logic
-Used in LogicList
+TrapPart
+
@@ -9245,14 +26480,13 @@ Logic types
Logic
-int
-logic_index
+Entity
+ceiling
-LogicDiceShop
-Used in LogicList
-Derived from Logic
+Treasure
+
@@ -9262,78 +26496,99 @@ LogicDiceShop
-int
-bet_machine
-
-
-
-int
-die1
-
-
-
-int
-die2
-
+bool
+cashed
+spawns a dust effect and adds money for the total
+
+TreasureHook
+
+
+
-int
-die_1_value
-
+Type
+Name
+Description
+
-int
-die_2_value
+SoundMeta
+sound
+
+TrueCrownPowerup
+Derived from Entity Movable Powerup
+
+
-int
-prize_dispenser
-
+Type
+Name
+Description
+
int
-prize
+timer
+
+UdjatSocket
+
+
+
-int
-forcefield
-
+Type
+Name
+Description
+
-bool
-bet_active
+Entity
+fx_button
+
+UnchainedSpikeBall
+
+
+
-bool
-forcefield_deactivated
-
+Type
+Name
+Description
+
bool
-boss_angry
+bounce
+
+Ushabti
+
+
+
-int
-result_announcement_timer
-
+Type
+Name
+Description
+
int
-won_prizes_count
+wiggle_timer
int
-balance
+shine_timer
-LogicList
-Used in StateMemory
+VanillaMovableBehavior
+Opaque handle to a movable behavior from the vanilla game
+Derived from MovableBehavior
@@ -9342,30 +26597,41 @@ LogicList
Description
+
+VladsCape
+Derived from Entity Movable Backpack Cape
+
+
-LogicOlmecCutscene
-olmec_cutscene
-
+Type
+Name
+Description
+
-LogicTiamatCutscene
-tiamat_cutscene
+bool
+can_double_jump
+
+WallTorch
+Derived from Entity Movable Torch
+
+
-LogicMagmamanSpawn
-magmaman_spawn
-
+Type
+Name
+Description
+
-LogicDiceShop
-diceshop
-
+bool
+dropped_gold
+if false, it will drop gold when light up
-LogicOlmecCutscene
-Used in LogicList
-Derived from Logic
+Web
+
@@ -9375,29 +26641,29 @@ LogicOlmecCutscene
-Entity
-olmec
-
-
-
-Entity
-player
-
+float
+decay_rate
+Is subtracted from the color alpha every frame after the stand_counter
is more than 300.
Entity automatically dies when the alpha is less than 0.1
+
+WebShot
+Derived from Entity Movable Projectile
+
+
-Entity
-cinematic_anchor
-
+Type
+Name
+Description
+
-int
-timer
-
+bool
+shot
+if false, it's attached to the gun
-LogicTiamatCutscene
-Used in LogicList
-Derived from Logic
+WoodenlogTrap
+
@@ -9407,23 +26673,34 @@ LogicTiamatCutscene
-Entity
-tiamat
+int
+ceiling_1_uid
-Entity
-player
+int
+ceiling_2_uid
-Entity
-cinematic_anchor
+float
+falling_speed
+
+YellowCape
+Derived from Entity Movable Backpack Cape
+
+
+
+Type
+Name
+Description
+
+
-int
-timer
+SoundMeta
+sound