Skip to content

Door

Floor entitiessource

Derived from Entity, Floor

Derived types: EggShipDoor, ExitDoor, LockedDoor

--If you want the locked door to look like the closed exit door at Hundun
function close_hundun_door(door)
door:unlock(false)
for _, uid in pairs(get_entities_overlapping_grid(door.x, door.y, door.layer)) do
ent = get_entity(uid)
if ent.type.id == ENT_TYPE.BG_DOOR then
ent:set_texture(TEXTURE.DATA_TEXTURES_DECO_EGGPLANT_0)
return
end
end
end

Fields

counter

integer

source

fx_button

Entity?

source

Methods

can_enter

function Door:can_enter(player?: Entity): boolean
player?: Entityoptional

Returns boolean

source

clear_virtual

function Door:clear_virtual(callback_id: integer)
callback_id: integer
source

enter

function Door:enter(who?: Entity): integer
who?: Entityoptional

Returns integer

source

is_unlocked

function Door:is_unlocked(): boolean

Returns boolean

source

light_level

function Door:light_level(): number

Returns number

source

set_post_can_enter

function Door:set_post_can_enter(fun: fun(self: Entity?, player: Entity?)): integer
fun: fun(self: Entity?, player: Entity?)

Returns integer

Can the door actually be entered by player. Overrides the button prompt too if false.

source

set_post_enter

function Door:set_post_enter(fun: fun(self: Entity?, who: Entity?)): integer
fun: fun(self: Entity?, who: Entity?)

Returns integer

Returns the entity state / behavior id to set the entity to after the entering animation.

source

set_post_enter_attempt

function Door:set_post_enter_attempt(fun: fun(self: Entity?, who: Entity?)): integer
fun: fun(self: Entity?, who: Entity?)

Returns integer

source

set_post_hide_hud

function Door:set_post_hide_hud(fun: fun(self: Entity?, who: Entity?)): integer
fun: fun(self: Entity?, who: Entity?)

Returns integer

source

set_post_is_unlocked

function Door:set_post_is_unlocked(fun: fun(self: Entity?)): integer
fun: fun(self: Entity?)

Returns integer

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

source

set_post_light_level

function Door:set_post_light_level(fun: fun(self: Entity?)): integer
fun: fun(self: Entity?)

Returns integer

Returns the darkest light level used to fade the entity when entering or exiting. 0 = black, 1 = no change

source

set_post_virtual

function Door:set_post_virtual(index: integer, fun: function): integer?
index: integer
fun: function
Callback signature not known from the code.

Returns integer? (may be nil)

source

set_pre_can_enter

function Door:set_pre_can_enter(fun: fun(self: Entity?, player: Entity?): boolean?): integer
fun: fun(self: Entity?, player: Entity?): boolean?
Returning nil (or nothing): the original function runs (a value replaces its result and skips it).

Returns integer

Can the door actually be entered by player. Overrides the button prompt too if false.

source

set_pre_enter

function Door:set_pre_enter(fun: fun(self: Entity?, who: Entity?): integer?): integer
fun: fun(self: Entity?, who: Entity?): integer?
Returning nil (or nothing): the original function runs (a value replaces its result and skips it).

Returns integer

Returns the entity state / behavior id to set the entity to after the entering animation.

source

set_pre_enter_attempt

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

Returns integer

source

set_pre_hide_hud

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

Returns integer

source

set_pre_is_unlocked

function Door:set_pre_is_unlocked(fun: fun(self: Entity?): boolean?): integer
fun: fun(self: Entity?): boolean?
Returning nil (or nothing): the original function runs (a value replaces its result and skips it).

Returns integer

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

source

set_pre_light_level

function Door:set_pre_light_level(fun: fun(self: Entity?): number?): integer
fun: fun(self: Entity?): number?
Returning nil (or nothing): the original function runs (a value replaces its result and skips it).

Returns integer

Returns the darkest light level used to fade the entity when entering or exiting. 0 = black, 1 = no change

source

set_pre_virtual

function Door:set_pre_virtual(index: integer, fun: function): integer?
index: integer
fun: function
Callback signature not known from the code.

Returns integer? (may be nil)

source

unlock

function Door:unlock(unlock: boolean)
unlock: boolean
source