Skip to content

spel2_types.lua (EmmyLua)

Download spel2_types.lua or all EmmyLua files.

---@meta
-- Generated by docs-digger from overlunky's sources: do not edit, regenerate.

---Axis-Aligned-Bounding-Box, represents for example a hitbox of an entity or the size of a gui element
---@class AABB
---@field bottom number
---@field left number
---@field right number
---@field top number
AABB = {}

---Create a new axis aligned bounding box - defaults to all zeroes
---@return AABB
---@overload fun(other: AABB): AABB
---@overload fun(top_left: Vec2, bottom_right: Vec2): AABB
---@overload fun(left_: number, top_: number, right_: number, bottom_: number): AABB
function AABB.new() end

---Fixes the AABB if any of the sides have negative length
---@return AABB
function AABB:abs() end

---Compute area of the AABB, can be zero if one dimension is zero or negative if one dimension is inverted.
---@return number
function AABB:area() end

---Short for `(aabb.left + aabb.right) / 2.0f, (aabb.top + aabb.bottom) / 2.0f`.
---@return number
---@return number
function AABB:center() end

---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`.
---@param amount number
---@return AABB
---@overload fun(self: AABB, amount_x: number, amount_y: number): AABB
function AABB:extrude(amount) end

---Short for `aabb.top - aabb.bottom`.
---@return number
function AABB:height() end

---Checks if point lies between left/right and top/bottom
---@param p Vec2
---@return boolean
---@overload fun(self: AABB, x: number, y: number): boolean
function AABB:is_point_inside(p) end

---Offsets the AABB by the given offset.
---@param off_x number
---@param off_y number
---@return AABB
function AABB:offset(off_x, off_y) end

---@param other AABB
---@return boolean
function AABB:overlaps_with(other) end

---@param other AABB
---@return AABB
function AABB:set(other) end

---@return number
---@return number
---@return number
---@return number
function AABB:split() end

---Short for `aabb.right - aabb.left`.
---@return number
function AABB:width() end

---@class AcidBubble : Entity, Movable
---@field float_counter number
---@field speed_x number
---@field speed_y number
AcidBubble = {}

---Used in Player
---@class Ai
---@field last_state integer
---@field state integer @AI state (patrol, sleep, attack, aggro...)
---@field target Entity|nil
---@field target_uid integer
---@field timer integer
---@field trust integer @Levels completed with, 0..3
---@field walk_pause_timer integer @positive: walking, negative: waiting/idle
---@field whipped integer @Number of times whipped by player
Ai = {}

---@class Alien : Entity, Movable, PowerupCapable, Monster
---@field jump_timer integer
---@field leg_shake_timer integer
---@field shudder_timer integer
Alien = {}

---@class Altar : Entity, Floor
---@field timer integer @for normal altar: counts from 0 to 20 then 0, then 1 then 0 and sacrifice happens
Altar = {}

---@class Ammit : Entity, Movable, PowerupCapable, Monster
---@field particle ParticleEmitterInfo|nil
---@field walk_pause_timer integer
Ammit = {}

---Used in EntityDB
---@class Animation
---@field first_tile integer
---@field id integer
---@field interval integer
---@field num_tiles integer
---@field repeat_mode REPEAT_TYPE
Animation = {}

---@class AnkhPowerup : Entity, Movable, Powerup
---@field fx_glow Entity|nil
---@field music_on_off boolean
---@field player Entity|nil
---@field sound SoundMeta|nil
---@field timer1 integer
---@field timer2 integer
---@field timer3 integer
AnkhPowerup = {}

---@class Anubis : Entity, Movable, PowerupCapable, Monster
---@field ai_timer integer
---@field attack_proximity_x number
---@field attack_proximity_y number
---@field awake boolean
---@field next_attack_timer integer
---@field psychic_orbs_counter integer
---@field spawn_x number
---@field spawn_y number
Anubis = {}

---@class ApepHead : Entity, Movable, PowerupCapable, Monster, ApepPart
---@field distance_traveled number
---@field fx_mouthpiece1_uid integer
---@field fx_mouthpiece2_uid integer
---@field sound1 SoundMeta|nil
---@field sound2 SoundMeta|nil
---@field tail_uid integer
ApepHead = {}

---@class ApepPart : Entity, Movable, PowerupCapable, Monster
---@field sine_angle number
---@field sync_timer integer @or pause timer, used to sync the body parts moving up and down
---@field y_pos number
ApepPart = {}

---Used in ArenaState
---@class ArenaConfigArenas
---@field dwelling_1 boolean
---@field dwelling_2 boolean
---@field dwelling_3 boolean
---@field dwelling_4 boolean
---@field dwelling_5 boolean
---@field icecaves_1 boolean
---@field icecaves_2 boolean
---@field icecaves_3 boolean
---@field icecaves_4 boolean
---@field icecaves_5 boolean
---@field jungle_1 boolean
---@field jungle_2 boolean
---@field jungle_3 boolean
---@field jungle_4 boolean
---@field jungle_5 boolean
---@field list boolean[]
---@field neobabylon_1 boolean
---@field neobabylon_2 boolean
---@field neobabylon_3 boolean
---@field neobabylon_4 boolean
---@field neobabylon_5 boolean
---@field sunkencity_1 boolean
---@field sunkencity_2 boolean
---@field sunkencity_3 boolean
---@field sunkencity_4 boolean
---@field sunkencity_5 boolean
---@field temple_1 boolean
---@field temple_2 boolean
---@field temple_3 boolean
---@field temple_4 boolean
---@field temple_5 boolean
---@field tidepool_1 boolean
---@field tidepool_2 boolean
---@field tidepool_3 boolean
---@field tidepool_4 boolean
---@field tidepool_5 boolean
---@field volcana_1 boolean
---@field volcana_2 boolean
---@field volcana_3 boolean
---@field volcana_4 boolean
---@field volcana_5 boolean
ArenaConfigArenas = {}

---Used in ArenaState
---@class ArenaConfigEquippedItems
---@field climbing_gloves boolean
---@field kapala boolean
---@field parachute boolean
---@field paste boolean
---@field pitchers_mitt boolean
---@field scepter boolean
---@field spike_shoes boolean
---@field spring_shoes boolean
ArenaConfigEquippedItems = {}

---Used in ArenaState
---@class ArenaConfigItems
---@field bombbag boolean
---@field bombbox boolean
---@field boomerang boolean
---@field camera boolean
---@field cape boolean
---@field climbing_gloves boolean
---@field cooked_turkey boolean
---@field crossbow boolean
---@field excalibur boolean
---@field freezeray boolean
---@field hoverpack boolean
---@field jetpack boolean
---@field kapala boolean
---@field machete boolean
---@field mattock boolean
---@field metal_shield boolean
---@field mine boolean
---@field parachute boolean
---@field paste boolean
---@field pickup_12bag boolean
---@field pickup_24bag boolean
---@field pitchers_mitt boolean
---@field plasma_cannon boolean
---@field pot boolean
---@field powerpack boolean
---@field rock boolean
---@field ropepile boolean
---@field royal_jelly boolean
---@field scepter boolean
---@field shotgun boolean
---@field snaptrap boolean
---@field spike_shoes boolean
---@field spring_shoes boolean
---@field telepack boolean
---@field teleporter boolean
---@field torch boolean
---@field true_crown boolean
---@field vlads_cape boolean
---@field webgun boolean
---@field wooden_shield boolean
ArenaConfigItems = {}

---Used in StateMemory
---@class ArenaState
---@field arena_select integer
---@field arenas ArenaConfigArenas
---@field bombs integer
---@field breath_cooldown integer
---@field crate_frequency integer
---@field current_arena integer
---@field dark_level_chance integer
---@field equipped_backitem integer
---@field equipped_items ArenaConfigEquippedItems
---@field final_ghost boolean
---@field format integer
---@field health integer
---@field held_item integer
---@field items_enabled ArenaConfigItems
---@field items_in_crate ArenaConfigItems
---@field lives integer
---@field mount integer
---@field player_idolheld_countdown integer[]
---@field player_lives integer[]
---@field player_teams integer[]
---@field player_totalwins integer[]
---@field player_won boolean[]
---@field punish_ball boolean
---@field ropes integer
---@field ruleset integer
---@field stun_time integer
---@field time_to_win integer
---@field timer integer @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
---@field timer_ending integer
---@field whip_damage integer
---@field wins integer
ArenaState = {}

---@class Arrow : Entity, Movable, Purchasable
---@field flame_uid integer
---@field is_on_fire boolean
---@field is_poisoned boolean
---@field shot_from_trap boolean
Arrow = {}

---@param lit boolean
function Arrow:light_up(lit) end

---@param poisoned boolean
function Arrow:poison_arrow(poisoned) end

---@class Arrowtrap : Entity, Floor
---@field arrow_shot boolean
Arrowtrap = {}

function Arrowtrap:rearm() end

---The uid must be movable entity for ownership transfers
---@param who_uid integer
function Arrowtrap:trigger(who_uid) end

---@class Axolotl : Entity, Movable, PowerupCapable, Mount
---@field attack_cooldown integer
---@field can_teleport boolean
Axolotl = {}

---@class AxolotlShot : Entity, Movable, Projectile
---@field distance_after_capture number
---@field size number
---@field swing number
---@field swing_periodicity number
---@field trapped_uid integer
AxolotlShot = {}

---@class BGBackLayerDoor : Entity
---@field illumination1 Illumination|nil
---@field illumination2 Illumination|nil
BGBackLayerDoor = {}

---@class BGEggshipRoom : Entity
---@field fx_door Entity|nil
---@field fx_shell Entity|nil
---@field platform_left Entity|nil
---@field platform_middle Entity|nil
---@field platform_right Entity|nil
---@field player_in boolean
---@field sound SoundMeta|nil
BGEggshipRoom = {}

---@class BGFloatingDebris : Entity, BGSurfaceLayer
---@field distance number @Distance it travels up and down from spawn position
---@field sine_angle number
---@field speed number
BGFloatingDebris = {}

---@class BGMovingStar : Entity, BGSurfaceStar
---@field falling_speed number @Can make it rise if set to negative
BGMovingStar = {}

---@class BGRelativeElement : Entity
---@field relative_x number
---@field relative_y number
BGRelativeElement = {}

---@class BGShootingStar : Entity, BGRelativeElement
---@field max_timer integer
---@field size number @Gets smaller as the timer gets close to the max_timer
---@field timer integer
---@field x_increment number
---@field y_increment number
BGShootingStar = {}

---@class BGShopEntrance : Entity
---@field on_entering boolean
BGShopEntrance = {}

---@class BGShopKeeperPrime : Entity
---@field bubble_spawn_delay integer
---@field bubble_spawn_trigger boolean
---@field bubbles_timer integer
---@field normal_y number
---@field sine_pos number
BGShopKeeperPrime = {}

---@class BGSurfaceLayer : Entity, BGRelativeElement
---@field relative_offset_x number
---@field relative_offset_y number
BGSurfaceLayer = {}

---@class BGSurfaceStar : Entity
---@field blink_timer integer
---@field relative_x number
---@field relative_y number
BGSurfaceStar = {}

---@class BGTutorialSign : Entity
---@field is_shown boolean
BGTutorialSign = {}

---Used in GameManager
---@class BackgroundMusic
---@field angered_shopkeeper BackgroundSound|nil
---@field arena BackgroundSound|nil
---@field arena_intro_and_win BackgroundSound|nil
---@field backlayer BackgroundSound|nil
---@field basecamp BackgroundSound|nil
---@field dark_level BackgroundSound|nil
---@field death_transition BackgroundSound|nil
---@field game_startup BackgroundSound|nil
---@field inside_sunken_city_pipe BackgroundSound|nil
---@field level_gameplay BackgroundSound|nil
---@field level_transition BackgroundSound|nil
---@field main_backgroundtrack BackgroundSound|nil
---@field pause_menu BackgroundSound|nil
---@field shop BackgroundSound|nil
---@field win_scene BackgroundSound|nil
BackgroundMusic = {}

---@class BackgroundSound : SoundMeta
BackgroundSound = {}

---@class Backpack : Entity, Movable, Powerup
---@field explosion_timer integer
---@field explosion_trigger boolean @More like on fire trigger, the explosion happens when the timer reaches > 29
Backpack = {}

---@param callback_id integer
function Backpack:clear_virtual(callback_id) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Backpack:set_post_trigger_explosion(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Backpack:set_post_virtual(index, fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Backpack:set_pre_trigger_explosion(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Backpack:set_pre_virtual(index, fun) end

function Backpack:trigger_explosion() end

---@class Bat : Entity, Movable, PowerupCapable, Monster
---@field spawn_x number
---@field spawn_y number
Bat = {}

---@class Bee : Entity, Movable, PowerupCapable, Monster
---@field can_rest boolean
---@field fly_hang_timer integer
---@field sound SoundMeta|nil
---@field targeting_timer integer
---@field walk_end_time integer
---@field walk_start_time integer
---@field wobble_x number
---@field wobble_y number
Bee = {}

---@class Beg : Entity, Movable, PowerupCapable, Monster, NPC
---@field disappear_timer integer
---@field walk_pause_timer integer
Beg = {}

---@class BigSpearTrap : Entity, Floor
---@field left_part boolean @setting the left part to 0 or right part to 1 destroys the trap
---@field spear_uid integer
BigSpearTrap = {}

---The uid must be movable entity for ownership transfers, has to be called on the left part of the trap,
---@param who_uid integer
---@param left boolean
function BigSpearTrap:trigger(who_uid, left) end

---@class Birdies : Entity, Movable
Birdies = {}

---@class Bodyguard : Entity, Movable, PowerupCapable, Monster, NPC
---@field message_shown boolean
---@field position_state integer @0 - none, 1 - Tusk dice shop, 2 - Entrance to pleasure palace, 3 - Basement entrance to pleasure palace
Bodyguard = {}

---@class Bomb : Entity, Movable
---@field is_big_bomb boolean @is bomb from powerpack
---@field scale_hor number @1.25 = default regular bomb, 1.875 = default giant bomb, > 1.25 generates ENT_TYPE_FX_POWEREDEXPLOSION
---@field scale_ver number
---@field sound SoundMeta|nil
Bomb = {}

---@class BoneBlock : Entity, Movable
BoneBlock = {}

---@class Boombox : Entity, Movable
---@field fx_button Entity|nil
---@field jump_state integer
---@field jump_timer integer
---@field music_note1 ParticleEmitterInfo|nil
---@field music_note2 ParticleEmitterInfo|nil
---@field spawn_y number
---@field station integer
---@field station_change_delay integer
Boombox = {}

---@class Boomerang : Entity, Movable, Purchasable
---@field distance number
---@field returns_to_uid integer
---@field rotation number
---@field sound SoundMeta|nil
---@field trail ParticleEmitterInfo|nil
Boomerang = {}

---@class Boulder : Entity, Movable
---@field is_rolling integer @is set to 1 when the boulder first hits the ground
Boulder = {}

---@class BoulderSpawner : Entity
---@field owner_uid integer @UID of entity that triggered the trap.
---@field sound SoundMeta|nil
---@field timer integer @Can be set negative for longer time period, spawns boulder at 150, setting it higher with count to overflow
BoulderSpawner = {}

---@class Bow : Entity, Movable, Purchasable
Bow = {}

---When laying on the ground
---@return number
function Bow:get_arrow_special_offset() end

---Shared memory structure used for Playlunky-Overlunky interoperability
---@class Bucket
---@field count integer @Number of API instances present
---@field custom_strings table<STRINGID, string> @Holds all the custom strings added thru [add_string](https://spelunky-fyi.github.io/overlunky/#add_string), read only
---@field data table<string, boolean|integer|number|string> @You can store arbitrary simple values here in Playlunky to be read in on Overlunky script for example.
---@field io SharedIO|nil @Shared part of ImGuiIO to block keyboard/mouse input across API instances.
---@field overlunky Overlunky|nil @Access Overlunky options here, nil if Overlunky is not loaded.
---@field pause PauseAPI|nil @PauseAPI is used by Overlunky and can be used to control the Overlunky pause options from scripts. Can be accessed from the global `pause` more easily.
Bucket = {}

---@class Bullet : Entity, Movable, Projectile
Bullet = {}

---@class BurningRopeEffect : Entity
---@field illumination Illumination|nil
---@field sound SoundMeta|nil
BurningRopeEffect = {}

---@class Button : Entity, Movable
---@field button_sprite integer @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
---@field is_visible boolean @It's false for selldialog used in shops
---@field player_trigger boolean @It's set true even if player does not see the button, like the drill or COG door
---@field seen integer @-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
---@field visibility number
Button = {}

---@class Camera
---@field adjusted_focus_x number
---@field adjusted_focus_y number
---@field bounds_bottom number
---@field bounds_left number
---@field bounds_right number
---@field bounds_top number
---@field calculated_focus_x number
---@field calculated_focus_y number
---@field focus_offset_x number
---@field focus_offset_y number
---@field focus_x number
---@field focus_y number
---@field focused_entity_uid integer @if set to -1, you have free control over camera focus through focus_x, focus_y
---@field inertia number @This is a bad name, but it represents the camera tweening speed. [0..5] where 0=still, 1=default (move 20% of distance per frame), 5=max (move 5*20% or 100% aka instantly to destination per frame)
---@field peek_layer integer
---@field peek_timer integer @amount of frames to freeze camera in place and move to the peek_layer during the peek you can freely set camera position no matter if focused_entity_uid is set to -1 or not
---@field shake_amplitude number
---@field shake_countdown integer
---@field shake_countdown_start integer
---@field shake_multiplier_x number
---@field shake_multiplier_y number
---@field uniform_shake boolean
---@field vertical_pan number
Camera = {}

---@return AABB
function Camera:get_bounds() end

---@param bounds AABB
function Camera:set_bounds(bounds) end

---@class CameraFlash : Entity
---@field illumination1 Illumination|nil
---@field illumination2 Illumination|nil
---@field timer integer
CameraFlash = {}

---@class Cape : Entity, Movable, Powerup, Backpack
---@field floating_down boolean
Cape = {}

---@class CatMummy : Entity, Movable, PowerupCapable, Monster
---@field attack_timer integer
---@field jump_height_multiplier integer @Set in process_input when jump is triggered to be used when applying velocity for the jump.
CatMummy = {}

---@class Caveman : Entity, Movable, PowerupCapable, Monster, WalkingMonster
---@field aggro_timer integer @keeps resetting when angry and a player is nearby
---@field can_pick_up_timer integer @0 = can pick something up, when holding forced to 179, after tripping and regaining consciousness counts down to 0
---@field wake_up_timer integer
Caveman = {}

---@class CavemanShopkeeper : Entity, Movable, PowerupCapable, Monster, WalkingMonster
---@field shop_entered boolean
---@field tripping boolean
CavemanShopkeeper = {}

---@class Chain : Entity, Movable
---@field attached_to_uid integer
---@field timer integer
Chain = {}

---@class ChainedPushBlock : Entity, Movable, PushBlock
---@field is_chained boolean
ChainedPushBlock = {}

---@class Chest : Entity, Movable
---@field bomb boolean @size of the bomb is random, if set both true only leprechaun spawns
---@field leprechaun boolean
Chest = {}

---@class CinematicAnchor : Entity
---@field blackbar_bottom Entity|nil
---@field blackbar_top Entity|nil
---@field roll_in number @0.0 to 1.0
CinematicAnchor = {}

---@class CityOfGoldDoor : Entity, Floor, Door, ExitDoor, DecoratedDoor
---@field unlocked boolean
CityOfGoldDoor = {}

---@class ClamBase : Entity, Movable
---@field top_part_uid integer
---@field treasure_type ENT_TYPE
---@field treasure_uid integer
---@field treasure_x_pos number
---@field treasure_y_pos number
ClamBase = {}

---@class Claw : Entity, Movable
---@field crabman_uid integer
---@field spawn_x number
---@field spawn_y number
Claw = {}

---@class ClimbableRope : Entity, Movable
---@field above_part Entity|nil
---@field below_part Entity|nil
---@field burn_timer integer @entity is killed after 20
---@field segment_nr integer
---@field segment_nr_inverse integer
ClimbableRope = {}

---@class CloneGunShot : Entity, Movable, Projectile, LightShot
---@field spawn_y number
---@field timer integer
CloneGunShot = {}

---@class Cobra : Entity, Movable, PowerupCapable, Monster
---@field spit_timer integer
Cobra = {}

---@class Coffin : Entity, Movable
---@field inside ENT_TYPE
---@field player_respawn boolean
---@field timer integer
Coffin = {}

---@class Coin : Entity, Movable
---@field nominal_price integer
Coin = {}

---@class Color
---@field a number
---@field b number
---@field g number
---@field r number
Color = {}

---Create a new color - defaults to black
---@return Color
---@overload fun(other: Color): Color
---@overload fun(r_: number, g_: number, b_: number, a_: number): Color
---@overload fun(color_name: string, alpha: integer|nil): Color
function Color.new() end

---@return Color
function Color.aqua() end

---@return Color
function Color.black() end

---@return Color
function Color.blue() end

---@return Color
function Color.fuchsia() end

---Returns RGBA colors in 0..255 range
---@return integer
---@return integer
---@return integer
---@return integer
function Color:get_rgba() end

---Returns the `uColor` used in `GuiDrawContext` drawing functions
---@return uColor
function Color:get_ucolor() end

---@return Color
function Color.gray() end

---@return Color
function Color.green() end

---@return Color
function Color.lime() end

---@return Color
function Color.maroon() end

---@return Color
function Color.navy() end

---@return Color
function Color.olive() end

---@return Color
function Color.purple() end

---@return Color
function Color.red() end

---Copies the values of different Color to this one
---@param other Color
---@return Color
function Color:set(other) end

---Changes color based on given RGBA colors in 0..255 range
---@param red integer
---@param green integer
---@param blue integer
---@param alpha integer
---@return Color
function Color:set_rgba(red, green, blue, alpha) end

---Changes color based on given uColor
---@param color integer
---@return Color
function Color:set_ucolor(color) end

---@return Color
function Color.silver() end

---@return Color
function Color.teal() end

---@return Color
function Color.white() end

---@return Color
function Color.yellow() end

---@class Constellation
---@field line_count integer
---@field line_red_intensity number
---@field lines ConstellationLine[]
---@field scale number
---@field star_count integer
---@field stars ConstellationStar[]
Constellation = {}

---@class ConstellationLine
---@field from integer
---@field to integer
ConstellationLine = {}

---@class ConstellationStar
---@field alpha number
---@field blue number
---@field canis_ring boolean
---@field fidelis_ring boolean
---@field green number
---@field halo_alpha number
---@field halo_blue number
---@field halo_green number
---@field halo_red number
---@field red number
---@field size number
---@field type integer
---@field x number
---@field y number
ConstellationStar = {}

---@class Container : Entity, Movable
---@field inside ENT_TYPE
Container = {}

---@class ControllerButton
---@field down boolean @Button is being held
---@field pressed boolean @Button was just pressed down this frame
ControllerButton = {}

---@class ControllerInput
---@field buttons ControllerButton[] @Zero-based indexing. Use PlayerSlot.input_mapping_controller or RAW_BUTTON (or RAW_DUALSHOCK) to index this.
ControllerInput = {}

---@class ConveyorBelt : Entity, Floor, TransferFloor
---@field timer integer
ConveyorBelt = {}

---@class CookFire : Entity, Movable, Torch
---@field emitted_light Illumination|nil
---@field particles_flames ParticleEmitterInfo|nil
---@field particles_smoke ParticleEmitterInfo|nil
---@field particles_warp ParticleEmitterInfo|nil
---@field sound SoundMeta|nil
CookFire = {}

---@class Crabman : Entity, Movable, PowerupCapable, Monster
---@field at_maximum_attack boolean
---@field attacking_claw_uid integer
---@field invincibility_timer integer
---@field poison_attack_timer integer
---@field walk_pause_timer integer
Crabman = {}

---@class Critter : Entity, Movable, PowerupCapable, Monster
---@field holding_state integer
---@field last_picked_up_by_uid integer
Critter = {}

---@class CritterBeetle : Entity, Movable, PowerupCapable, Monster, Critter
---@field pause boolean @used when he's getting eaten
CritterBeetle = {}

---@class CritterButterfly : Entity, Movable, PowerupCapable, Monster, Critter
---@field change_direction_timer integer
---@field vertical_flight_direction integer
CritterButterfly = {}

---@class CritterCrab : Entity, Movable, PowerupCapable, Monster, Critter
---@field unfriendly boolean @moves away from its target instead of towards it
---@field walk_pause_timer integer
---@field walking_left boolean
CritterCrab = {}

---@class CritterDrone : Entity, Movable, PowerupCapable, Monster, Critter
---@field applied_hor_momentum number
---@field applied_ver_momentum number
---@field emitted_light Illumination|nil
---@field move_timer integer
---@field sound SoundMeta|nil
---@field unfriendly boolean @moves away from its target instead of towards it
CritterDrone = {}

---@class CritterFirefly : Entity, Movable, PowerupCapable, Monster, Critter
---@field change_direction_timer integer
---@field sine_amplitude number
---@field sine_angle number
---@field sine_frequency number
---@field sit_cooldown_timer integer
---@field sit_timer integer
CritterFirefly = {}

---@class CritterFish : Entity, Movable, PowerupCapable, Monster, Critter
---@field player_in_proximity boolean
---@field swim_pause_timer integer
CritterFish = {}

---@class CritterLocust : Entity, Movable, PowerupCapable, Monster, Critter
---@field jump_timer integer
---@field sound SoundMeta|nil
CritterLocust = {}

---@class CritterPenguin : Entity, Movable, PowerupCapable, Monster, Critter
---@field jump_timer integer
---@field walk_pause_timer integer
CritterPenguin = {}

---@class CritterSlime : Entity, Movable, PowerupCapable, Monster, Critter
---@field pos_x number
---@field pos_y number
---@field rotation_angle number
---@field rotation_center_x number
---@field rotation_center_y number
---@field rotation_speed number
---@field walk_pause_timer integer
---@field x_direction number
---@field y_direction number
CritterSlime = {}

---@class CritterSnail : Entity, Movable, PowerupCapable, Monster, Critter
---@field pos_x number
---@field pos_y number
---@field rotation_angle number
---@field rotation_center_x number
---@field rotation_center_y number
---@field rotation_speed number
---@field x_direction number
---@field y_direction number
CritterSnail = {}

---@class Crocman : Entity, Movable, PowerupCapable, Monster, WalkingMonster
---@field teleport_cooldown integer
Crocman = {}

---@class CrossBeam : Entity
---@field attached_to_side_uid integer
---@field attached_to_top_uid integer
CrossBeam = {}

---@class CrushElevator : Entity, Movable
---@field speed number @This is custom variable, you need [activate_crush_elevator_hack](https://spelunky-fyi.github.io/overlunky/#activate_crush_elevator_hack) to use it
---@field y_limit number @This is custom variable, you need [activate_crush_elevator_hack](https://spelunky-fyi.github.io/overlunky/#activate_crush_elevator_hack) to use it
CrushElevator = {}

---@class Crushtrap : Entity, Movable
---@field bounce_back_timer integer @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
---@field dirx number
---@field diry number
---@field timer integer @counts from 30 to 0 before moving, after it stops, counts from 60 to 0 before it can be triggered again
Crushtrap = {}

---@class CursedEffect : Entity
---@field particle ParticleEmitterInfo|nil
---@field sound SoundMeta|nil
CursedEffect = {}

---@class CursedPot : Entity, Movable
---@field smoke ParticleEmitterInfo|nil
---@field smoke2 ParticleEmitterInfo|nil
CursedPot = {}

---Handle to a loaded FMOD Bank. Unloading a bank will destroy all objects loaded from it, and unload all sample data.
---Can be used to load and unload the non-streaming sample data of all events in the bank. However you can also
---control the loading state of non-streaming sample data for individual events with a `CustomEventDescription`.
---@class CustomBank
CustomBank = {}

---@return integer|nil
function CustomBank:get_loading_state() end

---@return integer|nil
function CustomBank:get_sample_loading_state() end

---@return boolean
function CustomBank:is_valid() end

---@return boolean
function CustomBank:load_sample_data() end

---@return boolean
function CustomBank:unload() end

---@return boolean
function CustomBank:unload_sample_data() end

---Handle to an FMOD event description, can be used to create a `CustomEventInstance` with
---`CustomEventDescription:create_instance()`. Also can be used to load and unload non-streaming
---sample data for the Event, and release all instances of the event. You can also get parameter
---IDs using `CustomEventDescription:get_parameter_description_by_name()`.
---@class CustomEventDescription
CustomEventDescription = {}

---@return CustomEventInstance
function CustomEventDescription:create_instance() end

---@param index integer
---@return ParameterDescription|nil
function CustomEventDescription:get_parameter_description_by_index(index) end

---@param name string
---@return ParameterDescription|nil
function CustomEventDescription:get_parameter_description_by_name(name) end

---@return integer|nil
function CustomEventDescription:get_parameter_description_count() end

---@param name string
---@return ParameterId|nil
function CustomEventDescription:get_parameter_id_by_name(name) end

---@return integer|nil
function CustomEventDescription:get_sample_loading_state() end

---@return boolean
function CustomEventDescription:is_valid() end

---@return boolean
function CustomEventDescription:load_sample_data() end

---@return boolean
function CustomEventDescription:release_all_instances() end

---@return boolean
function CustomEventDescription:unload_sample_data() end

---Handle to an FMOD event instance. Can be used to start and stop an event, or set the events parameters. Once you
---are done with an event instance and no longer need to change its playback state or parameters, you should call
---`CustomEventInstance:release()` so the event is marked for release and released when it stops playing to free resources.
---Generally though, it is best practice to call `CustomEventInstance:release()` immediately after `CustomEventInstance:start()`
---unless you want to play the event instance multiple times or explicitly start and stop it later.
---@class CustomEventInstance
CustomEventInstance = {}

---@param id ParameterId
---@return number|nil
function CustomEventInstance:get_parameter_by_id(id) end

---@param name string
---@return number|nil
function CustomEventInstance:get_parameter_by_name(name) end

---@return boolean|nil
function CustomEventInstance:get_pause() end

---@return number|nil
function CustomEventInstance:get_pitch() end

---@return integer|nil
function CustomEventInstance:get_playback_state() end

---@return integer|nil
function CustomEventInstance:get_timeline_position() end

---@return number|nil
function CustomEventInstance:get_volume() end

---@return boolean
function CustomEventInstance:is_valid() end

---@return boolean
function CustomEventInstance:key_off() end

---@return boolean
function CustomEventInstance:release() end

---@param id ParameterId
---@param value number
---@return boolean
---@overload fun(self: CustomEventInstance, id: ParameterId, value: number, ignoreseekspeed: boolean): boolean
function CustomEventInstance:set_parameter_by_id(id, value) end

---@param id ParameterId
---@param label string
---@return boolean
---@overload fun(self: CustomEventInstance, id: ParameterId, label: string, ignoreseekspeed: boolean): boolean
function CustomEventInstance:set_parameter_by_id_with_label(id, label) end

---@param name string
---@param value number
---@return boolean
---@overload fun(self: CustomEventInstance, name: string, value: number, ignoreseekspeed: boolean): boolean
function CustomEventInstance:set_parameter_by_name(name, value) end

---@param name string
---@param label string
---@return boolean
---@overload fun(self: CustomEventInstance, name: string, label: string, ignoreseekspeed: boolean): boolean
function CustomEventInstance:set_parameter_by_name_with_label(name, label) end

---@param pause boolean
---@return boolean
function CustomEventInstance:set_pause(pause) end

---@param pitch number
---@return boolean
function CustomEventInstance:set_pitch(pitch) end

---@param position integer
---@return boolean
function CustomEventInstance:set_timeline_position(position) end

---@param volume number
---@return boolean
function CustomEventInstance:set_volume(volume) end

---@return boolean
function CustomEventInstance:start() end

---@return boolean
---@overload fun(self: CustomEventInstance, mode: integer): boolean
function CustomEventInstance:stop() end

---Opaque handle to a custom movable behavior from a script mod
---@class CustomMovableBehavior : MovableBehavior
---@field base_behavior VanillaMovableBehavior|nil
CustomMovableBehavior = {}

---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`.
---@param behavior CustomMovableBehavior|nil
---@param force_state fun(movable: Movable|nil, base_fun: fun(p1: Movable|nil): boolean): boolean|nil @Returning nil: treated as false.
function CustomMovableBehavior.set_force_state(behavior, force_state) end

---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`.
---@param behavior CustomMovableBehavior|nil
---@param get_next_state_id fun(movable: Movable|nil, base_fun: fun(p1: Movable|nil): integer): integer|nil @Returning nil: treated as behavior->state_id.
function CustomMovableBehavior.set_get_next_state_id(behavior, get_next_state_id) end

---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`.
---@param behavior CustomMovableBehavior|nil
---@param on_enter fun(movable: Movable|nil, base_fun: fun(p1: Movable|nil)) @Returning nil: ignored.
function CustomMovableBehavior.set_on_enter(behavior, on_enter) end

---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`.
---@param behavior CustomMovableBehavior|nil
---@param on_exit fun(movable: Movable|nil, base_fun: fun(p1: Movable|nil)) @Returning nil: ignored.
function CustomMovableBehavior.set_on_exit(behavior, on_exit) end

---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`.
---@param behavior CustomMovableBehavior|nil
---@param update_logic fun(movable: Movable|nil, base_fun: fun(p1: Movable|nil)) @Returning nil: ignored.
function CustomMovableBehavior.set_update_logic(behavior, update_logic) end

