Skip to content

Purchasable

Movable entitiessource

Derived from Entity, Movable

Derived types: Arrow, Boomerang, Bow, DummyPurchasableEntity, Gun, Mattock, Pot, Present, RollingItem, Shield, Teleporter

Methods

clear_virtual

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

equip

function Purchasable:equip(who?: Entity)
who?: Entityoptional
source

set_post_equip

function Purchasable:set_post_equip(fun: fun(self: Entity?, who: Entity?)): integer
fun: fun(self: Entity?, who: Entity?)

Returns integer

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.

source

set_post_virtual

function Purchasable: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_equip

function Purchasable:set_pre_equip(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

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.

source

set_pre_virtual

function Purchasable: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