Skip to content

Deprecated functions

clear_entity_callback

deprecatedsource

function clear_entity_callback(uid: integer, cb_id: CallbackId)
uid: integer
cb_id: CallbackId

Use entity.clear_virtual instead. Clears a callback that is specific to an entity.

clrflag

deprecatedsame as clr_flagsource

function clrflag(flags: Flags, bit: integer): Flags
flags: Flags
bit: integer

Returns Flags

draw_circle

deprecatedsource

function draw_circle(x: number, y: number, radius: number, thickness: number, color: uColor)
x: number
y: number
radius: number
thickness: number
color: uColor

Use GuiDrawContext.draw_circle instead

draw_circle_filled

deprecatedsource

function draw_circle_filled(x: number, y: number, radius: number, color: uColor)
x: number
y: number
radius: number
color: uColor

Use GuiDrawContext.draw_circle_filled instead

draw_image

deprecatedsource

function draw_image(image: IMAGE, x1: number, y1: number, x2: number, y2: number, uvx1: number, uvy1: number, uvx2: number, uvy2: number, color: uColor)
image: IMAGE
x1: number
y1: number
x2: number
y2: number
uvx1: number
uvy1: number
uvx2: number
uvy2: number
color: uColor

Use GuiDrawContext.draw_image instead

draw_image_rotated

deprecatedsource

function draw_image_rotated(image: IMAGE, x1: number, y1: number, x2: number, y2: number, uvx1: number, uvy1: number, uvx2: number, uvy2: number, color: uColor, angle: number, px: number, py: number)
image: IMAGE
x1: number
y1: number
x2: number
y2: number
uvx1: number
uvy1: number
uvx2: number
uvy2: number
color: uColor
angle: number
px: number
py: number

Use GuiDrawContext.draw_image_rotated instead

draw_line

deprecatedsource

function draw_line(x1: number, y1: number, x2: number, y2: number, thickness: number, color: uColor)
x1: number
y1: number
x2: number
y2: number
thickness: number
color: uColor

Use GuiDrawContext.draw_line instead

draw_rect

deprecatedsource

function draw_rect(x1: number, y1: number, x2: number, y2: number, thickness: number, rounding: number, color: uColor)
x1: number
y1: number
x2: number
y2: number
thickness: number
rounding: number
color: uColor

Use GuiDrawContext.draw_rect instead

draw_rect_filled

deprecatedsource

function draw_rect_filled(x1: number, y1: number, x2: number, y2: number, rounding: number, color: uColor)
x1: number
y1: number
x2: number
y2: number
rounding: number
color: uColor

Use GuiDrawContext.draw_rect_filled instead

draw_text

deprecatedsource

function draw_text(x: number, y: number, size: number, text: string, color: uColor)
x: number
y: number
size: number
text: string
color: uColor

Use GuiDrawContext.draw_text instead

flip_entity

deprecatedsource

function flip_entity(uid: integer)
uid: integer

Use Entity:flip instead

force_dark_level

deprecatedsource

-- forces any level to be dark, even bosses
set_callback(function()
state.level_flags = set_flag(state.level_flags, 18)
end, ON.POST_ROOM_GENERATION)
function force_dark_level(g: boolean)
g: boolean

Set level flag 18 on post room generation instead, to properly force every level to dark

generate_particles

deprecatedsource

function generate_particles(particle_emitter_id: PARTICLEEMITTER, uid: integer): ParticleEmitterInfo?
particle_emitter_id: PARTICLEEMITTER
uid: integer

Returns ParticleEmitterInfo? (may be nil)

Use generate_world_particles

get_entities

deprecatedsource

function get_entities(): integer[]

Returns integer[]

Use get_entities_by(0, MASK.ANY, LAYER.BOTH) instead

get_entities_by_layer

deprecatedsource

function get_entities_by_layer(layer: LAYER): integer[]
layer: LAYER

Returns integer[]

Use get_entities_by(0, MASK.ANY, layer) instead

get_entities_by_mask

deprecatedsource

function get_entities_by_mask(mask: MASK): integer[]
mask: MASK

Returns integer[]

Use get_entities_by(0, mask, LAYER.BOTH) instead

get_entities_overlapping

deprecatedsource

function get_entities_overlapping(entity_type: ENT_TYPE, mask: MASK, sx: number, sy: number, sx2: number, sy2: number, layer: LAYER): integer[]
entity_type: ENT_TYPE
mask: MASK
sx: number
sy: number
sx2: number
sy2: number
layer: LAYER

Returns integer[]