---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`.
---@param behavior CustomMovableBehavior|nil
---@param update_world fun(movable: Movable|nil, base_fun: fun(p1: Movable|nil)) @Returning nil: ignored.
function CustomMovableBehavior.set_update_world(behavior, update_world) end

---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
---@class CustomSound
CustomSound = {}

---@return table<integer, string>
function CustomSound:get_parameters() end

---@return PlayingSound
---@overload fun(self: CustomSound, paused: boolean): PlayingSound
---@overload fun(self: CustomSound, paused: boolean, sound_type: SOUND_TYPE): PlayingSound
function CustomSound:play() 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.
---@class CustomTheme : ThemeInfo
---@field level_file string @Level file to load. Probably doesn't do much in custom themes, especially if you're forcing them in PRE_LOAD_LEVEL_FILES.
---@field textures table<DYNAMIC_TEXTURE, TEXTURE> @Add TEXTUREs here to override different dynamic textures.
---@field theme integer @Theme index. Probably shouldn't collide with the vanilla ones. Purpose unknown.
CustomTheme = {}

---Create a new theme with base dwelling and id 100.
---@return CustomTheme
---@overload fun(theme_id_: integer, base_theme_: integer): CustomTheme
---@overload fun(theme_id_: integer, base_theme_: integer, defaults: boolean): CustomTheme
function CustomTheme.new() end

---To disable or enable theme functions using the base_theme.
---@param index THEME_OVERRIDE
---@param enabled_ boolean
---@overload fun(self: CustomTheme, index: THEME_OVERRIDE, theme_: integer)
---@overload fun(self: CustomTheme, index: THEME_OVERRIDE, func_: function)
function CustomTheme:override(index, enabled_) end

---Set a callback to be called after this theme function, to fix some changes it did for example.
---@param index THEME_OVERRIDE
---@param func_ function
function CustomTheme:post(index, func_) end

---Set a callback to be called before this theme function.
---@param index THEME_OVERRIDE
---@param func_ function
function CustomTheme:pre(index, func_) end

---@class CutsceneBehavior
CutsceneBehavior = {}

---@class DMAlienBlast : Entity
---@field owner_uid integer
---@field reticule_external Entity|nil
---@field reticule_internal Entity|nil
---@field sound SoundMeta|nil
---@field timer integer
DMAlienBlast = {}

---@class DMSpawning : Entity
---@field sine_pos number
---@field spawn_x number
---@field spawn_y number
---@field timer integer
DMSpawning = {}

---@class DecoRegeneratingBlock : Entity
DecoRegeneratingBlock = {}

---@class DecoratedDoor : Entity, Floor, Door, ExitDoor
---@field special_bg Entity|nil
DecoratedDoor = {}

---@class DestructibleBG : Entity
DestructibleBG = {}

---@class Door : Entity, Floor
---@field counter integer
---@field fx_button Entity|nil
Door = {}

---Can the door actually be entered by player. Overrides the button prompt too if false.
---@param player Entity|nil
---@return boolean
function Door:can_enter(player) end

---@param callback_id integer
function Door:clear_virtual(callback_id) end

---Returns the entity state / behavior id to set the entity to after the entering animation.
---@param who Entity|nil
---@return integer
function Door:enter(who) end

---Should we display the button prompt when collided by player. Will always return `true` for exits, layers and others that the game never locks, even if you lock it with `unlock` function
---@return boolean
function Door:is_unlocked() end

---Returns the darkest light level used to fade the entity when entering or exiting. 0 = black, 1 = no change
---@return number
function Door:light_level() end

---Can the door actually be entered by player. Overrides the button prompt too if false.
---@param fun fun(self: Entity|nil, player: Entity|nil) @Returning nil: ignored.
---@return integer
function Door:set_post_can_enter(fun) end

---Returns the entity state / behavior id to set the entity to after the entering animation.
---@param fun fun(self: Entity|nil, who: Entity|nil) @Returning nil: ignored.
---@return integer
function Door:set_post_enter(fun) end

---@param fun fun(self: Entity|nil, who: Entity|nil) @Returning nil: ignored.
---@return integer
function Door:set_post_enter_attempt(fun) end

---@param fun fun(self: Entity|nil, who: Entity|nil) @Returning nil: ignored.
---@return integer
function Door:set_post_hide_hud(fun) end

---Should we display the button prompt when collided by player. Will always return `true` for exits, layers and others that the game never locks, even if you lock it with `unlock` function
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Door:set_post_is_unlocked(fun) end

---Returns the darkest light level used to fade the entity when entering or exiting. 0 = black, 1 = no change
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Door:set_post_light_level(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Door:set_post_virtual(index, fun) end

---Can the door actually be entered by player. Overrides the button prompt too if false.
---@param fun fun(self: Entity|nil, player: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Door:set_pre_can_enter(fun) end

---Returns the entity state / behavior id to set the entity to after the entering animation.
---@param fun fun(self: Entity|nil, who: Entity|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Door:set_pre_enter(fun) end

---@param fun fun(self: Entity|nil, who: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Door:set_pre_enter_attempt(fun) end

---@param fun fun(self: Entity|nil, who: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Door:set_pre_hide_hud(fun) end

---Should we display the button prompt when collided by player. Will always return `true` for exits, layers and others that the game never locks, even if you lock it with `unlock` function
---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Door:set_pre_is_unlocked(fun) end

---Returns the darkest light level used to fade the entity when entering or exiting. 0 = black, 1 = no change
---@param fun fun(self: Entity|nil): number|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Door:set_pre_light_level(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Door:set_pre_virtual(index, fun) end

---Lock/Unlock doors
---@param unlock boolean
function Door:unlock(unlock) end

---@class DoorCoords

---@class Drill : Entity, Movable
---@field sound1 SoundMeta|nil
---@field sound2 SoundMeta|nil
---@field top_chain_piece Entity|nil
Drill = {}

---@param play_sound_effect boolean|nil
function Drill:trigger(play_sound_effect) end

---@class DummyPurchasableEntity : Entity, Movable, Purchasable
---@field exploding boolean
---@field explosion_timer integer @Explodes when timer reaches 30
---@field replace_entity Entity|nil
DummyPurchasableEntity = {}

---@param callback_id integer
function DummyPurchasableEntity:clear_virtual(callback_id) end

---Transfers ownership etc. for who to blame, sets the exploding bool
---@param fun fun(self: Entity|nil, who: Entity|nil) @Returning nil: ignored.
---@return integer
function DummyPurchasableEntity:set_post_trigger_explosion(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function DummyPurchasableEntity:set_post_virtual(index, fun) end

---Transfers ownership etc. for who to blame, sets the exploding bool
---@param fun fun(self: Entity|nil, who: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function DummyPurchasableEntity:set_pre_trigger_explosion(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function DummyPurchasableEntity:set_pre_virtual(index, fun) end

---Transfers ownership etc. for who to blame, sets the exploding bool
---@param who Entity|nil
function DummyPurchasableEntity:trigger_explosion(who) end

---@class DustWallApep : Entity
---@field particle ParticleEmitterInfo|nil
DustWallApep = {}

---@class EggSac : Entity, Movable
---@field timer integer
EggSac = {}

---@class EggShipDoor : Entity, Floor, Door
---@field timer integer
EggShipDoor = {}

---@class EggShipDoorS : Entity, Floor, Door, EggShipDoor
---@field entered boolean
EggShipDoorS = {}

---@class EggplantMinister : Entity, Movable, PowerupCapable, Monster
---@field sound SoundMeta|nil
---@field squish_timer integer
---@field walk_pause_timer integer
EggplantMinister = {}

---@class EggplantThrower : Entity
EggplantThrower = {}

---@class EggshipCenterJetFlame : Entity, Movable
---@field emitted_light Illumination|nil
---@field particle ParticleEmitterInfo|nil
---@field smoke_on boolean
---@field sound SoundMeta|nil
EggshipCenterJetFlame = {}

---@class Elevator : Entity, Movable
---@field emitted_light Illumination|nil
---@field moving_up boolean
---@field timer integer @pause timer, counts down 60 to 0
Elevator = {}

---@class EmpressGrave : Entity, Movable
---@field fx_button Entity|nil
---@field ghost Entity|nil
EmpressGrave = {}

---@class Entity
---@field abs_x number @Absolute position in the world, even if overlaid. Might be a frame off since it's updated with `apply_movement` function and so it does not update if game moves the entity in different way after movement is processed. Use `get_absolute_position` for precise. Read only.
---@field abs_y number @Absolute position in the world, even if overlaid. Might be a frame off since it's updated with `apply_movement` function and so it does not update if game moves the entity in different way after movement is processed. Use `get_absolute_position` for precise. Read only.
---@field angle number
---@field animation_frame integer @Number (id) of the sprite in the texture
---@field color Color
---@field draw_depth integer @Depth level that this entity is drawn on. Don't edit this directly, use `set_draw_depth` function
---@field flags ENT_FLAG @see [flags.hpp](https://github.com/spelunky-fyi/overlunky/blob/main/src/game_api/flags.hpp) entity_flags
---@field height number @Height of the sprite
---@field hitbox_enabled boolean
---@field hitboxx number @Half of the width of the hitbox
---@field hitboxy number @Half of the height of the hitbox
---@field layer integer @Use `set_layer` to change
---@field more_flags ENT_MORE_FLAG @see [flags.hpp](https://github.com/spelunky-fyi/overlunky/blob/main/src/game_api/flags.hpp) more_flags
---@field offsetx number @Offset of the hitbox in relation to the entity position
---@field offsety number @Offset of the hitbox in relation to the entity position
---@field overlay any
---@field rendering_info RenderInfo|nil
---@field shape SHAPE
---@field special_offsetx number @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
---@field special_offsety number @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
---@field tile_height number @Size of the sprite in the texture
---@field tile_width number @Size of the sprite in the texture
---@field type EntityDB|nil @Type of the entity, contains special properties etc. If you want to edit them just for this entity look at the EntityDB
---@field uid integer @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)
---@field user_data any @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.
---@field width number @Width of the sprite
---@field x number @Position of the entity in the world, or relative to overlay if attached to something. Use `get_absolute_position` to get real position of anything in the game world.
---@field y number @Position of the entity in the world, or relative to overlay if attached to something. Use `get_absolute_position` to get real position of anything in the game world.
Entity = {}

---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)
---@param activator Entity|nil
function Entity:activate(activator) end

---Applies changes made in `entity.type`
function Entity:apply_db() end

---Adds the entity to its own layer, to add it to entity lookup tables without waiting for a state update
function Entity:apply_layer() end

---@param metadata integer
function Entity:apply_metadata(metadata) end

---@return AcidBubble|nil
function Entity.as_acidbubble() end

---@return Alien|nil
function Entity.as_alien() end

---@return Altar|nil
function Entity.as_altar() end

---@return Ammit|nil
function Entity.as_ammit() end

---@return AnkhPowerup|nil
function Entity.as_ankhpowerup() end

---@return Anubis|nil
function Entity.as_anubis() end

---@return ApepHead|nil
function Entity.as_apephead() end

---@return ApepPart|nil
function Entity.as_apeppart() end

---@return Arrow|nil
function Entity.as_arrow() end

---@return Arrowtrap|nil
function Entity.as_arrowtrap() end

---@return Axolotl|nil
function Entity.as_axolotl() end

---@return AxolotlShot|nil
function Entity.as_axolotlshot() end

---@return Backpack|nil
function Entity.as_backpack() end

---@return Bat|nil
function Entity.as_bat() end

---@return Bee|nil
function Entity.as_bee() end

---@return Beg|nil
function Entity.as_beg() end

---@return BGBackLayerDoor|nil
function Entity.as_bgbacklayerdoor() end

---@return BGEggshipRoom|nil
function Entity.as_bgeggshiproom() end

---@return BGFloatingDebris|nil
function Entity.as_bgfloatingdebris() end

---@return BGMovingStar|nil
function Entity.as_bgmovingstar() end

---@return BGRelativeElement|nil
function Entity.as_bgrelativeelement() end

---@return BGShootingStar|nil
function Entity.as_bgshootingstar() end

---@return BGShopEntrance|nil
function Entity.as_bgshopentrance() end

---@return BGShopKeeperPrime|nil
function Entity.as_bgshopkeeperprime() end

---@return BGSurfaceLayer|nil
function Entity.as_bgsurfacelayer() end

---@return BGSurfaceStar|nil
function Entity.as_bgsurfacestar() end

---@return BGTutorialSign|nil
function Entity.as_bgtutorialsign() end

---@return BigSpearTrap|nil
function Entity.as_bigspeartrap() end

---@return Birdies|nil
function Entity.as_birdies() end

---@return Bodyguard|nil
function Entity.as_bodyguard() end

---@return Bomb|nil
function Entity.as_bomb() end

---@return BoneBlock|nil
function Entity.as_boneblock() end

---@return Boombox|nil
function Entity.as_boombox() end

---@return Boomerang|nil
function Entity.as_boomerang() end

---@return Boulder|nil
function Entity.as_boulder() end

---@return BoulderSpawner|nil
function Entity.as_boulderspawner() end

---@return Bow|nil
function Entity.as_bow() end

---@return Bullet|nil
function Entity.as_bullet() end

---@return BurningRopeEffect|nil
function Entity.as_burningropeeffect() end

---@return Button|nil
function Entity.as_button() end

---@return CameraFlash|nil
function Entity.as_cameraflash() end

---@return Cape|nil
function Entity.as_cape() end

---@return CatMummy|nil
function Entity.as_catmummy() end

---@return Caveman|nil
function Entity.as_caveman() end

---@return CavemanShopkeeper|nil
function Entity.as_cavemanshopkeeper() end

---@return Chain|nil
function Entity.as_chain() end

---@return ChainedPushBlock|nil
function Entity.as_chainedpushblock() end

---@return Chest|nil
function Entity.as_chest() end

---@return CinematicAnchor|nil
function Entity.as_cinematicanchor() end

---@return CityOfGoldDoor|nil
function Entity.as_cityofgolddoor() end

---@return ClamBase|nil
function Entity.as_clambase() end

---@return Claw|nil
function Entity.as_claw() end

---@return ClimbableRope|nil
function Entity.as_climbablerope() end

---@return CloneGunShot|nil
function Entity.as_clonegunshot() end

---@return Cobra|nil
function Entity.as_cobra() end

---@return Coffin|nil
function Entity.as_coffin() end

---@return Coin|nil
function Entity.as_coin() end

---@return Container|nil
function Entity.as_container() end

---@return ConveyorBelt|nil
function Entity.as_conveyorbelt() end

---@return CookFire|nil
function Entity.as_cookfire() end

---@return Crabman|nil
function Entity.as_crabman() end

---@return Critter|nil
function Entity.as_critter() end

---@return CritterBeetle|nil
function Entity.as_critterbeetle() end

---@return CritterButterfly|nil
function Entity.as_critterbutterfly() end

---@return CritterCrab|nil
function Entity.as_crittercrab() end

---@return CritterDrone|nil
function Entity.as_critterdrone() end

---@return CritterFirefly|nil
function Entity.as_critterfirefly() end

---@return CritterFish|nil
function Entity.as_critterfish() end

---@return CritterLocust|nil
function Entity.as_critterlocust() end

---@return CritterPenguin|nil
function Entity.as_critterpenguin() end

---@return CritterSlime|nil
function Entity.as_critterslime() end

---@return CritterSnail|nil
function Entity.as_crittersnail() end

---@return Crocman|nil
function Entity.as_crocman() end

---@return CrossBeam|nil
function Entity.as_crossbeam() end

---@return CrushElevator|nil
function Entity.as_crushelevator() end

---@return Crushtrap|nil
function Entity.as_crushtrap() end

---@return CursedEffect|nil
function Entity.as_cursedeffect() end

---@return CursedPot|nil
function Entity.as_cursedpot() end

---@return DecoratedDoor|nil
function Entity.as_decorateddoor() end

---@return DecoRegeneratingBlock|nil
function Entity.as_decoregeneratingblock() end

---@return DestructibleBG|nil
function Entity.as_destructiblebg() end

---@return DMAlienBlast|nil
function Entity.as_dmalienblast() end

---@return DMSpawning|nil
function Entity.as_dmspawning() end

---@return Door|nil
function Entity.as_door() end

---@return Drill|nil
function Entity.as_drill() end

---@return DummyPurchasableEntity|nil
function Entity.as_dummypurchasableentity() end

---@return DustWallApep|nil
function Entity.as_dustwallapep() end

---@return EggplantMinister|nil
function Entity.as_eggplantminister() end

---@return EggplantThrower|nil
function Entity.as_eggplantthrower() end

---@return EggSac|nil
function Entity.as_eggsac() end

---@return EggshipCenterJetFlame|nil
function Entity.as_eggshipcenterjetflame() end

---@return EggShipDoor|nil
function Entity.as_eggshipdoor() end

---@return EggShipDoorS|nil
function Entity.as_eggshipdoors() end

---@return Elevator|nil
function Entity.as_elevator() end

---@return EmpressGrave|nil
function Entity.as_empressgrave() end

---@return Entity|nil
function Entity.as_entity() end

---@return Excalibur|nil
function Entity.as_excalibur() end

---@return ExitDoor|nil
function Entity.as_exitdoor() end

---@return Explosion|nil
function Entity.as_explosion() end

---@return FallingPlatform|nil
function Entity.as_fallingplatform() end

---@return Fireball|nil
function Entity.as_fireball() end

---@return Firebug|nil
function Entity.as_firebug() end

---@return FirebugUnchained|nil
function Entity.as_firebugunchained() end

---@return FireFrog|nil
function Entity.as_firefrog() end

---@return Fish|nil
function Entity.as_fish() end

---@return Flame|nil
function Entity.as_flame() end

---@return FlameSize|nil
function Entity.as_flamesize() end

---@return Floor|nil
function Entity.as_floor() end

---@return Fly|nil
function Entity.as_fly() end

---@return FlyHead|nil
function Entity.as_flyhead() end

---@return ForceField|nil
function Entity.as_forcefield() end

---@return ForestSister|nil
function Entity.as_forestsister() end

---@return Frog|nil
function Entity.as_frog() end

---@return FrostBreathEffect|nil
function Entity.as_frostbreatheffect() end

---@return FrozenLiquid|nil
function Entity.as_frozenliquid() end

---@return FxAlienBlast|nil
function Entity.as_fxalienblast() end

---@return FxAnkhBrokenPiece|nil
function Entity.as_fxankhbrokenpiece() end

---@return FxAnkhRotatingSpark|nil
function Entity.as_fxankhrotatingspark() end

---@return FxCompass|nil
function Entity.as_fxcompass() end

---@return FxEmpress|nil
function Entity.as_fxempress() end

---@return FxFireflyLight|nil
function Entity.as_fxfireflylight() end

---@return FxHundunNeckPiece|nil
function Entity.as_fxhundunneckpiece() end

---@return FxJellyfishStar|nil
function Entity.as_fxjellyfishstar() end

---@return FxJetpackFlame|nil
function Entity.as_fxjetpackflame() end

---@return FxKinguSliding|nil
function Entity.as_fxkingusliding() end

---@return FxLamassuAttack|nil
function Entity.as_fxlamassuattack() end

---@return FxMainExitDoor|nil
function Entity.as_fxmainexitdoor() end

---@return FxNecromancerANKH|nil
function Entity.as_fxnecromancerankh() end

---@return FxOuroboroDragonPart|nil
function Entity.as_fxouroborodragonpart() end

---@return FxOuroboroOccluder|nil
function Entity.as_fxouroborooccluder() end

---@return FxPickupEffect|nil
function Entity.as_fxpickupeffect() end

---@return FxPlayerIndicator|nil
function Entity.as_fxplayerindicator() end

---@return FxQuickSand|nil
function Entity.as_fxquicksand() end

---@return FxSaleContainer|nil
function Entity.as_fxsalecontainer() end

---@return FxShotgunBlast|nil
function Entity.as_fxshotgunblast() end

---@return FxSorceressAttack|nil
function Entity.as_fxsorceressattack() end

---@return FxSparkSmall|nil
function Entity.as_fxsparksmall() end

---@return FxSpringtrapRing|nil
function Entity.as_fxspringtrapring() end

---@return FxTiamatHead|nil
function Entity.as_fxtiamathead() end

---@return FxTiamatTail|nil
function Entity.as_fxtiamattail() end

---@return FxTiamatTorso|nil
function Entity.as_fxtiamattorso() end

---@return FxTornJournalPage|nil
function Entity.as_fxtornjournalpage() end

---@return FxUnderwaterBubble|nil
function Entity.as_fxunderwaterbubble() end

---@return FxVatBubble|nil
function Entity.as_fxvatbubble() end

---@return FxWaterDrop|nil
function Entity.as_fxwaterdrop() end

---@return FxWebbedEffect|nil
function Entity.as_fxwebbedeffect() end

---@return FxWitchdoctorHint|nil
function Entity.as_fxwitchdoctorhint() end

---@return Generator|nil
function Entity.as_generator() end

---@return Ghist|nil
function Entity.as_ghist() end

---@return Ghost|nil
function Entity.as_ghost() end

---@return GhostBreath|nil
function Entity.as_ghostbreath() end

---@return GiantClamTop|nil
function Entity.as_giantclamtop() end

---@return GiantFish|nil
function Entity.as_giantfish() end

---@return GiantFly|nil
function Entity.as_giantfly() end

---@return GiantFrog|nil
function Entity.as_giantfrog() end

---@return Goldbar|nil
function Entity.as_goldbar() end

---@return GoldMonkey|nil
function Entity.as_goldmonkey() end

---@return Grub|nil
function Entity.as_grub() end

---@return Gun|nil
function Entity.as_gun() end

---@return HangAnchor|nil
function Entity.as_hanganchor() end

---@return HangSpider|nil
function Entity.as_hangspider() end

---@return HangStrand|nil
function Entity.as_hangstrand() end

---@return Hermitcrab|nil
function Entity.as_hermitcrab() end

---@return Honey|nil
function Entity.as_honey() end

---@return HorizontalForceField|nil
function Entity.as_horizontalforcefield() end

---@return HornedLizard|nil
function Entity.as_hornedlizard() end

---@return Hoverpack|nil
function Entity.as_hoverpack() end

---@return Hundun|nil
function Entity.as_hundun() end

---@return HundunChest|nil
function Entity.as_hundunchest() end

---@return HundunHead|nil
function Entity.as_hundunhead() end

---@return IceSlidingSound|nil
function Entity.as_iceslidingsound() end

---@return Idol|nil
function Entity.as_idol() end

---@return Imp|nil
function Entity.as_imp() end

---@return Jetpack|nil
function Entity.as_jetpack() end

---@return Jiangshi|nil
function Entity.as_jiangshi() end

---@return JumpDog|nil
function Entity.as_jumpdog() end

---@return JungleSpearCosmetic|nil
function Entity.as_junglespearcosmetic() end

---@return JungleSpearTrap|nil
function Entity.as_junglespeartrap() end

---@return JungleTrapTrigger|nil
function Entity.as_jungletraptrigger() end

---@return KapalaPowerup|nil
function Entity.as_kapalapowerup() end

---@return Kingu|nil
function Entity.as_kingu() end

---@return Lahamu|nil
function Entity.as_lahamu() end

---@return Lamassu|nil
function Entity.as_lamassu() end

---@return LampFlame|nil
function Entity.as_lampflame() end

---@return Landmine|nil
function Entity.as_landmine() end

---@return LaserBeam|nil
function Entity.as_laserbeam() end

---@return LaserTrap|nil
function Entity.as_lasertrap() end

---@return Lava|nil
function Entity.as_lava() end

---@return Lavamander|nil
function Entity.as_lavamander() end

---@return Leaf|nil
function Entity.as_leaf() end

---@return Leprechaun|nil
function Entity.as_leprechaun() end

---@return LightArrow|nil
function Entity.as_lightarrow() end

---@return LightArrowPlatform|nil
function Entity.as_lightarrowplatform() end

---@return LightEmitter|nil
function Entity.as_lightemitter() end

---@return LightShot|nil
function Entity.as_lightshot() end

---@return LimbAnchor|nil
function Entity.as_limbanchor() end

---@return Liquid|nil
function Entity.as_liquid() end

---@return LiquidSurface|nil
function Entity.as_liquidsurface() end

---@return LockedDoor|nil
function Entity.as_lockeddoor() end

---@return LogicalAnchovyFlock|nil
function Entity.as_logicalanchovyflock() end

---@return LogicalConveyorbeltSound|nil
function Entity.as_logicalconveyorbeltsound() end

---@return LogicalDoor|nil
function Entity.as_logicaldoor() end

---@return LogicalDrain|nil
function Entity.as_logicaldrain() end

---@return LogicalLiquidStreamSound|nil
function Entity.as_logicalliquidstreamsound() end

---@return LogicalMiniGame|nil
function Entity.as_logicalminigame() end

---@return LogicalRegeneratingBlock|nil
function Entity.as_logicalregeneratingblock() end

---@return LogicalSound|nil
function Entity.as_logicalsound() end

---@return LogicalStaticSound|nil
function Entity.as_logicalstaticsound() end

---@return LogicalTrapTrigger|nil
function Entity.as_logicaltraptrigger() end

---@return MagmaMan|nil
function Entity.as_magmaman() end

---@return MainExit|nil
function Entity.as_mainexit() end

---@return Mantrap|nil
function Entity.as_mantrap() end

---@return Mattock|nil
function Entity.as_mattock() end

---@return Mech|nil
function Entity.as_mech() end

---@return MegaJellyfish|nil
function Entity.as_megajellyfish() end

---@return MegaJellyfishEye|nil
function Entity.as_megajellyfisheye() end

---@return MiniGameAsteroid|nil
function Entity.as_minigameasteroid() end

---@return MiniGameShip|nil
function Entity.as_minigameship() end

---@return MiniGameShipOffset|nil
function Entity.as_minigameshipoffset() end

---@return Mole|nil
function Entity.as_mole() end

---@return Monkey|nil
function Entity.as_monkey() end

---@return Monster|nil
function Entity.as_monster() end

---@return Mosquito|nil
function Entity.as_mosquito() end

---@return MotherStatue|nil
function Entity.as_motherstatue() end

---@return Mount|nil
function Entity.as_mount() end

---@return Movable|nil
function Entity.as_movable() end

---@return MovingIcon|nil
function Entity.as_movingicon() end

---@return Mummy|nil
function Entity.as_mummy() end

---@return MummyFliesSound|nil
function Entity.as_mummyfliessound() end

---@return Necromancer|nil
function Entity.as_necromancer() end

---@return NPC|nil
function Entity.as_npc() end

---@return Octopus|nil
function Entity.as_octopus() end

---@return Olmec|nil
function Entity.as_olmec() end

---@return OlmecCannon|nil
function Entity.as_olmeccannon() end

---@return OlmecFloater|nil
function Entity.as_olmecfloater() end

---@return OlmecShip|nil
function Entity.as_olmecship() end

---@return Olmite|nil
function Entity.as_olmite() end

---@return OnFireEffect|nil
function Entity.as_onfireeffect() end

---@return Orb|nil
function Entity.as_orb() end

---@return OsirisHand|nil
function Entity.as_osirishand() end

---@return OsirisHead|nil
function Entity.as_osirishead() end

---@return OuroboroCameraAnchor|nil
function Entity.as_ouroborocameraanchor() end

---@return OuroboroCameraZoomin|nil
function Entity.as_ouroborocamerazoomin() end

---@return PalaceSign|nil
function Entity.as_palacesign() end

---@return ParachutePowerup|nil
function Entity.as_parachutepowerup() end

---@return Pet|nil
function Entity.as_pet() end

---@return Pipe|nil
function Entity.as_pipe() end

---@return PipeTravelerSound|nil
function Entity.as_pipetravelersound() end

---@return Player|nil
function Entity.as_player() end

---@return PlayerBag|nil
function Entity.as_playerbag() end

---@return PlayerGhost|nil
function Entity.as_playerghost() end

---@return PoisonedEffect|nil
function Entity.as_poisonedeffect() end

---@return PoleDeco|nil
function Entity.as_poledeco() end

---@return Portal|nil
function Entity.as_portal() end

---@return Pot|nil
function Entity.as_pot() end

---@return Powerup|nil
function Entity.as_powerup() end

---@return PowerupCapable|nil
function Entity.as_powerupcapable() end

---@return Present|nil
function Entity.as_present() end

---@return PrizeDispenser|nil
function Entity.as_prizedispenser() end

---@return Projectile|nil
function Entity.as_projectile() end

---@return ProtoShopkeeper|nil
function Entity.as_protoshopkeeper() end

---@return PunishBall|nil
function Entity.as_punishball() end

---@return Purchasable|nil
function Entity.as_purchasable() end

---@return PushBlock|nil
function Entity.as_pushblock() end

---@return Qilin|nil
function Entity.as_qilin() end

---@return QuickSand|nil
function Entity.as_quicksand() end

---@return QuickSandSound|nil
function Entity.as_quicksandsound() end

---@return Quillback|nil
function Entity.as_quillback() end

---@return RegenBlock|nil
function Entity.as_regenblock() end

---@return Robot|nil
function Entity.as_robot() end

---@return Rockdog|nil
function Entity.as_rockdog() end

---@return RollingItem|nil
function Entity.as_rollingitem() end

---@return RoomLight|nil
function Entity.as_roomlight() end

---@return RoomOwner|nil
function Entity.as_roomowner() end

---@return Rubble|nil
function Entity.as_rubble() end

---@return Scarab|nil
function Entity.as_scarab() end

---@return Scepter|nil
function Entity.as_scepter() end

---@return ScepterShot|nil
function Entity.as_sceptershot() end

---@return Scorpion|nil
function Entity.as_scorpion() end

---@return Shield|nil
function Entity.as_shield() end

---@return ShootingStarSpawner|nil
function Entity.as_shootingstarspawner() end

---@return Shopkeeper|nil
function Entity.as_shopkeeper() end

---@return Skeleton|nil
function Entity.as_skeleton() end

---@return SkullDropTrap|nil
function Entity.as_skulldroptrap() end

---@return SleepBubble|nil
function Entity.as_sleepbubble() end

---@return SlidingWallCeiling|nil
function Entity.as_slidingwallceiling() end

---@return SnapTrap|nil
function Entity.as_snaptrap() end

---@return Sorceress|nil
function Entity.as_sorceress() end

---@return SoundShot|nil
function Entity.as_soundshot() end

---@return Spark|nil
function Entity.as_spark() end

---@return SparkTrap|nil
function Entity.as_sparktrap() end

---@return Spear|nil
function Entity.as_spear() end

---@return SpecialShot|nil
function Entity.as_specialshot() end

---@return Spider|nil
function Entity.as_spider() end

---@return SpikeballTrap|nil
function Entity.as_spikeballtrap() end

---@return SplashBubbleGenerator|nil
function Entity.as_splashbubblegenerator() end

---@return StickyTrap|nil
function Entity.as_stickytrap() end

---@return StretchChain|nil
function Entity.as_stretchchain() end

---@return Switch|nil
function Entity.as_switch() end

---@return Tadpole|nil
function Entity.as_tadpole() end

---@return Teleporter|nil
function Entity.as_teleporter() end

---@return TeleporterBackpack|nil
function Entity.as_teleporterbackpack() end

---@return TeleportingBorder|nil
function Entity.as_teleportingborder() end

---@return Telescope|nil
function Entity.as_telescope() end

---@return Tentacle|nil
function Entity.as_tentacle() end

---@return TentacleBottom|nil
function Entity.as_tentaclebottom() end

---@return Terra|nil
function Entity.as_terra() end

---@return ThinIce|nil
function Entity.as_thinice() end

---@return Tiamat|nil
function Entity.as_tiamat() end

---@return TiamatShot|nil
function Entity.as_tiamatshot() end

---@return TimedForceField|nil
function Entity.as_timedforcefield() end

---@return TimedPowderkeg|nil
function Entity.as_timedpowderkeg() end

---@return TimedShot|nil
function Entity.as_timedshot() end

---@return Torch|nil
function Entity.as_torch() end

---@return TorchFlame|nil
function Entity.as_torchflame() end

---@return TotemTrap|nil
function Entity.as_totemtrap() end

---@return TransferFloor|nil
function Entity.as_transferfloor() end

---@return TrapPart|nil
function Entity.as_trappart() end

---@return Treasure|nil
function Entity.as_treasure() end

---@return TreasureHook|nil
function Entity.as_treasurehook() end

---@return TrueCrownPowerup|nil
function Entity.as_truecrownpowerup() end

---@return Tun|nil
function Entity.as_tun() end

---@return TV|nil
function Entity.as_tv() end

---@return UdjatSocket|nil
function Entity.as_udjatsocket() end

---@return UFO|nil
function Entity.as_ufo() end

---@return UnchainedSpikeBall|nil
function Entity.as_unchainedspikeball() end

---@return Ushabti|nil
function Entity.as_ushabti() end

---@return Vampire|nil
function Entity.as_vampire() end

---@return VanHorsing|nil
function Entity.as_vanhorsing() end

---@return Vlad|nil
function Entity.as_vlad() end

---@return VladsCape|nil
function Entity.as_vladscape() end

---@return Waddler|nil
function Entity.as_waddler() end

---@return WalkingMonster|nil
function Entity.as_walkingmonster() end

---@return WallTorch|nil
function Entity.as_walltorch() end

---@return Web|nil
function Entity.as_web() end

---@return WebGun|nil
function Entity.as_webgun() end

---@return WebShot|nil
function Entity.as_webshot() end

---@return WetEffect|nil
function Entity.as_weteffect() end

---@return Whip|nil
function Entity.as_whip() end

---@return WitchDoctor|nil
function Entity.as_witchdoctor() end

---@return WitchDoctorSkull|nil
function Entity.as_witchdoctorskull() end

---@return WoodenlogTrap|nil
function Entity.as_woodenlogtrap() end

---@return Yama|nil
function Entity.as_yama() end

---@return Yang|nil
function Entity.as_yang() end

---@return YellowCape|nil
function Entity.as_yellowcape() end

---@return YetiKing|nil
function Entity.as_yetiking() end

---@return YetiQueen|nil
function Entity.as_yetiqueen() end

---Attach to other entity (at the current relative position to it)
---@param new_overlay Entity|nil
function Entity:attach(new_overlay) end

---@return boolean
function Entity:can_be_pushed() end

---@param callback_id integer
function Entity:clear_virtual(callback_id) end

---Completely removes the entity from existence
function Entity:destroy() end

---Short for using RECURSIVE_MODE.NONE
---@overload fun(self: Entity, mask: MASK|nil, ent_types: ENT_TYPE[], rec_mode: RECURSIVE_MODE)
function Entity:destroy_recursive() end

---Detach from overlay
---@param check_autokill boolean|nil
function Entity:detach(check_autokill) end

---@param left boolean
function Entity:flip(left) end

---Friction of this entity, affects it's contact with other entities (how fast it slows down on the floor, how fast it can move but also the other way around for floors/activefloors: how other entities can move on it)
---@return number
function Entity:friction() end

---Get the absolute position of an entity in the game world
---@return Vec2
function Entity:get_absolute_position() end

---Get's the velocity relative to the game world, only for movable or liquid entities
---@return Vec2
function Entity:get_absolute_velocity() end

---@return Entity|nil
function Entity:get_held_entity() end

---`use_render_pos` default is `false`
---@param use_render_pos boolean|nil
---@return AABB
function Entity:get_hitbox(use_render_pos) end

---@return integer[]
function Entity:get_items() end

---e.g. for turkey: stores health, poison/curse state, for mattock: remaining swings (returned value is transferred)
---@return integer
function Entity:get_metadata() end

---@return TEXTURE
function Entity:get_texture() end

---@return boolean
function Entity:is_cursed() end

---Returns true if entity is in water/lava
---@return boolean
function Entity:is_in_liquid() end

---@return boolean
function Entity:is_movable() end

---Kills the entity, you can set responsible to `nil` to ignore it
---@param destroy_corpse boolean
---@param responsible Entity|nil
function Entity:kill(destroy_corpse, responsible) end

---Short for using RECURSIVE_MODE.NONE
---@param destroy_corpse boolean
---@param responsible Entity|nil
---@overload fun(self: Entity, destroy_corpse: boolean, responsible: Entity|nil, mask: MASK|nil, ent_types: ENT_TYPE[], rec_mode: RECURSIVE_MODE)
function Entity:kill_recursive(destroy_corpse, responsible) end

---It's not called when item is bought. It does not remove the item from StateMemory`.room_owners.owned_items`
---Parameter `clear_parent` used only for CHAR_* entities, sets the `linked_companion_parent` to -1.
---@param clear_parent boolean
---@overload fun(self: Entity)
function Entity:liberate_from_shop(clear_parent) end

---@param other Entity|nil
---@return boolean
---@overload fun(self: Entity, hitbox: AABB): boolean
---@overload fun(self: Entity, rect_left: number, rect_bottom: number, rect_right: number, rect_top: number): boolean
function Entity:overlaps_with(other) end

---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.
---@param delta_x integer
---@param delta_y integer
function Entity:perform_teleport(delta_x, delta_y) end

---Moves the entity to the limbo-layer where it can later be retrieved from again via `respawn`
function Entity:remove() end

---Can be called multiple times for the same entity (for example when play throws/drops entity from it's hands)
---@param entity Entity|nil
---@param autokill_check boolean
function Entity:remove_item(entity, autokill_check) end

function Entity:reset_draw_depth() end

---Moves the entity from the limbo-layer (where it was previously put by `remove`) to `layer`
---@param layer_to LAYER
function Entity:respawn(layer_to) end

---optional unknown - game usually sets it to 0, doesn't appear to have any special effect (needs more reverse engineering)
---@param draw_depth integer
---@param unknown integer|nil
function Entity:set_draw_depth(draw_depth, unknown) end

---@param enabled boolean
function Entity:set_enable_turning(enabled) end

---@param value boolean
function Entity:set_invisible(value) end

---Moves the entity to specified layer with all it's items, nothing else happens, so this does not emulate a door transition
---@param layer LAYER
function Entity:set_layer(layer) end

---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)
---@param fun fun(self: Entity|nil, activator: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_activate(fun) end

---@param fun fun(self: Entity|nil, metadata: integer) @Returning nil: ignored.
---@return integer
function Entity:set_post_apply_metadata(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_can_be_pushed(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_create_rendering_info(fun) end

---Completely removes the entity from existence
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_destroy(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_dtor(fun) end

---@param fun fun(self: Entity|nil, left: boolean) @Returning nil: ignored.
---@return integer
function Entity:set_post_flip(fun) end

---Friction of this entity, affects it's contact with other entities (how fast it slows down on the floor, how fast it can move but also the other way around for floors/activefloors: how other entities can move on it)
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_friction(fun) end

---@param fun fun(self: Entity|nil, victim: Entity|nil, damage: integer, killing: boolean) @Returning nil: ignored.
---@return integer
function Entity:set_post_generate_damage_particles(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_get_held_entity(fun) end

---e.g. for turkey: stores health, poison/curse state, for mattock: remaining swings (returned value is transferred)
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_get_metadata(fun) end

---Applies changes made in `entity.type`
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_init(fun) end

---Returns true if entity is in water/lava
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_is_in_liquid(fun) end

---Kills the entity, you can set responsible to `nil` to ignore it
---@param fun fun(self: Entity|nil, destroy_corpse: boolean, responsible: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_kill(fun) end

---@param fun fun(self: Entity|nil, who: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_ledge_grab(fun) end

---It's not called when item is bought. It does not remove the item from StateMemory`.room_owners.owned_items`
---Parameter `clear_parent` used only for CHAR_* entities, sets the `linked_companion_parent` to -1.
---@param fun fun(self: Entity|nil, clear_parent: boolean) @Returning nil: ignored.
---@return integer
function Entity:set_post_liberate_from_shop(fun) end

---Collisions with stuff that blocks you, like walls, floors, etc. Triggers for entities in it's EntityDB.collision_mask
---@param fun fun(self: Entity|nil, other_entity: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_on_collision1(fun) end

---More like on_overlap, triggers when entities touch/overlap each other. Triggers for entities in it's EntityDB.collision2_mask
---@param fun fun(self: Entity|nil, other_entity: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_on_collision2(fun) end

---Can be called multiple times for the same entity (for example when play throws/drops entity from it's hands)
---@param fun fun(self: Entity|nil, entity: Entity|nil, autokill_check: boolean) @Returning nil: ignored.
---@return integer
function Entity:set_post_remove_item(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_reset_draw_depth(fun) end

---@param fun fun(self: Entity|nil, p2: SoundMeta|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_set_as_sound_source(fun) end

---@param fun fun(self: Entity|nil, draw_depth: integer, b3f: integer) @Returning nil: ignored.
---@return integer
function Entity:set_post_set_draw_depth(fun) end

---@param fun fun(self: Entity|nil, value: boolean) @Returning nil: ignored.
---@return integer
function Entity:set_post_set_invisible(fun) end

---@param fun fun(self: Entity|nil, entity: Entity|nil, p3: Vec2|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_stood_on(fun) end

---Triggers weapons and other held items like teleporter, mattock etc. You can check the [virtual-availability.md](https://github.com/spelunky-fyi/overlunky/blob/main/docs/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)
---@param fun fun(self: Entity|nil, user: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_trigger_action(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_update_state_machine(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Entity:set_post_virtual(index, fun) end

---@param fun fun(self: Entity|nil, walker: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_walked_off(fun) end

---@param fun fun(self: Entity|nil, walker: Entity|nil) @Returning nil: ignored.
---@return integer
function Entity:set_post_walked_on(fun) end

---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)
---@param fun fun(self: Entity|nil, activator: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_activate(fun) end

---@param fun fun(self: Entity|nil, metadata: integer): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_apply_metadata(fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Entity:set_pre_can_be_pushed(fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_create_rendering_info(fun) end

---Completely removes the entity from existence
---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_destroy(fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_dtor(fun) end

---@param fun fun(self: Entity|nil, left: boolean): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_flip(fun) end

---Friction of this entity, affects it's contact with other entities (how fast it slows down on the floor, how fast it can move but also the other way around for floors/activefloors: how other entities can move on it)
---@param fun fun(self: Entity|nil): number|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Entity:set_pre_friction(fun) end

---@param fun fun(self: Entity|nil, victim: Entity|nil, damage: integer, killing: boolean): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_generate_damage_particles(fun) end

---@param fun fun(self: Entity|nil): Entity|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Entity:set_pre_get_held_entity(fun) end

---e.g. for turkey: stores health, poison/curse state, for mattock: remaining swings (returned value is transferred)
---@param fun fun(self: Entity|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Entity:set_pre_get_metadata(fun) end

---Applies changes made in `entity.type`
---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_init(fun) end

---Returns true if entity is in water/lava
---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Entity:set_pre_is_in_liquid(fun) end

---Kills the entity, you can set responsible to `nil` to ignore it
---@param fun fun(self: Entity|nil, destroy_corpse: boolean, responsible: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_kill(fun) end

---@param fun fun(self: Entity|nil, who: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_ledge_grab(fun) end

---It's not called when item is bought. It does not remove the item from StateMemory`.room_owners.owned_items`
---Parameter `clear_parent` used only for CHAR_* entities, sets the `linked_companion_parent` to -1.
---@param fun fun(self: Entity|nil, clear_parent: boolean): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_liberate_from_shop(fun) end

---Collisions with stuff that blocks you, like walls, floors, etc. Triggers for entities in it's EntityDB.collision_mask
---@param fun fun(self: Entity|nil, other_entity: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_on_collision1(fun) end

---More like on_overlap, triggers when entities touch/overlap each other. Triggers for entities in it's EntityDB.collision2_mask
---@param fun fun(self: Entity|nil, other_entity: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_on_collision2(fun) end

---Can be called multiple times for the same entity (for example when play throws/drops entity from it's hands)
---@param fun fun(self: Entity|nil, entity: Entity|nil, autokill_check: boolean): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_remove_item(fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_reset_draw_depth(fun) end

---@param fun fun(self: Entity|nil, p2: SoundMeta|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_set_as_sound_source(fun) end

---@param fun fun(self: Entity|nil, draw_depth: integer, b3f: integer): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_set_draw_depth(fun) end

---@param fun fun(self: Entity|nil, value: boolean): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_set_invisible(fun) end

---@param fun fun(self: Entity|nil, entity: Entity|nil, p3: Vec2|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_stood_on(fun) end

---Triggers weapons and other held items like teleporter, mattock etc. You can check the [virtual-availability.md](https://github.com/spelunky-fyi/overlunky/blob/main/docs/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)
---@param fun fun(self: Entity|nil, user: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Entity:set_pre_trigger_action(fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_update_state_machine(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Entity:set_pre_virtual(index, fun) end

---@param fun fun(self: Entity|nil, walker: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_walked_off(fun) end

---@param fun fun(self: Entity|nil, walker: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Entity:set_pre_walked_on(fun) end

---Changes the entity texture, check the [textures.txt](game_data/textures.txt) for available vanilla textures or use [define_texture](https://spelunky-fyi.github.io/overlunky/#define_texture) to make custom one
---@param texture_id TEXTURE
---@return boolean
function Entity:set_texture(texture_id) end

---Returns the top entity in a chain (overlay)
---@return any
function Entity:topmost() end

---@return any
function Entity:topmost_mount() end

---Triggers weapons and other held items like teleporter, mattock etc. You can check the [virtual-availability.md](https://github.com/spelunky-fyi/overlunky/blob/main/docs/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)
---@param user Entity|nil
---@return boolean
function Entity:trigger_action(user) end

function Entity:update() end

---Used in Entity and [get_type](https://spelunky-fyi.github.io/overlunky/#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](https://dregu.github.io/Spelunky2ls/animation.html) can be helpful when messing with the animations. The default values are also listed in [entities.json](https://github.com/spelunky-fyi/overlunky/blob/main/docs/game_data/entities.json).
---@class EntityDB
---@field acceleration number
---@field animations table<integer, Animation>
---@field blood_content integer
---@field collision2_mask integer @MASK, will only call collision2 when colliding with entities that match this mask.
---@field collision_mask integer @MASK used for collision with floors, walls etc.
---@field damage integer
---@field default_color Color
---@field default_flags integer
---@field default_hitbox_enabled boolean
---@field default_more_flags integer
---@field default_shape SHAPE
---@field default_special_offsetx number
---@field default_special_offsety number
---@field description STRINGID
---@field draw_depth integer
---@field elasticity number
---@field friction number
---@field glow_alpha number
---@field glow_blue number
---@field glow_green number
---@field glow_red number
---@field height number
---@field hitboxx number @Half of the width of the hitbox
---@field hitboxy number @Half of the height of the hitbox
---@field id ENT_TYPE
---@field jump number
---@field leaves_corpse_behind boolean
---@field life integer
---@field max_speed number
---@field offsetx number @Offset of the hitbox in relation to the entity position
---@field offsety number @Offset of the hitbox in relation to the entity position
---@field properties_flags integer
---@field sacrifice_value integer @Favor for sacrificing alive. Halved when dead (health == 0).
---@field search_flags MASK @MASK
---@field sound_killed_by_other SOUNDID
---@field sound_killed_by_player SOUNDID
---@field sprint_factor number
---@field texture TEXTURE
---@field tilex integer
---@field tiley integer
---@field weight number
---@field width number
EntityDB = {}

---@param p1 EntityDB
---@return EntityDB
---@overload fun(p1: integer): EntityDB
function EntityDB.new(p1) end

---@class Excalibur : Entity, Movable
---@field in_stone boolean
Excalibur = {}

---@class ExitDoor : Entity, Floor, Door
---@field entered boolean @if true entering it does not load the transition
---@field level integer
---@field special_door boolean @use provided world/level/theme
---@field theme integer
---@field timer integer
---@field world integer
ExitDoor = {}

---Get target world, level, theme of this door. If the `special_door` is false, it returns the StateMemory world_next, level_next, theme_next
---@return integer
---@return integer
---@return integer
function ExitDoor:get_target() end

---@param ww integer
---@param l integer
---@param t integer
function ExitDoor:set_target(ww, l, t) end

---@class Explosion : Entity, Movable
---@field emitted_light Illumination|nil
Explosion = {}

---An `FMODguidMap` can be used to resolve FMOD GUIDs for events and snapshots from paths using the GUIDs.txt exported
---from an FMOD Studio Project. By default FMOD studio uses a strings bank to do this, however the games master bank and
---strings bank cannot be rebuilt to include the names and paths of new events or snapshots. `FMODguidMap` is a
---workaround for this, and allows you to get a `CustomEventDescription` from a path with `FMODguidMap:get_event()`.
---`FMODguidMap:get_event()` expects the path to be formatted similarly to event:/UI/Cancel or snapshot:/IngamePause.
---@class FMODguidMap
FMODguidMap = {}

---@param path string
---@return CustomEventDescription|nil
function FMODguidMap:get_event(path) end

---@class FallingPlatform : Entity, Movable
---@field shaking_factor number
---@field timer integer
---@field y_pos number
FallingPlatform = {}

---@class FireFrog : Entity, Movable, PowerupCapable, Monster, Frog
---@field sound SoundMeta|nil
FireFrog = {}

---@class Fireball : Entity, Movable, Projectile, LightShot, SoundShot
---@field particle ParticleEmitterInfo|nil
Fireball = {}

---@class Firebug : Entity, Movable, PowerupCapable, Monster
---@field detached_from_chain boolean
---@field fire_timer integer
---@field going_up boolean
---@field sound SoundMeta|nil
Firebug = {}

---@class FirebugUnchained : Entity, Movable, PowerupCapable, Monster
---@field ai_timer integer
---@field max_flight_height number
---@field sound SoundMeta|nil
---@field walking_timer integer
FirebugUnchained = {}

---@class Fish : Entity, Movable, PowerupCapable, Monster
---@field change_direction_timer integer
Fish = {}

---@class Flame : Entity, Movable
---@field emitted_light Illumination|nil
---@field sound SoundMeta|nil
Flame = {}

---@class FlameSize : Entity, Movable, Flame
---@field flame_size number @if changed, gradually goes down (0.03 per frame) to the default size, it's the base value for `entity.width` and `entity.height`
FlameSize = {}

---@class Floor : Entity
---@field deco_bottom integer
---@field deco_left integer
---@field deco_right integer
---@field deco_top integer
Floor = {}

---Explicitly add a decoration on the given side. Corner decorations only exist for `FLOOR_BORDERTILE` and `FLOOR_BORDERTILE_OCTOPUS`.
---@param side FLOOR_SIDE
function Floor:add_decoration(side) end

---@param callback_id integer
function Floor:clear_virtual(callback_id) end

function Floor:decorate_internal() end

---Sets `animation_frame` of the floor for types `FLOOR_BORDERTILE`, `FLOOR_BORDERTILE_METAL` and `FLOOR_BORDERTILE_OCTOPUS`.
function Floor:fix_border_tile_animation() end

---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_neighbors` to `true` to fix the neighboring 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.
---@param fix_also_neighbors boolean
---@param fix_styled_floor boolean
function Floor:fix_decorations(fix_also_neighbors, fix_styled_floor) end

