Sort src/ into subsystem folders (engine, game, level, level/grid, entity with player, npc, boss, familiar, effect, pickup and weapon, ui, ui/menu, lua, online), drop each folder's prefix from file names, include by path from src/, glob src/ recursively

This commit is contained in:
shweet committed 2026-11-23 16:41:49 -05:00
1 parent 9254158eef
commit 7d3cf33c20
706 files changed
+5337 -5336

No files matched your search

+647
View File
@@ -0,0 +1,647 @@
#include "lua/engine.h"
#include "classes.h"
#include "entity/weapon/bomb.h"
#include "entity/effect/effect.h"
#include "entity/familiar/familiar.h"
#include "entity/weapon/knife.h"
#include "entity/weapon/laser.h"
#include "entity/npc/npc.h"
#include "entity/pickup/pickup.h"
#include "entity/player/player.h"
#include "entity/weapon/projectile.h"
#include "entity/weapon/tear.h"
#include "game/game.h"
#include "lua/api.h"
#include "level/room_config.h"
constexpr int PILL_EFFECT_UNCHANGED = -1;
// One run of a callback: the name its errors log, its id, and the parameter mods filter it by.
struct CallbackRun
{
const char* name;
LuaCallback id;
int param = CALLBACK_PARAM_NONE;
};
// Calls _RunCallback with a callback's id, its filter parameter and its arguments when a mod added a function for it,
// leaving its one result on the stack. Whether it ran, false without a function or on an error, which is logged.
// The callers, result readers and error throws the original instantiates per callback are this and its readers
// (00872980, 00872c60, 00873470, 00873980, 00873d00, 00873fc0, 00874120, 00874210, 00874310, 00874a10, 00874f60)
// (0085c080, 008727d0, 0086130e, 00861225, 00861d96, 00861e7f, 008623a6, 0086248f, 008628b6, 0086299f, 00864453)
// (0086453c, 00865bbc, 00872a20, 00872b10, 00872ff0, 008730e0, 00873890, 00873ac0, 00873bb0, 00873e40, 008746b0)
// (00874860, 00874910, 00874ac0, 00874d20, 00874dd0, 00874e90, 00865a04, 0085bfd0, 0085bff0, 0085c270, 00873f40)
// (00872da0, 00872e90, 00873230, 00873320, 00873560, 00873650, 00873740, 00874400, 00874550, 00875050, 008663b6)
// (00872820, 00872860, 00872910, 00861c23, 00862233, 00862d53, 00865aad, 00865c61, 00866474, 00872a0c, 00872af1)
// (00872c43, 00872d80, 00872e71, 00872fc3, 008730c1, 00873213, 00873301, 00873453, 00873541, 00873631, 00873721)
// (00873873, 00873961, 00873aa0, 00873b91, 00873ce3, 00873e20, 00873f26, 00874103, 008741f1, 008742f7, 008743eb)
// (00874533, 0087469a, 00874846, 008748f6, 008749f7, 00874aa8, 00874bbb, 00874d0a, 00874db6, 00874e7e, 00874f4a)
// (00861bda, 008621ea, 00862d0a, 0085c250, 0085c2d0, 0085c300, 0085c340, 0085bf50, 0085c1d0, 0085c200, 0085c210)
// (0085da70)
// and their catches log through lua_error_log
// (00860ea3, 008611da, 0086191f, 00861d4b, 0086235b, 0086286b, 00862ea4, 008632e1)
// (00863706, 00863b6a, 00863e31, 00863f1e, 008640de, 00864408, 00864f6e, 00865b69, 008661cc, 00860826, 0086090e)
// (00860a70, 00860b4b, 00860c36, 00860d1e, 008613bf, 0086149f, 00861587, 00862a4c, 00862b2f, 00862cb8, 00862f8c)
// (0086306c, 00863154, 0086354b, 00863fff, 00864a6a, 00864bb8, 00864d16, 00865209, 008652e9, 00865424, 008659a7)
// (00865d53, 00865e99, 00865fe8, 008660ec)
// (00860f8b, 00861076, 0086166f, 0086174f, 00861837, 008619ff, 00861b88, 00861f2f, 0086200f, 00862198, 0086253f)
// (0086261f, 00862707, 0086362b, 00863879, 00863c6e, 00863d4e, 008641bb, 008642a4, 00864682, 00864e6d, 0086504e)
// (0086512e, 008655b7, 00866364, 0086675e, 008668e0).
template <typename... Args>
static bool callback_run(LuaEngine& engine, CallbackRun run, Args... args)
{
if (!engine.enabledCallbacks[run.id]) return false;
lua_State* state = engine.state;
lua_rawgeti(state, LUA_REGISTRYINDEX, engine.runCallbackRef);
lua_push(state, (int)run.id);
lua_push(state, run.param);
(lua_push(state, args), ...);
if (lua_pcall(state, sizeof...(Args) + 2, 1, 0) == LUA_OK) return true;
lua_error_log(state, run.name);
return false;
}
// Runs a callback whose result the game ignores.
template <typename... Args>
static void callback_notify(LuaEngine& engine, CallbackRun run, Args... args)
{
if (callback_run(engine, run, args...)) lua_pop(engine.state, 1);
}
// Runs a callback whose result is an integer that replaces fallback.
// The original aborts on a result that is neither nil nor an integer. This keeps fallback instead.
template <typename... Args>
static int callback_integer_run(LuaEngine& engine, CallbackRun run, int fallback, Args... args)
{
if (!callback_run(engine, run, args...)) return fallback;
int isInteger = 0;
lua_Integer result = lua_tointegerx(engine.state, -1, &isInteger);
lua_pop(engine.state, 1);
return isInteger ? (int)result : fallback;
}
// Runs a callback whose result, when not nil, is a boolean that replaces fallback.
template <typename... Args>
static bool callback_boolean_run(LuaEngine& engine, CallbackRun run, bool fallback, Args... args)
{
if (!callback_run(engine, run, args...)) return fallback;
bool result = lua_isnil(engine.state, -1) ? fallback : lua_toboolean(engine.state, -1);
lua_pop(engine.state, 1);
return result;
}
// Runs a Pre*Collision callback for an entity and what it hits, and reads its result as true, false or nothing.
template <typename T>
static LuaResult collision_run(LuaEngine& engine, CallbackRun run, T* entity, Entity* collider, bool isLow)
{
if (!callback_run(engine, run, entity, collider, isLow)) return LUA_RESULT_NIL;
LuaResult result = lua_isnil(engine.state, -1) ? LUA_RESULT_NIL
: lua_toboolean(engine.state, -1) ? LUA_RESULT_TRUE
: LUA_RESULT_FALSE;
lua_pop(engine.state, 1);
return result;
}
// Sets value to a field of the table on top of the stack, when the field is not nil.
static void field_read(lua_State* state, const char* key, bool& value)
{
lua_getfield(state, -1, key);
if (!lua_isnil(state, -1)) value = lua_toboolean(state, -1);
lua_pop(state, 1);
}
// Sets value to an element of the table on top of the stack, when the element is not nil. Whether it was not.
// The original aborts on an element that is not an integer. This keeps the value instead.
template <typename T>
static bool element_read(lua_State* state, int key, T& value)
{
int isInteger = 0;
bool isSet = lua_geti(state, -1, key) != LUA_TNIL;
lua_Integer element = lua_tointegerx(state, -1, &isInteger);
if (isInteger) value = (T)element;
lua_pop(state, 1);
return isSet;
}
// Pops a callback's result, and when it is a table sets values in order to its elements 1, 2 ... Whether any was set.
template <typename... T>
static bool elements_pop(lua_State* state, T&... values)
{
int key = 1;
bool isChanged = false;
if (lua_istable(state, -1)) ((isChanged |= element_read(state, key++, values)), ...);
lua_pop(state, 1);
return isChanged;
}
// 00862250 Runs MC_PRE_BOMB_COLLISION, filtered by the bomb's variant.
LuaResult LuaEngine::PreBombCollision(Entity_Bomb* bomb, Entity* collider, bool isLow)
{
CallbackRun run = {"PreBombCollision", MC_PRE_BOMB_COLLISION, (int)bomb->variant};
return collision_run(*this, run, bomb, collider, isLow);
}
// 008610d0 Runs MC_PRE_FAMILIAR_COLLISION, filtered by the familiar's variant.
LuaResult LuaEngine::PreFamiliarCollision(Entity_Familiar* familiar, Entity* collider, bool isLow)
{
CallbackRun run = {"PreFamiliarCollision", MC_PRE_FAMILIAR_COLLISION, (int)familiar->variant};
return collision_run(*this, run, familiar, collider, isLow);
}
// 00861c40 Runs MC_PRE_KNIFE_COLLISION, filtered by the knife's subtype.
LuaResult LuaEngine::PreKnifeCollision(Entity_Knife* knife, Entity* collider, bool isLow)
{
CallbackRun run = {"PreKnifeCollision", MC_PRE_KNIFE_COLLISION, (int)knife->subtype};
return collision_run(*this, run, knife, collider, isLow);
}
// 00860d70 Runs MC_PRE_NPC_COLLISION, filtered by the NPC's type.
LuaResult LuaEngine::PreNPCCollision(Entity_NPC* npc, Entity* collider, bool isLow)
{
CallbackRun run = {"PreNPCCollision", MC_PRE_NPC_COLLISION, (int)npc->type};
return collision_run(*this, run, npc, collider, isLow);
}
// 008631b0 Runs MC_PRE_PICKUP_COLLISION, filtered by the pickup's variant.
LuaResult LuaEngine::PrePickupCollision(Entity_Pickup* pickup, Entity* collider, bool isLow)
{
CallbackRun run = {"PrePickupCollision", MC_PRE_PICKUP_COLLISION, (int)pickup->variant};
return collision_run(*this, run, pickup, collider, isLow);
}
// 00864300 Runs MC_PRE_PLAYER_COLLISION, filtered by the player's variant.
LuaResult LuaEngine::PrePlayerCollide(Entity_Player* player, Entity* collider, bool isLow)
{
CallbackRun run = {"PrePlayerCollision", MC_PRE_PLAYER_COLLISION, (int)player->variant};
return collision_run(*this, run, player, collider, isLow);
}
// 00862760 Runs MC_PRE_PROJECTILE_COLLISION, filtered by the projectile's variant.
LuaResult LuaEngine::PreProjectileCollision(Entity_Projectile* projectile, Entity* collider, bool isLow)
{
CallbackRun run = {"PreProjectileCollision", MC_PRE_PROJECTILE_COLLISION, (int)projectile->variant};
return collision_run(*this, run, projectile, collider, isLow);
}
// 00862d70 Runs MC_PRE_TEAR_COLLISION, filtered by the tear's variant.
LuaResult LuaEngine::PreTearCollision(Entity_Tear* tear, Entity* collider, bool isLow)
{
CallbackRun run = {"PreTearCollision", MC_PRE_TEAR_COLLISION, (int)tear->variant};
return collision_run(*this, run, tear, collider, isLow);
}
// 00865340 Runs MC_GET_CARD for a card the pools drew. The card a mod chose, or the drawn one.
int LuaEngine::GetCard(const LuaCardDraw& draw)
{
return callback_integer_run(*this, {"GetCard", MC_GET_CARD}, draw.card, draw.rng,
draw.card, draw.isPlaying, draw.isRunes, draw.isOnlyRunes);
}
// 00865c80 Runs MC_GET_PILL_COLOR for a pill drawn from seed. The color a mod chose, 0 to keep the drawn one.
// The original's first argument is an unused 9, and Lua gets only the seed, not the drawn color.
int LuaEngine::GetPillColor(uint32_t seed)
{
return callback_integer_run(*this, {"GetPill", MC_GET_PILL_COLOR}, 0, seed);
}
// 00865ad0 Runs MC_GET_PILL_EFFECT for the effect a pill color got. The effect a mod chose, -1 to keep it.
int LuaEngine::GetPillEffect(int pillEffect, int pillColor)
{
CallbackRun run = {"GetPillEffect", MC_GET_PILL_EFFECT};
return callback_integer_run(*this, run, PILL_EFFECT_UNCHANGED, pillEffect, pillColor);
}
// 008658c0 Runs MC_GET_TRINKET for a trinket the pool drew, with a copy of the pool's RNG. The trinket a mod chose, 0
// to keep the drawn one.
int LuaEngine::GetTrinket(int trinket, const RNG& rng)
{
return callback_integer_run(*this, {"GetTrinket", MC_GET_TRINKET}, 0, trinket, rng);
}
// 00864c30 Runs MC_INPUT_ACTION for a boolean input hook, filtered by the hook. What a mod answered, nothing when no
// mod did.
std::optional<bool> LuaEngine::InputAction(Entity* entity, int hook, int action)
{
CallbackRun run = {"PreActionHookB", MC_INPUT_ACTION, hook};
if (!callback_run(*this, run, entity, hook, action)) return std::nullopt;
std::optional<bool> value;
if (!lua_isnil(state, -1)) value = lua_toboolean(state, -1);
lua_pop(state, 1);
return value;
}
// 00864d80 Runs MC_INPUT_ACTION for the action value hook. The value a mod answered, nothing when no mod did.
std::optional<float> LuaEngine::InputActionValue(Entity* entity, int action)
{
CallbackRun run = {"PreActionHookF", MC_INPUT_ACTION, INPUT_HOOK_VALUE};
if (!callback_run(*this, run, entity, INPUT_HOOK_VALUE, action)) return std::nullopt;
std::optional<float> value;
if (!lua_isnil(state, -1)) value = (float)luaL_checknumber(state, -1);
lua_pop(state, 1);
return value;
}
// 00864ae0 Runs MC_POST_CURSE_EVAL for the curses a floor got. The curses a mod chose, or those.
int LuaEngine::PostCurseEval(int curses)
{
return callback_integer_run(*this, {"PostCurseEval", MC_POST_CURSE_EVAL}, curses, curses);
}
// 00865f10 Runs MC_POST_GET_COLLECTIBLE for the collectible a pool gave. The collectible a mod chose, 0 to keep it.
int LuaEngine::PostGetCollectible(const LuaCollectibleDraw& draw)
{
CallbackRun run = {"PostGetCollectible", MC_POST_GET_COLLECTIBLE};
return callback_integer_run(*this, run, 0, draw.collectible, draw.poolType, draw.isDecrease, draw.seed);
}
// 00865dc0 Runs MC_PRE_GET_COLLECTIBLE before a pool draws. The collectible a mod chose, 0 to draw as usual.
int LuaEngine::PreGetCollectible(const LuaCollectibleDraw& draw)
{
CallbackRun run = {"PreGetCollectible", MC_PRE_GET_COLLECTIBLE};
return callback_integer_run(*this, run, 0, draw.poolType, draw.isDecrease, draw.seed);
}
// 00864560 Runs MC_ENTITY_TAKE_DMG for a hit, filtered by the entity's type. Whether the hit lands, false only when a
// mod returned false.
bool LuaEngine::EntityTakeDamage(Entity* entity, float damage, uint64_t damageFlags, const EntityRef& source,
int countdown)
{
CallbackRun run = {"EntityTakeDamage", MC_ENTITY_TAKE_DMG, entity->type};
return callback_boolean_run(*this, run, true, entity, damage, damageFlags, &source, countdown);
}
// 008667d0 Runs MC_PRE_ENTITY_DEVOLVE, filtered by the entity's type. Whether a mod skips the devolve.
bool LuaEngine::PreEntityDevolve(Entity* entity)
{
return callback_boolean_run(*this, {"PreEntityDevolve", MC_PRE_ENTITY_DEVOLVE, entity->type}, false, entity);
}
// 00866220 Runs MC_PRE_SPAWN_CLEAN_AWARD with copies of the award RNG and position. Whether a mod skips the award.
// The original throws past its callers on a Lua error. This logs it and spawns the award.
bool LuaEngine::PreSpawnCleanAward(const RNG& rng, const Vector& position)
{
return callback_boolean_run(*this, {"PreSpawnCleanAward", MC_PRE_SPAWN_CLEAN_AWARD}, false, rng, position);
}
// 00863760 Runs MC_PRE_USE_ITEM for an active item, filtered by its type. Whether a mod skips the use.
bool LuaEngine::PreUseItem(const LuaItemUse& use)
{
CallbackRun run = {"PreUseItem", MC_PRE_USE_ITEM, use.collectibleType};
return callback_boolean_run(*this, run, false, use.collectibleType, use.rng, use.player, use.useFlags,
use.activeSlot, use.customVarData);
}
// 00860960 Runs MC_PRE_NPC_UPDATE, filtered by the NPC's type. Whether a mod skips the NPC's AI this frame.
bool LuaEngine::PreNPCUpdate(Entity_NPC* npc)
{
CallbackRun run = {"PreNPCUpdate", MC_PRE_NPC_UPDATE, (int)npc->type};
if (!callback_run(*this, run, npc)) return false;
bool isSkipped = lua_toboolean(state, -1);
lua_pop(state, 1);
return isSkipped;
}
// 008646e0 Runs MC_PRE_ENTITY_SPAWN for a spawn. A table result replaces its type, variant, subtype and seed, in that
// order, with each element that is not nil.
void LuaEngine::Callback_PreEntitySpawn(EntitySpawn& spawn)
{
if (!callback_run(*this, {"PreEntitySpawn", MC_PRE_ENTITY_SPAWN}, spawn.type, spawn.variant, spawn.subType,
spawn.position, spawn.velocity, spawn.spawner, spawn.seed))
return;
elements_pop(state, spawn.type, spawn.variant, spawn.subType, spawn.seed);
}
// 00866490 Runs MC_PRE_ROOM_ENTITY_SPAWN for a layout entry about to spawn, filtered by its subtype as the original
// passes it. A table result replaces its type, variant and subtype, in that order, with each element that is not nil.
// Whether any was replaced.
bool LuaEngine::PreRoomEntitySpawn(RoomEntry& entry, int gridIndex, uint32_t seed)
{
CallbackRun run = {"PreRoomEntitySpawn", MC_PRE_ROOM_ENTITY_SPAWN, entry.subtype};
if (!callback_run(*this, run, (int)entry.type, (int)entry.variant, (int)entry.subtype, gridIndex, seed))
return false;
return elements_pop(state, entry.type, entry.variant, entry.subtype);
}
// 00863340 Runs MC_POST_PICKUP_SELECTION for the kind a pickup was given. A table result replaces its variant and
// subtype, in that order, with each element that is not nil.
void LuaEngine::PostPickupSelection(Entity_Pickup* pickup, int& variant, int& subType)
{
CallbackRun run = {"PostPickupSelection", MC_POST_PICKUP_SELECTION};
if (callback_run(*this, run, pickup, variant, subType))
elements_pop(state, variant, subType);
}
// 008638d0 Runs MC_USE_ITEM for an active item, filtered by its type. A table result sets Discharge, Remove and
// ShowAnim, any other result ShowAnim alone. Whether to show the use animation, false without a result.
bool LuaEngine::UseItem(LuaItemUse& use)
{
CallbackRun run = {"PostUseItem", MC_USE_ITEM, use.collectibleType};
if (!callback_run(*this, run, use.collectibleType, use.rng,
use.player, use.useFlags, use.activeSlot, use.customVarData))
return false;
bool isShowAnimation = false;
if (!lua_istable(state, -1)) isShowAnimation = lua_toboolean(state, -1);
else
{
field_read(state, "Discharge", use.isDischarge);
field_read(state, "Remove", use.isRemove);
field_read(state, "ShowAnim", isShowAnimation);
}
lua_pop(state, 1);
return isShowAnimation;
}
// 00863e90 Runs MC_EVALUATE_CACHE for a player's stat, filtered by the cache flag.
void LuaEngine::EvaluateItems(Entity_Player* player, int cacheFlag)
{
callback_notify(*this, {"PostEvaluateItems", MC_EVALUATE_CACHE, cacheFlag}, player,
cacheFlag);
}
// 008635a0 Runs MC_FAMILIAR_INIT, filtered by the familiar's variant.
void LuaEngine::FamiliarInit(Entity_Familiar* familiar)
{
callback_notify(*this, {"FamiliarInit", MC_FAMILIAR_INIT, familiar->variant}, familiar);
}
// 00860f00 Runs MC_FAMILIAR_UPDATE, filtered by the familiar's variant.
void LuaEngine::FamiliarUpdate(Entity_Familiar* familiar)
{
callback_notify(*this, {"FamiliarUpdate", MC_FAMILIAR_UPDATE, familiar->variant}, familiar);
}
// 00860fe0 Runs MC_POST_FAMILIAR_RENDER with the render offset, filtered by the familiar's variant.
void LuaEngine::PostFamiliarRender(Entity_Familiar* familiar, const Vector& offset)
{
callback_notify(*this, {"PostFamiliarRender", MC_POST_FAMILIAR_RENDER, familiar->variant}, familiar, offset);
}
// 00861ea0 Runs MC_POST_BOMB_INIT, filtered by the bomb's variant.
void LuaEngine::PostBombInit(Entity_Bomb* bomb)
{
callback_notify(*this, {"PostBombInit", MC_POST_BOMB_INIT, bomb->variant}, bomb);
}
// 00861f80 Runs MC_POST_BOMB_UPDATE, filtered by the bomb's variant.
void LuaEngine::PostBombUpdate(Entity_Bomb* bomb)
{
callback_notify(*this, {"PostBombUpdate", MC_POST_BOMB_UPDATE, bomb->variant}, bomb);
}
// 00862060 Runs MC_POST_BOMB_RENDER with the render offset, filtered by the bomb's variant.
void LuaEngine::PostBombRender(Entity_Bomb* bomb, const Vector& offset)
{
callback_notify(*this, {"PostBombRender", MC_POST_BOMB_RENDER, bomb->variant}, bomb, offset);
}
// 00861330 Runs MC_POST_EFFECT_INIT, filtered by the effect's variant.
void LuaEngine::PostEffectInit(Entity_Effect* effect)
{
callback_notify(*this, {"PostEffectInit", MC_POST_EFFECT_INIT, (int)effect->variant},
effect);
}
// 008614f0 Runs MC_POST_EFFECT_RENDER with the render offset, filtered by the effect's variant.
void LuaEngine::PostEffectRender(Entity_Effect* effect, const Vector& offset)
{
callback_notify(*this, {"PostEffectRender", MC_POST_EFFECT_RENDER, (int)effect->variant},
effect, offset);
}
// 00861410 Runs MC_POST_EFFECT_UPDATE, filtered by the effect's variant.
void LuaEngine::PostEffectUpdate(Entity_Effect* effect)
{
callback_notify(*this, {"PostEffectUpdate", MC_POST_EFFECT_UPDATE, (int)effect->variant},
effect);
}
// 00866140 Runs MC_POST_ENTITY_KILL, filtered by the entity's type.
void LuaEngine::PostEntityKill(Entity* entity)
{
callback_notify(*this, {"PostEntityKill", MC_POST_ENTITY_KILL, (int)entity->type},
entity);
}
// Runs MC_POST_ENTITY_REMOVE for Entity::ReleaseLuaRef, filtered by the entity's type.
void LuaEngine::PostEntityRemove(Entity* entity)
{
callback_notify(*this, {"PostEntityRemove", MC_POST_ENTITY_REMOVE, (int)entity->type},
entity);
}
// 00863f70 Runs MC_POST_FIRE_TEAR for a tear a player fired.
void LuaEngine::PostFireTear(Entity_Tear* tear)
{
callback_notify(*this, {"PostFireTear", MC_POST_FIRE_TEAR}, tear);
}
// 00864fc0 Runs MC_POST_GAME_END with whether the run ended in a game over.
void LuaEngine::PostGameEnd(bool isGameOver)
{
callback_notify(*this, {"PostGameEnd", MC_POST_GAME_END}, isGameOver);
}
// 00864ee0 Runs MC_POST_GAME_STARTED with whether the run continues a saved one.
void LuaEngine::PostGameStart(bool isContinued)
{
callback_notify(*this, {"PostGameStart", MC_POST_GAME_STARTED}, isContinued);
}
// 00861890 Runs MC_POST_KNIFE_INIT, filtered by the knife's subtype.
void LuaEngine::PostKnifeInit(Entity_Knife* knife)
{
callback_notify(*this, {"PostKnifeInit", MC_POST_KNIFE_INIT, (int)knife->subtype},
knife);
}
// 00861970 Runs MC_POST_KNIFE_UPDATE, filtered by the knife's subtype.
void LuaEngine::PostKnifeUpdate(Entity_Knife* knife)
{
callback_notify(*this, {"PostKnifeUpdate", MC_POST_KNIFE_UPDATE, knife->subtype}, knife);
}
// 00861a50 Runs MC_POST_KNIFE_RENDER with the render offset, filtered by the knife's subtype.
void LuaEngine::PostKnifeRender(Entity_Knife* knife, const Vector& offset)
{
callback_notify(*this, {"PostKnifeRender", MC_POST_KNIFE_RENDER, knife->subtype}, knife, offset);
}
// 008615e0 Runs MC_POST_LASER_INIT, filtered by the laser's variant.
void LuaEngine::PostLaserInit(Entity_Laser* laser)
{
callback_notify(*this, {"PostLaserInit", MC_POST_LASER_INIT, laser->variant}, laser);
}
// 008616c0 Runs MC_POST_LASER_UPDATE, filtered by the laser's variant.
void LuaEngine::PostLaserUpdate(Entity_Laser* laser)
{
callback_notify(*this, {"PostLaserUpdate", MC_POST_LASER_UPDATE, laser->variant}, laser);
}
// 008617a0 Runs MC_POST_LASER_RENDER with the render offset, filtered by the laser's variant.
void LuaEngine::PostLaserRender(Entity_Laser* laser, const Vector& offset)
{
callback_notify(*this, {"PostLaserRender", MC_POST_LASER_RENDER, laser->variant}, laser, offset);
}
// 00865260 Runs MC_POST_NEW_LEVEL once a floor is generated and its first room entered.
void LuaEngine::PostNewLevel()
{
callback_notify(*this, {"PostLevelLoad", MC_POST_NEW_LEVEL});
}
// 00865180 Runs MC_POST_NEW_ROOM once a room is loaded.
void LuaEngine::PostNewRoom()
{
callback_notify(*this, {"PostRoomLoad", MC_POST_NEW_ROOM});
}
// 00860c90 Runs MC_POST_NPC_DEATH, filtered by the NPC's type.
void LuaEngine::PostNPCDeath(Entity_NPC* npc)
{
callback_notify(*this, {"PostNPCDeath", MC_POST_NPC_DEATH, (int)npc->type}, npc);
}
// 00860880 Runs MC_POST_NPC_INIT, filtered by the NPC's type.
void LuaEngine::PostNPCInit(Entity_NPC* npc)
{
callback_notify(*this, {"PostNPCInit", MC_POST_NPC_INIT, (int)npc->type}, npc);
}
// 00860ba0 Runs MC_POST_NPC_RENDER with the render offset, filtered by the NPC's type.
void LuaEngine::PostNPCRender(Entity_NPC* npc, const Vector& offset)
{
callback_notify(*this, {"PostNPCRender", MC_POST_NPC_RENDER, (int)npc->type}, npc,
offset);
}
// 00860ac0 Runs MC_NPC_UPDATE after an NPC's AI, filtered by the NPC's type.
void LuaEngine::PostNPCUpdate(Entity_NPC* npc)
{
callback_notify(*this, {"PostNPCUpdate", MC_NPC_UPDATE, (int)npc->type}, npc);
}
// 00862f00 Runs MC_POST_PICKUP_INIT, filtered by the pickup's variant.
void LuaEngine::PostPickupInit(Entity_Pickup* pickup)
{
callback_notify(*this, {"PostPickupInit", MC_POST_PICKUP_INIT, (int)pickup->variant},
pickup);
}
// 008630c0 Runs MC_POST_PICKUP_RENDER with the render offset, filtered by the pickup's variant.
void LuaEngine::PostPickupRender(Entity_Pickup* pickup, const Vector& offset)
{
callback_notify(*this, {"PostPickupRender", MC_POST_PICKUP_RENDER, (int)pickup->variant},
pickup, offset);
}
// 00862fe0 Runs MC_POST_PICKUP_UPDATE, filtered by the pickup's variant.
void LuaEngine::PostPickupUpdate(Entity_Pickup* pickup)
{
callback_notify(*this, {"PostPickupUpdate", MC_POST_PICKUP_UPDATE, (int)pickup->variant},
pickup);
}
// 00864050 Runs MC_POST_PLAYER_INIT, filtered by the player's variant.
void LuaEngine::PostPlayerInit(Entity_Player* player)
{
callback_notify(*this, {"PostPlayerInit", MC_POST_PLAYER_INIT, (int)player->variant},
player);
}
// 00863be0 Runs MC_POST_PEFFECT_UPDATE, filtered by the player's character.
void LuaEngine::PostPEffectUpdate(Entity_Player* player)
{
callback_notify(*this, {"PostPEffectUpdate", MC_POST_PEFFECT_UPDATE, player->playerType}, player);
}
// 00864130 Runs MC_POST_PLAYER_UPDATE, filtered by the player's variant.
void LuaEngine::PostPlayerUpdate(Entity_Player* player)
{
callback_notify(*this, {"PostPlayerUpdate", MC_POST_PLAYER_UPDATE, player->variant}, player);
}
// 00864210 Runs MC_POST_PLAYER_RENDER with the render offset, filtered by the player's variant.
void LuaEngine::PostPlayerRender(Entity_Player* player, const Vector& offset)
{
callback_notify(*this, {"PostPlayerRender", MC_POST_PLAYER_RENDER, player->variant}, player, offset);
}
// 008624b0 Runs MC_POST_PROJECTILE_INIT, filtered by the projectile's variant.
void LuaEngine::PostProjectileInit(Entity_Projectile* projectile)
{
callback_notify(*this, {"PostProjectileInit", MC_POST_PROJECTILE_INIT, projectile->variant}, projectile);
}
// 00862590 Runs MC_POST_PROJECTILE_UPDATE, filtered by the projectile's variant.
void LuaEngine::PostProjectileUpdate(Entity_Projectile* projectile)
{
callback_notify(*this, {"PostProjectileUpdate", MC_POST_PROJECTILE_UPDATE, projectile->variant}, projectile);
}
// 00862670 Runs MC_POST_PROJECTILE_RENDER with the render offset, filtered by the projectile's variant.
void LuaEngine::PostProjectileRender(Entity_Projectile* projectile, const Vector& offset)
{
callback_notify(*this, {"PostProjectileRender", MC_POST_PROJECTILE_RENDER, projectile->variant}, projectile,
offset);
}
// 00863680 Runs MC_POST_RENDER after the game renders.
void LuaEngine::PostRender()
{
callback_notify(*this, {"PostRender", MC_POST_RENDER});
}
// 008629c0 Runs MC_POST_TEAR_INIT, filtered by the tear's variant.
void LuaEngine::PostTearInit(Entity_Tear* tear)
{
callback_notify(*this, {"PostTearInit", MC_POST_TEAR_INIT, (int)tear->variant}, tear);
}
// 00862b80 Runs MC_POST_TEAR_RENDER with the render offset, filtered by the tear's variant.
void LuaEngine::PostTearRender(Entity_Tear* tear, const Vector& offset)
{
callback_notify(*this, {"PostTearRender", MC_POST_TEAR_RENDER, (int)tear->variant},
tear, offset);
}
// 00862aa0 Runs MC_POST_TEAR_UPDATE, filtered by the tear's variant.
void LuaEngine::PostTearUpdate(Entity_Tear* tear)
{
callback_notify(*this, {"PostTearUpdate", MC_POST_TEAR_UPDATE, (int)tear->variant},
tear);
}
// 008607a0 Runs MC_POST_UPDATE after the game updates.
void LuaEngine::PostUpdate()
{
callback_notify(*this, {"PostUpdate", MC_POST_UPDATE});
}
// 008650a0 Runs MC_PRE_GAME_EXIT with whether the run is saved (its error handler 0086512e).
void LuaEngine::PreGameExit(bool isSaving)
{
callback_notify(*this, {"PreGameExit", MC_PRE_GAME_EXIT}, isSaving);
}
// 00863cc0 Runs MC_USE_CARD for a card a player used, filtered by the card.
void LuaEngine::UseCard(int card, Entity_Player* player, unsigned int useFlags)
{
callback_notify(*this, {"PostUseCard", MC_USE_CARD, card}, card, player, useFlags);
}
// 00863da0 Runs MC_USE_PILL for a pill effect, filtered by it.
void LuaEngine::UsePill(int pillEffect, Entity_Player* player, unsigned int useFlags)
{
callback_notify(*this, {"PostUsePillEffect", MC_USE_PILL, pillEffect}, pillEffect,
player, useFlags);
}