Add HOOK_ON_OBJECT_LOAD

This commit is contained in:
Agent X 2023-12-14 19:33:17 -05:00
parent db2d2a20fa
commit 741d742bab
6 changed files with 13 additions and 3 deletions

View file

@ -9269,7 +9269,10 @@ HOOK_MIRROR_MARIO_RENDER = 38
HOOK_OVERRIDE_PHYS_STEP_DEFACTO_SPEED = 39
--- @type LuaHookedEventType
HOOK_MAX = 40
HOOK_ON_OBJECT_LOAD = 40
--- @type LuaHookedEventType
HOOK_MAX = 41
--- @class HudDisplayFlags

View file

@ -3322,7 +3322,8 @@
| HOOK_ON_COLLIDE_LEVEL_BOUNDS | 37 |
| HOOK_MIRROR_MARIO_RENDER | 38 |
| HOOK_OVERRIDE_PHYS_STEP_DEFACTO_SPEED | 39 |
| HOOK_MAX | 40 |
| HOOK_ON_OBJECT_LOAD | 40 |
| HOOK_MAX | 41 |
[:arrow_up_small:](#)

View file

@ -127,6 +127,7 @@ The lua functions sent to `hook_event()` will be automatically called by SM64 wh
| HOOK_ON_COLLIDE_LEVEL_BOUNDS | Called when a mario collides with the level boundaries | [MarioState](structs.md#MarioState) mario |
| HOOK_MIRROR_MARIO_RENDER | Called when a Mirror Mario is rendered | [GraphNodeObject](structs.md#GraphNodeObject) mirrorMario | `integer` mirrorMarioIndex |
| HOOK_OVERRIDE_PHYS_STEP_DEFACTO_SPEED | Called when slope defacto speed for walking is being calculated, overrides the floor normal in the equation | [MarioState](structs.md#MarioState) mario |
| HOOK_ON_OBJECT_LOAD | Called when an object is spawned in | [Object](structs.md#Object) obj |
### Parameters

View file

@ -401,6 +401,8 @@ struct Object *create_object(const BehaviorScript *bhvScript) {
break;
}
smlua_call_event_hooks_object_param(HOOK_ON_OBJECT_LOAD, obj);
return obj;
}

View file

@ -3283,7 +3283,8 @@ char gSmluaConstants[] = ""
"HOOK_ON_COLLIDE_LEVEL_BOUNDS = 37\n"
"HOOK_MIRROR_MARIO_RENDER = 38\n"
"HOOK_OVERRIDE_PHYS_STEP_DEFACTO_SPEED = 39\n"
"HOOK_MAX = 40\n"
"HOOK_ON_OBJECT_LOAD = 40\n"
"HOOK_MAX = 41\n"
"ACTION_HOOK_EVERY_FRAME = 0\n"
"ACTION_HOOK_GRAVITY = 1\n"
"ACTION_HOOK_MAX = 2\n"

View file

@ -51,6 +51,7 @@ enum LuaHookedEventType {
HOOK_ON_COLLIDE_LEVEL_BOUNDS,
HOOK_MIRROR_MARIO_RENDER,
HOOK_OVERRIDE_PHYS_STEP_DEFACTO_SPEED,
HOOK_ON_OBJECT_LOAD,
HOOK_MAX,
};
@ -95,6 +96,7 @@ static const char* LuaHookedEventTypeName[] = {
"HOOK_ON_COLLIDE_LEVEL_BOUNDS",
"HOOK_MIRROR_MARIO_RENDER",
"HOOK_OVERRIDE_PHYS_STEP_DEFACTO_SPEED",
"HOOK_ON_OBJECT_LOAD",
"HOOK_MAX"
};