function get_entities_overlapping(entity_types: ENT_TYPE[], mask: MASK, sx: number, sy: number, sx2: number, sy2: number, layer: LAYER): integer[]
entity_types: ENT_TYPE[]
mask: MASK
sx: number
sy: number
sx2: number
sy2: number
layer: LAYER

Returns integer[]

Use get_entities_overlapping_hitbox instead

get_entity_ai_state

deprecatedsource

function get_entity_ai_state(uid: integer): integer
uid: integer

Returns integer

As the name is misleading. use Movable.move_state field instead

load_script

deprecatedsame as importsource

function load_script(id: string): any
id: string

Returns any (may be nil)

function load_script(id: string, version: string): any
id: string
version: string

Returns any (may be nil)

function load_script(id: string, version: string, optional: boolean): any
id: string
version: string
optional: boolean

Returns any (may be nil)

function load_script(id: string, optional: boolean): any
id: string
optional: boolean

Returns any (may be nil)

Same as import().

lock_door_at

deprecatedsource

function lock_door_at(x: number, y: number)
x: number
y: number

use Door:unlock instead

read_input

deprecatedsource

function read_input(uid: integer): INPUTS
uid: integer

Returns INPUTS

Use players[1].input.buttons_gameplay for only the inputs during the game, or .buttons for all the inputs, even during the pause menu Of course, you can get the Player by other mean, it doesn't need to be the players table You can only read inputs from actual players, HH don't have any inputs

read_prng

deprecatedsource

function read_prng(): integer[]

Returns integer[]

Read the game prng state. Use prng:get_pair() instead.

read_stolen_input

deprecatedsource

function read_stolen_input(uid: integer): INPUTS
uid: integer

Returns INPUTS

Read input that has been previously stolen with steal_input Use state.player_inputs.player_slots[player_slot].buttons_gameplay for only the inputs during the game, or .buttons for all the inputs, even during the pause menu

return_input

deprecatedsource

function return_input(uid: integer)
uid: integer

Return input previously stolen with steal_input

send_input

deprecatedsource

function send_input(uid: integer, buttons: INPUTS)
uid: integer
buttons: INPUTS

Send input to entity, has to be previously stolen with steal_input

set_arrowtrap_projectile

deprecatedsource

function set_arrowtrap_projectile(regular_entity_type: ENT_TYPE, poison_entity_type: ENT_TYPE)
regular_entity_type: ENT_TYPE
poison_entity_type: ENT_TYPE

Use replace_drop(DROP.ARROWTRAP_WOODENARROW, new_arrow_type) and replace_drop(DROP.POISONEDARROWTRAP_WOODENARROW, new_arrow_type) instead

set_blood_multiplication

deprecatedsource

function set_blood_multiplication(p1: integer, vladscape_multiplier: integer)
p1: integer
vladscape_multiplier: integer

This function never worked properly as too many places in the game individually check for vlads cape and calculate the blood multiplication default_multiplier doesn't do anything due to some changes in last game updates, vladscape_multiplier only changes the multiplier to some entities death's blood spit

set_on_damage

deprecatedsource

function set_on_damage(uid: integer, fun: fun(self: Entity?, damage_dealer: Entity?, damage_amount: integer, damage_flags: integer, velocity: Vec2?, unknown_damage_phase: integer, stun_amount: integer, iframes: integer, unknown_is_final: boolean): boolean?): CallbackId?
uid: integer
fun: fun(self: Entity?, damage_dealer: Entity?, damage_amount: integer, damage_flags: integer, velocity: Vec2?, unknown_damage_phase: integer, stun_amount: integer, iframes: integer, unknown_is_final: boolean): boolean?
Returning nil (or nothing): the original function runs (a value replaces its result and skips it).

Returns CallbackId? (may be nil)

Use entity:set_pre_damage instead. Returns unique id for the callback to be used in clear_entity_callback or nil if uid is not valid. Sets a callback that is called right before an entity is damaged, return true to skip the game's damage handling. Note that damage_dealer can be nil ! (long fall, ...) DO NOT CALL self:damage() in the callback ! Use this only when no other approach works, this call can be expensive if overused. The entity has to be of a Movable type.
The callback signature is bool on_damage(Entity self, Entity damage_dealer, int damage_amount, float vel_x, float vel_y, int stun_amount, int iframes)

set_on_destroy

deprecatedsource

function set_on_destroy(uid: integer, fun: fun(self: Entity?): boolean): CallbackId?
uid: integer
fun: fun(self: Entity?): boolean
Returning nil (or nothing): treated as false: the original function runs (true skips it).

Returns CallbackId? (may be nil)

