diff --git a/docs/game_data/spel2.lua b/docs/game_data/spel2.lua
index d1a366caf..e870263a3 100644
--- a/docs/game_data/spel2.lua
+++ b/docs/game_data/spel2.lua
@@ -2617,12 +2617,12 @@ function PRNG:random(min, max) end
---@field set_post_walked_off fun(self, fun: fun(self: Entity, walker: Entity): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil walked_off(Entity self, Entity walker)`
---@field set_pre_ledge_grab fun(self, fun: fun(self: Entity, who: Entity): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool ledge_grab(Entity self, Entity who)`
---@field set_post_ledge_grab fun(self, fun: fun(self: Entity, who: Entity): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil ledge_grab(Entity self, Entity who)`
- ---@field set_pre_stood_on fun(self, fun: fun(self: Entity, Vec2: Entity entity): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool stood_on(Entity self, Entity entity Vec2)`
- ---@field set_post_stood_on fun(self, fun: fun(self: Entity, Vec2: Entity entity): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil stood_on(Entity self, Entity entity Vec2)`
+ ---@field set_pre_stood_on fun(self, fun: fun(self: Entity, entity: Entity, Vec2: ): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool stood_on(Entity self, Entity entity, Vec2)`
+ ---@field set_post_stood_on fun(self, fun: fun(self: Entity, entity: Entity, Vec2: ): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil stood_on(Entity self, Entity entity, Vec2)`
---@field set_pre_liberate_from_shop fun(self, fun: fun(self: Entity, clear_parrent: boolean): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool liberate_from_shop(Entity self, boolean clear_parrent)`
Virtual function docs:
`clear_parent` used only for CHAR_* entities, sets the `linked_companion_parent` to -1. It's not called when item is bought
---@field set_post_liberate_from_shop fun(self, fun: fun(self: Entity, clear_parrent: boolean): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil liberate_from_shop(Entity self, boolean clear_parrent)`
Virtual function docs:
`clear_parent` used only for CHAR_* entities, sets the `linked_companion_parent` to -1. It's not called when item is bought
- ---@field set_pre_init fun(self, fun: fun(self: Entity): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool init(Entity self)`
- ---@field set_post_init fun(self, fun: fun(self: Entity): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil init(Entity self)`
+ ---@field set_pre_init fun(self, fun: fun(self: Entity): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool init(Entity self)`
Virtual function docs:
Applies changes made in `entity.type`
+ ---@field set_post_init fun(self, fun: fun(self: Entity): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil init(Entity self)`
Virtual function docs:
Applies changes made in `entity.type`
local Entity = nil
---@param hitbox AABB
---@return boolean
@@ -2714,7 +2714,7 @@ function Entity:destroy_recursive() end
---@field can_be_picked_up_by fun(self, entity_picking_up: Entity, boolean: ): boolean
---@field can_break_block fun(self, horizontal: boolean, block: Entity): boolean
---@field break_block fun(self, camera_shake: boolean, block: Entity): nil
- ---@field damage fun(self, damage_dealer: Entity, damage_amount: integer, damage_flags: DAMAGE_TYPE, velocity: Vec2, unknown_damage_phase: integer, stun_amount: integer, iframes: integer, unknown_is_final: boolean): boolean @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 pot that should break after hit etc.), false if the event should be ignored by damage_dealer
+ ---@field damage fun(self, damage_dealer: Entity, damage_amount: integer, damage_flags: DAMAGE_TYPE, velocity: Vec2, unknown_damage_phase: integer, stun_amount: integer, iframes: integer, unknown_is_final: boolean): boolean @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
---@field get_all_behaviors fun(self): integer[] @Get all available behavior ids
---@field set_behavior fun(self, behavior_id: integer): boolean @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
---@field get_behavior fun(self): integer @Get the current behavior id
@@ -2754,8 +2754,8 @@ function Entity:destroy_recursive() end
---@field set_post_attack fun(self, fun: fun(self: Movable, victim: Entity): boolean?): CallbackId @Hooks after the virtual function.
The callback signature is `nil attack(Movable self, Entity victim)`
Virtual function docs:
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)
---@field set_pre_thrown_into fun(self, fun: fun(self: Movable, victim: Entity): boolean?): CallbackId @Hooks before the virtual function.
The callback signature is `optional thrown_into(Movable self, Entity victim)`
Virtual function docs:
Same as above, but for being thrown into something and potentially dealing damage that way
---@field set_post_thrown_into fun(self, fun: fun(self: Movable, victim: Entity): boolean?): CallbackId @Hooks after the virtual function.
The callback signature is `nil thrown_into(Movable self, Entity victim)`
Virtual function docs:
Same as above, but for being thrown into something and potentially dealing damage that way
- ---@field set_pre_damage fun(self, fun: fun(self: Movable, damage_dealer: Entity, damage_amount: integer, damage_flags: DAMAGE_TYPE, velocity: Vec2, unknown_damage_phase: integer, stun_amount: integer, iframes: integer, unknown_is_final: boolean): boolean?): CallbackId @Hooks before the virtual function.
The callback signature is `optional damage(Movable self, Entity damage_dealer, integer damage_amount, DAMAGE_TYPE damage_flags, Vec2 velocity, integer unknown_damage_phase, integer stun_amount, integer iframes, boolean unknown_is_final)`
Virtual function docs:
Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities. `damage_dealer` can be set to nil.
Returns: true if entity was affected (for stuff like pot that should break after hit etc.), false if the event should be ignored by damage_dealer
- ---@field set_post_damage fun(self, fun: fun(self: Movable, damage_dealer: Entity, damage_amount: integer, damage_flags: DAMAGE_TYPE, velocity: Vec2, unknown_damage_phase: integer, stun_amount: integer, iframes: integer, unknown_is_final: boolean): boolean?): CallbackId @Hooks after the virtual function.
The callback signature is `nil damage(Movable self, Entity damage_dealer, integer damage_amount, DAMAGE_TYPE damage_flags, Vec2 velocity, integer unknown_damage_phase, integer stun_amount, integer iframes, boolean unknown_is_final)`
Virtual function docs:
Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities. `damage_dealer` can be set to nil.
Returns: true if entity was affected (for stuff like pot that should break after hit etc.), false if the event should be ignored by damage_dealer
+ ---@field set_pre_damage fun(self, fun: fun(self: Movable, damage_dealer: Entity, damage_amount: integer, damage_flags: DAMAGE_TYPE, velocity: Vec2, unknown_damage_phase: integer, stun_amount: integer, iframes: integer, unknown_is_final: boolean): boolean?): CallbackId @Hooks before the virtual function.
The callback signature is `optional damage(Movable self, Entity damage_dealer, integer damage_amount, DAMAGE_TYPE damage_flags, Vec2 velocity, integer unknown_damage_phase, integer stun_amount, integer iframes, boolean unknown_is_final)`
Virtual function docs:
Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities. `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
+ ---@field set_post_damage fun(self, fun: fun(self: Movable, damage_dealer: Entity, damage_amount: integer, damage_flags: DAMAGE_TYPE, velocity: Vec2, unknown_damage_phase: integer, stun_amount: integer, iframes: integer, unknown_is_final: boolean): boolean?): CallbackId @Hooks after the virtual function.
The callback signature is `nil damage(Movable self, Entity damage_dealer, integer damage_amount, DAMAGE_TYPE damage_flags, Vec2 velocity, integer unknown_damage_phase, integer stun_amount, integer iframes, boolean unknown_is_final)`
Virtual function docs:
Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities. `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
---@field set_pre_on_hit fun(self, fun: fun(self: Movable, damage_dealer: Entity): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool on_hit(Movable self, Entity damage_dealer)`
Virtual function docs:
Hit by broken arrows etc that don't deal damage, calls damage with 0 damage.
---@field set_post_on_hit fun(self, fun: fun(self: Movable, damage_dealer: Entity): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil on_hit(Movable self, Entity damage_dealer)`
Virtual function docs:
Hit by broken arrows etc that don't deal damage, calls damage with 0 damage.
---@field set_pre_get_damage_sound fun(self, fun: fun(self: Movable, damage: DAMAGE_TYPE): SOUNDID?): CallbackId @Hooks before the virtual function.
The callback signature is `optional get_damage_sound(Movable self, DAMAGE_TYPE damage)`
Virtual function docs:
returns sound id for the damage taken, return 0 to make it silence
@@ -2780,8 +2780,8 @@ function Entity:destroy_recursive() end
---@field set_post_stomped_by fun(self, fun: fun(self: Movable, stomper: Entity): boolean?): CallbackId @Hooks after the virtual function.
The callback signature is `nil stomped_by(Movable self, Entity stomper)`
---@field set_pre_thrown_by fun(self, fun: fun(self: Movable, thrower: Entity): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool thrown_by(Movable self, Entity thrower)`
---@field set_post_thrown_by fun(self, fun: fun(self: Movable, thrower: Entity): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil thrown_by(Movable self, Entity thrower)`
- ---@field set_pre_cloned_to fun(self, fun: fun(self: Movable, some_entity_uid: Entity clone integer): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool cloned_to(Movable self, Entity clone integer some_entity_uid)`
- ---@field set_post_cloned_to fun(self, fun: fun(self: Movable, some_entity_uid: Entity clone integer): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil cloned_to(Movable self, Entity clone integer some_entity_uid)`
+ ---@field set_pre_cloned_to fun(self, fun: fun(self: Movable, clone: Entity, some_entity_uid: integer): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool cloned_to(Movable self, Entity clone, integer some_entity_uid)`
Virtual function docs:
Entities must be of the same type!
+ ---@field set_post_cloned_to fun(self, fun: fun(self: Movable, clone: Entity, some_entity_uid: integer): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil cloned_to(Movable self, Entity clone, integer some_entity_uid)`
Virtual function docs:
Entities must be of the same type!
---@field set_pre_pick_up fun(self, fun: fun(self: Movable, entity_to_pick_up: Entity): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool pick_up(Movable self, Entity entity_to_pick_up)`
---@field set_post_pick_up fun(self, fun: fun(self: Movable, entity_to_pick_up: Entity): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil pick_up(Movable self, Entity entity_to_pick_up)`
---@field set_pre_can_be_picked_up_by fun(self, fun: fun(self: Movable, entity_picking_up: Entity, boolean: ): boolean?): CallbackId @Hooks before the virtual function.
The callback signature is `optional can_be_picked_up_by(Movable self, Entity entity_picking_up, boolean)`
@@ -2798,14 +2798,14 @@ function Entity:destroy_recursive() end
---@field set_post_initialize fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil initialize(Movable self)`
---@field set_pre_process_input fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool process_input(Movable self)`
---@field set_post_process_input fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil process_input(Movable self)`
- ---@field set_pre_picked_up fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool picked_up(Movable self)`
- ---@field set_post_picked_up fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil picked_up(Movable self)`
- ---@field set_pre_release fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool release(Movable self)`
- ---@field set_post_release fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil release(Movable self)`
+ ---@field set_pre_picked_up fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool picked_up(Movable self)`
Virtual function docs:
Called for entity that just has been picked up
+ ---@field set_post_picked_up fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil picked_up(Movable self)`
Virtual function docs:
Called for entity that just has been picked up
+ ---@field set_pre_release fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool release(Movable self)`
Virtual function docs:
Called for entity that just has been thrown/dropped
+ ---@field set_post_release fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil release(Movable self)`
Virtual function docs:
Called for entity that just has been thrown/dropped
---@field set_pre_generate_fall_poof_particles fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool generate_fall_poof_particles(Movable self)`
---@field set_post_generate_fall_poof_particles fun(self, fun: fun(self: Movable): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil generate_fall_poof_particles(Movable self)`
- ---@field set_pre_fall fun(self, fun: fun(self: Movable, number: number): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool fall(Movable self, number number)`
- ---@field set_post_fall fun(self, fun: fun(self: Movable, number: number): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil fall(Movable self, number number)`
+ ---@field set_pre_fall fun(self, fun: fun(self: Movable, number: number): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool fall(Movable self, number number)`
Virtual function docs:
Applies gravity to entity. Disable to float like on hoverpack.
+ ---@field set_post_fall fun(self, fun: fun(self: Movable, number: number): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil fall(Movable self, number number)`
Virtual function docs:
Applies gravity to entity. Disable to float like on hoverpack.
---@field set_pre_apply_friction fun(self, fun: fun(self: Movable, number: , vertical: boolean, number: ): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool apply_friction(Movable self, number, boolean vertical, number)`
---@field set_post_apply_friction fun(self, fun: fun(self: Movable, number: , vertical: boolean, number: ): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil apply_friction(Movable self, number, boolean vertical, number)`
---@field set_pre_can_break_block fun(self, fun: fun(self: Movable, horizontal: boolean, block: Entity): boolean?): CallbackId @Hooks before the virtual function.
The callback signature is `optional can_break_block(Movable self, boolean horizontal, Entity block)`
@@ -2849,8 +2849,8 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r
---@field set_pre_virtual fun(self, entry: ENTITY_OVERRIDE, fun: function): CallbackId @Hooks before the virtual function at index `entry`.
---@field set_post_virtual fun(self, entry: ENTITY_OVERRIDE, fun: function): CallbackId @Hooks after the virtual function at index `entry`.
---@field clear_virtual fun(self, callback_id: CallbackId): nil @Clears the hook given by `callback_id`, alternatively use `clear_callback()` inside the hook.
- ---@field set_pre_blood_collision fun(self, fun: fun(self: PowerupCapable): boolean?): CallbackId @Hooks before the virtual function.
The callback signature is `optional blood_collision(PowerupCapable self)`
- ---@field set_post_blood_collision fun(self, fun: fun(self: PowerupCapable): boolean?): CallbackId @Hooks after the virtual function.
The callback signature is `nil blood_collision(PowerupCapable self)`
+ ---@field set_pre_blood_collision fun(self, fun: fun(self: PowerupCapable): boolean?): CallbackId @Hooks before the virtual function.
The callback signature is `optional blood_collision(PowerupCapable self)`
Virtual function docs:
only triggers when entity has kapala
+ ---@field set_post_blood_collision fun(self, fun: fun(self: PowerupCapable): boolean?): CallbackId @Hooks after the virtual function.
The callback signature is `nil blood_collision(PowerupCapable self)`
Virtual function docs:
only triggers when entity has kapala
---@class Inventory
---@field money integer @Sum of the money collected in current level
@@ -3385,7 +3385,7 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r
---@field jump_pause_timer integer
---@field lava_detection_timer integer
---@field is_hot boolean
- ---@field player_detect_state integer @0 - didn't saw player, 1 - saw player, 2 - spited lava; probably used so he won't spit imminently after seeing the player
+ ---@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
---@class Firebug : Monster
---@field sound SoundMeta
@@ -4198,6 +4198,12 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r
---@class RollingItem : Purchasable
---@field roll_speed number
+ ---@field give_powerup fun(self, who: Entity, boolean: ): nil @Skip this function for item to be unpickable
+ ---@field set_pre_virtual fun(self, entry: ENTITY_OVERRIDE, fun: function): CallbackId @Hooks before the virtual function at index `entry`.
+ ---@field set_post_virtual fun(self, entry: ENTITY_OVERRIDE, fun: function): CallbackId @Hooks after the virtual function at index `entry`.
+ ---@field clear_virtual fun(self, callback_id: CallbackId): nil @Clears the hook given by `callback_id`, alternatively use `clear_callback()` inside the hook.
+ ---@field set_pre_give_powerup fun(self, fun: fun(self: RollingItem, who: Entity, boolean: ): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool give_powerup(RollingItem self, Entity who, boolean)`
Virtual function docs:
Skip this function for item to be unpickable
+ ---@field set_post_give_powerup fun(self, fun: fun(self: RollingItem, who: Entity, boolean: ): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil give_powerup(RollingItem self, Entity who, boolean)`
Virtual function docs:
Skip this function for item to be unpickable
---@class PlayerBag : Movable
---@field bombs integer
@@ -4207,10 +4213,10 @@ function Movable:generic_update_world(move, sprint_factor, disable_gravity, on_r
---@field set_pre_virtual fun(self, entry: ENTITY_OVERRIDE, fun: function): CallbackId @Hooks before the virtual function at index `entry`.
---@field set_post_virtual fun(self, entry: ENTITY_OVERRIDE, fun: function): CallbackId @Hooks after the virtual function at index `entry`.
---@field clear_virtual fun(self, callback_id: CallbackId): nil @Clears the hook given by `callback_id`, alternatively use `clear_callback()` inside the hook.
- ---@field set_pre_putting_on fun(self, fun: fun(self: Powerup, who: PowerupCapable): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool putting_on(Powerup self, PowerupCapable who)`
- ---@field set_post_putting_on fun(self, fun: fun(self: Powerup, who: PowerupCapable): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil putting_on(Powerup self, PowerupCapable who)`
- ---@field set_pre_putting_off fun(self, fun: fun(self: Powerup, who: PowerupCapable): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool putting_off(Powerup self, PowerupCapable who)`
- ---@field set_post_putting_off fun(self, fun: fun(self: Powerup, who: PowerupCapable): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil putting_off(Powerup self, PowerupCapable who)`
+ ---@field set_pre_putting_on fun(self, fun: fun(self: Powerup, who: PowerupCapable): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool putting_on(Powerup self, PowerupCapable who)`
Virtual function docs:
only for backpacks
+ ---@field set_post_putting_on fun(self, fun: fun(self: Powerup, who: PowerupCapable): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil putting_on(Powerup self, PowerupCapable who)`
Virtual function docs:
only for backpacks
+ ---@field set_pre_putting_off fun(self, fun: fun(self: Powerup, who: PowerupCapable): boolean): CallbackId @Hooks before the virtual function.
The callback signature is `bool putting_off(Powerup self, PowerupCapable who)`
Virtual function docs:
only for backpacks
+ ---@field set_post_putting_off fun(self, fun: fun(self: Powerup, who: PowerupCapable): boolean): CallbackId @Hooks after the virtual function.
The callback signature is `nil putting_off(Powerup self, PowerupCapable who)`
Virtual function docs:
only for backpacks
---@class KapalaPowerup : Powerup
---@field amount_of_blood integer
diff --git a/docs/parse_source.py b/docs/parse_source.py
index 68fd4375e..81985c1ef 100644
--- a/docs/parse_source.py
+++ b/docs/parse_source.py
@@ -630,7 +630,6 @@ def run_parse():
for item in classes:
if item["name"] != func_ref.group(1):
continue
- # TODO: pretty sure if the actual virtual function name is different then the one in VTableEntry there won't be comment in callback signature
func_name = func_ref.group(2)
# if it throws error at `item["member_funs"][func_name]` then the virtual defined using MemFun was not found in the parsed class/struct code
if (
@@ -645,8 +644,8 @@ def run_parse():
"index": index,
"ret": func["return"],
"args": [t for t in func["param"].split(",")],
- # "ref": func_name.group(2),
"binds": binds,
+ "ref": func_name,
}
else:
signature = re.search(r"([_a-zA-Z][\w]*.*)\((.*)\)", signature)
@@ -920,11 +919,12 @@ def run_parse():
for entry in vtable["entries"].values():
entry_name = entry["name"]
+ func_name = entry["ref"] if "ref" in entry else entry["name"]
pre_signature = None
post_signature = None
cpp_comment = []
- if entry_name in underlying_cpp_type["member_funs"]:
- for fun in underlying_cpp_type["member_funs"][entry_name]:
+ if func_name in underlying_cpp_type["member_funs"]:
+ for fun in underlying_cpp_type["member_funs"][func_name]:
ret = replace_fun(fun["return"])
ret = f"optional<{ret}>" if ret else "bool"
ret = ret if entry_name != "dtor" else "nil"
diff --git a/docs/src/includes/_enums.md b/docs/src/includes/_enums.md
index 5161ebe57..74ffffd4a 100644
--- a/docs/src/includes/_enums.md
+++ b/docs/src/includes/_enums.md
@@ -308,6 +308,7 @@ Name | Data | Description
[ACQUIRE](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ENTITY_OVERRIDE.ACQUIRE) | 93 |
[TRIGGER_EXPLOSION](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ENTITY_OVERRIDE.TRIGGER_EXPLOSION) | 94 |
[SPAWN_PROJECTILE](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ENTITY_OVERRIDE.SPAWN_PROJECTILE) | 93 |
+[GIVE_POWERUP](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=ENTITY_OVERRIDE.GIVE_POWERUP) | 93 |
## ENT_FLAG
diff --git a/docs/src/includes/_types.md b/docs/src/includes/_types.md
index 61ba1a419..796f23a52 100644
--- a/docs/src/includes/_types.md
+++ b/docs/src/includes/_types.md
@@ -4332,12 +4332,12 @@ nil | [clear_virtual(CallbackId callback_id)](https://github.com/spelunky-fyi/ov
[CallbackId](#Aliases) | [set_post_walked_off(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_walked_off) | Hooks after the virtual function.
The callback signature is `nil walked_off(Entity self, Entity walker)`
[CallbackId](#Aliases) | [set_pre_ledge_grab(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_ledge_grab) | Hooks before the virtual function.
The callback signature is `bool ledge_grab(Entity self, Entity who)`
[CallbackId](#Aliases) | [set_post_ledge_grab(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_ledge_grab) | Hooks after the virtual function.
The callback signature is `nil ledge_grab(Entity self, Entity who)`
-[CallbackId](#Aliases) | [set_pre_stood_on(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_stood_on) | Hooks before the virtual function.
The callback signature is `bool stood_on(Entity self, Entity entity Vec2)`
-[CallbackId](#Aliases) | [set_post_stood_on(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_stood_on) | Hooks after the virtual function.
The callback signature is `nil stood_on(Entity self, Entity entity Vec2)`
+[CallbackId](#Aliases) | [set_pre_stood_on(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_stood_on) | Hooks before the virtual function.
The callback signature is `bool stood_on(Entity self, Entity entity, Vec2)`
+[CallbackId](#Aliases) | [set_post_stood_on(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_stood_on) | Hooks after the virtual function.
The callback signature is `nil stood_on(Entity self, Entity entity, Vec2)`
[CallbackId](#Aliases) | [set_pre_liberate_from_shop(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_liberate_from_shop) | Hooks before the virtual function.
The callback signature is `bool liberate_from_shop(Entity self, bool clear_parrent)`
Virtual function docs:
`clear_parent` used only for CHAR_* entities, sets the `linked_companion_parent` to -1. It's not called when item is bought
[CallbackId](#Aliases) | [set_post_liberate_from_shop(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_liberate_from_shop) | Hooks after the virtual function.
The callback signature is `nil liberate_from_shop(Entity self, bool clear_parrent)`
Virtual function docs:
`clear_parent` used only for CHAR_* entities, sets the `linked_companion_parent` to -1. It's not called when item is bought
-[CallbackId](#Aliases) | [set_pre_init(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_init) | Hooks before the virtual function.
The callback signature is `bool init(Entity self)`
-[CallbackId](#Aliases) | [set_post_init(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_init) | Hooks after the virtual function.
The callback signature is `nil init(Entity self)`
+[CallbackId](#Aliases) | [set_pre_init(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_init) | Hooks before the virtual function.
The callback signature is `bool init(Entity self)`
Virtual function docs:
Applies changes made in `entity.type`
+[CallbackId](#Aliases) | [set_post_init(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_init) | Hooks after the virtual function.
The callback signature is `nil init(Entity self)`
Virtual function docs:
Applies changes made in `entity.type`
### IceSlidingSound
@@ -5232,7 +5232,7 @@ int | [shoot_lava_timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&
int | [jump_pause_timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=jump_pause_timer) |
int | [lava_detection_timer](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=lava_detection_timer) |
bool | [is_hot](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=is_hot) |
-int | [player_detect_state](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=player_detect_state) | 0 - didn't saw player, 1 - saw player, 2 - spited lava; probably used so he won't spit imminently after seeing the player
+int | [player_detect_state](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=player_detect_state) | 0 - didn't see player, 1 - saw player, 2 - spitted lava; probably used so he won't spit imminently after seeing the player
### Leprechaun
@@ -5517,8 +5517,8 @@ int | [worn_backitem()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q
[CallbackId](#Aliases) | [set_pre_virtual(ENTITY_OVERRIDE entry, function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_virtual) | Hooks before the virtual function at index `entry`.
[CallbackId](#Aliases) | [set_post_virtual(ENTITY_OVERRIDE entry, function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_virtual) | Hooks after the virtual function at index `entry`.
nil | [clear_virtual(CallbackId callback_id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=clear_virtual) | Clears the hook given by `callback_id`, alternatively use `clear_callback()` inside the hook.
-[CallbackId](#Aliases) | [set_pre_blood_collision(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_blood_collision) | Hooks before the virtual function.
The callback signature is `optional blood_collision(PowerupCapable self)`
-[CallbackId](#Aliases) | [set_post_blood_collision(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_blood_collision) | Hooks after the virtual function.
The callback signature is `nil blood_collision(PowerupCapable self)`
+[CallbackId](#Aliases) | [set_pre_blood_collision(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_blood_collision) | Hooks before the virtual function.
The callback signature is `optional blood_collision(PowerupCapable self)`
Virtual function docs:
only triggers when entity has kapala
+[CallbackId](#Aliases) | [set_post_blood_collision(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_blood_collision) | Hooks after the virtual function.
The callback signature is `nil blood_collision(PowerupCapable self)`
Virtual function docs:
only triggers when entity has kapala
### ProtoShopkeeper
@@ -6987,7 +6987,7 @@ bool | [is_powerup_capable()](https://github.com/spelunky-fyi/overlunky/search?l
bool | [can_be_picked_up_by(Entity entity_picking_up, bool)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=can_be_picked_up_by) |
bool | [can_break_block(bool horizontal, Entity block)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=can_break_block) |
nil | [break_block(bool camera_shake, Entity block)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=break_block) |
-bool | [damage(Entity damage_dealer, int damage_amount, DAMAGE_TYPE damage_flags, Vec2 velocity, int unknown_damage_phase, int stun_amount, int iframes, bool unknown_is_final)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=damage) | 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 pot that should break after hit etc.), false if the event should be ignored by damage_dealer
+bool | [damage(Entity damage_dealer, int damage_amount, DAMAGE_TYPE damage_flags, Vec2 velocity, int unknown_damage_phase, int stun_amount, int iframes, bool unknown_is_final)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=damage) | 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
vector<int> | [get_all_behaviors()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_all_behaviors) | Get all available behavior ids
bool | [set_behavior(int behavior_id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_behavior) | 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
int | [get_behavior()](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=get_behavior) | Get the current behavior id
@@ -7030,8 +7030,8 @@ nil | [clear_virtual(CallbackId callback_id)](https://github.com/spelunky-fyi/ov
[CallbackId](#Aliases) | [set_post_attack(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_attack) | Hooks after the virtual function.
The callback signature is `nil attack(Movable self, Entity victim)`
Virtual function docs:
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)
[CallbackId](#Aliases) | [set_pre_thrown_into(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_thrown_into) | Hooks before the virtual function.
The callback signature is `optional thrown_into(Movable self, Entity victim)`
Virtual function docs:
Same as above, but for being thrown into something and potentially dealing damage that way
[CallbackId](#Aliases) | [set_post_thrown_into(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_thrown_into) | Hooks after the virtual function.
The callback signature is `nil thrown_into(Movable self, Entity victim)`
Virtual function docs:
Same as above, but for being thrown into something and potentially dealing damage that way
-[CallbackId](#Aliases) | [set_pre_damage(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_damage) | Hooks before the virtual function.
The callback signature is `optional damage(Movable self, Entity damage_dealer, int damage_amount, DAMAGE_TYPE damage_flags, Vec2 velocity, int unknown_damage_phase, int stun_amount, int iframes, bool unknown_is_final)`
Virtual function docs:
Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities. `damage_dealer` can be set to nil.
Returns: true if entity was affected (for stuff like pot that should break after hit etc.), false if the event should be ignored by damage_dealer
-[CallbackId](#Aliases) | [set_post_damage(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_damage) | Hooks after the virtual function.
The callback signature is `nil damage(Movable self, Entity damage_dealer, int damage_amount, DAMAGE_TYPE damage_flags, Vec2 velocity, int unknown_damage_phase, int stun_amount, int iframes, bool unknown_is_final)`
Virtual function docs:
Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities. `damage_dealer` can be set to nil.
Returns: true if entity was affected (for stuff like pot that should break after hit etc.), false if the event should be ignored by damage_dealer
+[CallbackId](#Aliases) | [set_pre_damage(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_damage) | Hooks before the virtual function.
The callback signature is `optional damage(Movable self, Entity damage_dealer, int damage_amount, DAMAGE_TYPE damage_flags, Vec2 velocity, int unknown_damage_phase, int stun_amount, int iframes, bool unknown_is_final)`
Virtual function docs:
Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities. `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
+[CallbackId](#Aliases) | [set_post_damage(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_damage) | Hooks after the virtual function.
The callback signature is `nil damage(Movable self, Entity damage_dealer, int damage_amount, DAMAGE_TYPE damage_flags, Vec2 velocity, int unknown_damage_phase, int stun_amount, int iframes, bool unknown_is_final)`
Virtual function docs:
Damage the movable by the specified amount, stuns and gives it invincibility for the specified amount of frames and applies the velocities. `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
[CallbackId](#Aliases) | [set_pre_on_hit(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_on_hit) | Hooks before the virtual function.
The callback signature is `bool on_hit(Movable self, Entity damage_dealer)`
Virtual function docs:
Hit by broken arrows etc that don't deal damage, calls damage with 0 damage.
[CallbackId](#Aliases) | [set_post_on_hit(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_on_hit) | Hooks after the virtual function.
The callback signature is `nil on_hit(Movable self, Entity damage_dealer)`
Virtual function docs:
Hit by broken arrows etc that don't deal damage, calls damage with 0 damage.
[CallbackId](#Aliases) | [set_pre_get_damage_sound(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_get_damage_sound) | Hooks before the virtual function.
The callback signature is `optional get_damage_sound(Movable self, DAMAGE_TYPE damage)`
Virtual function docs:
returns sound id for the damage taken, return 0 to make it silence
@@ -7056,8 +7056,8 @@ nil | [clear_virtual(CallbackId callback_id)](https://github.com/spelunky-fyi/ov
[CallbackId](#Aliases) | [set_post_stomped_by(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_stomped_by) | Hooks after the virtual function.
The callback signature is `nil stomped_by(Movable self, Entity stomper)`
[CallbackId](#Aliases) | [set_pre_thrown_by(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_thrown_by) | Hooks before the virtual function.
The callback signature is `bool thrown_by(Movable self, Entity thrower)`
[CallbackId](#Aliases) | [set_post_thrown_by(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_thrown_by) | Hooks after the virtual function.
The callback signature is `nil thrown_by(Movable self, Entity thrower)`
-[CallbackId](#Aliases) | [set_pre_cloned_to(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_cloned_to) | Hooks before the virtual function.
The callback signature is `bool cloned_to(Movable self, Entity clone int some_entity_uid)`
-[CallbackId](#Aliases) | [set_post_cloned_to(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_cloned_to) | Hooks after the virtual function.
The callback signature is `nil cloned_to(Movable self, Entity clone int some_entity_uid)`
+[CallbackId](#Aliases) | [set_pre_cloned_to(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_cloned_to) | Hooks before the virtual function.
The callback signature is `bool cloned_to(Movable self, Entity clone, int some_entity_uid)`
Virtual function docs:
Entities must be of the same type!
+[CallbackId](#Aliases) | [set_post_cloned_to(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_cloned_to) | Hooks after the virtual function.
The callback signature is `nil cloned_to(Movable self, Entity clone, int some_entity_uid)`
Virtual function docs:
Entities must be of the same type!
[CallbackId](#Aliases) | [set_pre_pick_up(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_pick_up) | Hooks before the virtual function.
The callback signature is `bool pick_up(Movable self, Entity entity_to_pick_up)`
[CallbackId](#Aliases) | [set_post_pick_up(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_pick_up) | Hooks after the virtual function.
The callback signature is `nil pick_up(Movable self, Entity entity_to_pick_up)`
[CallbackId](#Aliases) | [set_pre_can_be_picked_up_by(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_can_be_picked_up_by) | Hooks before the virtual function.
The callback signature is `optional can_be_picked_up_by(Movable self, Entity entity_picking_up, bool)`
@@ -7074,14 +7074,14 @@ nil | [clear_virtual(CallbackId callback_id)](https://github.com/spelunky-fyi/ov
[CallbackId](#Aliases) | [set_post_initialize(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_initialize) | Hooks after the virtual function.
The callback signature is `nil initialize(Movable self)`
[CallbackId](#Aliases) | [set_pre_process_input(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_process_input) | Hooks before the virtual function.
The callback signature is `bool process_input(Movable self)`
[CallbackId](#Aliases) | [set_post_process_input(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_process_input) | Hooks after the virtual function.
The callback signature is `nil process_input(Movable self)`
-[CallbackId](#Aliases) | [set_pre_picked_up(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_picked_up) | Hooks before the virtual function.
The callback signature is `bool picked_up(Movable self)`
-[CallbackId](#Aliases) | [set_post_picked_up(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_picked_up) | Hooks after the virtual function.
The callback signature is `nil picked_up(Movable self)`
-[CallbackId](#Aliases) | [set_pre_release(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_release) | Hooks before the virtual function.
The callback signature is `bool release(Movable self)`
-[CallbackId](#Aliases) | [set_post_release(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_release) | Hooks after the virtual function.
The callback signature is `nil release(Movable self)`
+[CallbackId](#Aliases) | [set_pre_picked_up(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_picked_up) | Hooks before the virtual function.
The callback signature is `bool picked_up(Movable self)`
Virtual function docs:
Called for entity that just has been picked up
+[CallbackId](#Aliases) | [set_post_picked_up(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_picked_up) | Hooks after the virtual function.
The callback signature is `nil picked_up(Movable self)`
Virtual function docs:
Called for entity that just has been picked up
+[CallbackId](#Aliases) | [set_pre_release(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_release) | Hooks before the virtual function.
The callback signature is `bool release(Movable self)`
Virtual function docs:
Called for entity that just has been thrown/dropped
+[CallbackId](#Aliases) | [set_post_release(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_release) | Hooks after the virtual function.
The callback signature is `nil release(Movable self)`
Virtual function docs:
Called for entity that just has been thrown/dropped
[CallbackId](#Aliases) | [set_pre_generate_fall_poof_particles(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_generate_fall_poof_particles) | Hooks before the virtual function.
The callback signature is `bool generate_fall_poof_particles(Movable self)`
[CallbackId](#Aliases) | [set_post_generate_fall_poof_particles(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_generate_fall_poof_particles) | Hooks after the virtual function.
The callback signature is `nil generate_fall_poof_particles(Movable self)`
-[CallbackId](#Aliases) | [set_pre_fall(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_fall) | Hooks before the virtual function.
The callback signature is `bool fall(Movable self, float float)`
-[CallbackId](#Aliases) | [set_post_fall(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_fall) | Hooks after the virtual function.
The callback signature is `nil fall(Movable self, float float)`
+[CallbackId](#Aliases) | [set_pre_fall(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_fall) | Hooks before the virtual function.
The callback signature is `bool fall(Movable self, float float)`
Virtual function docs:
Applies gravity to entity. Disable to float like on hoverpack.
+[CallbackId](#Aliases) | [set_post_fall(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_fall) | Hooks after the virtual function.
The callback signature is `nil fall(Movable self, float float)`
Virtual function docs:
Applies gravity to entity. Disable to float like on hoverpack.
[CallbackId](#Aliases) | [set_pre_apply_friction(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_apply_friction) | Hooks before the virtual function.
The callback signature is `bool apply_friction(Movable self, float, bool vertical, float)`
[CallbackId](#Aliases) | [set_post_apply_friction(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_apply_friction) | Hooks after the virtual function.
The callback signature is `nil apply_friction(Movable self, float, bool vertical, float)`
[CallbackId](#Aliases) | [set_pre_can_break_block(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_can_break_block) | Hooks before the virtual function.
The callback signature is `optional can_break_block(Movable self, bool horizontal, Entity block)`
@@ -7227,10 +7227,10 @@ Type | Name | Description
[CallbackId](#Aliases) | [set_pre_virtual(ENTITY_OVERRIDE entry, function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_virtual) | Hooks before the virtual function at index `entry`.
[CallbackId](#Aliases) | [set_post_virtual(ENTITY_OVERRIDE entry, function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_virtual) | Hooks after the virtual function at index `entry`.
nil | [clear_virtual(CallbackId callback_id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=clear_virtual) | Clears the hook given by `callback_id`, alternatively use `clear_callback()` inside the hook.
-[CallbackId](#Aliases) | [set_pre_putting_on(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_putting_on) | Hooks before the virtual function.
The callback signature is `bool putting_on(Powerup self, PowerupCapable who)`
-[CallbackId](#Aliases) | [set_post_putting_on(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_putting_on) | Hooks after the virtual function.
The callback signature is `nil putting_on(Powerup self, PowerupCapable who)`
-[CallbackId](#Aliases) | [set_pre_putting_off(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_putting_off) | Hooks before the virtual function.
The callback signature is `bool putting_off(Powerup self, PowerupCapable who)`
-[CallbackId](#Aliases) | [set_post_putting_off(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_putting_off) | Hooks after the virtual function.
The callback signature is `nil putting_off(Powerup self, PowerupCapable who)`
+[CallbackId](#Aliases) | [set_pre_putting_on(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_putting_on) | Hooks before the virtual function.
The callback signature is `bool putting_on(Powerup self, PowerupCapable who)`
Virtual function docs:
only for backpacks
+[CallbackId](#Aliases) | [set_post_putting_on(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_putting_on) | Hooks after the virtual function.
The callback signature is `nil putting_on(Powerup self, PowerupCapable who)`
Virtual function docs:
only for backpacks
+[CallbackId](#Aliases) | [set_pre_putting_off(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_putting_off) | Hooks before the virtual function.
The callback signature is `bool putting_off(Powerup self, PowerupCapable who)`
Virtual function docs:
only for backpacks
+[CallbackId](#Aliases) | [set_post_putting_off(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_putting_off) | Hooks after the virtual function.
The callback signature is `nil putting_off(Powerup self, PowerupCapable who)`
Virtual function docs:
only for backpacks
### Present
@@ -7313,6 +7313,12 @@ Derived from [Entity](#Entity) [Movable](#Movable) [Purchasable](#Purchasable)
Type | Name | Description
---- | ---- | -----------
float | [roll_speed](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=roll_speed) |
+nil | [give_powerup(Entity who, bool)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=give_powerup) | Skip this function for item to be unpickable
+[CallbackId](#Aliases) | [set_pre_virtual(ENTITY_OVERRIDE entry, function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_virtual) | Hooks before the virtual function at index `entry`.
+[CallbackId](#Aliases) | [set_post_virtual(ENTITY_OVERRIDE entry, function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_virtual) | Hooks after the virtual function at index `entry`.
+nil | [clear_virtual(CallbackId callback_id)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=clear_virtual) | Clears the hook given by `callback_id`, alternatively use `clear_callback()` inside the hook.
+[CallbackId](#Aliases) | [set_pre_give_powerup(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_pre_give_powerup) | Hooks before the virtual function.
The callback signature is `bool give_powerup(RollingItem self, Entity who, bool)`
Virtual function docs:
Skip this function for item to be unpickable
+[CallbackId](#Aliases) | [set_post_give_powerup(function fun)](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=set_post_give_powerup) | Hooks after the virtual function.
The callback signature is `nil give_powerup(RollingItem self, Entity who, bool)`
Virtual function docs:
Skip this function for item to be unpickable
### Rubble
@@ -7687,7 +7693,7 @@ float | [falling_speed](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q
### YellowCape
-Derived from [Entity](#Entity) [Movable](#Movable) [Backpack](#Backpack) [Cape](#Cape)
+Derived from [Entity](#Entity) [Movable](#Movable) [Powerup](#Powerup) [Backpack](#Backpack) [Cape](#Cape)
Type | Name | Description
diff --git a/src/game_api/entities_chars.hpp b/src/game_api/entities_chars.hpp
index 9eadf6934..e8940d85b 100644
--- a/src/game_api/entities_chars.hpp
+++ b/src/game_api/entities_chars.hpp
@@ -93,7 +93,7 @@ class PowerupCapable : public Movable
/// Returns the uid of the currently worn backitem, or -1 if wearing nothing
int32_t worn_backitem();
- /// only triggers when it has kapala
+ /// only triggers when entity has kapala
virtual bool on_blood_collision() = 0;
// called for stunned entities, check bunch of stuff like state, hold entity, standing on entity etc. runs until returned 1
// this is used to clear the last_owner of stunned entity when it is no longed stunned
diff --git a/src/game_api/entities_items.hpp b/src/game_api/entities_items.hpp
index 2ee033901..7245214ff 100644
--- a/src/game_api/entities_items.hpp
+++ b/src/game_api/entities_items.hpp
@@ -766,7 +766,7 @@ class RollingItem : public Purchasable
float roll_speed; // only positive numbers
/// Skip this function for item to be unpickable
- virtual void pickup(Entity* who, bool) = 0;
+ virtual void give_powerup(Entity* who, bool) = 0;
};
class PlayerBag : public Movable
diff --git a/src/game_api/movable.hpp b/src/game_api/movable.hpp
index cec678771..12ecc5332 100644
--- a/src/game_api/movable.hpp
+++ b/src/game_api/movable.hpp
@@ -156,7 +156,7 @@ class Movable : public Entity
virtual bool thrown_into(Entity* victim) = 0; // 47
/// 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 pot that should break after hit etc.), false if the event should be ignored by damage_dealer
+ /// 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
virtual bool damage(Entity* damage_dealer, int8_t damage_amount, DAMAGE_TYPE damage_flags, Vec2* velocity, uint8_t unknown_damage_phase, uint16_t stun_amount, uint8_t iframes, bool unknown_is_final) = 0; // 48
/// Hit by broken arrows etc that don't deal damage, calls damage with 0 damage.
@@ -200,9 +200,11 @@ class Movable : public Entity
virtual void v77() = 0; // 77
virtual void process_input() = 0; // 78, more like: handle_movement
virtual void post_collision_damage_related() = 0; // 79, used for enemies attacks as well? 3 versions for: eggplant minister, players and the rest
- virtual void on_picked_up() = 0; // 80, plays pickup sound depending on the entity mask/type etc. set stun for pets and mounts etc.
- virtual void on_release() = 0; // 81, only for hired hands and lava pots
- virtual void generate_fall_poof_particles() = 0; // 82, entity.velocityy must be < -0.12 to generate a poof, might do other stuff regarding falling/landing
+ /// Called for entity that just has been picked up
+ virtual void on_picked_up() = 0; // 80, plays pickup sound depending on the entity mask/type etc. set stun for pets and mounts etc.
+ /// Called for entity that just has been thrown/dropped
+ virtual void on_release() = 0; // 81, only for hired hands and lava pots, the rest just returns
+ virtual void generate_fall_poof_particles() = 0; // 82, entity.velocityy must be < -0.12 to generate a poof, might do other stuff regarding falling/landing
/// Applies gravity to entity. Disable to float like on hoverpack.
virtual void handle_fall_logic(float) = 0; // 83, adjusts entity.velocityy when falling
virtual void apply_friction(float, bool vertical, float) = 0; // 84, applies entity.type.friction to entity.velocityx, the two floats for characters just multiply the friction, could also be returning the value
diff --git a/src/game_api/script/usertypes/entities_items_lua.cpp b/src/game_api/script/usertypes/entities_items_lua.cpp
index c086e74a5..045d38c2b 100644
--- a/src/game_api/script/usertypes/entities_items_lua.cpp
+++ b/src/game_api/script/usertypes/entities_items_lua.cpp
@@ -919,6 +919,8 @@ void register_usertypes(sol::state& lua)
"RollingItem",
"roll_speed",
&RollingItem::roll_speed,
+ "give_powerup",
+ &RollingItem::give_powerup,
sol::base_classes,
sol::bases());
diff --git a/src/game_api/script/usertypes/vtables_lua.cpp b/src/game_api/script/usertypes/vtables_lua.cpp
index 87af1ede9..cc7914ace 100644
--- a/src/game_api/script/usertypes/vtables_lua.cpp
+++ b/src/game_api/script/usertypes/vtables_lua.cpp
@@ -210,11 +210,17 @@ void register_usertypes(sol::state& lua)
VTableEntry<"spawn_projectile", 93, MemFun<&OlmecCannon::spawn_projectile>>>;
static OlmecCannonVTable olmec_cannon_vtable(lua, lua["OlmecCannon"], "ENTITY_OVERRIDE");
+ using RollingItemVTable = HookableVTable<
+ Entity,
+ CallbackType::Entity,
+ EntityVTable,
+ VTableEntry<"give_powerup", 93, MemFun<&RollingItem::give_powerup>>>;
+ static RollingItemVTable rolling_item_vtable(lua, lua["RollingItem"], "ENTITY_OVERRIDE");
+
// Arrow // poison_arrow // light_up ?
// Torch // light_up // get_flame_offset // get_flame_type
// Bow // get_arrow_special_offset
// Generator // randomize_timer ?
- // RollingItem // pickup
// SoundMeta // start // kill //update maybe?
// CritterSlime + CritterSnail // get_speed
// Ghist // on_body_destroyed