diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index 22a650342..23dabf278 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -634,6 +634,7 @@
- smlua_obj_utils.h
+ - [get_temp_object_hitbox](#get_temp_object_hitbox)
- [obj_get_first](#obj_get_first)
- [obj_get_first_with_behavior_id](#obj_get_first_with_behavior_id)
- [obj_get_first_with_behavior_id_and_field_f32](#obj_get_first_with_behavior_id_and_field_f32)
@@ -11589,6 +11590,24 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
+## [get_temp_object_hitbox](#get_temp_object_hitbox)
+
+### Lua Example
+`local ObjectHitboxValue = get_temp_object_hitbox()`
+
+### Parameters
+- None
+
+### Returns
+[ObjectHitbox](structs.md#ObjectHitbox)
+
+### C Prototype
+`struct ObjectHitbox* get_temp_object_hitbox(void);`
+
+[:arrow_up_small:](#)
+
+
+
## [obj_get_first](#obj_get_first)
### Lua Example
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index b74ae0506..b0a8f567d 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -7372,6 +7372,15 @@ int smlua_func_warp_to_level(lua_State* L) {
// smlua_obj_utils.h //
///////////////////////
+int smlua_func_get_temp_object_hitbox(UNUSED lua_State* L) {
+ if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
+
+
+ smlua_push_object(L, LOT_OBJECTHITBOX, get_temp_object_hitbox());
+
+ return 1;
+}
+
int smlua_func_obj_get_first(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
@@ -8690,6 +8699,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "warp_to_level", smlua_func_warp_to_level);
// smlua_obj_utils.h
+ smlua_bind_function(L, "get_temp_object_hitbox", smlua_func_get_temp_object_hitbox);
smlua_bind_function(L, "obj_get_first", smlua_func_obj_get_first);
smlua_bind_function(L, "obj_get_first_with_behavior_id", smlua_func_obj_get_first_with_behavior_id);
smlua_bind_function(L, "obj_get_first_with_behavior_id_and_field_f32", smlua_func_obj_get_first_with_behavior_id_and_field_f32);
diff --git a/src/pc/lua/utils/smlua_obj_utils.c b/src/pc/lua/utils/smlua_obj_utils.c
index 73efa8d41..6bfc351e0 100644
--- a/src/pc/lua/utils/smlua_obj_utils.c
+++ b/src/pc/lua/utils/smlua_obj_utils.c
@@ -195,14 +195,21 @@ struct Object *obj_get_next_with_same_behavior_id_and_field_f32(struct Object *o
}
struct SpawnParticlesInfo* obj_get_temp_spawn_particles_info(enum ModelExtendedId modelId) {
- static struct SpawnParticlesInfo spi = { 0 };
+ static struct SpawnParticlesInfo sTmpSpi = { 0 };
+ memset(&sTmpSpi, 0, sizeof(struct SpawnParticlesInfo));
u8 loadedModelId = smlua_model_util_load(modelId);
if (loadedModelId == 0xFF) {
LOG_ERROR("failed to load model %u", modelId);
return NULL;
}
- spi.model = loadedModelId;
+ sTmpSpi.model = loadedModelId;
- return &spi;
+ return &sTmpSpi;
+}
+
+struct ObjectHitbox* get_temp_object_hitbox(void) {
+ static struct ObjectHitbox sTmpHitbox = { 0 };
+ memset(&sTmpHitbox, 0, sizeof(struct ObjectHitbox));
+ return &sTmpHitbox;
}
diff --git a/src/pc/lua/utils/smlua_obj_utils.h b/src/pc/lua/utils/smlua_obj_utils.h
index f5fe66030..06eb18a08 100644
--- a/src/pc/lua/utils/smlua_obj_utils.h
+++ b/src/pc/lua/utils/smlua_obj_utils.h
@@ -29,5 +29,6 @@ struct Object *obj_get_next_with_same_behavior_id_and_field_f32(struct Object *o
// misc obj helpers
struct SpawnParticlesInfo* obj_get_temp_spawn_particles_info(enum ModelExtendedId modelId);
+struct ObjectHitbox* get_temp_object_hitbox(void);
#endif