Use entity:set_pre_destroy instead. Returns unique id for the callback to be used in clear_entity_callback or nil if uid is not valid. Sets a callback that is called right when an entity is destroyed, e.g. as if by Entity.destroy() before the game applies any side effects. Use this only when no other approach works, this call can be expensive if overused.
The callback signature is nil on_destroy(Entity self)

set_on_kill

deprecatedsource

function set_on_kill(uid: integer, fun: fun(self: Entity?, destroy_corpse: boolean, responsible: Entity?): boolean): CallbackId?
uid: integer
fun: fun(self: Entity?, destroy_corpse: boolean, responsible: Entity?): boolean
Returning nil (or nothing): treated as false: the original function runs (true skips it).

Returns CallbackId? (may be nil)

Use entity:set_pre_kill instead. Returns unique id for the callback to be used in clear_entity_callback or nil if uid is not valid. Sets a callback that is called right when an entity is eradicated, before the game applies any side effects. Use this only when no other approach works, this call can be expensive if overused.
The callback signature is nil on_kill(Entity self, Entity killer)

set_on_open

deprecatedsource

function set_on_open(uid: integer, fun: fun(usee: Entity?, user: Entity?)): CallbackId?
uid: integer
fun: fun(usee: Entity?, user: Entity?)

Returns CallbackId? (may be nil)

Use entity:set_pre_trigger_action instead. Returns unique id for the callback to be used in clear_entity_callback or nil if uid is not valid. Sets a callback that is called right when a container is opened by the player (up+whip) Use this only when no other approach works, this call can be expensive if overused. Check here to see whether you can use this callback on the entity type you intend to.
The callback signature is nil on_open(Entity entity_self, Entity opener)

set_post_floor_update

deprecatedsource

-- Use FLOOR_GENERIC with textures from different themes that update correctly when destroyed.
-- This lets you use the custom tile code 'floor_generic_tidepool'
-- in the level editor to spawn tidepool floor in dwelling for example...
define_tile_code("floor_generic_tidepool")
set_pre_tile_code_callback(function(x, y, layer)
local uid = spawn_grid_entity(ENT_TYPE.FLOOR_GENERIC, x, y, layer)
set_post_floor_update(uid, function(me)
me:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TIDEPOOL_0)
for i,v in ipairs(entity_get_items_by(me.uid, ENT_TYPE.DECORATION_GENERIC, MASK.DECORATION)) do
local deco = get_entity(v)
deco:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TIDEPOOL_0)
end
end)
return true
end, "floor_generic_tidepool")
-- Fix quicksand decorations when not in temple
set_post_entity_spawn(function(ent)
ent:set_post_floor_update(function(me)
me:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TEMPLE_0)
for i,v in ipairs(entity_get_items_by(me.uid, ENT_TYPE.DECORATION_GENERIC, MASK.DECORATION)) do
local deco = get_entity(v)
deco:set_texture(TEXTURE.DATA_TEXTURES_FLOOR_TEMPLE_0)
end
end)
end, SPAWN_TYPE.ANY, MASK.FLOOR, ENT_TYPE.FLOOR_QUICKSAND)
function set_post_floor_update(uid: integer, fun: fun(self: Entity?)): CallbackId?
uid: integer
fun: fun(self: Entity?)

Returns CallbackId? (may be nil)

Use entity:set_post_floor_update instead. Returns unique id for the callback to be used in clear_entity_callback or nil if uid is not valid. Sets a callback that is called right after a floor is updated (by killed neighbor). Use this only when no other approach works, this call can be expensive if overused.
The callback signature is nil post_floor_update(Entity self)

set_post_render

deprecatedsource

function set_post_render(uid: integer, fun: fun(render_ctx: VanillaRenderContext, p2: Entity?): boolean): CallbackId?
uid: integer
fun: fun(render_ctx: VanillaRenderContext, p2: Entity?): boolean
Returning nil (or nothing): passed on as an empty optional.

Returns CallbackId? (may be nil)

Use entity.rendering_info:set_post_render in combination with render_info:get_entity instead. Returns unique id for the callback to be used in clear_entity_callback or nil if uid is not valid. Sets a callback that is called right after the entity is rendered. Use this only when no other approach works, this call can be expensive if overused.
The callback signature is nil post_render(VanillaRenderContext render_ctx, Entity self)

set_post_statemachine

deprecatedsource

function set_post_statemachine(uid: integer, fun: fun(self: Entity?)): CallbackId?
uid: integer
fun: fun(self: Entity?)

Returns CallbackId? (may be nil)