---Returns it's ENT_TYPE except for FLOOR_PEN (returns FLOORSTYLED_MINEWOOD) and FLOOR_QUICKSAND, FLOOR_TOMB, FLOOR_EMPRESS_GRAVE which return FLOOR_GENERIC
---@return ENT_TYPE
function Floor:get_floor_type() end

---Explicitly remove a decoration on the given side. Corner decorations only exist for `FLOOR_BORDERTILE` and `FLOOR_BORDERTILE_OCTOPUS`.
---@param side FLOOR_SIDE
function Floor:remove_decoration(side) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Floor:set_post_floor_update(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Floor:set_post_virtual(index, fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Floor:set_pre_floor_update(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Floor:set_pre_virtual(index, fun) end

---@class Fly : Entity, Movable
---@field timer integer
Fly = {}

---@class FlyHead : Entity, Movable
---@field vored_entity_uid integer
FlyHead = {}

---@class FlyingThing
---@field amplitude number
---@field entity_type ENT_TYPE
---@field frequency number
---@field sinewave_angle number
---@field spritesheet_animation_length number
---@field spritesheet_column number
---@field spritesheet_row number
---@field texture_info TextureRenderingInfo
---@field velocity_x number
FlyingThing = {}

---@class ForceField : Entity, Floor
---@field emitted_light Illumination|nil
---@field first_item_beam Entity|nil
---@field fx Entity|nil
---@field is_on boolean
---@field sound SoundMeta|nil
ForceField = {}

---@param turn_on boolean
function ForceField:activate_laserbeam(turn_on) end

---@class ForestSister : Entity, Movable, PowerupCapable, Monster, NPC
---@field walk_pause_timer integer
ForestSister = {}

---@class Frog : Entity, Movable, PowerupCapable, Monster
---@field grub_being_eaten_uid integer
---@field jump_timer integer
---@field pause boolean
Frog = {}

---@class FrostBreathEffect : Entity
---@field timer integer
FrostBreathEffect = {}

---@class FrozenLiquid : Entity, Movable
FrozenLiquid = {}

---@class FxAlienBlast : Entity, Movable
FxAlienBlast = {}

---@class FxAnkhBrokenPiece : Entity, Movable
FxAnkhBrokenPiece = {}

---@class FxAnkhRotatingSpark : Entity, Movable
---@field inclination number
---@field radius number
---@field sine_angle number
---@field size number
---@field speed number @0 - 1.0
FxAnkhRotatingSpark = {}

---@class FxCompass : Entity, Movable
---@field is_active boolean @Player has compass
---@field sine_angle number @Counts form 0 to 2*pi, responsible for moving back and forth
---@field visibility number
FxCompass = {}

---@class FxEmpress : Entity, Movable
---@field sine_angle number
FxEmpress = {}

---@class FxFireflyLight : Entity, Movable
---@field cooldown_timer integer @Timer between light flashes
---@field illumination Illumination|nil
---@field light_timer integer
FxFireflyLight = {}

---@class FxHundunNeckPiece : Entity, Movable
---@field kill_timer integer @Short timer after the head is dead
FxHundunNeckPiece = {}

---@class FxJellyfishStar : Entity, Movable
---@field radius number
---@field rotation_angle number
---@field speed number
FxJellyfishStar = {}

---@class FxJetpackFlame : Entity, Movable
---@field illumination Illumination|nil
---@field particle_flame ParticleEmitterInfo|nil
---@field particle_smoke ParticleEmitterInfo|nil
---@field sound SoundMeta|nil
FxJetpackFlame = {}

---@class FxKinguSliding : Entity, Movable
---@field particle ParticleEmitterInfo|nil
FxKinguSliding = {}

---@class FxLamassuAttack : Entity, Movable
---@field attack_angle number
FxLamassuAttack = {}

---@class FxMainExitDoor : Entity, Movable
---@field emitted_light Illumination|nil
---@field timer integer @When breaking open in tutorial
FxMainExitDoor = {}

---@class FxNecromancerANKH : Entity, Movable
FxNecromancerANKH = {}

---@class FxOuroboroDragonPart : Entity, Movable
---@field particle ParticleEmitterInfo|nil
---@field speed number
---@field timer integer
FxOuroboroDragonPart = {}

---@class FxOuroboroOccluder : Entity, Movable
FxOuroboroOccluder = {}

---@class FxPickupEffect : Entity, Movable
---@field spawn_y number
---@field visibility number
FxPickupEffect = {}

---@class FxPlayerIndicator : Entity, Movable
---@field attached_to integer
---@field pos_x number
---@field pos_y number
FxPlayerIndicator = {}

---@class FxQuickSand : Entity, Movable
FxQuickSand = {}

---@class FxSaleContainer : Entity, Movable
---@field fx_button Entity|nil
---@field fx_icon Entity|nil
---@field fx_value Entity|nil
---@field pop_in_out_procentage integer
---@field shake_amplitude number @For effect when you don't have enough money
---@field sound_trigger boolean @Also sound_played, keeps re-triggering from time to time
FxSaleContainer = {}

---@class FxShotgunBlast : Entity, Movable
---@field illumination Illumination|nil
FxShotgunBlast = {}

---@class FxSorceressAttack : Entity, Movable
---@field size number
FxSorceressAttack = {}

---@class FxSparkSmall : Entity, Movable
---@field timer integer
FxSparkSmall = {}

---@class FxSpringtrapRing : Entity, Movable
---@field illumination Illumination|nil
---@field timer integer
FxSpringtrapRing = {}

---@class FxTiamatHead : Entity, Movable
---@field timer integer
FxTiamatHead = {}

---@class FxTiamatTail : Entity, Movable
---@field angle_two number @Added _two just to not shadow angle in entity, it's angle but the pivot point is at the edge
---@field x_pos number
---@field y_pos number
FxTiamatTail = {}

---@class FxTiamatTorso : Entity, Movable
---@field timer integer
---@field torso_target_size number @Slowly increases/decreases to the given value
FxTiamatTorso = {}

---@class FxTornJournalPage : Entity, Movable
---@field page_number integer @Only in tutorial
FxTornJournalPage = {}

---@class FxUnderwaterBubble : Entity, Movable
---@field bubble_source_uid integer
---@field direction integer @1 / -1
---@field inverted boolean
---@field pop boolean @Setting it true makes it disappear/fade away
FxUnderwaterBubble = {}

---@class FxVatBubble : Entity, Movable
---@field max_y number
FxVatBubble = {}

---@class FxWaterDrop : Entity, Movable
---@field droplet_source_uid integer
---@field inverted boolean
FxWaterDrop = {}

---@class FxWebbedEffect : Entity, Movable
---@field visible boolean
FxWebbedEffect = {}

---@class FxWitchdoctorHint : Entity, Movable
FxWitchdoctorHint = {}

---Can be accessed via global [game_manager](https://spelunky-fyi.github.io/overlunky/#game_manager)
---@class GameManager
---@field buttons_controls integer[] @Yet another place to get player inputs, in some format
---@field buttons_movement integer[] @Yet another place to get player inputs, in some format
---@field game_props GameProps|nil
---@field journal_ui JournalUI|nil
---@field main_menu_music BackgroundSound|nil
---@field music BackgroundMusic|nil
---@field pause_ui PauseUI|nil
---@field save_related SaveRelated|nil
---@field screen_arena_level Screen|nil
---@field screen_arena_score Screen|nil
---@field screen_camp ScreenCamp|nil
---@field screen_intro ScreenIntro|nil
---@field screen_leaderboards Screen|nil @All handled by the Online
---@field screen_level ScreenLevel|nil
---@field screen_logo ScreenLogo|nil
---@field screen_menu ScreenMenu|nil
---@field screen_online_loading ScreenOnlineLoading|nil
---@field screen_online_lobby ScreenOnlineLobby|nil
---@field screen_options ScreenOptions|nil
---@field screen_player_profile Screen|nil @It just opens journal
---@field screen_prologue ScreenPrologue|nil
---@field screen_seed_input ScreenCodeInput|nil
---@field screen_title ScreenTitle|nil
---@field screen_transition Screen|nil
GameManager = {}

---@class GameProps
---@field game_has_focus boolean
---@field input integer[] @Used for player input and might be used for some menu inputs not found in buttons_menu. You can probably capture and edit this in ON.POST_PROCESS_INPUT. These are raw inputs, without things like autorun applied.
---@field input_index integer[] @Input index for players 1-4 and maybe for the menu controls. -1: disabled, 0..3: keyboards, 4..7: Xinput, 8..11: other controllers
---@field input_menu MENU_INPUT @Inputs used to control all the menus, separate from player inputs. You can probably capture and edit this in ON.POST_PROCESS_INPUT
---@field input_menu_previous MENU_INPUT @Previous state of buttons_menu
---@field input_previous integer[]
---@field menu_open boolean
GameProps = {}

---Used in ImGuiIO
---@class Gamepad
---@field buttons integer
---@field enabled boolean
---@field lt number
---@field lx number
---@field ly number
---@field rt number
---@field rx number
---@field ry number
Gamepad = {}

---@class Generator : Entity, Floor
---@field on_off boolean @Applicable only for ENT_TYPE`.FLOOR_SUNCHALLENGE_GENERATOR`
---@field set_timer integer
---@field spawned_uid integer
---@field start_counter integer @Applicable only for ENT_TYPE`.FLOOR_SUNCHALLENGE_GENERATOR`
---@field timer integer
Generator = {}

---@class Ghist : Entity, Movable, PowerupCapable, Monster
---@field body_uid integer
---@field fadeout integer
---@field idle_timer integer
---@field sound SoundMeta|nil
---@field transparency integer
Ghist = {}

---@class Ghost : Entity, Movable, PowerupCapable, Monster
---@field blown_by_player boolean
---@field emitted_light Illumination|nil
---@field ghost_behaviour GHOST_BEHAVIOR
---@field happy_dancing_clockwise boolean
---@field linked_ghost Entity|nil
---@field pace_timer integer @Controls ghost pacing when all players are dead.
---@field sound SoundMeta|nil
---@field split_timer integer @for SMALL_HAPPY this is also the sequence timer of its various states
---@field target_dist_visibility_factor number
---@field target_layer_visibility_factor number
---@field velocity_multiplier number
---@field wobble_timer integer
Ghost = {}

---@class GhostBreath : Entity, Movable, Projectile
---@field big_cloud boolean
---@field timer integer
GhostBreath = {}

---@class GiantClamTop : Entity, Movable
---@field close_timer integer
---@field open_timer integer
GiantClamTop = {}

---@class GiantFish : Entity, Movable, PowerupCapable, Monster
---@field change_direction_timer integer @when bouncing into a wall
---@field lose_interest_timer integer @delay in-between attacks
---@field sound SoundMeta|nil
GiantFish = {}

---@class GiantFly : Entity, Movable, PowerupCapable, Monster
---@field delta_y_angle number
---@field head_entity Entity|nil
---@field particle ParticleEmitterInfo|nil
---@field sine_amplitude number
---@field sine_counter integer
---@field sine_frequency number
---@field sound SoundMeta|nil
GiantFly = {}

---@class GiantFrog : Entity, Movable, PowerupCapable, Monster
---@field attack_timer integer
---@field door_back_layer Entity|nil
---@field door_front_layer Entity|nil
---@field frogs_ejected_in_cycle integer
---@field invincibility_timer integer
---@field mouth_close_timer integer
---@field mouth_open_trigger boolean @opens the mouth and starts mouth_close_timer, used when detecting grub in the mouth area
---@field platform Entity|nil
GiantFrog = {}

---@class GoldMonkey : Entity, Movable, PowerupCapable, Monster
---@field jump_timer integer
---@field poop_count integer
---@field poop_timer integer
GoldMonkey = {}

---@class Goldbar : Entity, Movable
Goldbar = {}

---@class Grub : Entity, Movable, PowerupCapable, Monster
---@field drop boolean
---@field particle ParticleEmitterInfo|nil
---@field rotation_delta number
---@field rotation_direction boolean @Counter-clockwise if true.
---@field rotation_timer integer @Will randomly pick a new direction and angle when this timer elapses.
---@field sound SoundMeta|nil
---@field turn_into_fly_timer integer
---@field walk_pause_timer integer @alternates between walking and pausing every time it reaches zero.
---@field wall_collision_cooldown integer @Delay after colliding into a wall before it will change its movement direction again.
Grub = {}

---Used in [register_option_callback](https://spelunky-fyi.github.io/overlunky/#register_option_callback) and [set_callback](https://spelunky-fyi.github.io/overlunky/#set_callback) with ON.GUIFRAME
---@class GuiDrawContext
GuiDrawContext = {}

---Draws a cubic bezier curve on screen.
---@param p1 Vec2
---@param p2 Vec2
---@param p3 Vec2
---@param p4 Vec2
---@param thickness number
---@param color uColor
function GuiDrawContext:draw_bezier_cubic(p1, p2, p3, p4, thickness, color) end

---Draws a quadratic bezier curve on screen.
---@param p1 Vec2
---@param p2 Vec2
---@param p3 Vec2
---@param thickness number
---@param color uColor
function GuiDrawContext:draw_bezier_quadratic(p1, p2, p3, thickness, color) end

---Draws a circle on screen
---@param x number
---@param y number
---@param radius number
---@param thickness number
---@param color uColor
function GuiDrawContext:draw_circle(x, y, radius, thickness, color) end

---Draws a filled circle on screen
---@param x number
---@param y number
---@param radius number
---@param color uColor
function GuiDrawContext:draw_circle_filled(x, y, radius, color) end

---Draws an image on screen from top-left to bottom-right. Use UV coordinates `0, 0, 1, 1` to just draw the whole image.
---@param image IMAGE
---@param left number
---@param top number
---@param right number
---@param bottom number
---@param uvx1 number
---@param uvy1 number
---@param uvx2 number
---@param uvy2 number
---@param color uColor
---@overload fun(self: GuiDrawContext, image: IMAGE, rect: AABB, uv_rect: AABB, color: uColor)
function GuiDrawContext:draw_image(image, left, top, right, bottom, uvx1, uvy1, uvx2, uvy2, color) end

---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)
---@param image IMAGE
---@param left number
---@param top number
---@param right number
---@param bottom number
---@param uvx1 number
---@param uvy1 number
---@param uvx2 number
---@param uvy2 number
---@param color uColor
---@param angle number
---@param px number
---@param py number
---@overload fun(self: GuiDrawContext, image: IMAGE, rect: AABB, uv_rect: AABB, color: uColor, angle: number, px: number, py: number)
function GuiDrawContext:draw_image_rotated(image, left, top, right, bottom, uvx1, uvy1, uvx2, uvy2, color, angle, px, py) end

---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.
---@param layer DRAW_LAYER
function GuiDrawContext:draw_layer(layer) end

---Draws a line on screen
---@param x1 number
---@param y1 number
---@param x2 number
---@param y2 number
---@param thickness number
---@param color uColor
function GuiDrawContext:draw_line(x1, y1, x2, y2, thickness, color) end

---Draws a polyline on screen.
---@param points Vec2[]
---@param thickness number
---@param color uColor
function GuiDrawContext:draw_poly(points, thickness, color) end

---Draws a filled convex polyline on screen.
---@param points Vec2[]
---@param color uColor
function GuiDrawContext:draw_poly_filled(points, color) end

---Draws a rectangle on screen from top-left to bottom-right.
---@param left number
---@param top number
---@param right number
---@param bottom number
---@param thickness number
---@param rounding number
---@param color uColor
---@overload fun(self: GuiDrawContext, rect: AABB, thickness: number, rounding: number, color: uColor)
function GuiDrawContext:draw_rect(left, top, right, bottom, thickness, rounding, color) end

---Draws a filled rectangle on screen from top-left to bottom-right.
---@param left number
---@param top number
---@param right number
---@param bottom number
---@param rounding number
---@param color uColor
---@overload fun(self: GuiDrawContext, rect: AABB, rounding: number, color: uColor)
function GuiDrawContext:draw_rect_filled(left, top, right, bottom, rounding, color) end

---Draws text in screen coordinates `x`, `y`, anchored top-left. Text size 0 uses the default 18.
---@param x number
---@param y number
---@param size number
---@param text string
---@param color uColor
function GuiDrawContext:draw_text(x, y, size, text, color) end

---Draws a triangle on screen.
---@param p1 Vec2
---@param p2 Vec2
---@param p3 Vec2
---@param thickness number
---@param color uColor
function GuiDrawContext:draw_triangle(p1, p2, p3, thickness, color) end

---Draws a filled triangle on screen.
---@param p1 Vec2
---@param p2 Vec2
---@param p3 Vec2
---@param color uColor
function GuiDrawContext:draw_triangle_filled(p1, p2, p3, color) end

---Returns KEY flags including held OL_MOD modifiers, or -1 before any key has been pressed and released, or mouse button pressed. Also returns -1 before all initially held keys are released before the picker was opened, or if another key picker is already waiting for keys. If a modifier is released, that modifier is returned as an actual keycode (e.g. `KEY.LSHIFT`) while the other held modifiers are returned as `KEY.OL_MOD_...` flags.
---Shows a fullscreen key picker with a message, with the accepted input type (keyboard/mouse) filtered by flags. The picker won't show before all previously held keys have been released and other key pickers have returned a valid key.
---@param message string
---@param flags KEY_TYPE
---@return integer
function GuiDrawContext:key_picker(message, flags) end

---Add a button
---@param text string
---@return boolean
function GuiDrawContext:win_button(text) end

---Add a checkbox
---@param label string
---@param value boolean
---@return boolean
function GuiDrawContext:win_check(label, value) end

---Add a combo box
---@param label string
---@param selected integer
---@param opts string
---@return integer
function GuiDrawContext:win_combo(label, selected, opts) end

---Add an float dragfield
---@param label string
---@param value number
---@param min number
---@param max number
---@return number
function GuiDrawContext:win_drag_float(label, value, min, max) end

---Add an integer dragfield
---@param label string
---@param value integer
---@param min integer
---@param max integer
---@return integer
function GuiDrawContext:win_drag_int(label, value, min, max) end

---Draw image to window.
---@param image IMAGE
---@param width number
---@param height number
function GuiDrawContext:win_image(image, width, height) end

---Draw imagebutton to window.
---@param label string
---@param image IMAGE
---@param width number
---@param height number
---@param uvx1 number
---@param uvy1 number
---@param uvx2 number
---@param uvy2 number
---@return boolean
function GuiDrawContext:win_imagebutton(label, image, width, height, uvx1, uvy1, uvx2, uvy2) end

---Indent contents, or unindent if negative
---@param width number
function GuiDrawContext:win_indent(width) end

---Add next thing on the same line. This is same as `win_sameline(0, -1)`
function GuiDrawContext:win_inline() end

---Add a float field
---@param label string
---@param value number
---@return number
function GuiDrawContext:win_input_float(label, value) end

---Add an integer field
---@param label string
---@param value integer
---@return integer
function GuiDrawContext:win_input_int(label, value) end

---Add a text field
---@param label string
---@param value string
---@return string
function GuiDrawContext:win_input_text(label, value) end

---Pop unique identifier from the stack. Put after the input.
function GuiDrawContext:win_popid() end

---Add unique identifier to the stack, to distinguish identical inputs from each other. Put before the input.
---@param id integer
---@overload fun(self: GuiDrawContext, id: string)
function GuiDrawContext:win_pushid(id) end

---Add next thing on the same line, with an offset
---@param offset number
---@param spacing number
function GuiDrawContext:win_sameline(offset, spacing) end

---Add a collapsing accordion section, put contents in the callback function.
---@param title string
---@param callback fun() @Returning nil: ignored.
function GuiDrawContext:win_section(title, callback) end

---Add a separator line to window
function GuiDrawContext:win_separator() end

---Add a separator text line to window
---@param text string
function GuiDrawContext:win_separator_text(text) end

---Add an float slider
---@param label string
---@param value number
---@param min number
---@param max number
---@return number
function GuiDrawContext:win_slider_float(label, value, min, max) end

---Add an integer slider
---@param label string
---@param value integer
---@param min integer
---@param max integer
---@return integer
function GuiDrawContext:win_slider_int(label, value, min, max) end

---Add some text to window, automatically wrapped
---@param text string
function GuiDrawContext:win_text(text) end

---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)
---@param width number
function GuiDrawContext:win_width(width) end

---Create a new widget window. Put all win_ widgets inside the callback function. The window functions are just wrappers for the
---[ImGui](https://github.com/ocornut/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)
---@param title string
---@param x number
---@param y number
---@param w number
---@param h number
---@param movable boolean
---@param callback fun(p1: GuiDrawContext|nil, p2: Vec2, p3: Vec2) @Returning nil: ignored.
---@return boolean
function GuiDrawContext:window(title, x, y, w, h, movable, callback) end

---@class Gun : Entity, Movable, Purchasable
---@field cooldown integer
---@field in_chamber integer @Only for webgun, uid of the webshot entity
---@field shots integer @used only for webgun
---@field shots2 integer @used only for clonegun
Gun = {}

---@class HangAnchor : Entity, Movable
---@field spider_uid integer
HangAnchor = {}

---@class HangSpider : Entity, Movable, PowerupCapable, Monster
---@field ceiling_pos_x number
---@field ceiling_pos_y number
---@field dangle_jump_timer integer
HangSpider = {}

---@class HangStrand : Entity, Movable
---@field start_pos_y number
HangStrand = {}

---@class Hermitcrab : Entity, Movable, PowerupCapable, Monster
---@field carried_entity_type ENT_TYPE
---@field carried_entity_uid integer
---@field going_up boolean @Whether the hermit crab is moving up when climbing a pole.
---@field is_active boolean @whether it is hidden behind the carried block or not, if true you can damage him
---@field is_inactive boolean
---@field spawn_new_carried_item boolean @defaults to true, when toggled to false, a new carried item spawns
---@field walk_spit_timer integer
Hermitcrab = {}

---@class Honey : Entity, Movable
---@field wiggle_timer integer
Honey = {}

---@class HorizontalForceField : Entity, Floor
---@field first_item_beam Entity|nil
---@field fx Entity|nil
---@field is_on boolean
---@field sound SoundMeta|nil
---@field timer integer
HorizontalForceField = {}

---@class HornedLizard : Entity, Movable, PowerupCapable, Monster
---@field attack_cooldown_timer integer @won't attack until timer reaches zero
---@field blood_squirt_timer integer
---@field eaten_uid integer @dungbeetle being eaten
---@field particle ParticleEmitterInfo|nil
---@field sound SoundMeta|nil
---@field walk_pause_timer integer @alternates between walking and pausing when timer reaches zero
HornedLizard = {}

---@class Hoverpack : Entity, Movable, Powerup, Backpack
---@field is_on boolean
---@field sound SoundMeta|nil
Hoverpack = {}

---@class Hud
---@field data HudData|nil
---@field opacity number
---@field y number
Hud = {}

---@class HudData
---@field angry_shopkeeper boolean
---@field clover_falling_apart_timer number
---@field clover_icon TextureRenderingInfo
---@field dollar_icon TextureRenderingInfo
---@field hourglass_icon TextureRenderingInfo
---@field inventory HudInventory[]
---@field kapala_icon TextureRenderingInfo
---@field level HudElement
---@field level_highlight TextureRenderingInfo
---@field level_icon TextureRenderingInfo
---@field level_num integer
---@field money HudMoney
---@field money_and_time_highlight TextureRenderingInfo @Money and time use the same TextureRendering, just offset while drawing
---@field money_counter integer
---@field money_increase_sparkles ParticleEmitterInfo|nil
---@field money_total integer
---@field opacity number
---@field player_ankh TextureRenderingInfo
---@field player_bomb TextureRenderingInfo
---@field player_crown TextureRenderingInfo
---@field player_cursed_particles ParticleEmitterInfo[]
---@field player_heart TextureRenderingInfo
---@field player_highlight TextureRenderingInfo @For player related icons, they use the same TextureRendering, just offset while drawing
---@field player_poisoned_particles ParticleEmitterInfo[]
---@field player_rope TextureRenderingInfo
---@field players HudPlayer[]
---@field roll_in number
---@field seed integer
---@field seed_background TextureRenderingInfo
---@field seed_shown boolean
---@field time_level integer @in ms
---@field time_total integer @in ms
---@field timer HudElement
---@field udjat boolean
---@field udjat_icon TextureRenderingInfo
---@field world_num integer
HudData = {}

---@class HudElement
---@field dim boolean @Hide background and dim if using the auto adjust setting.
---@field opacity number @Background will be drawn if this is not 0.5
---@field time_dim integer @Level time when element should dim again after highlighted, INT_MAX if dimmed on auto adjust. 0 on opaque.
HudElement = {}

---@class HudInventory
---@field ankh boolean
---@field bombs integer
---@field crown ENT_TYPE @Powerup type or 0
---@field curse boolean
---@field elixir boolean
---@field enabled boolean
---@field health integer
---@field item_count integer @Amount of generic pickup items at the bottom. Set to 0 to not draw them.
---@field kapala boolean
---@field kapala_blood integer
---@field kapala_sprite SpritePosition
---@field poison boolean
---@field powerup_sprites SpritePosition[]
---@field ropes integer
HudInventory = {}

---@class HudMoney : HudElement
---@field counter integer
---@field timer integer
---@field total integer
HudMoney = {}

---@class HudPlayer : HudElement
---@field bombs integer
---@field health integer
---@field ropes integer
HudPlayer = {}

---@class Hundun : Entity, Movable, PowerupCapable, Monster
---@field applied_hor_velocity number
---@field applied_ver_velocity number
---@field bird_head_spawn_y number @This is custom variable, you need [activate_hundun_hack](https://spelunky-fyi.github.io/overlunky/#activate_hundun_hack) to use it
---@field birdhead_defeated boolean
---@field birdhead_entity_uid integer
---@field bounce_timer integer
---@field fireball_timer integer
---@field hundun_flags integer @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
---@field rising_speed_x number @This is custom variable, you need [activate_hundun_hack](https://spelunky-fyi.github.io/overlunky/#activate_hundun_hack) to use it
---@field rising_speed_y number @This is custom variable, you need [activate_hundun_hack](https://spelunky-fyi.github.io/overlunky/#activate_hundun_hack) to use it
---@field snake_head_spawn_y number @This is custom variable, you need [activate_hundun_hack](https://spelunky-fyi.github.io/overlunky/#activate_hundun_hack) to use it
---@field snakehead_defeated boolean
---@field snakehead_entity_uid integer
---@field y_level number @current floor level
---@field y_limit number @This is custom variable, you need [activate_hundun_hack](https://spelunky-fyi.github.io/overlunky/#activate_hundun_hack) to use it
Hundun = {}

---@class HundunChest : Entity, Movable, Treasure
---@field timer integer
HundunChest = {}

---@class HundunHead : Entity, Movable, PowerupCapable, Monster
---@field attack_position_x number @Position where the head will move on attack
---@field attack_position_y number
---@field egg_crack_effect_uid integer
---@field invincibility_timer integer
---@field looking_for_target_timer integer @also cooldown before attack
---@field targeted_player_uid integer
HundunHead = {}

---@class IceSlidingSound : Entity, LogicalSound
IceSlidingSound = {}

---@class Idol : Entity, Movable
---@field spawn_x number
---@field spawn_y number
---@field touch integer @changes to 0 when first picked up by player and back to -1 if HH picks it up
---@field trap_triggered boolean @if you set it to true for the ice caves or volcano idol, the trap won't trigger
Idol = {}

---Generic object for lights in the game, you can make your own with [create_illumination](https://spelunky-fyi.github.io/overlunky/#create_illumination)
---Used in StateMemory, Player, PlayerGhost, BurningRopeEffect ...
---@class Illumination
---@field brightness number
---@field brightness_multiplier number
---@field distortion number
---@field enabled boolean
---@field entity_uid integer
---@field flags integer @see [flags.hpp](https://github.com/spelunky-fyi/overlunky/blob/main/src/game_api/flags.hpp) illumination_flags
---@field layer integer
---@field light1 LightParams
---@field light2 LightParams
---@field light3 LightParams
---@field light4 LightParams @It's rendered on objects around, not as an actual bright spot
---@field light_pos_x number
---@field light_pos_y number
---@field lights LightParams[] @Table of light1, light2, ... etc.
---@field offset_x number
---@field offset_y number
---@field timer integer
---@field type_flags LIGHT_TYPE
Illumination = {}

---Used in [get_io](https://spelunky-fyi.github.io/overlunky/#get_io), also see [set_hotkey](https://spelunky-fyi.github.io/overlunky/#set_hotkey) and GuiDrawContext::key_picker.
---
---- Functions are static, not class methods expecting `self` (call with `get_io().keydown(key)`, not `:`)
---- The clicked/pressed actions only work in `ON.GUIFRAME` (they are true for one GUIFRAME), but get_io() can be used anywhere for the other parts.
---- You can use `KEY` or other standard virtual keycodes < 0xFF to index `keys[]` or in the functions.
---- You can use chords `KEY.OL_MOD_CTRL | KEY.X` in the keydown/keypressed/keyreleased functions.
---- You can also use mouse buttons (e.g. `KEY.OL_MOUSE_1`) or anything returned by GuiDrawContext:key_picker in the keydown/keypressed/keyreleased functions.
---- A modifier key as a keycode (`keypressed(KEY.LCONTROL)`) is not the same as modifier flags OL_MOD_... `keypressed(KEY.OL_MOD_CTRL)` won't work, `keypressed(KEY.OL_MOD_CTRL | KEY.LSHIFT)` will trigger on "Ctrl+Shift" but not "Shift+Ctrl"
---- All held modifiers must be present in the chord, e.g. `keypressed(KEY.OL_MOD_CTRL | KEY.X)` won't trigger when Ctrl+Shift+X is pressed, `keydown(KEY.Y)` won't trigger when Ctrl+Y is pressed.
---- Most fields are read only, except `wantkeyboard`, `wantmouse` and `showcursor`.
---- Setting `wantkeyboard` early (e.g. already when `modifierdown(KEY.OL_MOD_CTRL | KEY.X)`) will prevent the game and UI from reacting to your actual combo later (e.g. `keypressed(KEY.OL_MOD_CTRL | KEY.X)`)
---- Gamepad is basically [XINPUT_GAMEPAD](https://docs.microsoft.com/en-us/windows/win32/api/xinput/ns-xinput-xinput_gamepad) but variables are renamed and values are normalized to -1.0..1.0 range.
---@class ImGuiIO
---@field displaysize Vec2
---@field framerate number
---@field gamepad Gamepad
---@field keyalt boolean
---@field keyctrl boolean
---@field keys boolean[] @ZeroIndexArray<bool> of currently held keys, indexed by KEY <= 0xFF
---@field keyshift boolean
---@field keysuper boolean
---@field mouseclicked boolean[]
---@field mousedoubleclicked boolean[]
---@field mousedown boolean[]
---@field mousepos Vec2
---@field mousereleased boolean[]
---@field mousewheel number
---@field showcursor boolean @True when the cursor is visible. Set to true to force the cursor visible.
---@field wantkeyboard boolean @True if anyone else (i.e. some input box, OL hotkey) is already capturing keyboard or reacted to this keypress and you probably shouldn't. Set this to true every GUIFRAME while you want to capture keyboard and disable UI key bindings and game keys. Won't affect UI or game keys on this frame though, that train has already sailed. Also see Bucket::Overlunky for other ways to override key bindings. Do not set this to false, unless you want the player input to bleed through input fields.
---@field wantmouse boolean @True if anyone else (i.e. hovering some window) is already capturing mouse and you probably shouldn't. Set this to true if you want to capture mouse and override UI mouse binding.
ImGuiIO = {}

---Gamepad gamepads(int index)
---This is the XInput index 1..4, might not be the same as the player slot.
---@param index integer
---@return Gamepad
function ImGuiIO.gamepads(index) end

---Returns true if key or chord is down.
---bool keydown(KEY keychord)
---bool keydown(char key)
---@param keycode integer
---@return boolean
---@overload fun(key: integer): boolean
function ImGuiIO.keydown(keycode) end

---Returns true if key or chord was pressed this GUIFRAME.
---bool keypressed(KEY keychord, bool repeat = false)
---bool keypressed(char key, bool repeat = false)
---@param keycode integer
---@return boolean
---@overload fun(keycode: integer, repeat_: boolean): boolean
---@overload fun(key: integer): boolean
---@overload fun(key: integer, repeat_: boolean): boolean
function ImGuiIO.keypressed(keycode) end

---Returns true if key or chord was released this GUIFRAME.
---bool keyreleased(KEY keychord)
---bool keyreleased(char key)
---@param keycode integer
---@return boolean
---@overload fun(key: integer): boolean
function ImGuiIO.keyreleased(keycode) end

---bool modifierdown(KEY keychord)
---Returns true if modifiers in chord are down, ignores other keys in chord.
---@param chord integer
---@return boolean
function ImGuiIO.modifierdown(chord) end

---@class Imp : Entity, Movable, PowerupCapable, Monster
---@field carrying_uid integer
---@field patrol_y_level number
Imp = {}

---Used in PlayerSlot
---@class InputMapping
---@field attack integer
---@field bomb integer
---@field down integer
---@field journal integer
---@field jump integer
---@field left integer
---@field mapping RAW_KEY[] @Can be indexed with INPUT_FLAG. Keyboard uses RAW_KEY values, controller uses RAW_BUTTON values.
---@field pause_menu integer
---@field right integer
---@field rope integer
---@field up integer
---@field use_door_buy integer
---@field walk_run integer
InputMapping = {}

---Used in Player, PlayerGhost and Items
---@class Inventory
---@field acquired_powerups ENT_TYPE[] @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
---@field bombs integer
---@field collected_money ENT_TYPE[] @Types of gold/gems collected during this level, used later to display during the transition
---@field collected_money_count integer @Count/size for the `collected_money` arrays
---@field collected_money_total integer @Total money collected during previous levels (so excluding the current one)
---@field collected_money_values integer[] @Values of gold/gems collected during this level, used later to display during the transition
---@field companion_count integer @Number of companions, it will determinate how many companions will be transferred to next level Increments when player acquires new companion, decrements when one of them dies
---@field companion_health integer[] @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
---@field companion_held_item_metadatas integer[] @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
---@field companion_held_items ENT_TYPE[] @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
---@field companion_poison_tick_timers integer[] @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
---@field companion_trust integer[] @(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
---@field companions ENT_TYPE[] @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
---@field cursed boolean @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
---@field elixir_buff boolean @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
---@field health integer @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
---@field held_item ENT_TYPE @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
---@field held_item_metadata integer @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
---@field is_companion_cursed boolean[] @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
---@field kapala_blood_amount integer @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
---@field killed_enemies ENT_TYPE[] @Types of enemies killed during this level, used later to display during the transition
---@field kills_level integer
---@field kills_total integer
---@field money integer @Sum of the money collected in current level
---@field mount_metadata integer @Metadata of the mount (health, is cursed etc.) Used to transfer information to transition/next level (player riding a mount). Is not updated during a level You can use `ON.PRE_LEVEL_GENERATION` to access/edit this
---@field mount_type ENT_TYPE @Used to transfer information to transition/next level (player riding a mount). Is not updated during a level You can use `ON.PRE_LEVEL_GENERATION` to access/edit this
---@field player_slot integer
---@field poison_tick_timer integer @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
---@field ropes integer
---@field saved_pets_count integer
---@field time_of_death integer @Is set to state.time_total when player dies in coop (to determinate who should be first to re-spawn from coffin)
Inventory = {}

---Used in RoomOwnersInfo
---@class ItemOwnerDetails
---@field owner_type ENT_TYPE @Used in RoomOwnersInfo
---@field owner_uid integer @Used in RoomOwnersInfo
ItemOwnerDetails = {}

---Used in StateMemory
---@class Items
---@field is_pet_cursed boolean[]
---@field is_pet_poisoned boolean[]
---@field leader integer @Index of leader player in coop
---@field player_count integer
---@field player_inventory Inventory[]
---@field player_select SelectPlayerSlot[]
---@field players Player[] @Table of players, also keeps the dead body until they are destroyed (necromancer revive also destroys the old body)
---@field saved_pets ENT_TYPE[] @Pet information for level transition
---@field saved_pets_count integer @Only for the level transition, the actual number is held in player inventory
Items = {}

---@class Jetpack : Entity, Movable, Powerup, Backpack
---@field flame_on boolean
---@field fuel integer
Jetpack = {}

---@return number
function Jetpack:acceleration() end

---@param callback_id integer
function Jetpack:clear_virtual(callback_id) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Jetpack:set_post_acceleration(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Jetpack:set_post_virtual(index, fun) end

---@param fun fun(self: Entity|nil): number|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Jetpack:set_pre_acceleration(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Jetpack:set_pre_virtual(index, fun) end

---@class Jiangshi : Entity, Movable, PowerupCapable, Monster
---@field jump_counter integer @only female aka assassin: when 0 will jump up into ceiling
---@field on_ceiling boolean @only female aka assassin
---@field wait_timer integer @wait time between jumps
Jiangshi = {}

---Used in SaveRelated
---@class JournalBestiaryData : JournalPageData
---@field background_sprite_id integer
---@field defeated_NA boolean
---@field killed_by_NA boolean
---@field texture TEXTURE
JournalBestiaryData = {}

---Used in [set_callback](https://spelunky-fyi.github.io/overlunky/#set_callback) with ON.RENDER_POST_JOURNAL_PAGE
---@class JournalPage
---@field background TextureRenderingInfo
---@field page_number integer
JournalPage = {}

---@return JournalPageBestiary|nil
function JournalPage.as_journal_page_bestiary() end

---@return JournalPageDeathCause|nil
function JournalPage.as_journal_page_deathcause() end

---@return JournalPageDeathMenu|nil
function JournalPage.as_journal_page_deathmenu() end

---@return JournalPageFeats|nil
function JournalPage.as_journal_page_feats() end

---@return JournalPageItems|nil
function JournalPage.as_journal_page_items() end

---@return JournalPageJournalMenu|nil
function JournalPage.as_journal_page_journalmenu() end

---@return JournalPageLastGamePlayed|nil
function JournalPage.as_journal_page_lastgameplayed() end

---@return JournalPagePeople|nil
function JournalPage.as_journal_page_people() end

---@return JournalPagePlaces|nil
function JournalPage.as_journal_page_places() end

---@return JournalPagePlayerProfile|nil
function JournalPage.as_journal_page_playerprofile() end

---@return JournalPageProgress|nil
function JournalPage.as_journal_page_progress() end

---@return JournalPageTraps|nil
function JournalPage.as_journal_page_traps() end

---@return JOURNAL_PAGE_TYPE
function JournalPage:get_type() end

---background.x < 0
---@return boolean
function JournalPage:is_right_side_page() end

---@class JournalPageBestiary : JournalPage, JournalPageDiscoverable
---@field defeated_killedby_black_bars TextureRenderingInfo
---@field defeated_text_info TextRenderingInfo|nil
---@field defeated_value_text_info TextRenderingInfo|nil
---@field killedby_text_info TextRenderingInfo|nil
---@field killedby_value_text_info TextRenderingInfo|nil
---@field monster_background TextureRenderingInfo
---@field monster_icon TextureRenderingInfo
JournalPageBestiary = {}

---Used in SaveRelated
---@class JournalPageData
---@field description STRINGID
---@field name STRINGID
---@field offset_x number
---@field offset_y number
---@field page_nr integer
---@field scale number
---@field sprite_id integer
JournalPageData = {}

---@class JournalPageDeathCause : JournalPage
---@field death_cause_text_info TextRenderingInfo|nil
JournalPageDeathCause = {}

---@class JournalPageDeathMenu : JournalPage
---@field game_over_text_info TextRenderingInfo|nil
---@field level_text_info TextRenderingInfo|nil
---@field level_value_text_info TextRenderingInfo|nil
---@field money_text_info TextRenderingInfo|nil
---@field money_value_text_info TextRenderingInfo|nil
---@field time_text_info TextRenderingInfo|nil
---@field time_value_text_info TextRenderingInfo|nil
JournalPageDeathMenu = {}

---@class JournalPageDiscoverable : JournalPage
---@field chapter_title_text_info TextRenderingInfo|nil
---@field entry_text_info TextRenderingInfo|nil
---@field show_main_image boolean
---@field title_text_info TextRenderingInfo|nil
JournalPageDiscoverable = {}

---@class JournalPageFeats : JournalPage
---@field chapter_title_text_info TextRenderingInfo|nil
---@field feat_icons TextureRenderingInfo
JournalPageFeats = {}

---@class JournalPageItems : JournalPage, JournalPageDiscoverable
---@field item_background TextureRenderingInfo
---@field item_icon TextureRenderingInfo
JournalPageItems = {}

---@class JournalPageJournalMenu : JournalPage
---@field completion_badge TextureRenderingInfo
---@field journal_text_info TextRenderingInfo|nil
JournalPageJournalMenu = {}

---@class JournalPageLastGamePlayed : JournalPage
---@field last_game_played_text_info TextRenderingInfo|nil
---@field level_text_info TextRenderingInfo|nil
---@field level_value_text_info TextRenderingInfo|nil
---@field main_image TextureRenderingInfo
---@field money_text_info TextRenderingInfo|nil
---@field money_value_text_info TextRenderingInfo|nil
---@field sticker_count integer
---@field stickers TextureRenderingInfo[]
---@field time_text_info TextRenderingInfo|nil
---@field time_value_text_info TextRenderingInfo|nil
JournalPageLastGamePlayed = {}

---@class JournalPagePeople : JournalPage, JournalPageDiscoverable
---@field character_background TextureRenderingInfo
---@field character_drawing TextureRenderingInfo
---@field character_icon TextureRenderingInfo
JournalPagePeople = {}

---@class JournalPagePlaces : JournalPage, JournalPageDiscoverable
---@field main_image TextureRenderingInfo
JournalPagePlaces = {}

---@class JournalPagePlayerProfile : JournalPage
---@field average_score_text_info TextRenderingInfo|nil
---@field average_score_value_text_info TextRenderingInfo|nil
---@field average_time_text_info TextRenderingInfo|nil
---@field average_time_value_text_info TextRenderingInfo|nil
---@field best_time_text_info TextRenderingInfo|nil
---@field best_time_value_text_info TextRenderingInfo|nil
---@field deadliest_level_text_info TextRenderingInfo|nil
---@field deadliest_level_value_text_info TextRenderingInfo|nil
---@field deaths_text_info TextRenderingInfo|nil
---@field deaths_value_text_info TextRenderingInfo|nil
---@field deepest_level_text_info TextRenderingInfo|nil
---@field deepest_level_value_text_info TextRenderingInfo|nil
---@field player_icon TextureRenderingInfo
---@field player_icon_id integer
---@field player_profile_text_info TextRenderingInfo|nil
---@field plays_text_info TextRenderingInfo|nil
---@field plays_value_text_info TextRenderingInfo|nil
---@field top_score_text_info TextRenderingInfo|nil
---@field top_score_value_text_info TextRenderingInfo|nil
---@field win_pct_text_info TextRenderingInfo|nil
---@field win_pct_value_text_info TextRenderingInfo|nil
---@field wins_text_info TextRenderingInfo|nil
---@field wins_value_text_info TextRenderingInfo|nil
JournalPagePlayerProfile = {}

---@class JournalPageProgress : JournalPage
---@field coffeestain_top TextureRenderingInfo
JournalPageProgress = {}

---@class JournalPageTraps : JournalPage, JournalPageDiscoverable
---@field trap_background TextureRenderingInfo
---@field trap_icon TextureRenderingInfo
JournalPageTraps = {}

---Used in SaveRelated
---@class JournalPeopleData : JournalPageData
---@field background_sprite_id integer
---@field defeated_NA boolean
---@field killed_by_NA boolean
---@field portrait_texture TEXTURE
---@field texture TEXTURE
JournalPeopleData = {}

---Used in SaveRelated
---@class JournalPopupUI
---@field black_background TextureRenderingInfo
---@field button_icon TextureRenderingInfo
---@field chapter_to_show integer
---@field entry_to_show integer
---@field slide_position number
---@field timer integer
---@field wiggling_page_angle number
---@field wiggling_page_icon TextureRenderingInfo
JournalPopupUI = {}

---Used in StateMemory
---@class JournalProgressStainSlot
---@field angle number
---@field scale number
---@field texture_column integer
---@field texture_range integer
---@field texture_row integer
---@field x number
---@field y number
JournalProgressStainSlot = {}

---Used in StateMemory
---@class JournalProgressStickerSlot
---@field angle number
---@field entity_type ENT_TYPE
---@field grid_position integer
---@field theme integer
---@field x number
---@field y number
JournalProgressStickerSlot = {}

---Used in SaveRelated
---@class JournalTrapData : JournalPageData
---@field background_sprite_id integer
---@field texture TEXTURE
JournalTrapData = {}

---@class JournalUI
---@field arrow_left TextureRenderingInfo
---@field arrow_right TextureRenderingInfo
---@field book_background TextureRenderingInfo
---@field chapter_shown JOURNALUI_PAGE_SHOWN
---@field current_page integer
---@field entire_book TextureRenderingInfo
---@field fade_timer integer
---@field flipping_to_page integer
---@field max_page_count integer
---@field opacity number
---@field page_timer integer
---@field pages JournalPage[] @Stores pages loaded into memory. It's not cleared after the journal is closed or when you go back to the main (menu) page. Use `:get_type()` to check page type and cast it correctly (see ON.[RENDER_PRE_JOURNAL_PAGE](https://spelunky-fyi.github.io/overlunky/#ON-RENDER_PRE_JOURNAL_PAGE))
---@field state integer
JournalUI = {}

---@class JumpDog : Entity, Movable, PowerupCapable, Monster
---@field squish_timer integer
---@field walk_pause_timer integer
JumpDog = {}

---@class JungleSpearCosmetic : Entity, Movable
---@field move_x number
---@field move_y number
JungleSpearCosmetic = {}

---@class JungleSpearTrap : Entity, Floor
JungleSpearTrap = {}

---The uid must be movable entity for ownership transfers, direction: 1 = left, 2 = right, 3 = up, 4 = down
---@param who_uid integer
---@param direction integer
function JungleSpearTrap:trigger(who_uid, direction) end

---@class JungleTrapTrigger : Entity, LogicalTrapTrigger
JungleTrapTrigger = {}

---@class KapalaPowerup : Entity, Movable, Powerup
---@field amount_of_blood integer
KapalaPowerup = {}

---@class KeyboardKey
---@field down boolean @Key is being held
---@field pressed boolean @Key was just pressed down this frame
KeyboardKey = {}

---@class Kingu : Entity, Movable, PowerupCapable, Monster
---@field climb_direction_x number
---@field climb_direction_y number
---@field climb_pause_timer integer
---@field initial_shell_health integer @Excalibur wipes out immediately, bombs take off 11 points, when 0 vulnerable to whip
---@field monster_spawn_timer integer
---@field player_seen_by_kingu boolean
---@field shell_invincibility_timer integer
---@field sound1 SoundMeta|nil @initialized when breaking the shell (sliding down sound maybe?)
---@field sound2 SoundMeta|nil @Turning into stone sound
Kingu = {}

---@class Lahamu : Entity, Movable, PowerupCapable, Monster
---@field attack_cooldown_timer integer
---@field eyeball Entity|nil
---@field has_logged_to_journal boolean
---@field sound SoundMeta|nil
Lahamu = {}

---@class Lamassu : Entity, Movable, PowerupCapable, Monster
---@field attack_angle number
---@field attack_effect_entity Entity|nil
---@field attack_timer integer
---@field emitted_light Illumination|nil
---@field flight_timer integer
---@field particle ParticleEmitterInfo|nil
---@field sound SoundMeta|nil
---@field walk_pause_timer integer
---@field was_flying boolean
Lamassu = {}

---@class LampFlame : Entity, Movable, Flame
---@field flame_particle ParticleEmitterInfo|nil
LampFlame = {}

---@class Landmine : Entity, Movable, LightEmitter
---@field timer integer @explodes at 57, if you set it to 58 will count to overflow
Landmine = {}

---@class LaserBeam : Entity, Movable
---@field emitted_light Illumination|nil
---@field sparks ParticleEmitterInfo|nil
LaserBeam = {}

---@class LaserTrap : Entity, Floor
---@field emitted_light Illumination|nil
---@field phase_2 boolean
---@field reset_timer integer
---@field timer integer @counts up from 0 after triggering, cannot shoot again until 360
LaserTrap = {}

---The uid must be movable entity for ownership transfers
---@param who_uid integer
function LaserTrap:trigger(who_uid) end

---@class Lava : Entity, Liquid
---@field emitted_light Illumination|nil
Lava = {}

---@class Lavamander : Entity, Movable, PowerupCapable, Monster
---@field emitted_light Illumination|nil
---@field is_hot boolean
---@field jump_pause_timer integer
---@field lava_detection_timer integer
---@field player_detect_state integer @0 - didn't see player, 1 - saw player, 2 - spitted lava; probably used so he won't spit imminently after seeing the player
---@field shoot_lava_timer integer @when this timer reaches zero, it appears on the surface/shoots lava, triggers on player proximity
Lavamander = {}

---@class Leaf : Entity, Movable
---@field fade_away_counter number @counts to 100.0 then the leaf fades away
---@field fade_away_trigger boolean
---@field swing_direction integer
Leaf = {}

---@class Leprechaun : Entity, Movable, PowerupCapable, Monster, WalkingMonster
---@field collected_treasure integer[]
---@field gold integer @amount of gold he picked up, will be drooped on death
---@field hump_timer integer
---@field jump_trigger boolean @Triggers a jump on the next frame.
---@field sound SoundMeta|nil
---@field target_in_sight_timer integer
---@field timer_after_humping integer
Leprechaun = {}

---@class Letter
---@field bottom Triangle
---@field top Triangle
Letter = {}

---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
---@return Vec2
function Letter:center() end

---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
---@return Quad
function Letter:get_quad() end

---Inverse of the get_quad
---@param quad Quad
function Letter:set_quad(quad) end

---Data relating to level generation, changing anything in here from ON.LEVEL or later will likely have no effect, used in StateMemory
---@class LevelGenSystem
---@field backlayer_shop_music integer
---@field backlayer_shop_type SHOP_TYPE
---@field exit_doors Vec2[]
---@field flags integer
---@field flags2 integer
---@field flags3 integer
---@field level_config integer[]
---@field shop_music integer
---@field shop_type SHOP_TYPE
---@field spawn_room_x integer
---@field spawn_room_y integer
---@field spawn_x number
---@field spawn_y number
---@field themes ThemeInfo[]
LevelGenSystem = {}

---@class LightArrow : Entity, Movable, Purchasable, Arrow
---@field emitted_light Illumination|nil
LightArrow = {}

---@class LightArrowPlatform : Entity, Movable
---@field emitted_light Illumination|nil
LightArrowPlatform = {}

---@class LightEmitter : Entity, Movable
---@field emitted_light Illumination|nil
LightEmitter = {}

---Used in Illumination
---@class LightParams
---@field blue number
---@field green number
---@field red number
---@field size number
LightParams = {}

---Returns LightParams as Color, note that size = alpha
---@return Color|nil
function LightParams:as_color() end

---@class LightShot : Entity, Movable, Projectile
---@field emitted_light Illumination|nil
LightShot = {}

---@class LimbAnchor : Entity
---@field anchor_x number @Current position of the ankle/wrist of this limb anchor.
---@field anchor_y number @Current position of the ankle/wrist of this limb anchor.
---@field elapsed_move_time integer @Number of frames the limb has been moving from move_origin to move_destination.
---@field flip_vertical boolean
---@field move_destination_x number @Position of this limb anchor at the end of a movement.
---@field move_destination_y number @Position of this limb anchor at the end of a movement.
---@field move_duration integer @Number of frames the limb should take to move from move_origin to move_destination.
---@field move_origin_x number @Position of this limb anchor at the beginning of a movement.
---@field move_origin_y number @Position of this limb anchor at the beginning of a movement.
LimbAnchor = {}

---@class Liquid : Entity
---@field fx_surface Entity|nil
Liquid = {}

---@return integer
function Liquid:get_liquid_flags() end

---@param flags integer
function Liquid:set_liquid_flags(flags) end

---Use LIQUID_POOL enum for the index
---Used in StateMemory
---@class LiquidPhysics
---@field pools LiquidPool[]
LiquidPhysics = {}

---Used in LiquidPool
---@class LiquidPhysicsEngine
---@field cohesion number
---@field count integer
---@field elasticity number
---@field gravity number
---@field pause boolean
---@field size number
---@field weight number
LiquidPhysicsEngine = {}

---Used in LiquidPool
---@class LiquidPhysicsParams
---@field cohesion number
---@field elasticity number
---@field gravity number
LiquidPhysicsParams = {}

---Used in LiquidPhysics
---@class LiquidPool
---@field default LiquidPhysicsParams
---@field engine LiquidPhysicsEngine|nil
LiquidPool = {}

---@class LiquidSurface : Entity, Movable
---@field glow_radius number
---@field sine_pos number
---@field sine_pos_increment number
LiquidSurface = {}

---Context received in ON.LOAD
---Used to load from save_{}.dat into a string
---@class LoadContext
LoadContext = {}

---Context received in ON.LOAD
---Used to load from save_{}.dat into a string
---@return string
function LoadContext:load() end

---@class LockedDoor : Entity, Floor, Door
---@field unlocked boolean
LockedDoor = {}

---Used in LogicList
---@class Logic
---@field logic_index LOGIC
Logic = {}

---Used in LogicList
---@class LogicApepTrigger : Logic
---@field apep_journal_entry_logged boolean
---@field cooling_down boolean
---@field spawn_cooldown integer
LogicApepTrigger = {}

---Used in LogicList
---@class LogicArena1 : Logic
---@field crate_spawn_timer integer
LogicArena1 = {}

---Used in LogicList
---@class LogicArenaAlienBlast : Logic
---@field timer integer
LogicArenaAlienBlast = {}

---Used in LogicList
---@class LogicArenaLooseBombs : Logic
---@field timer integer
LogicArenaLooseBombs = {}

---Used in LogicList
---@class LogicBasecampSpeedrun : Logic
---@field administrator integer @entity uid of the character that keeps the time
---@field crate integer @entity uid. you must break this crate for the run to be valid, otherwise you're cheating
LogicBasecampSpeedrun = {}

---Used in LogicList
---@class LogicCOGAnkhSacrifice : Logic
---@field timer integer
LogicCOGAnkhSacrifice = {}

---Used in LogicMoonChallenge, LogicStarChallenge, LogicSunChallenge
---@class LogicChallenge : Logic
---@field challenge_active boolean
---@field floor_challenge_entrance_uid integer
---@field floor_challenge_waitroom_uid integer
---@field forcefield_countdown integer
LogicChallenge = {}

---Used in LogicList
---@class LogicDiceShop : Logic
---@field balance integer @cash balance of all the games
---@field bet_active boolean
---@field bet_machine integer @entity uid
---@field boss_type ENT_TYPE
---@field boss_uid integer
---@field die1 integer @entity uid
---@field die2 integer @entity uid
---@field die_1_value integer
---@field die_2_value integer
---@field forcefield integer @entity uid
---@field forcefield_deactivated boolean
---@field prize integer @entity uid
---@field prize_dispenser integer @entity uid
---@field result_announcement_timer integer @the time the boss waits after your second die throw to announce the results
---@field won_prizes_count integer
LogicDiceShop = {}

---Used in LogicList
---@class LogicGhostToast : Logic
---@field toast_timer integer @default 90
LogicGhostToast = {}

---Used in StateMemory
---@class LogicList
---@field apep_spawner LogicApepTrigger|nil @Triggers and spawns Apep only in rooms set as ROOM_TEMPLATE.APEP
---@field arena_1 LogicArena1|nil @Handles create spawns and more, is cleared as soon as the winner is decided (on last player alive)
---@field arena_2 Logic|nil
---@field arena_3 Logic|nil @Handles time end death
---@field arena_alien_blast LogicArenaAlienBlast|nil
---@field arena_loose_bombs LogicArenaLooseBombs|nil
---@field basecamp_speedrun LogicBasecampSpeedrun|nil @Keep track of time, player position passing official
---@field black_market Logic|nil @Changes the camera bounds when you reach black market
---@field bubbler LogicTiamatBubbles|nil @Spawn rising bubbles at Tiamat (position hardcoded)
---@field city_of_gold_ankh_sacrifice LogicCOGAnkhSacrifice|nil @All it does is it runs transition to Duat after time delay (sets the state next theme etc. and state.items for proper player respawn)
---@field diceshop LogicDiceShop|nil
---@field discovery_info Logic|nil @black market, vlad, wet fur discovery, logic shows the toast
---@field duat_bosses_spawner Logic|nil
---@field ghost_toast_trigger LogicGhostToast|nil
---@field ghost_trigger Logic|nil @It's absence is the only reason why ghost doesn't spawn at boss levels or CO
---@field jellyfish_trigger Logic|nil
---@field magmaman_spawn LogicMagmamanSpawn|nil
---@field olmec_cutscene LogicOlmecCutscene|nil
---@field ouroboros LogicOuroboros|nil
---@field tiamat_cutscene LogicTiamatCutscene|nil
---@field tun_aggro Logic|nil @Spawns tun at the door at 30s mark
---@field tun_moon_challenge LogicMoonChallenge|nil
---@field tun_pre_challenge LogicTunPreChallenge|nil
---@field tun_star_challenge LogicStarChallenge|nil
---@field tun_sun_challenge LogicSunChallenge|nil
---@field tusk_pleasure_palace LogicTuskPleasurePalace|nil @Triggers aggro on everyone when non-high roller enters door
---@field tutorial LogicTutorial|nil @Handles dropping of the torch and rope in intro routine (first time play)
---@field water_bubbles LogicUnderwaterBubbles|nil @Only the bubbles that spawn from the floor (no border tiles, checks decoration flag), also spawn droplets falling from ceiling Even without it, entities moving in water still spawn bubbles
LogicList = {}

---This only properly constructs the base class
---you may still need to initialise the parameters correctly
---@param idx LOGIC
---@return any
function LogicList:start_logic(idx) end

---@param idx LOGIC
---@overload fun(self: LogicList, log: Logic|nil)
function LogicList:stop_logic(idx) end

---Used in LogicList
---@class LogicMagmamanSpawn : Logic
---@field magmaman_positions MagmamanSpawnPosition[]
LogicMagmamanSpawn = {}

---@param x integer
---@param y integer
---@overload fun(self: LogicMagmamanSpawn, ms: MagmamanSpawnPosition)
function LogicMagmamanSpawn:add_spawn(x, y) end

---@param x integer
---@param y integer
---@overload fun(self: LogicMagmamanSpawn, ms: MagmamanSpawnPosition)
function LogicMagmamanSpawn:remove_spawn(x, y) end

---Used in LogicList
---@class LogicMoonChallenge : Logic, LogicChallenge
---@field mattock_uid integer @entity uid
LogicMoonChallenge = {}

---Used in LogicList
---@class LogicOlmecCutscene : Logic
---@field cinematic_anchor Entity|nil
---@field fx_olmecpart_large Entity|nil
---@field olmec Entity|nil
---@field player Entity|nil
---@field timer integer
LogicOlmecCutscene = {}

---Used in LogicList
---@class LogicOuroboros : Logic
---@field sound SoundMeta|nil
---@field timer integer
LogicOuroboros = {}

---Used in LogicList
---@class LogicStarChallenge : Logic, LogicChallenge
---@field start_countdown integer
---@field torches Entity[]
LogicStarChallenge = {}

---Used in LogicList
---@class LogicSunChallenge : Logic, LogicChallenge
---@field start_countdown integer
LogicSunChallenge = {}

---Used in LogicList
---@class LogicTiamatBubbles : Logic
---@field bubble_spawn_timer integer
LogicTiamatBubbles = {}

---Used in LogicList
---@class LogicTiamatCutscene : Logic
---@field cinematic_anchor Entity|nil
---@field player Entity|nil
---@field tiamat Entity|nil
---@field timer integer
LogicTiamatCutscene = {}

---Used in LogicList
---@class LogicTunPreChallenge : Logic
---@field tun_uid integer
LogicTunPreChallenge = {}

---Used in LogicList
---@class LogicTuskPleasurePalace : Logic
---@field locked_door integer
LogicTuskPleasurePalace = {}

---Used in LogicList
---@class LogicTutorial : Logic
---@field pet_tutorial Entity|nil
---@field timer integer
LogicTutorial = {}

---Used in LogicList
---@class LogicUnderwaterBubbles : Logic
---@field droplets_enabled boolean @Enable/disable spawn of ENT_TYPE.FX_WATER_DROP from ceiling (or ground if liquid gravity is inverse)
---@field droplets_spawn_chance integer @It's inverse chance, so the lower the number the higher the chance, values below 10 may crash the game
---@field gravity_direction number @1.0 = normal, -1.0 = inversed, other values have undefined behavior this value basically have to be the same as return from `ThemeInfo:get_liquid_gravity()`
LogicUnderwaterBubbles = {}

---@class LogicalAnchovyFlock : Entity
---@field current_speed number @Increases until max_speed reached
---@field max_speed number
---@field timer integer
LogicalAnchovyFlock = {}

---@class LogicalConveyorbeltSound : Entity, LogicalSound
LogicalConveyorbeltSound = {}

---@class LogicalDoor : Entity
---@field door_type ENT_TYPE @Spawns this entity when not covered by floor. Must be initialized to valid ENT_TYPE before revealed, or crashes the game.
---@field platform_spawned boolean @Set automatically when tile below is not covered by floor. Unset to force the platform to spawn if it was never covered in the first place.
---@field platform_type ENT_TYPE @Spawns this entity below when tile below is uncovered. Doesn't spawn anything if it was never covered by floor, unless platform_spawned is set to false. Must be initialized to valid ENT_TYPE before revealed, or crashes the game.
---@field visible boolean @Set automatically when not covered by floor.
LogicalDoor = {}

---@class LogicalDrain : Entity
---@field timer integer @Little delay between pulling blob of liquid thru
LogicalDrain = {}

---@class LogicalLiquidStreamSound : Entity, LogicalSound, LogicalStaticSound
---@field liquid_intensity number @Just the parameter for sound in LogicalSound
LogicalLiquidStreamSound = {}

---@class LogicalMiniGame : Entity
---@field timer integer @Delay between spawning ufo
LogicalMiniGame = {}

---@class LogicalRegeneratingBlock : Entity
---@field timer integer
LogicalRegeneratingBlock = {}

---@class LogicalSound : Entity
---@field sound SoundMeta|nil
LogicalSound = {}

---@class LogicalStaticSound : Entity, LogicalSound
LogicalStaticSound = {}

---@class LogicalTrapTrigger : Entity
---@field min_empty_distance integer @Used in BigSpearTrap when it has to have minimum 2 free spaces to be able to trigger, value in tiles
---@field trigger_distance integer @Value in tiles
---@field vertical boolean
LogicalTrapTrigger = {}

---@class MagmaMan : Entity, Movable, PowerupCapable, Monster
---@field alive_timer integer
---@field emitted_light Illumination|nil
---@field jump_timer integer
---@field particle ParticleEmitterInfo|nil
---@field sound SoundMeta|nil
MagmaMan = {}

---Used in LogicMagmamanSpawn
---@class MagmamanSpawnPosition
---@field timer integer
---@field x integer
---@field y integer
MagmamanSpawnPosition = {}

---@param x_ integer
---@param y_ integer
---@return MagmamanSpawnPosition
function MagmamanSpawnPosition.new(x_, y_) end

---@class MainExit : Entity, Floor, Door, ExitDoor
---@field door_blocker Entity|nil @Normally `FX_MAIN_EXIT_DOOR` but setting any entity here will block the door
---@field sound SoundMeta|nil
MainExit = {}

---@class Mantrap : Entity, Movable, PowerupCapable, Monster
---@field eaten_uid integer @the uid of the entity the mantrap has eaten, in case it can break out, like a shopkeeper
---@field walk_pause_timer integer @alternates between walking and pausing every time it reaches zero
Mantrap = {}

---@class Mattock : Entity, Movable, Purchasable
---@field remaining integer
Mattock = {}

---@class Mech : Entity, Movable, PowerupCapable, Mount
---@field breaking_wall boolean
---@field crouch_walk_sound SoundMeta|nil
---@field explosion_sound SoundMeta|nil
---@field gun_cooldown integer
---@field walking boolean
Mech = {}

---@class MegaJellyfish : Entity, Movable, PowerupCapable, Monster
---@field applied_velocity number
---@field flipper1 Entity|nil
---@field flipper2 Entity|nil
---@field flipper_distance integer @only applies to door-blocking one
---@field orb_uid integer @game checks if this uid, and two following exist, if not, the Jellyfish starts chasing player
---@field sound SoundMeta|nil
---@field tail_bg_uid integer
---@field velocity_application_timer integer
---@field wagging_tail_counter number
MegaJellyfish = {}

---@class MegaJellyfishEye : Entity, Movable
---@field timer integer
MegaJellyfishEye = {}

---@class MenuScreenPanels
---@field bottom_left_text STRINGID
---@field bottom_middle_text STRINGID
---@field bottom_right_text STRINGID
---@field bottom_woodpanel TextureRenderingInfo
---@field bottom_woodpanel_speed_multiplayer number
---@field bottom_woodpanel_visible boolean
---@field bottom_woodpanel_y_offset number
---@field capitalize_scroll_text boolean
---@field scroll TextureRenderingInfo
---@field scroll_text STRINGID
---@field scroll_unfurl_progress number
---@field toggle_woodpanel_slidein_animation boolean
---@field top_woodpanel TextureRenderingInfo
---@field top_woodpanel_left_scrollhandle TextureRenderingInfo
---@field top_woodpanel_right_scrollhandle TextureRenderingInfo
---@field top_woodpanel_visible boolean
---@field woodpanels_progress number
---@field woodpanels_velocity number
MenuScreenPanels = {}

---@class MiniGameAsteroid : Entity, Movable
---@field spin_speed number
MiniGameAsteroid = {}

---@class MiniGameShip : Entity, Movable
---@field sound SoundMeta|nil
---@field swing number
---@field up_down_normal number @0.0 - down, 1.0 - up, 0.5 - idle
---@field velocity_x number
---@field velocity_y number
MiniGameShip = {}

---@class MiniGameShipOffset : Entity, Movable
---@field normal_y_offset number @Is added to offset_y
---@field offset_x number
---@field offset_y number
MiniGameShipOffset = {}

---@class Mole : Entity, Movable, PowerupCapable, Monster
---@field burrow_dir_x number
---@field burrow_dir_y number
---@field burrowing_in_uid integer @stores the last uid as well
---@field burrowing_particle ParticleEmitterInfo|nil
---@field burrowing_sound SoundMeta|nil
---@field countdown_for_appearing integer
---@field counter_burrowing integer
---@field counter_nonburrowing integer
---@field digging_state integer @0 - non_burrowed, 1 - unknown, 2 - burrowed, 3 - state_change
---@field nonburrowing_sound SoundMeta|nil
Mole = {}

---@class Monkey : Entity, Movable, PowerupCapable, Monster
---@field jump_timer integer
---@field on_vine boolean
---@field sound SoundMeta|nil
Monkey = {}

---@class Monster : Entity, Movable, PowerupCapable
---@field chased_target_uid integer
---@field target_selection_timer integer
Monster = {}

---@class Mosquito : Entity, Movable, PowerupCapable, Monster
---@field direction_x number
---@field direction_y number
---@field sound SoundMeta|nil
---@field stuck_rel_pos_x number
---@field stuck_rel_pos_y number
---@field timer integer
Mosquito = {}

---@class MotherStatue : Entity, Floor
---@field eggplantchild_detected boolean
---@field eggplantchild_timer integer
---@field player1_health_received boolean
---@field player1_health_timer integer
---@field player1_standing boolean
---@field player2_health_received boolean
---@field player2_health_timer integer
---@field player2_standing boolean
---@field player3_health_received boolean
---@field player3_health_timer integer
---@field player3_standing boolean
---@field player4_health_received boolean
---@field player4_health_timer integer
---@field player4_standing boolean
---@field players_health_received boolean[] @Table of player1_health_received, player2_health_received, ... etc.
---@field players_health_timer integer[] @Table of player1_health_timer, player2_health_timer, ... etc.
---@field players_standing boolean[] @Table of player1_standing, player2_standing, ... etc.
MotherStatue = {}

---@class Mount : Entity, Movable, PowerupCapable
---@field can_doublejump boolean
---@field rider_uid integer
---@field sound SoundMeta|nil
---@field tamed boolean
---@field taming_timer integer
---@field walk_pause_timer integer
Mount = {}

---@param rider Movable|nil
function Mount:carry(rider) end

---@return SOUNDID
function Mount:get_attack_sound() end

---@param double_jump boolean
---@return SOUNDID
function Mount:get_jump_sound(double_jump) end

---@return SOUNDID
function Mount:get_mounting_sound() end

---@param offset Vec2
---@return Vec2
function Mount:get_rider_offset(offset) end

---@param value Vec2
---@return Vec2
function Mount:get_rider_offset_crouching(value) end

---@return SOUNDID
function Mount:get_untamed_loop_sound() end

---@return SOUNDID
function Mount:get_walking_sound() end

function Mount:remove_rider() end

---@param value boolean
function Mount:tame(value) end

---@return boolean
function Mount:used_double_jump() end

---@class Movable : Entity
---@field buttons BUTTON
---@field buttons_previous BUTTON
---@field current_animation Animation|nil
---@field cutscene CutsceneBehavior|nil
---@field dark_shadow_timer integer
---@field dont_damage_owner_timer integer @When > 0, will not deal damage to the owner_uid, so that throwing an object does not harm yourself.
---@field exit_gold_invincibility_timer integer @When > 0, money intersecting a door or at a pipe entrance will not be collected. Also gives iframes from monster collision.
---@field exit_invincibility_timer integer
---@field falling_timer integer
---@field frozen_timer integer
---@field health integer
---@field holding_uid integer
---@field idle_counter integer
---@field invincibility_frames_timer integer
---@field jump_height_multiplier number @EntityDB.jump gets multiplied by this to get the jump
---@field knockback_invincibility_timer integer @Will not apply velocity from various sources when >0. Can be ignored by certain damage flags, so will not be invincible from knockback of all damage types.
---@field last_owner_uid integer
---@field last_state integer
---@field lock_input_timer integer @Related to taking damage, also drops you from ladder/rope, can't be set while on the ground unless you're on a mount
---@field move Vec2 @{movex, movey}
---@field move_state integer
---@field movex number @Move directions (-1.0 to 1.0) that represent in whit direction the entity want's to move
---@field movey number @Move directions (-1.0 to 1.0) that represent in whit direction the entity want's to move
---@field onfire_effect_timer integer
---@field owner_uid integer
---@field poison_tick_timer integer @Used to apply damage from poison, can be set to -1 to cure poison, to set poison use [poison_entity](https://spelunky-fyi.github.io/overlunky/#poison_entity)
---@field price integer
---@field reset_owner_timer integer @Timer for resetting owner_uid.
---@field some_state integer
---@field stand_counter integer
---@field standing_on_uid integer
---@field state integer
---@field stun_state integer
---@field stun_timer integer
---@field velocityx number @speed, can be relative to the platform you standing on (pushblocks, elevators), use [get_velocity](https://spelunky-fyi.github.io/overlunky/#get_velocity) to get accurate speed in the game world
---@field velocityy number @speed, can be relative to the platform you standing on (pushblocks, elevators), use [get_velocity](https://spelunky-fyi.github.io/overlunky/#get_velocity) to get accurate speed in the game world
---@field wet_effect_timer integer
Movable = {}

---Add a behavior to this movable, can be either a `VanillaMovableBehavior` or a
---`CustomMovableBehavior`
---@param movable Movable|nil
---@param behavior MovableBehavior|nil
function Movable.add_behavior(movable, behavior) end

---Mostly used for ragdoll by the game
---@param velocities Vec2|nil
---@param ignore_weight boolean
function Movable:apply_velocity(velocities, ignore_weight) end

---Runs on contact damage, returns false if there wasn't any interaction (called from on_collision2, will be called as long as the hitboxes overlap)
---@param victim Entity|nil
---@return boolean
function Movable:attack(victim) end

---@param camera_shake boolean
---@param block Entity|nil
function Movable:break_block(camera_shake, block) end

---@param dont_ignore_liquid boolean
---@return number
function Movable:calculate_jump_velocity(dont_ignore_liquid) end

---@param entity_picking_up Entity|nil
---@param p2 boolean
---@return boolean
function Movable:can_be_picked_up_by(entity_picking_up, p2) end

---@param horizontal boolean
---@param block Entity|nil
---@return boolean
function Movable:can_break_block(horizontal, block) end

---Return true if the entity is allowed to jump, even midair. Return false and can't jump, except from ladders apparently.
---@return boolean
function Movable:can_jump() end

---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
---@param movable Movable|nil
---@param behavior MovableBehavior|nil
function Movable.clear_behavior(movable, behavior) end

---Clears all behaviors of this movable, need to call `add_behavior` to avoid crashing
---@param movable Movable|nil
function Movable.clear_behaviors(movable) end

function Movable:clear_cutscene() end

---@param callback_id integer
function Movable:clear_virtual(callback_id) end

---Adds or subtracts the specified amount of money to the movable's (player's) inventory. Shows the calculation animation in the HUD. Adds treasure to the inventory list shown on transition. Use the global add_money to add money without adding specific treasure.
---@param value integer
---@param treasure ENT_TYPE
---@return boolean
function Movable:collect_treasure(value, treasure) end

---Entities must be of the same type!
---@param clone Entity|nil
---@param some_entity_uid integer
function Movable:copy_extra_info(clone, some_entity_uid) end

---@param damage_dealer_uid integer
---@param damage_amount integer
---@param stun_time integer
---@param velocity_x number
---@param velocity_y number
---@param iframes integer|nil
---@return boolean
---@overload fun(self: Movable, damage_dealer: Entity|nil, damage_amount: integer, damage_flags: DAMAGE_TYPE, velocity: Vec2|nil, unknown_damage_phase: integer, stun_amount: integer, iframes: integer, unknown_is_final: boolean): boolean
function Movable:damage(damage_dealer_uid, damage_amount, stun_time, velocity_x, velocity_y, iframes) end

---Called when dropping or throwing
function Movable:drop() end

---Sets the `frozen_timer`, the param `ignore_lava` doesn't do much, just skips the liquid check,
---if in lava the game will set `frozen_timer` to 0 immediately most of the time
---@param framecount integer
---@param ignore_lava boolean
---@overload fun(self: Movable, frame_count: integer)
function Movable:freeze(framecount, ignore_lava) end

---Move a movable according to its velocity, update physics, gravity, etc.
---Will also update `movable.animation_frame` and various timers and counters
---@param movable Movable|nil
---@overload fun(movable: Movable|nil, disable_gravity: boolean)
---@overload fun(movable: Movable|nil, move: Vec2, sprint_factor: number, disable_gravity: boolean, on_rope: boolean)
function Movable.generic_update_world(movable) end

---Get all available behavior ids
---@return integer[]
function Movable:get_all_behaviors() end

---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`
---@param movable Movable|nil
---@param state_id integer
---@return VanillaMovableBehavior|nil
function Movable.get_base_behavior(movable, state_id) end

---Get the current behavior id
---@return integer
function Movable:get_behavior() end

---Returns the damage that the entity deals
---@return integer
function Movable:get_damage() end

---returns sound id for the damage taken, return 0 to make it silence
---@param damage DAMAGE_TYPE
---@return SOUNDID
function Movable:get_damage_sound(damage) end

---@param button BUTTON
---@return boolean
function Movable:is_button_held(button) end

---@param button BUTTON
---@return boolean
function Movable:is_button_pressed(button) end

---@param button BUTTON
---@return boolean
function Movable:is_button_released(button) end

---@return boolean
function Movable:is_on_fire() end

---@return boolean
function Movable:is_poisoned() end

---@return boolean
function Movable:is_powerup_capable() end

---@overload fun(self: Movable, time: integer)
function Movable:light_on_fire() end

---@param entity_to_pick_up Entity|nil
function Movable:pick_up(entity_to_pick_up) end

---@param frames integer
function Movable:poison(frames) end

function Movable:process_input() end

---Remove the gravity hook and reset to defaults
function Movable:reset_gravity() end

---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
---@param behavior_id integer
---@return boolean
function Movable:set_behavior(behavior_id) end

---@param b boolean
---@param effect boolean
---@overload fun(self: Movable, b: boolean)
function Movable:set_cursed(b, effect) end

---Force the gravity for this entity. Will override anything set by special states like swimming too, unless you reset it. Default 1.0
---@param gravity number
function Movable:set_gravity(gravity) end

---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.
---@param to_x number
---@param to_y number
function Movable:set_position(to_x, to_y) end

---@param fun fun(self: Entity|nil, p2: number, vertical: boolean, p4: number) @Returning nil: ignored.
---@return integer
function Movable:set_post_apply_friction(fun) end

---@param fun fun(self: Entity|nil, p2: integer, p3: integer, p4: integer) @Returning nil: ignored.
---@return integer
function Movable:set_post_apply_movement(fun) end

---Mostly used for ragdoll by the game
---@param fun fun(self: Entity|nil, velocities: Vec2|nil, ignore_weight: boolean) @Returning nil: ignored.
---@return integer
function Movable:set_post_apply_velocity(fun) end

---Runs on contact damage, returns false if there wasn't any interaction (called from on_collision2, will be called as long as the hitboxes overlap)
---@param fun fun(self: Entity|nil, victim: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_attack(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_body_destruction(fun) end

---@param fun fun(self: Entity|nil, camera_shake: boolean, block: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_break_block(fun) end

---@param fun fun(self: Entity|nil, dont_ignore_liquid: boolean) @Returning nil: ignored.
---@return integer
function Movable:set_post_calculate_jump_velocity(fun) end

---@param fun fun(self: Entity|nil, entity_picking_up: Entity|nil, p3: boolean) @Returning nil: ignored.
---@return integer
function Movable:set_post_can_be_picked_up_by(fun) end

---@param fun fun(self: Entity|nil, horizontal: boolean, block: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_can_break_block(fun) end

---Return true if the entity is allowed to jump, even midair. Return false and can't jump, except from ladders apparently.
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_can_jump(fun) end

---Disable to not get killed outside level bounds.
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_check_out_of_bounds(fun) end

---Entities must be of the same type!
---@param fun fun(self: Entity|nil, clone: Entity|nil, some_entity_uid: integer) @Returning nil: ignored.
---@return integer
function Movable:set_post_cloned_to(fun) end

---Adds or subtracts the specified amount of money to the movable's (player's) inventory. Shows the calculation animation in the HUD. Adds treasure to the inventory list shown on transition. Use the global add_money to add money without adding specific treasure.
---@param fun fun(self: Entity|nil, value: integer, treasure: integer) @Returning nil: ignored.
---@return integer
function Movable:set_post_collect_treasure(fun) end

---@param fun fun(self: Entity|nil, p2: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_crush(fun) end

---Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities. `damage_dealer` can be set to nil.
---Returns: true if entity was affected (for stuff like: if pot was thrown into entity, should that pot break after hit), false if the event should be ignored by damage_dealer
---@param fun fun(self: Entity|nil, damage_dealer: Entity|nil, damage_amount: integer, damage_flags: integer, velocity: Vec2|nil, unknown_damage_phase: integer, stun_amount: integer, iframes: integer, unknown_is_final: boolean) @Returning nil: ignored.
---@return integer
function Movable:set_post_damage(fun) end

---Called when dropping or throwing
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_drop(fun) end

---Applies gravity to entity. Disable to float like on hoverpack.
---@param fun fun(self: Entity|nil, p2: number) @Returning nil: ignored.
---@return integer
function Movable:set_post_fall(fun) end

---Sets the `frozen_timer`, the param `ignore_lava` doesn't do much, just skips the liquid check,
---if in lava the game will set `frozen_timer` to 0 immediately most of the time
---@param fun fun(self: Entity|nil, framecount: integer, ignore_lava: boolean) @Returning nil: ignored.
---@return integer
function Movable:set_post_freeze(fun) end

---Only for landing on the floor or activefloor, generates "poof" particle and plays sfx (note: when stunned, sfx is played by the damage function)
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_generate_landing_effects(fun) end

---Returns the damage that the entity deals
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_get_damage(fun) end

---returns sound id for the damage taken, return 0 to make it silence
---@param fun fun(self: Entity|nil, damage: integer) @Returning nil: ignored.
---@return integer
function Movable:set_post_get_damage_sound(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_initialize(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_is_on_fire(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_is_powerup_capable(fun) end

---Does not damage entity
---@param fun fun(self: Entity|nil, time: integer) @Returning nil: ignored.
---@return integer
function Movable:set_post_light_on_fire(fun) end

---Hit by broken arrows etc that don't deal damage, calls damage with 0 damage.
---@param fun fun(self: Entity|nil, damage_dealer: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_on_hit(fun) end

---@param fun fun(self: Entity|nil, entity_to_pick_up: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_pick_up(fun) end

---Called for entity that just has been picked up
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_picked_up(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_process_input(fun) end

---Called for entity that just has been thrown/dropped
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_release(fun) end

---@param fun fun(self: Entity|nil, b: boolean, effect: boolean) @Returning nil: ignored.
---@return integer
function Movable:set_post_set_cursed(fun) end

---@param fun fun(self: Entity|nil, entity_uid: integer) @Returning nil: ignored.
---@return integer
function Movable:set_post_set_standing_on(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_sprint_factor(fun) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_standing_on(fun) end

---@param fun fun(self: Entity|nil, stomper: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_stomped_by(fun) end

---@param fun fun(self: Entity|nil, framecount: integer) @Returning nil: ignored.
---@return integer
function Movable:set_post_stun(fun) end

---@param fun fun(self: Entity|nil, thrower: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_thrown_by(fun) end

---Same as above, but for being thrown into something and potentially dealing damage that way
---@param fun fun(self: Entity|nil, victim: Entity|nil) @Returning nil: ignored.
---@return integer
function Movable:set_post_thrown_into(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Movable:set_post_virtual(index, fun) end

---@param fun fun(self: Entity|nil, p2: boolean) @Returning nil: ignored.
---@return integer
function Movable:set_post_web_collision(fun) end

---@param fun fun(self: Entity|nil, p2: number, vertical: boolean, p4: number): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_apply_friction(fun) end

---@param fun fun(self: Entity|nil, p2: integer, p3: integer, p4: integer): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_apply_movement(fun) end

---Mostly used for ragdoll by the game
---@param fun fun(self: Entity|nil, velocities: Vec2|nil, ignore_weight: boolean): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_apply_velocity(fun) end

---Runs on contact damage, returns false if there wasn't any interaction (called from on_collision2, will be called as long as the hitboxes overlap)
---@param fun fun(self: Entity|nil, victim: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_attack(fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_body_destruction(fun) end

---@param fun fun(self: Entity|nil, camera_shake: boolean, block: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_break_block(fun) end

---@param fun fun(self: Entity|nil, dont_ignore_liquid: boolean): number|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_calculate_jump_velocity(fun) end

---@param fun fun(self: Entity|nil, entity_picking_up: Entity|nil, p3: boolean): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_can_be_picked_up_by(fun) end

---@param fun fun(self: Entity|nil, horizontal: boolean, block: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_can_break_block(fun) end

---Return true if the entity is allowed to jump, even midair. Return false and can't jump, except from ladders apparently.
---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_can_jump(fun) end

---Disable to not get killed outside level bounds.
---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_check_out_of_bounds(fun) end

---Entities must be of the same type!
---@param fun fun(self: Entity|nil, clone: Entity|nil, some_entity_uid: integer): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_cloned_to(fun) end

---Adds or subtracts the specified amount of money to the movable's (player's) inventory. Shows the calculation animation in the HUD. Adds treasure to the inventory list shown on transition. Use the global add_money to add money without adding specific treasure.
---@param fun fun(self: Entity|nil, value: integer, treasure: integer): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_collect_treasure(fun) end

---@param fun fun(self: Entity|nil, p2: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_crush(fun) end

---Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities. `damage_dealer` can be set to nil.
---Returns: true if entity was affected (for stuff like: if pot was thrown into entity, should that pot break after hit), false if the event should be ignored by damage_dealer
---@param fun fun(self: Entity|nil, damage_dealer: Entity|nil, damage_amount: integer, damage_flags: integer, velocity: Vec2|nil, unknown_damage_phase: integer, stun_amount: integer, iframes: integer, unknown_is_final: boolean): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_damage(fun) end

---Called when dropping or throwing
---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_drop(fun) end

---Applies gravity to entity. Disable to float like on hoverpack.
---@param fun fun(self: Entity|nil, p2: number): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_fall(fun) end

---Sets the `frozen_timer`, the param `ignore_lava` doesn't do much, just skips the liquid check,
---if in lava the game will set `frozen_timer` to 0 immediately most of the time
---@param fun fun(self: Entity|nil, framecount: integer, ignore_lava: boolean): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_freeze(fun) end

---Only for landing on the floor or activefloor, generates "poof" particle and plays sfx (note: when stunned, sfx is played by the damage function)
---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_generate_landing_effects(fun) end

---Returns the damage that the entity deals
---@param fun fun(self: Entity|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_get_damage(fun) end

---returns sound id for the damage taken, return 0 to make it silence
---@param fun fun(self: Entity|nil, damage: integer): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_get_damage_sound(fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_initialize(fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_is_on_fire(fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_is_powerup_capable(fun) end

---Does not damage entity
---@param fun fun(self: Entity|nil, time: integer): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_light_on_fire(fun) end

---Hit by broken arrows etc that don't deal damage, calls damage with 0 damage.
---@param fun fun(self: Entity|nil, damage_dealer: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_on_hit(fun) end

---@param fun fun(self: Entity|nil, entity_to_pick_up: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_pick_up(fun) end

---Called for entity that just has been picked up
---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_picked_up(fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_process_input(fun) end

---Called for entity that just has been thrown/dropped
---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_release(fun) end

---@param fun fun(self: Entity|nil, b: boolean, effect: boolean): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_set_cursed(fun) end

---@param fun fun(self: Entity|nil, entity_uid: integer): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_set_standing_on(fun) end

---@param fun fun(self: Entity|nil): number|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_sprint_factor(fun) end

---@param fun fun(self: Entity|nil): Entity|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_standing_on(fun) end

---@param fun fun(self: Entity|nil, stomper: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_stomped_by(fun) end

---@param fun fun(self: Entity|nil, framecount: integer): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_stun(fun) end

---@param fun fun(self: Entity|nil, thrower: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_thrown_by(fun) end

---Same as above, but for being thrown into something and potentially dealing damage that way
---@param fun fun(self: Entity|nil, victim: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function Movable:set_pre_thrown_into(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Movable:set_pre_virtual(index, fun) end

---@param fun fun(self: Entity|nil, p2: boolean): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Movable:set_pre_web_collision(fun) end

---@return Entity|nil
function Movable:standing_on() end

---@param framecount integer
function Movable:stun(framecount) end

---Same as above, but for being thrown into something and potentially dealing damage that way
---@param victim Entity|nil
---@return boolean
function Movable:thrown_into(victim) end

---Opaque handle to a movable behavior used in some Movable functions
---@class MovableBehavior
MovableBehavior = {}

---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.
---@param behavior MovableBehavior|nil
---@return integer
function MovableBehavior.get_state_id(behavior) end

---@class MovingIcon : Entity, Movable
---@field movement_timer integer @Used to move it up and down in sync with others
MovingIcon = {}

---@class Mummy : Entity, Movable, PowerupCapable, Monster
---@field walk_pause_timer integer
Mummy = {}

---@class MummyFliesSound : Entity, LogicalSound
---@field flies integer @Numbers of flies spawned
---@field mummy_uid integer
MummyFliesSound = {}

---@class NPC : Entity, Movable, PowerupCapable, Monster
---@field aggro boolean @for bodyguard and shopkeeperclone it spawns a weapon as well
---@field ai_state integer
---@field climb_direction number
---@field target_in_sight_timer integer
NPC = {}

---@return boolean
function NPC:should_attack_on_sight() end

---@return ENT_TYPE
function NPC:weapon_type() end

---@class Necromancer : Entity, Movable, PowerupCapable, Monster, WalkingMonster
---@field red_skeleton_spawn_x number
---@field red_skeleton_spawn_y number
---@field resurrection_timer integer
---@field resurrection_uid integer
---@field sound SoundMeta|nil
---@field target_layer integer
Necromancer = {}

---@class Octopus : Entity, Movable, PowerupCapable, Monster, WalkingMonster
Octopus = {}

---@class Olmec : Entity, Movable
---@field ai_timer integer @general timer that counts down whenever olmec is active
---@field attack_phase integer @0 = stomp, 1 = bombs, 2 = stomp+ufos, 3 = in lava
---@field attack_timer integer @in phase 0/2: time spent looking for player, in phase 1: time between bomb salvo
---@field jump_timer integer
---@field move_direction integer @-1 = left, 0 = down, 1 = right, phase 0/2: depends on target, phase 1: travel direction
---@field phase1_amount_of_bomb_salvos integer
---@field sound SoundMeta|nil
---@field target_uid integer
---@field unknown_attack_state integer
Olmec = {}

---@return integer
function Olmec:broken_floaters() end

---@class OlmecCannon : Entity, Movable
---@field bombs_left integer
---@field timer integer
OlmecCannon = {}

---@param callback_id integer
function OlmecCannon:clear_virtual(callback_id) end

---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function OlmecCannon:set_post_spawn_projectile(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function OlmecCannon:set_post_virtual(index, fun) end

---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function OlmecCannon:set_pre_spawn_projectile(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function OlmecCannon:set_pre_virtual(index, fun) end

function OlmecCannon:spawn_projectile() end

---@class OlmecFloater : Entity, Movable
---@field both_floaters_intact boolean
---@field on_breaking boolean
OlmecFloater = {}

---@class OlmecShip : Entity, Movable
---@field door_fx Entity|nil
---@field flight_time integer
---@field has_spawned_jetflames boolean
---@field smoke ParticleEmitterInfo|nil
---@field sound SoundMeta|nil
OlmecShip = {}

---@class Olmite : Entity, Movable, PowerupCapable, Monster, WalkingMonster
---@field armor_on boolean
---@field attack_cooldown_timer integer
---@field in_stack boolean @disables the attack, stun, lock's looking left flag between stack
---@field in_stack2 boolean @is set to false couple frame after being detached from stack
---@field on_top_uid integer
---@field y_offset number
Olmite = {}

---@class OnFireEffect : Entity
---@field illumination Illumination|nil
---@field particle_flame ParticleEmitterInfo|nil
---@field particle_smoke ParticleEmitterInfo|nil
OnFireEffect = {}

---Can be accessed via global [online](https://spelunky-fyi.github.io/overlunky/#online)
---@class Online
---@field lobby OnlineLobby
---@field local_player OnlinePlayer
---@field online_players OnlinePlayer[]
Online = {}

---@return boolean
function Online:is_active() end

---Used in Online
---@class OnlineLobby
---@field code integer
---@field local_player_slot integer
OnlineLobby = {}

---Gets the string equivalent of the code
---@return string
function OnlineLobby:get_code() end

---@class OnlineLobbyScreenPlayer
---@field character integer @0 - Ana Spelunky, 1 - Margaret Tunnel, 2 - Colin Northward, 3 - Roffy D. Sloth.. and so on. Same order as in ENT_TYPE
---@field platform_icon integer @16 = PC, 17 = Discord, 18 = Steam, 19 = Xbox, 32 = switch, 48 = PS, 49 = PS again?
---@field ready boolean
---@field searching boolean
OnlineLobbyScreenPlayer = {}

---Used in Online
---@class OnlinePlayer
---@field character integer
---@field game_mode GAME_MODE
---@field platform PLATFORM
---@field player_name string
---@field ready_state READY_STATE
OnlinePlayer = {}

---@class Orb : Entity, Movable
---@field sound SoundMeta|nil
---@field timer integer
Orb = {}

---@class OsirisHand : Entity, Movable, PowerupCapable, Monster
---@field attack_cooldown_timer integer
OsirisHand = {}

---@class OsirisHead : Entity, Movable, PowerupCapable, Monster
---@field invincibility_timer integer
---@field left_hand_uid integer
---@field moving_left boolean
---@field oscillation_phase integer
---@field right_hand_uid integer @right from his perspective
OsirisHead = {}

---@class OuroboroCameraAnchor : Entity
---@field target_x number
---@field target_y number
---@field velocity_x number
---@field velocity_y number
OuroboroCameraAnchor = {}

---@class OuroboroCameraZoomin : Entity
---@field zoomin_level number @Can be set to negative, seams to trigger the warp at some value
OuroboroCameraZoomin = {}

---Used to get and set Overlunky settings in Bucket
---@class Overlunky
---@field hovered_uid integer @Currently hovered entity uid or -1 if nothing is hovered.
---@field ignore_features string[] @TODO: Disable Overlunky features. Doesn't do anything yet.
---@field ignore_keycodes KEY[] @Disable keys that may or may not be used by Overlunky. You should probably write the keycodes you need here just in case if you think using OL will interfere with your keybinds.
---@field ignore_keys string[] @Disable some key bindings in Overlunky, whatever key they are actually bound to. Remember this might not be bound to the default any more, so only use this if you also plan on overriding the current keybinding, or just need to disable some feature and don't care what key it is bound on.
---@field keys table<string, KEY> @Current Overlunky key bindings. Read only. You can use this to bind some custom feature to the same unknown key as currently bound by the user.
---@field options table<string, boolean|integer|number|string> @Current Overlunky options. Read only.
---@field selected_uid integer @Currently selected uid in the entity picker or -1 if nothing is selected.
---@field selected_uids integer[] @Currently selected uids in the entity finder.
---@field set_options table<string, boolean|integer|number|string> @Write [some select options](https://github.com/search?q=repo%3Aspelunky-fyi%2Foverlunky+legal_options+language%3AC%2B%2B&type=code&l=C%2B%2B) here to change Overlunky options.
---@field set_selected_uid integer|nil @Set currently selected uid in the entity picker or -1 to clear selection.
---@field set_selected_uids integer[]|nil @Set currently selected uids in the entity finder.
Overlunky = {}

---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](https://spelunky-fyi.github.io/overlunky/#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](https://spelunky-fyi.github.io/overlunky/#prng)`.random`.
---@class PRNG
PRNG = {}

---@param type PRNG_CLASS
---@return integer
---@return integer
function PRNG:get_pair(type) end

---Drop-in replacement for `math.random()`
---@return number
---@overload fun(self: PRNG, i: integer): integer|nil
---@overload fun(self: PRNG, min: integer, max: integer): integer
function PRNG:random() end

---Returns true with a chance of `1/inverse_chance`
---@param inverse_chance integer
---@param type PRNG_CLASS
---@return boolean
function PRNG:random_chance(inverse_chance, type) end

---Generate a random floating point number in the range `[0, 1)`
---@param type PRNG_CLASS
---@return number
function PRNG:random_float(type) end

---Generate a integer number in the range `[1, i]` or `nil` if `i < 1`
---@param i integer
---@param type PRNG_CLASS
---@return integer|nil
function PRNG:random_index(i, type) end

---Generate a integer number in the range `[min, max]`
---@param min integer
---@param max integer
---@param type PRNG_CLASS
---@return integer
function PRNG:random_int(min, max, type) end

---Same as `seed_prng`
---@param seed integer
function PRNG:seed(seed) end

---@param type PRNG_CLASS
---@param first integer
---@param second integer
function PRNG:set_pair(type, first, second) end

---@class PalaceSign : Entity
---@field arrow_change_timer integer
---@field arrow_illumination Illumination|nil
---@field illumination Illumination|nil
---@field sound SoundMeta|nil @The neon buzz sound
PalaceSign = {}

---@class ParachutePowerup : Entity, Movable, Powerup
---@field deployed boolean
---@field falltime_deploy integer @this gets compared with entity's falling_timer
---@field gold_spawning_time integer @Time until gold nuggets stop spawning.
---@field gold_timer integer @Timer for spawning a single gold nugget.
ParachutePowerup = {}

function ParachutePowerup:deploy() end

---FMOD Studio descriptor for an event parameter. The descriptor
---includes metadata about the event parameter including
---name, behavior flags, parameter type, and information about
---the default, minimum, and maximum values for the event
---parameter. It also contains the event parameter identifier
---which can be useful if you need to update the value of the
---event parameter at a high frequency.
---@class ParameterDescription
---@field defaultvalue number
---@field flags integer
---@field id ParameterId
---@field maximum number
---@field minimum number
---@field name string
---@field type integer
ParameterDescription = {}

---FMOD Studio event parameter identifier. Can be retrieved with
---`CustomEventDescription:get_parameter_description_by_name().id`, or
---directly by using `CustomEventDescription:get_parameter_id_by_name()`.
---Can be used with `CustomEventInstance:set_parameter_by_id()`,
---`CustomEventInstance:set_parameter_by_id_with_label()`, and
---`CustomEventInstance:get_parameter_by_id()`. This is useful
---if you need to get or update an event parameter at a high
---frequency, since setting and getting parameters by ID do
---not require FMOD to perform a name to ID lookup internally
---like FMOD does when setting or getting parameters by name.
---@class ParameterId
---@field data1 integer
---@field data2 integer
ParameterId = {}

---Used in ParticleEmitterInfo
---@class Particle
---@field color uColor
---@field height number
---@field lifetime integer
---@field max_lifetime integer
---@field velocityx number
---@field velocityy number
---@field width number
---@field x number
---@field y number
Particle = {}

---Used in ParticleDB, [get_particle_type](https://spelunky-fyi.github.io/overlunky/#get_particle_type)
---@class ParticleDB
---@field animation_sequence_length integer
---@field blue integer
---@field green integer
---@field hor_deflection_1 number
---@field hor_deflection_2 number
---@field hor_scattering number
---@field hor_velocity number
---@field id PARTICLEEMITTER
---@field invisible boolean
---@field lifespan integer
---@field lifespan_min integer
---@field opacity number
---@field permanent boolean
---@field red integer
---@field rotation_speed number
---@field scale_x number
---@field scale_x_min number
---@field scale_y number
---@field scale_y_min number
---@field sheet_id integer
---@field shrink_growth_factor number
---@field spawn_count integer
---@field spawn_count_min integer
---@field spawn_interval number
---@field ver_deflection_1 number
---@field ver_deflection_2 number
---@field ver_scattering number
---@field ver_velocity number
ParticleDB = {}

---@param p1 ParticleDB
---@return ParticleDB
---@overload fun(p1: integer): ParticleDB
function ParticleDB.new(p1) end

---@return TEXTURE
function ParticleDB:get_texture() end

---@param texture_id TEXTURE
---@return boolean
function ParticleDB:set_texture(texture_id) end

---Generic type for creating particles in the game, you can make your own with [generate_world_particles](https://spelunky-fyi.github.io/overlunky/#generate_world_particles) or [generate_screen_particles](https://spelunky-fyi.github.io/overlunky/#generate_screen_particles)
---Used in ScreenCharacterSelect, ScreenTitle, CursedEffect, OnFireEffect, PoisonedEffect ...
---@class ParticleEmitterInfo
---@field draw_depth integer
---@field emitted_particles Particle[]
---@field emitted_particles_back_layer Particle[]
---@field entity_uid integer
---@field layer integer
---@field offset_x number
---@field offset_y number
---@field particle_count integer
---@field particle_count_back_layer integer
---@field particle_type ParticleDB|nil
---@field particle_type2 ParticleDB|nil
---@field x number
---@field y number
ParticleEmitterInfo = {}

---Control the pause API
---@class PauseAPI
---@field blocked boolean @Is true when PauseAPI is freezing the game.
---@field ignore_screen PAUSE_SCREEN @Bitmask for game SCREEN where the PRE_✱ pause types are ignored, even though enabled in `pause`. Can also use the special cases [FADE, EXIT] to unfreeze temporarily during fades (or other screen transitions where player input is probably impossible) or the level exit walk of shame.
---@field ignore_screen_trigger PAUSE_SCREEN @Bitmask for game SCREEN where the triggers are ignored.
---@field last_fade_timer integer @Fade timer stamp when fade triggers were last checked.
---@field last_instance boolean @Set to true to run pause logic and triggers only in the last API instance in the chain (Playlunky) when multiple instances of the API (Overlunky and Playlunky) are injected.
---@field last_trigger_frame integer @Global frame stamp when one of the triggers was last triggered, used to prevent running them again on the same frame on unpause.
---@field modifiers_block integer @Bitmask of modifier KEYs that will block all game input
---@field modifiers_clear_input boolean @Enable to clear affected input when modifiers are held, disable to ignore all input events, i.e. keep held button state as it was before pressing the modifier key
---@field modifiers_down integer @Bitmask of modifier KEYs that are currently held
---@field pause PAUSE_TYPE @Current pause state bitmask. Use custom PAUSE_TYPE.PRE_✱ (or multiple) to freeze the game at the specified callbacks automatically. Checked after the matching ON update callbacks, so can be set on the same callback you want to block at the latest. Vanilla PAUSE flags will be forwarded to state.pause, but use of vanilla PAUSE flags is discouraged and might not work with other PauseAPI features.
---@field pause_screen PAUSE_SCREEN @Bitmask to only enable PAUSE_TRIGGER.SCREEN during specific SCREEN, or any screen when NONE.
---@field pause_trigger PAUSE_TRIGGER @Bitmask for conditions when the current `pause_type` should be automatically enabled in `pause`, can have multiple conditions.
---@field pause_type PAUSE_TYPE @Pause mask to toggle when using the PauseAPI methods to set or get pause state.
---@field skip boolean @Set to true to unfreeze the game for one update cycle. Sets back to false after ON.POST_GAME_LOOP, so it can be used to check if current frame is a frame advance frame.
---@field skip_fade boolean @Set to true to skip all fade transitions, forcing fade_timer and fade_value to 0 on every update.
---@field unpause_screen PAUSE_SCREEN @Bitmask to only enable PAUSE_TRIGGER.SCREEN during specific SCREEN, or any screen when NONE.
---@field unpause_trigger PAUSE_TRIGGER @Bitmask for conditions when the current `pause_type` should be automatically disabled in `pause`, can have multiple conditions.
---@field update_camera boolean @Set to true to enable normal camera movement when the game is paused or frozen on a callback by PauseAPI.
PauseAPI = {}

---Sets skip
function PauseAPI:frame_advance() end

---Get the current pause flags
---@return PAUSE_TYPE
function PauseAPI:get_pause() end

---Is the game currently loading and PAUSE_SCREEN.LOADING would be triggered, based on state.loading and some arbitrary checks.
---@return boolean
function PauseAPI:loading() end

---Is the game currently paused and that pause state matches any of the current the pause_type
---@return boolean
function PauseAPI:paused() end

---Set the current pause flags
---@param flags PAUSE_TYPE
function PauseAPI:set_pause(flags) end

---Enable/disable the current pause_type flags in pause state
---@param enable boolean
---@return boolean
function PauseAPI:set_paused(enable) end

---Toggles pause state
---@return boolean
function PauseAPI:toggle() end

---@class PauseUI
---@field blurred_background TextureRenderingInfo
---@field buttons_actions integer[]
---@field buttons_movement integer[]
---@field confirmation_panel TextureRenderingInfo @Prompt background
---@field menu_slidein_progress number
---@field prompt_visible boolean
---@field scroll TextureRenderingInfo
---@field selected_option integer @It's set wh game displays the prompt
---@field visibility integer @0 - Invisible, 1 - Sliding down, 2 - Visible, 3 - Sliding up
---@field woodpanel_left TextureRenderingInfo
---@field woodpanel_middle TextureRenderingInfo
---@field woodpanel_right TextureRenderingInfo
---@field woodpanel_top TextureRenderingInfo
PauseUI = {}

---@class Pet : Entity, Movable, PowerupCapable, Monster
---@field active_state integer @-1 = sitting and yelling, 0 = either running, dead or picked up
---@field func_timer integer @used when free running in the camp
---@field fx_button Entity|nil
---@field petted_counter integer @number of times petted in the camp
---@field petting_by_uid integer @person whos petting it, only in the camp
---@field sit_cooldown_timer integer @Cooldown before sitting again when colliding with a player in the camp.
---@field sit_timer integer @When sitting after colliding with a player in the camp.
---@field yell_counter integer @counts up to 400 (6.6 sec), when 0 the pet yells out
Pet = {}

---@class Pipe : Entity, Floor
---@field direction_type integer @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
---@field end_pipe boolean
Pipe = {}

---@class PipeTravelerSound : Entity, LogicalSound
---@field enter_exit boolean
PipeTravelerSound = {}

---@class Player : Entity, Movable, PowerupCapable
---@field ai Ai|nil
---@field basecamp_button_entity Entity|nil @Used in base camp to talk with the NPC's
---@field coyote_timer integer @can jump while airborne if greater than 0
---@field emitted_light Illumination|nil
---@field hired_hand_name integer @0-25 alphabetical index of hired hand names.
---@field input PlayerSlot|nil
---@field inventory Inventory|nil
---@field jump_lock_timer integer @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.
---@field linked_companion_child integer @entity uid
---@field linked_companion_parent integer @entity uid
---@field special_sound SoundMeta|nil @For Lise System walking and looking up sounds
---@field swim_timer integer @Timer between strokes when holding jump button in water.
Player = {}

---Get the heart color of the character, this will be the modded heart color not only the vanilla heart color.
---@return Color
function Player:get_heart_color() end

---Get the full name of the character, this will be the modded name not only the vanilla name.
---@return string
function Player:get_name() end

---Get the short name of the character, this will be the modded name not only the vanilla name.
---@return string
function Player:get_short_name() end

---Check whether the character is female, will be `true` if the character was modded to be female as well.
---@return boolean
function Player:is_female() end

---@return integer
function Player:kapala_blood_amount() end

---Drops from ladders, ropes and ledge grabs
function Player:let_go() end

---Set the heart color for the character.
---@param hcolor Color
function Player:set_heart_color(hcolor) end

---@class PlayerBag : Entity, Movable
---@field bombs integer
---@field ropes integer
PlayerBag = {}

---@class PlayerGhost : Entity, Movable, LightEmitter
---@field body_uid integer @Is not set to -1 when crushed
---@field boost_timer integer
---@field inventory Inventory|nil
---@field player_inputs PlayerSlot|nil
---@field shake_timer integer
---@field sound SoundMeta|nil
---@field sparkles_particle ParticleEmitterInfo|nil
PlayerGhost = {}

---Used in StateMemory
---@class PlayerInputs
---@field player_settings PlayerSlotSettings[]
---@field player_slot_1 PlayerSlot
---@field player_slot_1_settings PlayerSlotSettings
---@field player_slot_2 PlayerSlot
---@field player_slot_2_settings PlayerSlotSettings
---@field player_slot_3 PlayerSlot
---@field player_slot_3_settings PlayerSlotSettings
---@field player_slot_4 PlayerSlot
---@field player_slot_4_settings PlayerSlotSettings
---@field player_slots PlayerSlot[]
PlayerInputs = {}

---@class PlayerSlot
---@field buttons INPUTS
---@field buttons_gameplay INPUTS
---@field input_mapping_controller InputMapping|nil
---@field input_mapping_keyboard InputMapping|nil
---@field is_participating boolean
---@field player_slot integer
PlayerSlot = {}

---@class PlayerSlotSettings
---@field auto_run_enabled boolean
---@field controller_right_stick boolean
---@field controller_vibration boolean
PlayerSlotSettings = {}

---@class Players

---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
---@class PlayingSound
PlayingSound = {}

---@param parameter_index VANILLA_SOUND_PARAM
---@return number|nil
function PlayingSound:get_parameter(parameter_index) end

---@return table<integer, string>
function PlayingSound:get_parameters() end

---@return boolean
function PlayingSound:is_playing() end

---@param callback fun() @Returning nil: ignored.
function PlayingSound:set_callback(callback) end

---@param loop_mode SOUND_LOOP_MODE
---@return boolean
function PlayingSound:set_looping(loop_mode) end

---@param mute boolean
---@return boolean
function PlayingSound:set_mute(mute) end

---@param pan number
---@return boolean
function PlayingSound:set_pan(pan) end

---@param parameter_index VANILLA_SOUND_PARAM
---@param value number
---@return boolean
function PlayingSound:set_parameter(parameter_index, value) end

---@param pause boolean
---@return boolean
function PlayingSound:set_pause(pause) end

---@param pitch number
---@return boolean
function PlayingSound:set_pitch(pitch) end

---@param volume number
---@return boolean
function PlayingSound:set_volume(volume) end

---@return boolean
function PlayingSound:stop() end

---@class PoisonedEffect : Entity
---@field burst_active boolean @If forced to false, it will not play the sound or spawn burst particles
---@field burst_timer integer
---@field particle_base ParticleEmitterInfo|nil
---@field particle_burst ParticleEmitterInfo|nil
PoisonedEffect = {}

---@class PoleDeco : Entity, Floor
---@field deco_down integer
---@field deco_up integer
PoleDeco = {}

---@class Portal : Entity
---@field emitted_light Illumination|nil
---@field level integer
---@field theme integer
---@field timer integer
---@field transition_timer integer
---@field world integer
Portal = {}

---Context received in ON.POST_ROOM_GENERATION.
---Used to change the room templates in the level and other shenanigans that affect level gen.
---@class PostRoomGenerationContext
PostRoomGenerationContext = {}

---Overrides a specific short tile code, this means it will change for the whole level
---@param short_tile_code SHORT_TILE_CODE
---@param short_tile_code_def ShortTileCodeDef
function PostRoomGenerationContext:change_short_tile_code(short_tile_code, short_tile_code_def) end

---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
---@param short_tile_code_def ShortTileCodeDef
---@return SHORT_TILE_CODE|nil
function PostRoomGenerationContext:define_short_tile_code(short_tile_code_def) end

---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
---@param x integer
---@param y integer
---@param layer LAYER
---@return boolean
function PostRoomGenerationContext:mark_as_machine_room_origin(x, y, layer) end

---Marks the room as a set-room, a corresponding `setroomy-x` template must be loaded, else the game will crash
---@param x integer
---@param y integer
---@param layer LAYER
---@return boolean
function PostRoomGenerationContext:mark_as_set_room(x, y, layer) end

---Change the amount of extra spawns for the given `extra_spawn_id`.
---@param extra_spawn_id integer
---@param num_spawns_front_layer integer
---@param num_spawns_back_layer integer
function PostRoomGenerationContext:set_num_extra_spawns(extra_spawn_id, num_spawns_front_layer, num_spawns_back_layer) end

---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.
---@param chance_id PROCEDURAL_CHANCE
---@param inverse_chance integer
---@return boolean
function PostRoomGenerationContext:set_procedural_spawn_chance(chance_id, inverse_chance) end

---Set the room template at the given index and layer, returns `false` if the index is outside of the level.
---@param x integer
---@param y integer
---@param layer LAYER
---@param room_template ROOM_TEMPLATE
---@return boolean
function PostRoomGenerationContext:set_room_template(x, y, layer, room_template) end

---Set the shop type for a specific room, does nothing if the room is not a shop
---@param x integer
---@param y integer
---@param layer LAYER
---@param shop_type integer
---@return boolean
function PostRoomGenerationContext:set_shop_type(x, y, layer, shop_type) end

---Unmarks the room as a set-room
---@param x integer
---@param y integer
---@param layer LAYER
---@return boolean
function PostRoomGenerationContext:unmark_as_set_room(x, y, layer) end

---@class Pot : Entity, Movable, Purchasable
---@field dont_transfer_dmg boolean
---@field inside ENT_TYPE
Pot = {}

---@class Powerup : Entity, Movable
Powerup = {}

---@param callback_id integer
function Powerup:clear_virtual(callback_id) end

---only for backpacks
---@param fun fun(self: Entity|nil, who: PowerupCapable|nil) @Returning nil: ignored.
---@return integer
function Powerup:set_post_putting_off(fun) end

---only for backpacks
---@param fun fun(self: Entity|nil, who: PowerupCapable|nil) @Returning nil: ignored.
---@return integer
function Powerup:set_post_putting_on(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Powerup:set_post_virtual(index, fun) end

---only for backpacks
---@param fun fun(self: Entity|nil, who: PowerupCapable|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Powerup:set_pre_putting_off(fun) end

---only for backpacks
---@param fun fun(self: Entity|nil, who: PowerupCapable|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Powerup:set_pre_putting_on(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Powerup:set_pre_virtual(index, fun) end

---@class PowerupCapable : Entity, Movable
PowerupCapable = {}

---@param callback_id integer
function PowerupCapable:clear_virtual(callback_id) end

---Return all powerups that the entity has
---@return ENT_TYPE[]
function PowerupCapable:get_powerups() end

---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.
---@param powerup_type ENT_TYPE
function PowerupCapable:give_powerup(powerup_type) end

---Checks whether the player/monster has a certain powerup
---@param powerup_type ENT_TYPE
---@return boolean
function PowerupCapable:has_powerup(powerup_type) end

---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.
---@param powerup_type ENT_TYPE
function PowerupCapable:remove_powerup(powerup_type) end

---@param fuel integer
function PowerupCapable:set_jetpack_fuel(fuel) end

---only triggers when entity has kapala
---@param fun fun(self: Entity|nil) @Returning nil: ignored.
---@return integer
function PowerupCapable:set_post_blood_collision(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function PowerupCapable:set_post_virtual(index, fun) end

---only triggers when entity has kapala
---@param fun fun(self: Entity|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function PowerupCapable:set_pre_blood_collision(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function PowerupCapable:set_pre_virtual(index, fun) end

---Unequips the currently worn backitem
function PowerupCapable:unequip_backitem() end

---Returns the uid of the currently worn backitem, or -1 if wearing nothing
---@return integer
function PowerupCapable:worn_backitem() end

---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.
---@class PreHandleRoomTilesContext
PreHandleRoomTilesContext = {}

---Add a back layer that is a copy of the front layer
---Does nothing if there already is a backlayer
function PreHandleRoomTilesContext:add_copied_back_layer() end

---Add a back layer filled with all `0` if there is no back layer yet
---Does nothing if there already is a backlayer
function PreHandleRoomTilesContext:add_empty_back_layer() end

---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
---@param layer LAYER
---@param short_tile_code SHORT_TILE_CODE
---@return table
function PreHandleRoomTilesContext:find_all_short_tile_codes(layer, short_tile_code) end

---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
---@param tx integer
---@param ty integer
---@param layer LAYER
---@return SHORT_TILE_CODE|nil
function PreHandleRoomTilesContext:get_short_tile_code(tx, ty, layer) end

---Check whether the room has a back layer
---@return boolean
function PreHandleRoomTilesContext:has_back_layer() end

---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
---@param layer LAYER
---@param short_tile_code SHORT_TILE_CODE
---@param replacement_short_tile_code SHORT_TILE_CODE
---@return boolean
function PreHandleRoomTilesContext:replace_short_tile_code(layer, short_tile_code, replacement_short_tile_code) end

---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
---@param tx integer
---@param ty integer
---@param layer LAYER
---@param short_tile_code SHORT_TILE_CODE
---@return boolean
function PreHandleRoomTilesContext:set_short_tile_code(tx, ty, layer, short_tile_code) end

---Context received in ON.PRE_LOAD_LEVEL_FILES, used for forcing specific `.lvl` files to load.
---@class PreLoadLevelFilesContext
PreLoadLevelFilesContext = {}

---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.
---@param levels string[]
function PreLoadLevelFilesContext:add_level_files(levels) end

---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.
---@param levels string[]
function PreLoadLevelFilesContext:override_level_files(levels) end

---@class Present : Entity, Movable, Purchasable
---@field inside ENT_TYPE
Present = {}

---@class PrizeDispenser : Entity, Movable
---@field item_ids integer[] @Id's of the items (not types), by default 0-24, look at [change_diceshop_prizes](https://spelunky-fyi.github.io/overlunky/#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
---@field prizes_spawned integer
PrizeDispenser = {}

---@class Projectile : Entity, Movable
Projectile = {}

---@class ProtoShopkeeper : Entity, Movable, PowerupCapable, Monster
---@field movement_state integer @1: "Headpulse/explosion related, 2: Walking, 3: Headpulse/explosion related, 4: Crawling, 6: Headpulse/explosion related
---@field walk_pause_explode_timer integer
---@field walking_speed integer @0 = slow, 4 = fast
ProtoShopkeeper = {}

---@class PunishBall : Entity, Movable
---@field attached_to_uid integer
---@field timer integer @counts down from 20 while the ball is eligible to break a floor and tries to break it at 0
---@field x_pos number
---@field y_pos number
PunishBall = {}

---@class Purchasable : Entity, Movable
Purchasable = {}

---@param callback_id integer
function Purchasable:clear_virtual(callback_id) end

---Is called after purchase, changes the DummyPurchasableEntity into the real entity plus tries to equip it, or pick it up (for stuff like weapons), or give the powerup.
---Nothing else happens, by itself it does not remove item from shop etc.
---@param who Entity|nil
function Purchasable:equip(who) end

---Is called after purchase, changes the DummyPurchasableEntity into the real entity plus tries to equip it, or pick it up (for stuff like weapons), or give the powerup.
---Nothing else happens, by itself it does not remove item from shop etc.
---@param fun fun(self: Entity|nil, who: Entity|nil) @Returning nil: ignored.
---@return integer
function Purchasable:set_post_equip(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Purchasable:set_post_virtual(index, fun) end

---Is called after purchase, changes the DummyPurchasableEntity into the real entity plus tries to equip it, or pick it up (for stuff like weapons), or give the powerup.
---Nothing else happens, by itself it does not remove item from shop etc.
---@param fun fun(self: Entity|nil, who: Entity|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function Purchasable:set_pre_equip(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function Purchasable:set_pre_virtual(index, fun) end

---@class PushBlock : Entity, Movable
---@field dest_pos_x number
---@field dust_particle ParticleEmitterInfo|nil
---@field sound SoundMeta|nil
PushBlock = {}

---@class Qilin : Entity, Movable, PowerupCapable, Mount
---@field attack_cooldown integer
---@field fly_gallop_sound SoundMeta|nil
Qilin = {}

---@class Quad
---@field bottom_left_x number
---@field bottom_left_y number
---@field bottom_right_x number
---@field bottom_right_y number
---@field top_left_x number
---@field top_left_y number
---@field top_right_x number
---@field top_right_y number
Quad = {}

---@return Quad
---@overload fun(other: Quad): Quad
---@overload fun(aabb: AABB): Quad
---@overload fun(_bottom_left_x: number, _bottom_left_y: number, _bottom_right_x: number, _bottom_right_y: number, _top_right_x: number, _top_right_y: number, _top_left_x: number, _top_left_y: number): Quad
---@overload fun(bottom_left_: Vec2, bottom_right_: Vec2, top_right_: Vec2, top_left_: Vec2): Quad
function Quad.new() end

---@return Quad
function Quad:flip_horizontally() end

---@return Quad
function Quad:flip_vertically() end

---Returns the max/min values of the Quad
---@return AABB
function Quad:get_AABB() end

---@param p Vec2
---@return boolean
---@overload fun(self: Quad, p: Vec2, epsilon: number): boolean
---@overload fun(self: Quad, x: number, y: number): boolean
---@overload fun(self: Quad, x: number, y: number, epsilon: number): boolean
function Quad:is_point_inside(p) end

---@param vec Vec2
---@return Quad
---@overload fun(self: Quad, off_x: number, off_y: number): Quad
function Quad:offset(vec) end

---Rotates a Quad by an angle, px/py are not offsets, use `:get_AABB():center()` to get approximated center for symmetrical quadrangle
---@param angle number
---@param px number
---@param py number
---@return Quad
function Quad:rotate(angle, px, py) end

---@param other Quad
---@return Quad
function Quad:set(other) end

---@return Vec2
---@return Vec2
---@return Vec2
---@return Vec2
function Quad:split() end

---@class QuestsInfo
---@field beg_state integer
---@field jungle_sisters_flags integer
---@field madame_tusk_state integer
---@field sparrow_state integer
---@field van_horsing_state integer
---@field yang_state integer
QuestsInfo = {}

---@class QuickSand : Entity, Floor
QuickSand = {}

---@class QuickSandSound : Entity, LogicalSound
QuickSandSound = {}

---@class Quillback : Entity, Movable, PowerupCapable, Monster, WalkingMonster
---@field broke_block boolean
---@field particle ParticleEmitterInfo|nil
---@field post_hit_wall_direction integer
---@field seen_player boolean
---@field sound SoundMeta|nil
Quillback = {}

---@class RawInput
---@field controller ControllerInput[] @State of controller buttons per controller. Zero-based indexing, i.e. use GameProps.input_index directly to index this.
---@field keyboard KeyboardKey[] @State of all keyboard buttons in a random game order as usual, most key indexes can be found in RAW_KEY. Zero-based indexing, i.e. use PlayerSlot.input_mapping_keyboard directly to index this.
RawInput = {}

---@class RegenBlock : Entity, Movable
---@field on_breaking boolean
RegenBlock = {}

---Some information used to render the entity, can not be changed, used in Entity
---@class RenderInfo
---@field angle number
---@field animation_frame integer
---@field brightness number
---@field destination Quad
---@field facing_left boolean
---@field offset_x number
---@field offset_y number
---@field render_inactive boolean
---@field shader WORLD_SHADER
---@field source Quad
---@field texture_num integer
---@field tileh number
---@field tilew number
---@field x number
---@field y number
RenderInfo = {}

---@param callback_id integer
function RenderInfo:clear_virtual(callback_id) end

---@return Entity|nil
function RenderInfo:get_entity() end

---@return TEXTURE|nil
function RenderInfo:get_second_texture() end

---@return TEXTURE|nil
function RenderInfo:get_third_texture() end

---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)
---@param texture_id TEXTURE
---@return boolean
function RenderInfo:set_normal_map_texture(texture_id) end

---@param fun fun(self: RenderInfo|nil) @Returning nil: ignored.
---@return integer
function RenderInfo:set_post_draw(fun) end

---@param fun fun(self: RenderInfo|nil) @Returning nil: ignored.
---@return integer
function RenderInfo:set_post_dtor(fun) end

---@param fun fun(self: RenderInfo|nil, p2: Vec2|nil, p3: VanillaRenderContext) @Returning nil: ignored.
---@return integer
function RenderInfo:set_post_render(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function RenderInfo:set_post_virtual(index, fun) end

---@param fun fun(self: RenderInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function RenderInfo:set_pre_draw(fun) end

---@param fun fun(self: RenderInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function RenderInfo:set_pre_dtor(fun) end

---@param fun fun(self: RenderInfo|nil, p2: Vec2|nil, p3: VanillaRenderContext): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function RenderInfo:set_pre_render(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function RenderInfo:set_pre_virtual(index, fun) end

---@param texture_id TEXTURE
---@return boolean
function RenderInfo:set_second_texture(texture_id) end

---Set the number of textures that may be used, need to have them set before for it to work
---@param num integer
---@return boolean
function RenderInfo:set_texture_num(num) end

---@param texture_id TEXTURE
---@return boolean
function RenderInfo:set_third_texture(texture_id) end

---@class Robot : Entity, Movable, PowerupCapable, Monster, WalkingMonster
---@field emitted_light_explosion Illumination|nil
---@field sound SoundMeta|nil
Robot = {}

---@class Rockdog : Entity, Movable, PowerupCapable, Mount
---@field attack_cooldown integer
Rockdog = {}

---@class RollingItem : Entity, Movable, Purchasable
---@field roll_speed number
RollingItem = {}

---@param callback_id integer
function RollingItem:clear_virtual(callback_id) end

---Skip this function for item to be unpickable
---@param who Entity|nil
---@param play_sfx boolean
function RollingItem:give_powerup(who, play_sfx) end

---Skip this function for item to be unpickable
---@param fun fun(self: Entity|nil, who: Entity|nil, play_sfx: boolean) @Returning nil: ignored.
---@return integer
function RollingItem:set_post_give_powerup(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function RollingItem:set_post_virtual(index, fun) end

---Skip this function for item to be unpickable
---@param fun fun(self: Entity|nil, who: Entity|nil, play_sfx: boolean): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function RollingItem:set_pre_give_powerup(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function RollingItem:set_pre_virtual(index, fun) end

---@class RoomLight : Entity
---@field illumination Illumination|nil
RoomLight = {}

---@class RoomOwner : Entity, Movable, PowerupCapable, Monster
---@field aggro_trigger boolean @setting this makes him angry, if it's shopkeeper you get 2 aggro points
---@field ai_state integer
---@field climb_y_direction number
---@field countdown_timer integer @can't shot when the timer is running
---@field is_patrolling boolean
---@field lose_interest_timer integer
---@field patrol_timer integer
---@field room_index integer
---@field was_hurt boolean @also is set true if you set aggro to true, get's trigger even when whipping
RoomOwner = {}

---@return boolean
function RoomOwner:is_angry_flag_set() end

---@return boolean
function RoomOwner:should_attack_on_sight() end

---@return ENT_TYPE
function RoomOwner:weapon_type() end

---Used in RoomOwnersInfo
---@class RoomOwnerDetails
---@field layer integer @Used in RoomOwnersInfo
---@field owner_uid integer @Used in RoomOwnersInfo
---@field room_index integer @Used in RoomOwnersInfo
RoomOwnerDetails = {}

---Used in StateMemory
---@class RoomOwnersInfo
---@field owned_items table<integer, ItemOwnerDetails> @Used in StateMemory
---@field owned_rooms RoomOwnerDetails[] @Used in StateMemory
RoomOwnersInfo = {}

---@class Rubble : Entity, Movable
Rubble = {}

---Context received in ON.SAVE
---Used to save a string to some form of save_{}.dat
---Future calls to this will override the save
---@class SaveContext
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
---@param data string
---@return boolean
function SaveContext:save(data) end

---@class SaveData
---@field bestiary boolean[]
---@field bestiary_killed integer[]
---@field bestiary_killed_by integer[]
---@field character_deaths integer[]
---@field characters integer @20bit bitmask of unlocked characters
---@field completed_hard boolean
---@field completed_ironman boolean
---@field completed_normal boolean
---@field constellation Constellation
---@field deaths integer
---@field deepest_area integer
---@field deepest_level integer
---@field items boolean[]
---@field last_daily string
---@field level_last integer
---@field people boolean[]
---@field people_killed integer[]
---@field people_killed_by integer[]
---@field pets_rescued integer[]
---@field places boolean[]
---@field players integer[]
---@field plays integer
---@field profile_seen boolean
---@field score_last integer
---@field score_top integer
---@field score_total integer
---@field seeded_unlocked boolean
---@field shortcuts integer @Terra quest state 0..10 (0=not met ... 10=complete)
---@field stickers ENT_TYPE[]
---@field theme_last integer
---@field time_best integer
---@field time_last integer
---@field time_total integer
---@field time_tutorial integer
---@field traps boolean[]
---@field tutorial_state integer @Tutorial state 0..4. Changes the camp layout, camera and lighting. (0=nothing, 1=journal got, 2=key spawned, 3=door unlocked, 4=complete)
---@field wins_hard integer
---@field wins_normal integer
---@field wins_special integer
---@field world_last integer
SaveData = {}

---Used in GameManager
---@class SaveRelated
---@field bestiary_data table<integer, JournalBestiaryData>
---@field item_info table<integer, JournalPageData>
---@field journal_popup_ui JournalPopupUI
---@field monster_part_to_main table<integer, integer> @used to map stuff like Osiris_Hand -> Osiris_Head, Hundun limbs -> Hundun etc.
---@field people_info table<integer, JournalPeopleData>
---@field people_part_to_main table<integer, integer> @used to map shopkeeper clone to shopkeeper only
---@field places_data table<integer, JournalPageData> @Scale and offset not used in those pages. Can't add more
---@field stickers_data table<integer, StickersData>
---@field trap_info table<integer, JournalPageData>
---@field trap_part_to_main table<integer, integer> @used for stuff like upsidedown_spikes -> spikes, skulldrop skulls -> skulldrop trap etc.
SaveRelated = {}

---Gets local version of the SaveData
---@return SaveData|nil
function SaveRelated:get_savegame() end

---@class SaveState
SaveState = {}

---Create a new temporary SaveState/clone of the main level state. Unlike save_state slots that are preallocated by the game anyway, these will use 32MiB a pop and aren't freed automatically, so make sure to clear them or reuse the same one to save memory. The garbage collector will eventually clear the SaveStates you don't have a handle to any more though.
---@return SaveState
function SaveState.new() end

---Delete the SaveState and free the memory. The SaveState can't be used after this.
function SaveState:clear() end

---Get the pre-allocated by the game save slot 1-4. Call as `SaveState.get(slot)`
---@param slot integer
---@return any
function SaveState.get(slot) end

---Get the current frame from the SaveState, equivelent to the [get_frame](https://spelunky-fyi.github.io/overlunky/#Get_frame) global function that returns the frame from the "loaded in state"
---@return integer
function SaveState:get_frame() end

---Access the PRNG inside a SaveState
---@return PRNG|nil
function SaveState:get_prng() end

---Access the StateMemory inside a SaveState
---@return StateMemory|nil
function SaveState:get_state() end

---Load a SaveState
function SaveState:load() end

---Save over a previously allocated SaveState
function SaveState:save() end

---@class Scarab : Entity, Movable, PowerupCapable, Monster
---@field emitted_light Illumination|nil
---@field sound SoundMeta|nil
---@field timer integer @how long to stay in current position
Scarab = {}

---@class Scepter : Entity, Movable
---@field cooldown integer
Scepter = {}

---@class ScepterShot : Entity, Movable, LightEmitter
---@field idle_timer integer @short timer before it goes after target
---@field sound SoundMeta|nil
---@field speed number
ScepterShot = {}

---@class Scorpion : Entity, Movable, PowerupCapable, Monster
---@field jump_cooldown_timer integer
---@field walk_pause_timer integer
Scorpion = {}

---@class Screen
---@field render_timer number
Screen = {}

---@return ScreenArenaIntro|nil
function Screen.as_screen_arena_intro() end

---@return ScreenArenaItems|nil
function Screen.as_screen_arena_items() end

---@return ScreenArenaLevel|nil
function Screen.as_screen_arena_level() end

---@return ScreenArenaMenu|nil
function Screen.as_screen_arena_menu() end

---@return ScreenArenaScore|nil
function Screen.as_screen_arena_score() end

---@return ScreenArenaStagesSelect|nil
function Screen.as_screen_arena_select() end

---@return ScreenArenaStagesSelect|nil
function Screen.as_screen_arena_stages() end

---@return ScreenCamp|nil
function Screen.as_screen_camp() end

---@return ScreenCharacterSelect|nil
function Screen.as_screen_character_select() end

---@return ScreenConstellation|nil
function Screen.as_screen_constellation() end

---@return ScreenCredits|nil
function Screen.as_screen_credits() end

---@return ScreenDeath|nil
function Screen.as_screen_death() end

---@return ScreenIntro|nil
function Screen.as_screen_intro() end

---@return ScreenLevel|nil
function Screen.as_screen_level() end

---@return ScreenLogo|nil
function Screen.as_screen_logo() end

---@return ScreenMenu|nil
function Screen.as_screen_menu() end

---@return ScreenOnlineLoading|nil
function Screen.as_screen_online_loading() end

---@return ScreenOnlineLobby|nil
function Screen.as_screen_online_lobby() end

---@return ScreenOptions|nil
function Screen.as_screen_options() end

---@return ScreenPrologue|nil
function Screen.as_screen_prologue() end

---@return ScreenRecap|nil
function Screen.as_screen_recap() end

---@return ScreenScores|nil
function Screen.as_screen_scores() end

---@return ScreenCodeInput|nil
function Screen.as_screen_seed_input() end

---@return ScreenStateCamp|nil
function Screen.as_screen_state_camp() end

---@return ScreenStateLevel|nil
function Screen.as_screen_state_level() end

---@return ScreenTeamSelect|nil
function Screen.as_screen_team_select() end

---@return ScreenTitle|nil
function Screen.as_screen_title() end

---@return ScreenTransition|nil
function Screen.as_screen_transition() end

---@return ScreenWin|nil
function Screen.as_screen_win() end

---Initializes the screen.
function Screen:init() end

---@class ScreenArenaIntro : Screen
---@field background_colors TextureRenderingInfo
---@field countdown integer
---@field left_scroll TextureRenderingInfo
---@field line_electricity_effect_timer number
---@field names_opacity number
---@field particles ParticleEmitterInfo[]
---@field players TextureRenderingInfo
---@field right_scroll TextureRenderingInfo
---@field scroll_unfurl number
---@field state integer
---@field vertical_line_electricity_effect TextureRenderingInfo
---@field vertical_lines TextureRenderingInfo
---@field waiting boolean
ScreenArenaIntro = {}

---@class ScreenArenaItems : Screen
---@field black_background_bottom_right TextureRenderingInfo
---@field brick_background TextureRenderingInfo
---@field center_panels_horizontal_slide_position number
---@field controls ScreenControls
---@field esc_panel_slide_timer number
---@field esc_woodpanel TextureRenderingInfo
---@field held_item_crate_on_scroll TextureRenderingInfo
---@field held_item_on_scroll TextureRenderingInfo
---@field item_background TextureRenderingInfo
---@field item_equipped_badge TextureRenderingInfo
---@field item_held_badge TextureRenderingInfo
---@field item_icons TextureRenderingInfo
---@field item_off_gray_overlay TextureRenderingInfo
---@field item_selection_gold_outline TextureRenderingInfo
---@field items_to_gray_out table<integer, number>
---@field screen_panels MenuScreenPanels
---@field scroll_bottom TextureRenderingInfo
---@field scroll_right_handle_bottom TextureRenderingInfo
---@field selected_item_index integer
---@field toggles_background TextureRenderingInfo
---@field woodpanel_bottom TextureRenderingInfo
ScreenArenaItems = {}

---@class ScreenArenaLevel : Screen
---@field get_ready TextureRenderingInfo
---@field get_ready_gray_background TextureRenderingInfo
---@field get_ready_outline TextureRenderingInfo
---@field particles ParticleEmitterInfo[]
ScreenArenaLevel = {}

---@class ScreenArenaMenu : Screen
---@field black_option_boxes_center TextureRenderingInfo
---@field black_option_boxes_left TextureRenderingInfo
---@field black_option_boxes_right TextureRenderingInfo
---@field blurry_border TextureRenderingInfo
---@field blurry_border2 TextureRenderingInfo
---@field bottom_left_bricks TextureRenderingInfo
---@field brick_background TextureRenderingInfo
---@field center_panels_hor_slide_position number
---@field characters_drawing TextureRenderingInfo
---@field controls ScreenControls
---@field esc_next_panels_slide_timer number
---@field gold_option_outline TextureRenderingInfo
---@field info_black_background TextureRenderingInfo
---@field main_panel_bottom TextureRenderingInfo
---@field main_panel_bottom_left_corner TextureRenderingInfo
---@field main_panel_bottom_right_corner TextureRenderingInfo
---@field main_panel_center TextureRenderingInfo
---@field main_panel_left TextureRenderingInfo
---@field main_panel_right TextureRenderingInfo
---@field main_panel_top TextureRenderingInfo
---@field main_panel_top_left_corner TextureRenderingInfo
---@field main_panel_top_right_corner TextureRenderingInfo
---@field main_panel_vertical_scroll_position number
---@field next_panel TextureRenderingInfo
---@field option_icons TextureRenderingInfo
---@field option_left_arrow TextureRenderingInfo
---@field option_right_arrow TextureRenderingInfo
---@field rules_scroll TextureRenderingInfo
---@field screen_panels MenuScreenPanels
---@field selected_option_index integer
---@field top_left_esc_panel TextureRenderingInfo
ScreenArenaMenu = {}

---@class ScreenArenaScore : Screen
---@field animation_sequence integer
---@field background TextureRenderingInfo
---@field bottom_lava TextureRenderingInfo
---@field lava_bubbles TextureRenderingInfo
---@field lava_bubbles_positions ScreenArenaScoreLavaBubble[]
---@field next_sidepanel_slidein_timer number
---@field next_transition_timer integer
---@field ok_panel TextureRenderingInfo
---@field particles ParticleEmitterInfo[]
---@field pillars TextureRenderingInfo
---@field player_bottom_pillar_offset number[]
---@field player_create_giblets boolean[]
---@field player_crushing_pillar_height number[]
---@field player_ready boolean[]
---@field player_shadows TextureRenderingInfo
---@field player_won boolean[]
---@field players TextureRenderingInfo
---@field ready_panel TextureRenderingInfo
---@field ready_speechbubble_indicator TextureRenderingInfo
---@field score_counter TextureRenderingInfo
---@field scroll_unfurl number
---@field squash_and_celebrate boolean
---@field text_id_1 STRINGID
---@field text_id_2 STRINGID
---@field victory_jump_velocity number
---@field victory_jump_y_pos number
---@field woodpanel TextureRenderingInfo
---@field woodpanel_left_scroll TextureRenderingInfo
---@field woodpanel_right_scroll TextureRenderingInfo
---@field woodpanel_slide number
---@field woodpanel_slide_toggle boolean
---@field woodpanel_visible boolean
ScreenArenaScore = {}

---@class ScreenArenaScoreLavaBubble
---@field timer1 integer
---@field timer2 integer
---@field visible boolean
---@field x number
---@field y number
ScreenArenaScoreLavaBubble = {}

---@class ScreenArenaStagesSelect : Screen
---@field big_player_drawing TextureRenderingInfo
---@field blocky_level_representation TextureRenderingInfo
---@field brick_background TextureRenderingInfo
---@field bricks_bottom_left TextureRenderingInfo
---@field buttons integer
---@field controls ScreenControls
---@field grid_background_disabled_cross TextureRenderingInfo
---@field grid_background_manipulators TextureRenderingInfo
---@field grid_background_row_0 TextureRenderingInfo
---@field grid_background_row_1 TextureRenderingInfo
---@field grid_background_row_2 TextureRenderingInfo
---@field grid_background_row_3 TextureRenderingInfo
---@field grid_background_row_4 TextureRenderingInfo
---@field grid_background_row_5 TextureRenderingInfo
---@field grid_background_row_6 TextureRenderingInfo
---@field grid_background_row_7 TextureRenderingInfo
---@field grid_disabled_cross TextureRenderingInfo
---@field grid_player_icon TextureRenderingInfo
---@field grid_yellow_highlighter TextureRenderingInfo
---@field info_black_background TextureRenderingInfo
---@field panels_slide_from_both_sides number
---@field players_turn_scroll TextureRenderingInfo
---@field players_turn_scroll_handle TextureRenderingInfo
---@field screen_panels MenuScreenPanels
---@field selected_stage_index integer
---@field stages_to_gray_out table<integer, number>
---@field theme_indicator TextureRenderingInfo
---@field unknown21 TextureRenderingInfo
---@field visibility_all_stages number
---@field woodenpanel_center TextureRenderingInfo
---@field woodpanel_esc TextureRenderingInfo
---@field woodpanel_fight TextureRenderingInfo
ScreenArenaStagesSelect = {}

---@class ScreenCamp : Screen
---@field buttons integer
ScreenCamp = {}

---@class ScreenCharacterSelect : Screen
---@field action_buttons_keycap_size number
---@field amount_of_mine_entrances_activated integer
---@field arena boolean @Short for `screen->next_screen_to_load == SCREEN.TEAM_SELECT and not screen->seeded_run and not screen->daily_challenge`
---@field available_mine_entrances integer
---@field background TextureRenderingInfo
---@field blackout_transparency number
---@field blurred_border TextureRenderingInfo
---@field blurred_border2 TextureRenderingInfo
---@field blurred_border_zoom_progress number
---@field blurred_border_zoom_target number
---@field buttons integer[]
---@field character TextureRenderingInfo
---@field character_flag TextureRenderingInfo
---@field character_left_arrow TextureRenderingInfo
---@field character_right_arrow TextureRenderingInfo
---@field character_shadow TextureRenderingInfo
---@field daily_challenge boolean
---@field disable_controls boolean
---@field flying_thing_countdown integer
---@field flying_things FlyingThing[]
---@field main_background_zoom_progress number
---@field main_background_zoom_target number
---@field mine_entrance_background TextureRenderingInfo
---@field mine_entrance_border TextureRenderingInfo
---@field mine_entrance_shutter TextureRenderingInfo
---@field next_screen_to_load integer
---@field not_ready_to_start_yet boolean
---@field particle_ceilingdust_rubble ParticleEmitterInfo|nil
---@field particle_ceilingdust_smoke ParticleEmitterInfo|nil
---@field particle_mist ParticleEmitterInfo|nil
---@field particle_torchflame_flames1 ParticleEmitterInfo|nil
---@field particle_torchflame_flames2 ParticleEmitterInfo|nil
---@field particle_torchflame_flames3 ParticleEmitterInfo|nil
---@field particle_torchflame_flames4 ParticleEmitterInfo|nil
---@field particle_torchflame_smoke1 ParticleEmitterInfo|nil
---@field particle_torchflame_smoke2 ParticleEmitterInfo|nil
---@field particle_torchflame_smoke3 ParticleEmitterInfo|nil
---@field particle_torchflame_smoke4 ParticleEmitterInfo|nil
---@field player_arrow_slidein_timer number[][]
---@field player_facing_left boolean[]
---@field player_quickselect_coords number[][]
---@field player_quickselect_fadein_timer number[]
---@field player_quickselect_shown boolean[]
---@field player_quickselect_wiggle_angle number[]
---@field player_shutter_timer number[]
---@field player_x number[]
---@field player_y number[]
---@field quick_select_panel TextureRenderingInfo
---@field quick_select_panel_related TextureRenderingInfo
---@field quick_select_selected_char_background TextureRenderingInfo
---@field screen_blackout TextureRenderingInfo
---@field screen_loading boolean
---@field screen_panels MenuScreenPanels
---@field seeded_run boolean
---@field start_panel_slidein number
---@field start_pressed boolean
---@field start_sidepanel TextureRenderingInfo
---@field topleft_woodpanel_esc TextureRenderingInfo
---@field topleft_woodpanel_esc_slidein number
---@field torch_sound SoundMeta[]
---@field transition_to_game_started boolean
ScreenCharacterSelect = {}

---@class ScreenCodeInput : Screen
---@field allow_random boolean @needs to be set before opening the screen to show the correct text at the bottom
---@field hand_pointer TextureRenderingInfo
---@field key_background TextureRenderingInfo
---@field letter_cutouts TextureRenderingInfo
---@field main_woodpanel_center TextureRenderingInfo
---@field main_woodpanel_left_border TextureRenderingInfo
---@field main_woodpanel_right_border TextureRenderingInfo
---@field pressed_select boolean
---@field screen_panels MenuScreenPanels
---@field scroll_text_id STRINGID
---@field seed_length integer @Current input length (0-8). You probably shouldn't write to this, except to set it to 0.
---@field selected_button_index integer
---@field start_sidepanel TextureRenderingInfo
---@field start_sidepanel_slidein number
---@field start_text_id STRINGID
---@field top_scroll TextureRenderingInfo
---@field topleft_woodpanel_esc TextureRenderingInfo
---@field topleft_woodpanel_esc_slidein number
ScreenCodeInput = {}

---Get the seed currently entered in the seed dialog or nil if nothing is entered. Will also return incomplete seeds, check seed_length to verify it's ready.
---@return integer|nil
function ScreenCodeInput:get_seed() end

---Set the seed entered in the seed dialog. Call without arguments to clear entered seed. Optionally enter a length to set partial seed.
---@param seed integer|nil
---@param length integer|nil
function ScreenCodeInput:set_seed(seed, length) end

---@class ScreenConstellation : Screen
---@field animation_timer integer
---@field constellation_text string
---@field constellation_text_opacity number
---@field explosion_and_loop SoundMeta|nil
---@field music SoundMeta|nil
---@field sequence_state integer
ScreenConstellation = {}

---@class ScreenControls
---@field direction_input integer @-1 - none, 0 - UP, 1 - DOWN, 2 - LEFT, 3 - RIGHT
---@field down boolean
---@field fast_scroll_timer integer
---@field hold_down_timer integer @Delay after which fast scroll activates (can stop at different value, only matters when you hold down the direction button)
---@field left boolean
---@field right boolean
---@field up boolean
ScreenControls = {}

---@class ScreenCredits : Screen
---@field bg_music_info SoundMeta|nil
---@field credits_progression number
ScreenCredits = {}

---The POST render call will only be visible in the polaroid area on the left of the book. The Journal is drawn on top of that.
---@class ScreenDeath : Screen
ScreenDeath = {}

---Available in ScreenOnlineLobby
---@class ScreenEnterOnlineCode : Screen, ScreenCodeInput
---@field enter_code_your_code_scroll TextureRenderingInfo
---@field enter_code_your_code_scroll_left_handle TextureRenderingInfo
---@field enter_code_your_code_scroll_right_handle TextureRenderingInfo
ScreenEnterOnlineCode = {}

---@class ScreenIntro : Screen
---@field active boolean @ends the intro immediately if set to false
---@field blackout_alpha number
---@field blackout_background TextureRenderingInfo
---@field skip_prologue boolean @skips prologue and goes straight to the title screen after the intro
ScreenIntro = {}

---@class ScreenLevel : Screen
---@field buttons integer
ScreenLevel = {}

---@class ScreenLogo : Screen
---@field logo_blitworks TextureRenderingInfo
---@field logo_fmod TextureRenderingInfo
---@field logo_mossmouth TextureRenderingInfo
---@field state integer @0 - mossmouth, 1 - blitworks, 2 - fmod, 3 - end (next screen)
---@field timer integer
ScreenLogo = {}

---@class ScreenMenu : Screen
---@field controls ScreenControls
---@field cthulhu_body TextureRenderingInfo
---@field cthulhu_disc TextureRenderingInfo
---@field cthulhu_disc_ring_angle number
---@field cthulhu_disc_split_progress number
---@field cthulhu_disc_y number
---@field cthulhu_sound SoundMeta|nil
---@field cthulhu_timer number
---@field info_toast TextureRenderingInfo
---@field left_spear TextureRenderingInfo
---@field loaded_once boolean @Set to true when going from title to menu screen for the first time, makes sure the animation play once
---@field loop boolean @Allow going up from first to last option
---@field menu_id integer @0 = main menu, 1 = play, 2 = online
---@field menu_text_opacity number
---@field particle_rubble ParticleEmitterInfo|nil
---@field particle_smoke ParticleEmitterInfo|nil
---@field play_scroll TextureRenderingInfo
---@field play_scroll_descend_timer number
---@field right_spear TextureRenderingInfo
---@field salamander_right TextureRenderingInfo
---@field scroll_text STRINGID
---@field selected_menu_index integer
---@field shake_offset_x number
---@field shake_offset_y number
---@field sides_fast_scroll_timer integer
---@field sides_hold_down_timer integer
---@field skull_left TextureRenderingInfo
---@field spear_dangle_angle integer[]
---@field spear_dangle_momentum integer[]
---@field spear_dangler SpritePosition[]
---@field spear_dangler_related TextureRenderingInfo
---@field spear_position number[]
---@field state integer @0: "cthulhu_pre_movement", 1: "cthulhu_rotating", 2: "cthulhu_separating", 3: "cthulhu_lowering", 4: "cthulhu_transition_to_menu", 5: "return_from_backlayer", 6: "highlight_selection", 7: "idle", 8: "to_submenu", 9: "to_backlayer", 10: "backlayer_idle"
---@field transfer_to_menu_id integer
---@field tunnel_background TextureRenderingInfo
---@field tunnel_ring_darkbrown TextureRenderingInfo
---@field tunnel_ring_lightbrown TextureRenderingInfo
---@field vine_left TextureRenderingInfo
---@field vine_right TextureRenderingInfo
ScreenMenu = {}

---@class ScreenOnlineLoading : Screen
---@field ouroboros TextureRenderingInfo
---@field ouroboros_angle number
ScreenOnlineLoading = {}

---@class ScreenOnlineLobby : Screen
---@field arrow_left TextureRenderingInfo
---@field arrow_left_hor_offset number
---@field arrow_right TextureRenderingInfo
---@field arrow_right_hor_offset number
---@field background_image TextureRenderingInfo
---@field character TextureRenderingInfo
---@field character_facing_left boolean
---@field character_walk_offset number
---@field move_direction integer
---@field platform_icon TextureRenderingInfo
---@field player_count integer
---@field player_ready_icon TextureRenderingInfo
---@field players OnlineLobbyScreenPlayer[]
---@field screen_code_input ScreenEnterOnlineCode|nil
---@field screen_panels MenuScreenPanels
---@field searching_for_players boolean
---@field show_code_panel boolean
---@field topleft_woodpanel_esc TextureRenderingInfo
---@field topleft_woodpanel_esc_slidein number
ScreenOnlineLobby = {}

---@class ScreenOptions : Screen
---@field bottom_left_scrollhandle TextureRenderingInfo
---@field bottom_right_scrollhandle TextureRenderingInfo
---@field bottom_scroll TextureRenderingInfo @For the code in the sync menu
---@field brick_background TextureRenderingInfo
---@field brick_foreground TextureRenderingInfo
---@field brick_middlelayer TextureRenderingInfo
---@field credits_progression number|nil
---@field direction_input integer @-1 = none, 0 = down, 1 = up
---@field disable_controls boolean @Used for sync progress
---@field down boolean
---@field fast_scroll_timer integer
---@field hold_down_timer integer
---@field item_option_arrow_left TextureRenderingInfo
---@field item_option_arrow_right TextureRenderingInfo
---@field loop boolean @Allow going up from first to last option
---@field menu_id integer
---@field options_visiable boolean
---@field pet_icons TextureRenderingInfo @In "Gameplay" menu
---@field progressbar_background TextureRenderingInfo
---@field progressbar_foreground TextureRenderingInfo
---@field screen_panels MenuScreenPanels
---@field sectionheader_background TextureRenderingInfo
---@field selected_item_rounded_rect TextureRenderingInfo
---@field selected_item_scarab TextureRenderingInfo
---@field selected_menu_index integer
---@field show_apply_button boolean
---@field show_highlight boolean @Shows the red background behind the option, the scarab on the left and left/right arrows
---@field sides_fast_scroll_timer integer
---@field sides_hold_down_timer integer
---@field sync_progress_state integer @0 - none, 1 - waiting for the code, 2 - code acquired, 3 - sync in progress, 4 - sync completed
---@field text_fadein number
---@field tooltip_background TextureRenderingInfo
---@field tooltip_text integer[]
---@field topleft_woodpanel_esc TextureRenderingInfo
---@field topleft_woodpanel_esc_slidein number
---@field transfer_to_menu_id integer
---@field up boolean
---@field vertical_scroll_effect number
---@field volume_progressbar_foreground TextureRenderingInfo
---@field volume_progressbar_position_indicator TextureRenderingInfo
ScreenOptions = {}

---@class ScreenPrologue : Screen
---@field line1 STRINGID
---@field line1_alpha number
---@field line2 STRINGID
---@field line2_alpha number
---@field line3 STRINGID
---@field line3_alpha number
ScreenPrologue = {}

---The recap book is drawn on top of the POST render event
---@class ScreenRecap : Screen
ScreenRecap = {}

---@class ScreenScores : Screen
---@field animation_state integer
---@field animation_timer integer
---@field dollarsign TextureRenderingInfo
---@field hourglass TextureRenderingInfo
---@field woodpanel1 TextureRenderingInfo
---@field woodpanel2 TextureRenderingInfo
---@field woodpanel3 TextureRenderingInfo
---@field woodpanel_cutout TextureRenderingInfo
---@field woodpanel_slidedown_timer number
ScreenScores = {}

---@class ScreenStateCamp : Screen
---@field time_till_reset integer @Delay after player death to reset camp
ScreenStateCamp = {}

---@class ScreenStateLevel : Screen
---@field buttons integer
---@field time_till_death_screen integer @Delay after player death to open the death screen
ScreenStateLevel = {}

---@class ScreenTeamSelect : Screen
---@field buttons integer
---@field four_characters TextureRenderingInfo
---@field four_ropes TextureRenderingInfo
---@field gems_above_the_ropes TextureRenderingInfo
---@field go_back_wooden_panel TextureRenderingInfo
---@field go_back_wooden_panel_slide number
---@field left_arrow TextureRenderingInfo
---@field player_portrait TextureRenderingInfo
---@field pulsating_arrows_timer number
---@field ready boolean
---@field right_arrow TextureRenderingInfo
---@field scroll_bottom_left TextureRenderingInfo
---@field scrollend_bottom_left TextureRenderingInfo
---@field selected_player integer
---@field start_panel TextureRenderingInfo
---@field start_panel_slide number
ScreenTeamSelect = {}

---@class ScreenTitle : Screen
---@field ana TextureRenderingInfo
---@field ana_left_eyeball_torch_reflection TextureRenderingInfo
---@field ana_right_eyeball_torch_reflection TextureRenderingInfo
---@field brightness number
---@field logo_spelunky2 TextureRenderingInfo
---@field music SoundMeta|nil
---@field particle_torchflame_ash ParticleEmitterInfo|nil
---@field particle_torchflame_backflames ParticleEmitterInfo|nil
---@field particle_torchflame_backflames_animated ParticleEmitterInfo|nil
---@field particle_torchflame_flames ParticleEmitterInfo|nil
---@field particle_torchflame_flames_animated ParticleEmitterInfo|nil
---@field particle_torchflame_smoke ParticleEmitterInfo|nil
---@field torch_sound SoundMeta|nil
ScreenTitle = {}

---@class ScreenTransition : Screen
---@field big_dollar_sign TextureRenderingInfo
---@field buttons integer[]
---@field hide_press_to_go_next_level boolean
---@field hourglasses TextureRenderingInfo
---@field killcount_rounded_rect TextureRenderingInfo
---@field level_completed_panel TextureRenderingInfo
---@field level_completed_pos number
---@field mama_tunnel TextureRenderingInfo
---@field mama_tunnel_agree_panel TextureRenderingInfo
---@field mama_tunnel_agree_panel_indicator TextureRenderingInfo
---@field mama_tunnel_agree_with_gift boolean
---@field mama_tunnel_choice_visible boolean
---@field mama_tunnel_face_invisible boolean
---@field mama_tunnel_face_transparency number
---@field mama_tunnel_fade_targetvalue number
---@field mama_tunnel_text_id STRINGID
---@field player_icon TextureRenderingInfo[]
---@field player_icon_index integer[]
---@field player_secondary_icon TextureRenderingInfo[]
---@field player_secondary_icon_type integer[]
---@field player_stats_scroll_numeric_value integer[]
---@field scroll TextureRenderingInfo
---@field small_dollar_signs TextureRenderingInfo
---@field speechbubble TextureRenderingInfo
---@field speechbubble_arrow TextureRenderingInfo
---@field stats_scroll_horizontal_posaa number
---@field stats_scroll_state_1 integer
---@field stats_scroll_state_2 integer
---@field stats_scroll_top_bottom TextureRenderingInfo
---@field stats_scroll_unfurl_actualvalue number
---@field stats_scroll_unfurl_sequence integer
---@field stats_scroll_unfurl_targetvalue number
---@field stats_scroll_vertical_pos number
---@field this_level_money_color Color
---@field woodpanel1 TextureRenderingInfo
---@field woodpanel2 TextureRenderingInfo
---@field woodpanel3 TextureRenderingInfo
---@field woodpanel_bottomcutout1 TextureRenderingInfo
---@field woodpanel_bottomcutout2 TextureRenderingInfo
---@field woodpanel_bottomcutout3 TextureRenderingInfo
---@field woodpanel_cutout1 TextureRenderingInfo
---@field woodpanel_cutout2 TextureRenderingInfo
---@field woodpanel_cutout3 TextureRenderingInfo
---@field woodpanel_cutout_big_money1 TextureRenderingInfo
---@field woodpanel_cutout_big_money2 TextureRenderingInfo
---@field woodpanel_cutout_big_money3 TextureRenderingInfo
---@field woodpanel_pos number
---@field woodplank TextureRenderingInfo
ScreenTransition = {}

---@class ScreenWin : Screen
---@field animation_state integer
---@field frame_timer integer
---@field rescuing_ship_entity Entity|nil
---@field sequence_timer integer
ScreenWin = {}

---Used in Items
---@class SelectPlayerSlot
---@field activated boolean
---@field character ENT_TYPE
---@field texture TEXTURE
SelectPlayerSlot = {}

---@class SharedIO
---@field wantkeyboard boolean|nil
---@field wantmouse boolean|nil
SharedIO = {}

---@class Shield : Entity, Movable, Purchasable
---@field shake number
Shield = {}

---@class ShootingStarSpawner : Entity
---@field timer integer
ShootingStarSpawner = {}

---@class Shopkeeper : Entity, Movable, PowerupCapable, Monster, RoomOwner
---@field has_key boolean @will drop key after stun/kill
---@field is_ear boolean
---@field name integer @0 - Ali, 1 - Bob, 2 - Comso ... and so one, anything above 28 is just random string, can crash the game
---@field shop_owner boolean
---@field shotgun_attack_delay integer @can't shot when the timer is running
Shopkeeper = {}

---Used in [get_short_tile_code](https://spelunky-fyi.github.io/overlunky/#get_short_tile_code), [get_short_tile_code_definition](https://spelunky-fyi.github.io/overlunky/#get_short_tile_code_definition) and PostRoomGenerationContext
---@class ShortTileCodeDef
---@field alt_tile_code TILE_CODE @Alternative tile code, ignored if `chance == 100`. Defaults to 0.
---@field chance integer @Chance in percent to pick `tile_code` over `alt_tile_code`, ignored if `chance == 0`. Defaults to 100.
---@field tile_code TILE_CODE @Tile code that is used by default when this short tile code is encountered. Defaults to 0.
ShortTileCodeDef = {}

---@class Skeleton : Entity, Movable, PowerupCapable, Monster
---@field explosion_timer integer @-1 = never explodes
Skeleton = {}

---@class SkullDropTrap : Entity, Movable
---@field left_skull_drop_time integer
---@field left_skull_uid integer
---@field middle_skull_drop_time integer
---@field middle_skull_uid integer
---@field right_skull_drop_time integer
---@field right_skull_uid integer
---@field sound SoundMeta|nil
---@field timer integer @counts from 60 to 0, 3 times, the last time dropping the skulls, then random longer timer for reset
SkullDropTrap = {}

---@class SleepBubble : Entity, Movable
---@field show_hide_timer integer
SleepBubble = {}

---@class SlidingWallCeiling : Entity, Floor
---@field active_floor_part_uid integer
---@field attached_piece Entity|nil
---@field ball_drop SoundMeta|nil
---@field ball_rise SoundMeta|nil
---@field state integer @1 - going up / is at the top, 2 - pause
SlidingWallCeiling = {}

---@class SnapTrap : Entity, Movable
---@field bait_uid integer
---@field reload_timer integer
SnapTrap = {}

---@class Sorceress : Entity, Movable, PowerupCapable, Monster, WalkingMonster
---@field fx_entity Entity|nil
---@field halo_emitted_light Illumination|nil
---@field hover_timer integer
---@field in_air_timer number
---@field inbetween_attack_timer integer
---@field sound SoundMeta|nil
Sorceress = {}

---@class SoundInfo
---@field sound_id SOUNDID
---@field sound_name string
SoundInfo = {}

---@class SoundMeta
---@field left_channel number[] @Use VANILLA_SOUND_PARAM as index, warning: special case with first index at 0, loop using pairs will get you all results but the key/index will be wrong, ipairs will have correct key/index but will skip the first element
---@field playing boolean @set to false to turn off
---@field right_channel number[] @Use VANILLA_SOUND_PARAM as index warning: special case with first index at 0, loop using pairs will get you all results but the key/index will be wrong, ipairs will have correct key/index but will skip the first element
---@field sound_info SoundInfo|nil
---@field start_over boolean @when false, current track starts from the beginning, is immediately set back to true
---@field x number
---@field y number
SoundMeta = {}

function SoundMeta:start() end

---@class SoundShot : Entity, Movable, Projectile, LightShot
---@field sound SoundMeta|nil
SoundShot = {}

---@class Spark : Entity, Movable, Flame
---@field distance number @This is custom variable, you need [activate_sparktraps_hack](https://spelunky-fyi.github.io/overlunky/#activate_sparktraps_hack) to use it
---@field fx_entity Entity|nil
---@field next_size number @width and height will be set to `next_size * size_multiply` next frame
---@field particle ParticleEmitterInfo|nil
---@field rotation_angle number
---@field rotation_center_x number
---@field rotation_center_y number
---@field size number @slowly goes down to default 1.0, is 0.0 when not on screen
---@field size_change_timer integer @very short timer before next size change, giving a pulsing effect
---@field size_multiply number @0.0 when not on screen
---@field speed number @This is custom variable, you need [activate_sparktraps_hack](https://spelunky-fyi.github.io/overlunky/#activate_sparktraps_hack) to use it
Spark = {}

---@class SparkTrap : Entity, Floor
---@field emitted_light Illumination|nil
---@field spark_uid integer
SparkTrap = {}

---@class SpawnInfo
---@field grid_entity Entity|nil @Grid entity at this position, will only try to spawn procedural if this is nil
---@field room_template ROOM_TEMPLATE
---@field x number
---@field y number
SpawnInfo = {}

---@class Spear : Entity, Movable
---@field sound_id SOUNDID
Spear = {}

---@class SpecialShot : Entity, Movable, LightEmitter
---@field target_x number
---@field target_y number
SpecialShot = {}

---@class Spider : Entity, Movable, PowerupCapable, Monster
---@field ceiling_pos_x number
---@field ceiling_pos_y number
---@field jump_timer integer @For the giant spider, some times he shot web instead of jumping
---@field trigger_distance number @only in the x coordinate
Spider = {}

---@return boolean
function Spider:on_ceiling() end

---@class SpikeballTrap : Entity, Floor
---@field chain Entity|nil
---@field end_piece Entity|nil
---@field sound SoundMeta|nil
---@field state integer @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
---@field timer integer @for the start and retract
SpikeballTrap = {}

---@class SplashBubbleGenerator : Entity
---@field timer integer
SplashBubbleGenerator = {}

---@class SpritePosition
---@field column integer
---@field row integer
SpritePosition = {}

---Can be accessed via global [state](https://spelunky-fyi.github.io/overlunky/#state)
---@class StateMemory
---@field arena ArenaState
---@field camera Camera|nil @Camera bounds and position
---@field camera_layer integer
---@field cause_of_death CAUSE_OF_DEATH
---@field cause_of_death_entity_type ENT_TYPE
---@field coffin_contents ENT_TYPE @the contents of the special coffin that will be spawned during levelgen
---@field correct_ushabti integer @See `get_correct_ushabti`. == anim_frame - (2 * floor(anim_frame/12))
---@field current_theme ThemeInfo|nil @Points to the current ThemeInfo
---@field damage_taken integer @Total amount of damage taken, excluding cause of death
---@field end_spaceship_character ENT_TYPE @Who pops out the spaceship for a tiamat/hundun win, this is set upon the spaceship door open
---@field fade_circle boolean @Makes loading use circle iris effect instead of fade on FADE.IN
---@field fade_delay integer @Additional delay after fade_timer reaches 0, before moving to the next fading state. Used after Ouroboros, in credits etc. for longer black screens, but also works after FADE.IN.
---@field fade_enabled boolean @Enables the fade effect on FADE.IN, setting to false makes loading skip FADE.IN state instantly
---@field fade_length integer @Total frames for fade-in/fade-out when loading.
---@field fade_timer integer @Remaining frames for fade-in/fade-out when loading. Counts down to 0.
---@field fade_value number @Current fade-to-black amount (0.0 = all visible; 1.0 = all black). Manipulated by the loading routine when loading > 0.
---@field first_damage_cause ENT_TYPE
---@field first_damage_level integer
---@field first_damage_world integer
---@field height integer @level height in rooms (number of rooms vertically)
---@field illumination Illumination|nil @The global level illumination, very big and bright.
---@field items Items|nil @Has the current player count, player inventories and character selections
---@field journal_flags JOURNAL_FLAG
---@field journal_progress_stain_count integer
---@field journal_progress_stain_slots JournalProgressStainSlot[] @blood splats and paw prints in journal progress page
---@field journal_progress_sticker_count integer
---@field journal_progress_sticker_slots JournalProgressStickerSlot[] @stickers for notable items and entities in journal progress page
---@field journal_progress_theme_count integer
---@field journal_progress_theme_slots THEME[] @visited themes in journal progress page
---@field kali_altars_destroyed integer @Also affects if the player has punish ball, if the punish ball is destroyed it is set to -1
---@field kali_favor integer
---@field kali_gifts integer @0 - none, 1 - item, 3 - kapala
---@field kali_status integer
---@field kills_npc integer
---@field layer_transition_timer integer
---@field level integer @Current level number, shown in hud and used by some game logic like choosing the next level on transition
---@field level_count integer @Current zero-based level count, or number of levels completed
---@field level_flags integer
---@field level_gen LevelGenSystem|nil @Entrance and exit coordinates, shop types and all themes
---@field level_next integer @Next level number, used when loading a new level or transition
---@field level_start integer @Level number to start new runs in
---@field liquid LiquidPhysics|nil
---@field loading FADE @Current loading/fade state. Pauses all updates if > FADE.NONE. Writing FADE.OUT or FADE.LOAD will trigger a screen load to `screen_next`.
---@field logic LogicList|nil @Level logic like dice game and cutscenes
---@field merchant_aggro integer @Tun aggro
---@field money_last_levels integer
---@field money_shop_total integer @Total amount spent in shops and sold idols during the run<br> The total money currently available is `loop (players[].inventory.money + players[].inventory.collected_money_total) + state.money_shop_total`
---@field next_entity_uid integer @Next entity spawned will have this uid
---@field outposts_spawned integer
---@field pause PAUSE @8bit flags, multiple might be active at the same time 1: Menu: Pauses the level timer and engine. Can't set, controlled by the menu. 2: Fade/Loading: Pauses all timers and engine. 4: Cutscene: Pauses total/level time but not engine. Used by boss cutscenes. 8: Unknown: Pauses total/level time and engine. Does not pause the global counter so set_global_interval still runs. 16: Unknown: Pauses total/level time and engine. Does not pause the global counter so set_global_interval still runs. 32: Ankh: Pauses all timers, engine, but not camera. Used by the ankh cutscene.
---@field player_inputs PlayerInputs|nil @Access the player inputs even when no player entities are available
---@field presence_flags PRESENCE_FLAG
---@field quest_flags QUEST_FLAG @32bit flags, can be written to trigger a run reset on next level load etc.
---@field quests QuestsInfo|nil @NPC quest states
---@field room_owners RoomOwnersInfo @Holds info about owned rooms and items (shops, challenge rooms, vault etc.)
---@field saved_cats integer
---@field saved_dogs integer @Run totals
---@field saved_hamsters integer
---@field screen SCREEN @Current SCREEN, generally read-only or weird things will happen
---@field screen_arena_intro ScreenArenaIntro|nil
---@field screen_arena_items ScreenArenaItems|nil
---@field screen_arena_level ScreenArenaLevel|nil
---@field screen_arena_menu ScreenArenaMenu|nil
---@field screen_arena_score ScreenArenaScore|nil
---@field screen_arena_stages_select ScreenArenaStagesSelect|nil
---@field screen_camp ScreenStateCamp|nil
---@field screen_change_counter integer
---@field screen_character_select ScreenCharacterSelect|nil
---@field screen_constellation ScreenConstellation|nil
---@field screen_credits ScreenCredits|nil @The spaceship minigame
---@field screen_death ScreenDeath|nil
---@field screen_last SCREEN @Previous SCREEN, used to check where we're coming from when loading another SCREEN
---@field screen_level ScreenStateLevel|nil
---@field screen_next SCREEN @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`.
---@field screen_recap ScreenRecap|nil @Journal after CO win
---@field screen_scores ScreenScores|nil @Landing on the moon after win
---@field screen_team_select ScreenTeamSelect|nil @For the arena
---@field screen_transition ScreenTransition|nil
---@field screen_win ScreenWin|nil
---@field seed integer @Current seed in seeded mode, just set to a funny value and does nothing in adventure mode
---@field shoppie_aggro integer @Current shoppie aggro
---@field shoppie_aggro_next integer @Shoppie aggro to use in the next level
---@field special_visibility_flags integer
---@field speechbubble_owner integer
---@field speechbubble_timer integer
---@field speedrun_activation_trigger boolean @must transition from true to false to activate it
---@field speedrun_character ENT_TYPE @Who administers the tutorial speedrun in base camp
---@field storage_uid integer @entity uid of the first floor_storage entity
---@field theme THEME @Current THEME number, used to pick the music and by some game logic like choosing the next level on transition
---@field theme_info ThemeInfo|nil @Points to the current ThemeInfo
---@field theme_next THEME @Next THEME number, used when loading a new level or transition
---@field theme_start THEME @THEME to start new runs in
---@field time_last_level integer @Level time of previous level in frames, used by game logic to decide dark levels etc
---@field time_level integer @Level time of current level in frames, show on the hud
---@field time_speedrun integer
---@field time_startup integer @Number of frames since the game was launched
---@field time_total integer @Total frames of current run, equal to the final game time on win
---@field toast_timer integer
---@field transition_to_layer integer
---@field user_data any @You can store a table (or lua primitive) here and it will store data correctly in online multiplayer, by having a different copy on each state and being copied over when the game does. Doesn't support recursive tables / cyclic references. Metatables will be transferred by reference instead of being copied
---@field waddler_metadata integer[]
---@field waddler_storage ENT_TYPE[]
---@field width integer @level width in rooms (number of rooms horizontally)
---@field win_state integer @0 = no win 1 = tiamat win 2 = hundun win 3 = CO win; set this and next doorway leads to victory scene
---@field world integer @Current world number, shown in hud and used by some game logic like choosing the next level on transition
---@field world2_coffin_spawned boolean
---@field world4_coffin_spawned boolean
---@field world6_coffin_spawned boolean
---@field world_next integer @Next world number, used when loading a new level or transition
---@field world_start integer @World number to start new runs in
StateMemory = {}

---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!
---@param t THEME
function StateMemory:force_current_theme(t) end

---Returns animation_frame of the correct ushabti
---@return integer
function StateMemory:get_correct_ushabti() end

---@param animation_frame integer
function StateMemory:set_correct_ushabti(animation_frame) end

---Used in SaveRelated
---@class StickersData
---@field sprite_id integer
---@field texture TEXTURE
StickersData = {}

---@class StickyTrap : Entity, Floor
---@field attached_piece_uid integer
---@field ball_uid integer
---@field sound SoundMeta|nil
---@field state integer @0 - none, 1 - start, 2 - going down, 3 - is at the bottom, 4 - going up, 5 - pause
---@field timer integer
StickyTrap = {}

---@class StretchChain : Entity, Movable
---@field at_end_of_chain_uid integer
---@field dot_offset number
---@field inverse_doubled_position_in_chain integer
---@field is_dot_hidden boolean
---@field position_in_chain integer
StretchChain = {}

---@class Switch : Entity, Movable
---@field timer integer
Switch = {}

---@class TV : Entity, Movable
---@field emitted_light Illumination|nil
---@field fx_button Entity|nil
---@field sound SoundMeta|nil
---@field station integer
TV = {}

---@class Tadpole : Entity, Movable, PowerupCapable, Monster
---@field acceleration_timer integer
---@field player_spotted boolean
Tadpole = {}

---@class Teleporter : Entity, Movable, Purchasable
---@field teleport_number integer
Teleporter = {}

---@class TeleporterBackpack : Entity, Movable, Powerup, Backpack
---@field teleport_number integer
TeleporterBackpack = {}

---@class TeleportingBorder : Entity, Floor
---@field direction integer @0 - right, 1 - left, 2 - bottom, 3 - top, 4 - disable
TeleportingBorder = {}

---@class Telescope : Entity, Movable
---@field camera_anchor Entity|nil
---@field fx_button Entity|nil
---@field looked_through_by_uid integer
Telescope = {}

---@class Tentacle : Entity, Movable, Chain
---@field bottom Entity|nil
Tentacle = {}

---@class TentacleBottom : Entity, Floor
---@field attached_piece_uid integer
---@field state integer @0 - none, 1 - start, 2 - moving up, 3 - at the top, 4 - moving down 5 - pause
---@field tentacle_uid integer
TentacleBottom = {}

---@class Terra : Entity, Movable, PowerupCapable, Monster
---@field abuse_speechbubble_timer integer
---@field fx_button Entity|nil
---@field x_pos number
Terra = {}

---@class TextRenderingInfo
---@field height number
---@field special_texture_id TEXTURE @Used to draw buttons and stuff, default is -1 which uses the buttons texture
---@field text_length integer @You can also just use `#` operator on the whole TextRenderingInfo to get the text length
---@field width number
---@field x number
---@field y number
TextRenderingInfo = {}

---@param text string
---@param x number
---@param y number
---@param scale_x number
---@param scale_y number
---@param alignment integer
---@param fontstyle integer
---@return TextRenderingInfo
---@overload fun(text: string, scale_x: number, scale_y: number, alignment: integer, fontstyle: integer): TextRenderingInfo
function TextRenderingInfo.new(text, x, y, scale_x, scale_y, alignment, fontstyle) end

---Returns reference to the letter coordinates relative to the x,y position
---@return Letter[]
function TextRenderingInfo:get_dest() end

---@return TEXTURE
function TextRenderingInfo:get_font() end

---Returns reference to the letter coordinates in the texture
---@return Letter[]
function TextRenderingInfo:get_source() end

---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
---@param angle number
---@param px number|nil
---@param py number|nil
function TextRenderingInfo:rotate(angle, px, py) end

---@param id TEXTURE
---@return boolean
function TextRenderingInfo:set_font(id) end

---Changes the text, only position stays the same, everything else (like rotation) is reset or set according to the parameters
---@param text string
---@param scale_x number
---@param scale_y number
---@param alignment VANILLA_TEXT_ALIGNMENT
---@param fontstyle VANILLA_FONT_STYLE
function TextRenderingInfo:set_text(text, scale_x, scale_y, alignment, fontstyle) end

---{width, height}, is only updated when you set/change the text. This is equivalent to draw_text_size
---@return number
---@return number
function TextRenderingInfo:text_size() end

---Use `TextureDefinition.new()` to get a new instance to this and pass it to [define_texture](https://spelunky-fyi.github.io/overlunky/#define_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.
---@class TextureDefinition
---@field height integer
---@field sub_image_height integer
---@field sub_image_offset_x integer
---@field sub_image_offset_y integer
---@field sub_image_width integer
---@field texture_path string
---@field tile_height integer
---@field tile_width integer
---@field width integer
TextureDefinition = {}

---@class TextureRenderingInfo
---@field destination_bottom_left_x number @destination is relative to the x,y center point
---@field destination_bottom_left_y number
---@field destination_bottom_right_x number
---@field destination_bottom_right_y number
---@field destination_top_left_x number
---@field destination_top_left_y number
---@field destination_top_right_x number
---@field destination_top_right_y number
---@field source_bottom_left_x number
---@field source_bottom_left_y number
---@field source_bottom_right_x number
---@field source_bottom_right_y number
---@field source_top_left_x number
---@field source_top_left_y number
---@field source_top_right_x number
---@field source_top_right_y number
---@field x number
---@field y number
TextureRenderingInfo = {}

---@return TextureRenderingInfo
---@overload fun(p1: TextureRenderingInfo): TextureRenderingInfo
function TextureRenderingInfo.new() end

---@return Quad
function TextureRenderingInfo:dest_get_quad() end

---@param quad Quad
function TextureRenderingInfo:dest_set_quad(quad) end

---@param bbox AABB
function TextureRenderingInfo:set_destination(bbox) end

---@return Quad
function TextureRenderingInfo:source_get_quad() end

---@param quad Quad
function TextureRenderingInfo:source_set_quad(quad) end

---@class ThemeInfo
---@field allow_beehive boolean
---@field allow_leprechaun boolean
---@field sub_theme ThemeInfo|nil
---@field theme integer
ThemeInfo = {}

---Adds a character unlock coffin room
function ThemeInfo:add_coffin() end

---Adds a Dirk coffin room
function ThemeInfo:add_dirk_coffin() end

---Adds an idol room
function ThemeInfo:add_idol() end

---Adds a player revival coffin room
function ThemeInfo:add_player_coffin() end

---Adds the metal clanking or oppression rooms
function ThemeInfo:add_special_feeling() end

---Adds rooms related to udjat, black market, castle etc
function ThemeInfo:add_special_rooms() end

---Adds a vault room
function ThemeInfo:add_vault() end

---@param callback_id integer
function ThemeInfo:clear_virtual(callback_id) end

---Spawns a single procedural entity, used in spawn_procedural (mostly monsters, scarab in dark levels etc.)
---@param info SpawnInfo|nil
function ThemeInfo:do_procedural_spawn(info) end

---Generates and adds the path rooms and exit room
---Params: reset to start over from the beginning if other rooms didn't fit
---@param reset boolean
function ThemeInfo:generate_path(reset) end

---Returns: dynamic backlayer light level (0..1)
---@return number
function ThemeInfo:get_backlayer_light_level() end

---Returns: TEXTURE for the LUT to be applied to the special back layer, e.g. vlad's castle
---@return integer
function ThemeInfo:get_backlayer_lut() end

---Returns: ENT_TYPE used for the backwall (BG_LEVEL_BACKWALL by default)
---@return ENT_TYPE
function ThemeInfo:get_backwall_type() end

---Returns: THEME, or logical base THEME for special levels (Abzu->Tide Pool etc)
---@return integer
function ThemeInfo:get_base_id() end

---Returns: ENT_TYPE to use for the border tiles
---@return ENT_TYPE
function ThemeInfo:get_border_type() end

---Returns: ENT_TYPE for theme specific critter
---@return ENT_TYPE
function ThemeInfo:get_critter_type() end

---Returns: TEXTURE based on texture_id
---Params: DYNAMIC_TEXTURE texture_id
---@param texture_id DYNAMIC_TEXTURE
---@return TEXTURE
function ThemeInfo:get_dynamic_texture(texture_id) end

---Returns: usually state.height - 1. For special levels fixed heights are returned.
---@return integer
function ThemeInfo:get_exit_room_y_level() end

---Returns: true if explosions should spawn background soot
---@return boolean
function ThemeInfo:get_explosion_soot() end

---Returns: ENT_TYPE used for floor spreading (generic or one of the styled floors)
---@return ENT_TYPE
function ThemeInfo:get_floor_spreading_type() end

---Returns: ENT_TYPE used for floor spreading (stone or one of the styled floors)
---@return ENT_TYPE
function ThemeInfo:get_floor_spreading_type2() end

---Returns: The .lvl file to load (e.g. dwelling = dwellingarea.lvl except when level == 4 (cavebossarea.lvl))
---@return string
function ThemeInfo:get_level_file() end

---Returns: gravity used to initialize liquid pools (-1..1)
---@return number
function ThemeInfo:get_liquid_gravity() end

---Returns: true if the loop rendering should be enabled (Combine with the right get_border_type)
---@return boolean
function ThemeInfo:get_loop() end

---Returns: false to disable most player damage and the usage of bombs and ropes. Enabled in parts of base camp.
---@return boolean
function ThemeInfo:get_player_damage() end

---Returns: inverse shop chance
---@return integer
function ThemeInfo:get_shop_chance() end

---Returns: allow_beehive or allow_leprechaun flag
---Params: index: 0 or 1
---@param index integer
---@return boolean
function ThemeInfo:get_theme_flag(index) end

---Returns: THEME, or subtheme in CO
---@return integer
function ThemeInfo:get_theme_id() end

---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
---@return integer
function ThemeInfo:get_transition_floor_modifier() end

---Returns: true if transition should use styled floor
---@return boolean
function ThemeInfo:get_transition_styled_floor() end

---Returns: ENT_TYPE used for the transition floor
---@return ENT_TYPE
function ThemeInfo:get_transition_styled_floor_type() end

---Returns: highest y-level a vault can spawn
---@return integer
function ThemeInfo:get_vault_level() end

---Initializes some flags in the LevelGenSystem, also dark level flag in state.level_flags.
function ThemeInfo:init_flags() end

---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.
function ThemeInfo:init_level() end

function ThemeInfo:init_rooms() end

---Fixes textures on pleasure palace ladders, adds some decorations
function ThemeInfo:post_process_entities() end

---Theme specific specialties like randomizing ushabti and Coco coffin location, spawns impostor lakes
function ThemeInfo:post_process_level() end

---Handles loading the next level screen from a transition screen
function ThemeInfo:post_transition() end

---Sets state.level_next, world_next and theme_next (or state.win_state) based on level number. Runs when exiting a level.
function ThemeInfo:pre_transition() end

---Sets the beehive and leprechaun flags
function ThemeInfo:reset_theme_flags() end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_backlayer_light_level(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_base_id(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_coffin(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_dirk_coffin(fun) end

---@param fun fun(self: ThemeInfo|nil, p2: SpawnInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_do_procedural_spawn(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_dtor(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_ent_backwall(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_ent_border(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_ent_critter(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_ent_floor_spreading(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_ent_floor_spreading2(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_ent_transition_styled_floor(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_exit_room_y_level(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_feeling(fun) end

---@param fun fun(self: ThemeInfo|nil, p2: boolean) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_generate_path(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_gravity(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_idol(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_init_flags(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_init_level(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_init_rooms(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_loop(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_player_coffin(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_player_damage(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_post_process_entities(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_post_process_level(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_post_transition(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_pre_transition(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_reset_theme_flags(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_shop_chance(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_soot(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_spawn_background(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_spawn_border(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_spawn_decoration(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_spawn_decoration2(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_spawn_effects(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_spawn_extra(fun) end

---@param fun fun(self: ThemeInfo|nil, p2: integer, p3: integer, p4: integer) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_spawn_level(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_spawn_lights(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_spawn_players(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_spawn_procedural(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_spawn_transition(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_spawn_traps(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_special_rooms(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_texture_backlayer_lut(fun) end

---@param fun fun(self: ThemeInfo|nil, p2: integer) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_texture_dynamic(fun) end

---@param fun fun(self: ThemeInfo|nil, p2: integer) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_theme_flag(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_theme_id(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_transition_modifier(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_transition_styled_floor(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_vault(fun) end

---@param fun fun(self: ThemeInfo|nil) @Returning nil: ignored.
---@return integer
function ThemeInfo:set_post_vault_level(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function ThemeInfo:set_post_virtual(index, fun) end

---@param fun fun(self: ThemeInfo|nil): number|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_backlayer_light_level(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_base_id(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_coffin(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_dirk_coffin(fun) end

---@param fun fun(self: ThemeInfo|nil, p2: SpawnInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_do_procedural_spawn(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_dtor(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_ent_backwall(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_ent_border(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_ent_critter(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_ent_floor_spreading(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_ent_floor_spreading2(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_ent_transition_styled_floor(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_exit_room_y_level(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_feeling(fun) end

---@param fun fun(self: ThemeInfo|nil, p2: boolean): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_generate_path(fun) end

---@param fun fun(self: ThemeInfo|nil): number|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_gravity(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_idol(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_init_flags(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_init_level(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_init_rooms(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_loop(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_player_coffin(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_player_damage(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_post_process_entities(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_post_process_level(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_post_transition(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_pre_transition(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_reset_theme_flags(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_shop_chance(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_soot(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_spawn_background(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_spawn_border(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_spawn_decoration(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_spawn_decoration2(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_spawn_effects(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_spawn_extra(fun) end

---@param fun fun(self: ThemeInfo|nil, p2: integer, p3: integer, p4: integer): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_spawn_level(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_spawn_lights(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_spawn_players(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_spawn_procedural(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_spawn_transition(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_spawn_traps(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_special_rooms(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_texture_backlayer_lut(fun) end

---@param fun fun(self: ThemeInfo|nil, p2: integer): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_texture_dynamic(fun) end

---@param fun fun(self: ThemeInfo|nil, p2: integer): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_theme_flag(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_theme_id(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_transition_modifier(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_transition_styled_floor(fun) end

---@param fun fun(self: ThemeInfo|nil): boolean|nil @Returning nil: treated as false: the original function runs (true skips it).
---@return integer
function ThemeInfo:set_pre_vault(fun) end

---@param fun fun(self: ThemeInfo|nil): integer|nil @Returning nil: the original function runs (a value replaces its result and skips it).
---@return integer
function ThemeInfo:set_pre_vault_level(fun) end

---@param index integer
---@param fun function
---@return integer|nil
function ThemeInfo:set_pre_virtual(index, fun) end

---Adds the main level background , e.g. CO stars / Duat moon / Plain backwall for other themes
function ThemeInfo:spawn_background() end

---Spawns the border entities (some floor or teleportingborder)
function ThemeInfo:spawn_border() end

---Spawns some specific decoration, e.g. Vlad's big banner
function ThemeInfo:spawn_decoration() end

---Spawns some other specific decorations, e.g. grass, flowers, udjat room decal
function ThemeInfo:spawn_decoration2() end

---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. Spawns beg and handles it's quest flags
function ThemeInfo:spawn_effects() end

---Spawns specific extra entities and decorations, like gold key, seaweed, lanterns, banners, signs, wires...
function ThemeInfo:spawn_extra() end

---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.)
function ThemeInfo:spawn_level() end

---Adds room lights to udjat chest room or black market
function ThemeInfo:spawn_lights() end

---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.
function ThemeInfo:spawn_players() end

---Adds legs under platforms, random pots, goldbars, monsters, compass indicator, initialises quests, random shadows...
function ThemeInfo:spawn_procedural() end

---Spawns the transition tunnel and players in it
function ThemeInfo:spawn_transition() end

---Spawns theme specific random traps, pushblocks and critters. Sets special exit doors.
function ThemeInfo:spawn_traps() end

---@class ThinIce : Entity, Movable
---@field strength integer @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
ThinIce = {}

---@class Tiamat : Entity, Movable, PowerupCapable, Monster
---@field attack_timer integer
---@field attack_x number @This is custom variable, you need [activate_tiamat_position_hack](https://spelunky-fyi.github.io/overlunky/#activate_tiamat_position_hack) to use it
---@field attack_y number @This is custom variable, you need [activate_tiamat_position_hack](https://spelunky-fyi.github.io/overlunky/#activate_tiamat_position_hack) to use it
---@field damage_timer integer
---@field frown_timer integer
---@field fx_tiamat_arm_right1 integer
---@field fx_tiamat_arm_right2 integer
---@field fx_tiamat_head integer
---@field right_arm_angle number
---@field sound SoundMeta|nil @Turning into stone sound
---@field tail_angle number
---@field tail_move_speed number
---@field tail_radian number
Tiamat = {}

---@class TiamatShot : Entity, Movable, LightEmitter
---@field sound SoundMeta|nil
TiamatShot = {}

---@class TimedForceField : Entity, Floor, ForceField
---@field pause boolean
---@field timer integer
TimedForceField = {}

---@class TimedPowderkeg : Entity, Movable, PushBlock
---@field timer integer @timer till explosion, -1 = pause, counts down
TimedPowderkeg = {}

---@class TimedShot : Entity, Movable, Projectile, LightShot
---@field timer integer
TimedShot = {}

---@class Torch : Entity, Movable
---@field flame_uid integer
---@field is_lit boolean @It's used just to check, to light/extinguish use `light_up` function
Torch = {}

---@return ENT_TYPE
function Torch:get_flame_type() end

---@param lit boolean
function Torch:light_up(lit) end

---@class TorchFlame : Entity, Movable, Flame
---@field flame_particle ParticleEmitterInfo|nil
---@field flame_size number
---@field smoke_particle ParticleEmitterInfo|nil
---@field warp_particle ParticleEmitterInfo|nil
TorchFlame = {}

---@class TotemTrap : Entity, Floor
---@field first_sound_id SOUNDID
---@field spawn_entity_type ENT_TYPE
TotemTrap = {}

---The uid must be movable entity for ownership transfers
---@param who_uid integer
---@param left boolean
function TotemTrap:trigger(who_uid, left) end

---@class TransferFloor : Entity, Floor
---@field transferred_entities table<integer, integer> @Index is the uid, value is frame the entity entered the floor (time_level), use `pairs` to loop thru
TransferFloor = {}

---@class TrapPart : Entity, Movable
---@field ceiling Entity|nil
TrapPart = {}

---@class Treasure : Entity, Movable
---@field cashed boolean @spawns a dust effect and adds money for the total
Treasure = {}

---@class TreasureHook : Entity, Movable
---@field sound SoundMeta|nil
TreasureHook = {}

---@class Triangle
---@field A Vec2
---@field B Vec2
---@field C Vec2
Triangle = {}

---@return Triangle
---@overload fun(other: Triangle): Triangle
---@overload fun(p1: Vec2, p2: Vec2, p3: Vec2): Triangle
---@overload fun(ax: number, ay: number, bx: number, by: number, cx: number, cy: number): Triangle
function Triangle.new() end

---@return number
function Triangle:area() end

---Also known as centroid
---@return Vec2
function Triangle:center() end

---Returns ABC, BCA, CAB angles in radians
---@return number
---@return number
---@return number
function Triangle:get_angles() end

---@param p Vec2
---@return boolean
---@overload fun(self: Triangle, p: Vec2, epsilon: number): boolean
---@overload fun(self: Triangle, x: number, y: number): boolean
---@overload fun(self: Triangle, x: number, y: number, epsilon: number): boolean
function Triangle:is_point_inside(p) end

---@param off Vec2
---@return Triangle
---@overload fun(self: Triangle, x: number, y: number): Triangle
function Triangle:offset(off) end

---Rotate triangle by an angle, the px/py are just coordinates, not offset from the center
---@param angle number
---@param px number
---@param py number
---@return Triangle
function Triangle:rotate(angle, px, py) end

---@param scale number
---@return Triangle
function Triangle:scale(scale) end

---@param other Triangle
---@return Triangle
function Triangle:set(other) end

---@return Vec2
---@return Vec2
---@return Vec2
function Triangle:split() end

---@class TrueCrownPowerup : Entity, Movable, Powerup
---@field timer integer
TrueCrownPowerup = {}

---@class Tun : Entity, Movable, PowerupCapable, Monster, RoomOwner
---@field arrows_left integer
---@field challenge_fee_paid boolean @affect only the speech bubble
---@field congrats_challenge boolean @congrats message shown after exiting a challenge
---@field murdered boolean
---@field reload_timer integer @when 0, a new arrow is loaded into the bow; resets when she finds an arrow on the ground
---@field shop_entered boolean
---@field tiamat_encounter boolean @if set to false, greets you with 'you've done well to reach this place'
Tun = {}

---@class UFO : Entity, Movable, PowerupCapable, Monster
---@field attack_cooldown_timer integer
---@field is_rising boolean
---@field patrol_distance integer
---@field sound SoundMeta|nil
UFO = {}

---@class UdjatSocket : Entity, Movable
---@field fx_button Entity|nil
UdjatSocket = {}

---Requires unsafe mode.
---@class UdpServer
UdpServer = {}

---Start/bind an UDP server on specified address. Set port to 0 to use a random ephemeral port.
---@param host string
---@param port integer
---@return UdpServer
---@overload fun(address: string): UdpServer
---@overload fun(): UdpServer
function UdpServer.new(host, port) end

---Returns string representation of the server address in format "ip:port"
---@return string
function UdpServer:address() end

---Closes the server.
function UdpServer:close() end

---Returns true if the port was opened successfully and the server hasn't been closed yet.
---@return boolean
function UdpServer:is_open() end

---Value of the last raised exception
---@return integer
function UdpServer:last_error() end

---Returns a string explaining the last error
---@return string
function UdpServer:last_error_str() end

---Read message from the socket buffer. Reads maximum of 32KiB at the time. If the message is longer, it will be split to portions of 32KiB. On failure or empty buffer returns -1, on success calls the function with signature `nil(message, source)`
---@param fun function
---@return integer
function UdpServer:read(fun) end

---Send to address in format `ip:port`
---@param message string
---@param address string
---@return integer
---@overload fun(self: UdpServer, message: string, host: string, port: integer): integer
function UdpServer:send(message, address) end

---@class UnchainedSpikeBall : Entity, Movable
---@field bounce boolean
UnchainedSpikeBall = {}

---@class Ushabti : Entity, Movable
---@field shine_timer integer
---@field wiggle_timer integer
Ushabti = {}

---@class Vampire : Entity, Movable, PowerupCapable, Monster
---@field jump_trigger_distance_x number
---@field jump_trigger_distance_y number
---@field sleep_pos_x number
---@field sleep_pos_y number
---@field walk_pause_timer integer
Vampire = {}

---@class VanHorsing : Entity, Movable, PowerupCapable, Monster, NPC
---@field show_text boolean @if set to true, he will say "I've been hunting this fiend a long time!" when on screen
---@field special_message_shown boolean @one way door message has been shown
VanHorsing = {}

---Opaque handle to a movable behavior from the vanilla game
---@class VanillaMovableBehavior : MovableBehavior
VanillaMovableBehavior = {}

---Used in [set_callback](https://spelunky-fyi.github.io/overlunky/#set_callback) ON.RENDER_* callbacks, [set_post_render](https://spelunky-fyi.github.io/overlunky/#set_post_render), [set_post_render_screen](https://spelunky-fyi.github.io/overlunky/#set_post_render_screen), [set_pre_render](https://spelunky-fyi.github.io/overlunky/#set_pre_render), [set_pre_render_screen](https://spelunky-fyi.github.io/overlunky/#set_pre_render_screen)
---@class VanillaRenderContext
---@field bounding_box AABB
VanillaRenderContext = {}

---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
---@param A Vec2
---@param B Vec2
---@param thickness number
---@param color Color
function VanillaRenderContext:draw_screen_line(A, B, thickness, color) end

---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
---@param points Quad
---@param thickness number
---@param color Color
---@param closed boolean
---@overload fun(self: VanillaRenderContext, points: Vec2[], thickness: number, color: Color, closed: boolean)
function VanillaRenderContext:draw_screen_poly(points, thickness, color, closed) end

---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
---@param points Quad
---@param color Color
---@overload fun(self: VanillaRenderContext, points: Vec2[], color: Color)
function VanillaRenderContext:draw_screen_poly_filled(points, color) end

---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 rotation 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
---@param rect AABB
---@param thickness number
---@param color Color
---@param angle number|nil
---@param px number|nil
---@param py number|nil
function VanillaRenderContext:draw_screen_rect(rect, thickness, color, angle, px, py) end

---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 rotation where 0,0 is center 1,1 is top right corner etc.
---Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
---@param rect AABB
---@param color Color
---@param angle number|nil
---@param px number|nil
---@param py number|nil
function VanillaRenderContext:draw_screen_rect_filled(rect, color, angle, px, py) end

---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
---@param texture_id TEXTURE
---@param row integer
---@param column integer
---@param left number
---@param top number
---@param right number
---@param bottom number
---@param color Color
---@overload fun(self: VanillaRenderContext, texture_id: TEXTURE, row: integer, column: integer, rect: AABB, color: Color)
---@overload fun(self: VanillaRenderContext, texture_id: TEXTURE, row: integer, column: integer, rect: AABB, color: Color, angle: number, px: number, py: number)
---@overload fun(self: VanillaRenderContext, texture_id: TEXTURE, row: integer, column: integer, dest: Quad, color: Color)
---@overload fun(self: VanillaRenderContext, texture_id: TEXTURE, source: Quad, dest: Quad, color: Color)
---@overload fun(self: VanillaRenderContext, texture_id: TEXTURE, tri: TextureRenderingInfo, color: Color)
function VanillaRenderContext:draw_screen_texture(texture_id, row, column, left, top, right, bottom, color) end

---Draw triangle in screen coordinates using the built-in renderer.
---Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
---@param triangle Triangle
---@param thickness number
---@param color Color
function VanillaRenderContext:draw_screen_triangle(triangle, thickness, color) end

---Draw filled triangle in screen coordinates using the built-in renderer.
---Use in combination with ON.RENDER_✱_HUD/PAUSE_MENU/JOURNAL_PAGE events
---@param triangle Triangle
---@param color Color
function VanillaRenderContext:draw_screen_triangle_filled(triangle, color) end

---Draw text using the built-in renderer
---Use in combination with ON.RENDER_✱ events. See vanilla_rendering.lua in the example scripts.
---@param text string
---@param x number
---@param y number
---@param scale_x number
---@param scale_y number
---@param color Color
---@param alignment VANILLA_TEXT_ALIGNMENT
---@param fontstyle VANILLA_FONT_STYLE
---@overload fun(self: VanillaRenderContext, tri: TextRenderingInfo|nil, color: Color)
function VanillaRenderContext:draw_text(text, x, y, scale_x, scale_y, color, alignment, fontstyle) end

---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
---@param text string
---@param scale_x number
---@param scale_y number
---@param fontstyle integer
---@return number
---@return number
function VanillaRenderContext:draw_text_size(text, scale_x, scale_y, fontstyle) end

---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
---@param A Vec2
---@param B Vec2
---@param thickness number
---@param color Color
function VanillaRenderContext:draw_world_line(A, B, thickness, color) end

---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
---@param points Quad
---@param thickness number
---@param color Color
---@param closed boolean
---@overload fun(self: VanillaRenderContext, points: Vec2[], thickness: number, color: Color, closed: boolean)
function VanillaRenderContext:draw_world_poly(points, thickness, color, closed) end

---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
---@param points Quad
---@param color Color
---@overload fun(self: VanillaRenderContext, points: Vec2[], color: Color)
function VanillaRenderContext:draw_world_poly_filled(points, color) end

---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 rotation 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
---@param rect AABB
---@param thickness number
---@param color Color
---@param angle number|nil
---@param px number|nil
---@param py number|nil
function VanillaRenderContext:draw_world_rect(rect, thickness, color, angle, px, py) end

---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 rotation where 0,0 is center 1,1 is top right corner etc.
---Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
---@param rect AABB
---@param color Color
---@param angle number|nil
---@param px number|nil
---@param py number|nil
function VanillaRenderContext:draw_world_rect_filled(rect, color, angle, px, py) end

---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
---@param texture_id TEXTURE
---@param row integer
---@param column integer
---@param left number
---@param top number
---@param right number
---@param bottom number
---@param color Color
---@overload fun(self: VanillaRenderContext, texture_id: TEXTURE, row: integer, column: integer, dest: AABB, color: Color)
---@overload fun(self: VanillaRenderContext, texture_id: TEXTURE, row: integer, column: integer, dest: AABB, color: Color, angle: number, px: number, py: number)
---@overload fun(self: VanillaRenderContext, texture_id: TEXTURE, row: integer, column: integer, dest: Quad, color: Color)
---@overload fun(self: VanillaRenderContext, texture_id: TEXTURE, row: integer, column: integer, dest: Quad, color: Color, shader: WORLD_SHADER)
---@overload fun(self: VanillaRenderContext, texture_id: TEXTURE, source: Quad, dest: Quad, color: Color)
---@overload fun(self: VanillaRenderContext, texture_id: TEXTURE, source: Quad, dest: Quad, color: Color, shader: WORLD_SHADER)
function VanillaRenderContext:draw_world_texture(texture_id, row, column, left, top, right, bottom, color) end

---Draw triangle in world coordinates using the built-in renderer.
---Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
---@param triangle Triangle
---@param thickness number
---@param color Color
function VanillaRenderContext:draw_world_triangle(triangle, thickness, color) end

---Draw filled triangle in world coordinates using the built-in renderer.
---Use in combination with ON.RENDER_PRE_DRAW_DEPTH event
---@param triangle Triangle
---@param color Color
function VanillaRenderContext:draw_world_triangle_filled(triangle, color) end

---@param layer LAYER
---@param draw_depth integer
---@param bbox AABB
function VanillaRenderContext:render_draw_depth(layer, draw_depth, bbox) end

---Set the preferred way of drawing corners for the non filled shapes
---@param c CORNER_FINISH
function VanillaRenderContext:set_corner_finish(c) end

---Simple object to hold pair of coordinates
---@class Vec2
---@field x number
---@field y number
Vec2 = {}

---@return Vec2
---@overload fun(other: Vec2): Vec2
---@overload fun(x_: number, y_: number): Vec2
function Vec2.new() end

---Just simple Pythagoras theorem
---@param other Vec2
---@return number
function Vec2:distance_to(other) end

---@param angle number
---@param px number
---@param py number
---@return Vec2
---@overload fun(self: Vec2, angle: number, p: Vec2): Vec2
function Vec2:rotate(angle, px, py) end

---@param other Vec2
---@return Vec2
function Vec2:set(other) end

---@return number
---@return number
function Vec2:split() end

---@class Vlad : Entity, Movable, PowerupCapable, Monster, Vampire
---@field aggro boolean @or is awake
---@field teleport_timer integer @triggers when Vlad teleports, when timer running he can't teleport and will stun when hit
Vlad = {}

---@class VladsCape : Entity, Movable, Powerup, Backpack, Cape
---@field can_double_jump boolean
VladsCape = {}

---@class Waddler : Entity, Movable, PowerupCapable, Monster, RoomOwner
---@field air_timer integer
---@field on_the_ground boolean
---@field player_detected boolean
Waddler = {}

---@class WalkingMonster : Entity, Movable, PowerupCapable, Monster
---@field chatting_to_uid integer
---@field cooldown_timer integer @used for chatting with other monsters, attack cooldowns etc.
---@field walk_pause_timer integer @alternates between walking and pausing every time it reaches zero
WalkingMonster = {}

---@class WallTorch : Entity, Movable, Torch
---@field dropped_gold boolean @if false, it will drop gold when light up
WallTorch = {}

---@class Web : Entity, Movable
---@field decay_rate number @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
Web = {}

---@class WebGun : Entity, Movable, Purchasable, Gun

---@class WebShot : Entity, Movable, Projectile
---@field shot boolean @if false, it's attached to the gun
WebShot = {}

---@class WetEffect : Entity
---@field particle ParticleEmitterInfo|nil
WetEffect = {}

---@class Whip : Entity, Movable
---@field flaming boolean
Whip = {}

---@class WitchDoctor : Entity, Movable, PowerupCapable, Monster, WalkingMonster
---@field skull_regen_timer integer
---@field sound SoundMeta|nil
WitchDoctor = {}

---@class WitchDoctorSkull : Entity, Movable, PowerupCapable, Monster
---@field emitted_light Illumination|nil
---@field rotation_angle number
---@field sound SoundMeta|nil
---@field witch_doctor_uid integer
WitchDoctorSkull = {}

---@class WoodenlogTrap : Entity, Movable
---@field ceiling_1_uid integer
---@field ceiling_2_uid integer
---@field falling_speed number
WoodenlogTrap = {}

---@class Yama : Entity, Movable, PowerupCapable, Monster
---@field message_shown boolean
Yama = {}

---@class Yang : Entity, Movable, PowerupCapable, Monster, RoomOwner
---@field first_message_shown boolean @I'm looking for turkeys, wanna help?
---@field quest_incomplete boolean @Is set to false when the quest is over (Yang dead or second turkey delivered)
---@field special_message_shown boolean @Tusk palace/black market/one way door - message shown
---@field turkeys_in_den integer[] @Table of uids of the turkeys, goes only up to 3, is nil when yang is angry
Yang = {}

---@class YellowCape : Entity, Movable, Powerup, Backpack, Cape
---@field sound SoundMeta|nil
YellowCape = {}

---@class YetiKing : Entity, Movable, PowerupCapable, Monster
---@field emitted_light Illumination|nil
---@field particle_dust ParticleEmitterInfo|nil
---@field particle_fog ParticleEmitterInfo|nil
---@field particle_sparkles ParticleEmitterInfo|nil
---@field walk_pause_timer integer
YetiKing = {}

---@class YetiQueen : Entity, Movable, PowerupCapable, Monster
---@field walk_pause_timer integer
YetiQueen = {}