diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index 9a226b400..78bdadc5c 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -8563,6 +8563,17 @@ function obj_set_vel(o, vx, vy, vz)
-- ...
end
+--- @param x number
+--- @param y number
+--- @param z number
+--- @param strength integer
+--- @param area integer
+--- @param index integer
+--- @return nil
+function set_whirlpools(x, y, z, strength, area, index)
+ -- ...
+end
+
--- @param behaviorId BehaviorId
--- @param modelId ModelExtendedId
--- @param x number
diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md
index fee0a0e5b..f18e56eac 100644
--- a/docs/lua/functions-5.md
+++ b/docs/lua/functions-5.md
@@ -614,6 +614,31 @@
+## [set_whirlpools](#set_whirlpools)
+
+### Lua Example
+`set_whirlpools(x, y, z, strength, area, index)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| x | `number` |
+| y | `number` |
+| z | `number` |
+| strength | `integer` |
+| area | `integer` |
+| index | `integer` |
+
+### Returns
+- None
+
+### C Prototype
+`void set_whirlpools(f32 x, f32 y, f32 z, s16 strength, s16 area, s32 index);`
+
+[:arrow_up_small:](#)
+
+
+
## [spawn_non_sync_object](#spawn_non_sync_object)
### Lua Example
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index a7458fccf..c12df4ef6 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -1580,6 +1580,7 @@
- [obj_move_xyz](functions-5.md#obj_move_xyz)
- [obj_set_model_extended](functions-5.md#obj_set_model_extended)
- [obj_set_vel](functions-5.md#obj_set_vel)
+ - [set_whirlpools](functions-5.md#set_whirlpools)
- [spawn_non_sync_object](functions-5.md#spawn_non_sync_object)
- [spawn_sync_object](functions-5.md#spawn_sync_object)
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 64542286b..fc30a97d9 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -27799,6 +27799,33 @@ int smlua_func_obj_set_vel(lua_State* L) {
return 1;
}
+int smlua_func_set_whirlpools(lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 6) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_whirlpools", 6, top);
+ return 0;
+ }
+
+ f32 x = smlua_to_number(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_whirlpools"); return 0; }
+ f32 y = smlua_to_number(L, 2);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_whirlpools"); return 0; }
+ f32 z = smlua_to_number(L, 3);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "set_whirlpools"); return 0; }
+ s16 strength = smlua_to_integer(L, 4);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "set_whirlpools"); return 0; }
+ s16 area = smlua_to_integer(L, 5);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "set_whirlpools"); return 0; }
+ s32 index = smlua_to_integer(L, 6);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "set_whirlpools"); return 0; }
+
+ set_whirlpools(x, y, z, strength, area, index);
+
+ return 1;
+}
+
int smlua_func_spawn_non_sync_object(lua_State* L) {
if (L == NULL) { return 0; }
@@ -30185,6 +30212,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "obj_move_xyz", smlua_func_obj_move_xyz);
smlua_bind_function(L, "obj_set_model_extended", smlua_func_obj_set_model_extended);
smlua_bind_function(L, "obj_set_vel", smlua_func_obj_set_vel);
+ smlua_bind_function(L, "set_whirlpools", smlua_func_set_whirlpools);
smlua_bind_function(L, "spawn_non_sync_object", smlua_func_spawn_non_sync_object);
smlua_bind_function(L, "spawn_sync_object", smlua_func_spawn_sync_object);
diff --git a/src/pc/lua/smlua_hooks.c b/src/pc/lua/smlua_hooks.c
index 0e61d43a4..fea237284 100644
--- a/src/pc/lua/smlua_hooks.c
+++ b/src/pc/lua/smlua_hooks.c
@@ -90,11 +90,16 @@ int smlua_call_hook(lua_State* L, int nargs, int nresults, int errfunc, struct M
gLuaActiveMod = activeMod;
gLuaLastHookMod = activeMod;
#if defined(LUA_PROFILER)
- lua_profiler_start_counter(activeMod);
+ extern bool configLuaProfiler;
+ if (configLuaProfiler) {
+ lua_profiler_start_counter(activeMod);
+ }
#endif
int rc = smlua_pcall(L, nargs, nresults, errfunc);
#if defined(LUA_PROFILER)
- lua_profiler_stop_counter(activeMod);
+ if (configLuaProfiler) {
+ lua_profiler_stop_counter(activeMod);
+ }
#endif
gLuaActiveMod = prev;
return rc;
diff --git a/src/pc/lua/utils/smlua_obj_utils.c b/src/pc/lua/utils/smlua_obj_utils.c
index 4f2a83e15..2dff1e9c6 100644
--- a/src/pc/lua/utils/smlua_obj_utils.c
+++ b/src/pc/lua/utils/smlua_obj_utils.c
@@ -383,3 +383,13 @@ void obj_move_xyz(struct Object *o, f32 dx, f32 dy, f32 dz) {
o->oPosY += dy;
o->oPosZ += dz;
}
+
+void set_whirlpools(f32 x, f32 y, f32 z, s16 strength, s16 area, s32 index) {
+ static struct Whirlpool whirlpool;
+
+ gAreas[area].whirlpools[index] = &whirlpool;
+ gAreas[area].whirlpools[index]->pos[0] = x;
+ gAreas[area].whirlpools[index]->pos[1] = y;
+ gAreas[area].whirlpools[index]->pos[2] = z;
+ gAreas[area].whirlpools[index]->strength = strength;
+}
diff --git a/src/pc/lua/utils/smlua_obj_utils.h b/src/pc/lua/utils/smlua_obj_utils.h
index c4e73d460..6fc395cd9 100644
--- a/src/pc/lua/utils/smlua_obj_utils.h
+++ b/src/pc/lua/utils/smlua_obj_utils.h
@@ -53,5 +53,6 @@ bool obj_check_overlap_with_hitbox_params(struct Object *o, f32 x, f32 y, f32 z,
void obj_set_vel(struct Object *o, f32 vx, f32 vy, f32 vz);
void obj_move_xyz(struct Object *o, f32 dx, f32 dy, f32 dz);
+void set_whirlpools(f32 x, f32 y, f32 z, s16 strength, s16 area, s32 index);
#endif