Use entity:set_post_update_state_machine instead. Returns unique id for the callback to be used in clear_entity_callback or nil if uid is not valid. uid has to be the uid of a Movable or else stuff will break. Sets a callback that is called right after the statemachine, so you can override any values the satemachine might have set (e.g. animation_frame). Use this only when no other approach works, this call can be expensive if overused. Check here to see whether you can use this callback on the entity type you intend to.
The callback signature is nil statemachine(Entity self)

set_pre_collision1

deprecatedsource

function set_pre_collision1(uid: integer, fun: fun(self: Entity?, other_entity: Entity?): boolean): CallbackId?
uid: integer
fun: fun(self: Entity?, other_entity: Entity?): boolean
Returning nil (or nothing): treated as false: the original function runs (true skips it).

Returns CallbackId? (may be nil)

Use entity:set_pre_collision1 instead. Returns unique id for the callback to be used in clear_entity_callback or nil if uid is not valid. Sets a callback that is called right before the collision 1 event, return true to skip the game's collision handling. Use this only when no other approach works, this call can be expensive if overused. Check here to see whether you can use this callback on the entity type you intend to.
The callback signature is bool pre_collision1(Entity entity_self, Entity collision_entity)

set_pre_collision2

deprecatedsource

function set_pre_collision2(uid: integer, fun: fun(self: Entity?, other_entity: Entity?): boolean): CallbackId?
uid: integer
fun: fun(self: Entity?, other_entity: Entity?): boolean
Returning nil (or nothing): treated as false: the original function runs (true skips it).

Returns CallbackId? (may be nil)

Use entity:set_pre_collision2 instead. Returns unique id for the callback to be used in clear_entity_callback or nil if uid is not valid. Sets a callback that is called right before the collision 2 event, return true to skip the game's collision handling. Use this only when no other approach works, this call can be expensive if overused. Check here to see whether you can use this callback on the entity type you intend to.
The callback signature is bool pre_collision12(Entity self, Entity collision_entity)

set_pre_floor_update

deprecatedsource

function set_pre_floor_update(uid: integer, fun: fun(self: Entity?): boolean): CallbackId?
uid: integer
fun: fun(self: Entity?): boolean
Returning nil (or nothing): treated as false: the original function runs (true skips it).

Returns CallbackId? (may be nil)

Use entity:set_pre_floor_update instead. Returns unique id for the callback to be used in clear_entity_callback or nil if uid is not valid. Sets a callback that is called right before a floor is updated (by killed neighbor), return true to skip the game's neighbor update handling. Use this only when no other approach works, this call can be expensive if overused.
The callback signature is bool pre_floor_update(Entity self)

set_pre_render

deprecatedsource

function set_pre_render(uid: integer, fun: fun(render_ctx: VanillaRenderContext, p2: Entity?): boolean): CallbackId?
uid: integer
fun: fun(render_ctx: VanillaRenderContext, p2: Entity?): boolean
Returning nil (or nothing): passed on as an empty optional.

Returns CallbackId? (may be nil)

Use entity.rendering_info:set_pre_render in combination with render_info:get_entity instead. Returns unique id for the callback to be used in clear_entity_callback or nil if uid is not valid. Sets a callback that is called right after the entity is rendered. Return true to skip the original rendering function and all later pre_render callbacks. Use this only when no other approach works, this call can be expensive if overused.
The callback signature is bool render(VanillaRenderContext render_ctx, Entity self)

set_pre_statemachine

deprecatedsource

function set_pre_statemachine(uid: integer, fun: fun(self: Entity?): boolean): CallbackId?
uid: integer
fun: fun(self: Entity?): boolean
Returning nil (or nothing): treated as false: the original function runs (true skips it).

Returns CallbackId? (may be nil)

Use entity:set_pre_update_state_machine instead. Returns unique id for the callback to be used in clear_entity_callback or nil if uid is not valid. uid has to be the uid of a Movable or else stuff will break. Sets a callback that is called right before the statemachine, return true to skip the statemachine update. Use this only when no other approach works, this call can be expensive if overused. Check here to see whether you can use this callback on the entity type you intend to.
The callback signature is bool statemachine(Entity self)

setflag

deprecatedsame as set_flagsource

function setflag(flags: Flags, bit: integer): Flags
flags: Flags
bit: integer

Returns Flags

steal_input

deprecatedsource

function steal_input(uid: integer)
uid: integer

Deprecated because it's a weird old hack that crashes the game. You can modify inputs in many other ways, like editing state.player_inputs.player_slot_1.buttons_gameplay in PRE_UPDATE or a set_pre_process_input hook. Steal input from a Player, HiredHand or PlayerGhost.

testflag

deprecatedsame as test_flagsource

function testflag(flags: Flags, bit: integer): boolean
flags: Flags
bit: integer

Returns boolean

udp_listen

deprecateddocumented onlysource

function udp_listen(host: string, port: integer, cb: function): any
host: string
port: integer
cb: function

Returns any

Use the new operator on UdpServer instead The server will be closed lazily by garbage collection once the handle is released. Requires unsafe mode.
The callback signature is optional on_message(string msg, string src)

unlock_door_at

deprecatedsource

function unlock_door_at(x: number, y: number)
x: number
y: number

use Door:unlock instead

win_button

deprecatedsource

function win_button(text: string): boolean
text: string

Returns boolean

Use GuiDrawContext.win_button instead

win_check

deprecatedsource

function win_check(label: string, value: boolean): boolean
label: string
value: boolean

Returns boolean

Use GuiDrawContext.win_check instead

win_combo

deprecatedsource

function win_combo(label: string, selected: integer, opts: string): integer
label: string
selected: integer
opts: string

Returns integer

Use GuiDrawContext.win_combo instead

win_drag_float

deprecatedsource

function win_drag_float(label: string, value: number, min: number, max: number): number
label: string
value: number
min: number
max: number

Returns number

Use GuiDrawContext.win_drag_float instead

win_drag_int

deprecatedsource

function win_drag_int(label: string, value: integer, min: integer, max: integer): integer
label: string
value: integer
min: integer
max: integer

Returns integer

Use GuiDrawContext.win_drag_int instead

win_image

deprecatedsource

function win_image(image: IMAGE, width: number, height: number)
image: IMAGE
width: number
height: number

Use GuiDrawContext.win_image instead

win_inline

deprecatedsource

function win_inline()

Use GuiDrawContext.win_inline instead

win_input_float

deprecatedsource

function win_input_float(label: string, value: number): number
label: string
value: number

Returns number

Use GuiDrawContext.win_input_float instead

win_input_int

deprecatedsource

function win_input_int(label: string, value: integer): integer
label: string
value: integer

Returns integer

Use GuiDrawContext.win_input_int instead

win_input_text

deprecatedsource

function win_input_text(label: string, value: string): string
label: string
value: string

Returns string

Use GuiDrawContext.win_input_text instead

win_popid

deprecatedsource

function win_popid()

Use GuiDrawContext.win_popid instead

win_pushid

deprecatedsource

function win_pushid(id: integer)
id: integer

Use GuiDrawContext.win_pushid instead

win_sameline

deprecatedsource

function win_sameline(offset: number, spacing: number)
offset: number
spacing: number

Use GuiDrawContext.win_sameline instead

win_separator

deprecatedsource

function win_separator()

Use GuiDrawContext.win_separator instead

win_slider_float

deprecatedsource

function win_slider_float(label: string, value: number, min: number, max: number): number
label: string
value: number
min: number
max: number

Returns number

Use GuiDrawContext.win_slider_float instead

win_slider_int

deprecatedsource

function win_slider_int(label: string, value: integer, min: integer, max: integer): integer
label: string
value: integer
min: integer
max: integer

Returns integer

Use GuiDrawContext.win_slider_int instead

win_text

deprecatedsource

function win_text(text: string)
text: string

Use GuiDrawContext.win_text instead

window

deprecatedsource

function window(title: string, x: number, y: number, w: number, h: number, movable: boolean, callback: fun(p1: GuiDrawContext?, p2: Vec2, p3: Vec2))
title: string
x: number
y: number
w: number
h: number
movable: boolean
callback: fun(p1: GuiDrawContext?, p2: Vec2, p3: Vec2)

Use GuiDrawContext.window instead

on_camp

global your script defines function?source

Use set_callback(function, ON.CAMP) instead

on_death

global your script defines function?source

Use set_callback(function, ON.DEATH) instead

on_frame

global your script defines function?source

Use set_callback(function, ON.FRAME) instead

on_guiframe

global your script defines function?source

Use set_callback(function, ON.GUIFRAME) instead

on_level

global your script defines function?source

Use set_callback(function, ON.LEVEL) instead

on_screen

global your script defines function?source

Use set_callback(function, ON.SCREEN) instead

on_start

global your script defines function?source

Use set_callback(function, ON.START) instead

on_transition

global your script defines function?source

Use set_callback(function, ON.TRANSITION) instead

on_win

global your script defines function?source

Use set_callback(function, ON.WIN) instead