diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index 870ad337..b6ae3887 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -8101,6 +8101,11 @@ function get_lighting_dir(index)
-- ...
end
+--- @return string
+function get_local_discord_id()
+ -- ...
+end
+
--- @return integer
function get_network_area_timer()
-- ...
diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md
index 26eab4de..41330aef 100644
--- a/docs/lua/functions-5.md
+++ b/docs/lua/functions-5.md
@@ -1997,6 +1997,24 @@
+## [get_local_discord_id](#get_local_discord_id)
+
+### Lua Example
+`local stringValue = get_local_discord_id()`
+
+### Parameters
+- None
+
+### Returns
+- `string`
+
+### C Prototype
+`const char* get_local_discord_id(void);`
+
+[:arrow_up_small:](#)
+
+
+
## [get_network_area_timer](#get_network_area_timer)
### Lua Example
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index 82ed69d7..9b1eb885 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -1686,6 +1686,7 @@
- [get_last_star_or_key](functions-5.md#get_last_star_or_key)
- [get_lighting_color](functions-5.md#get_lighting_color)
- [get_lighting_dir](functions-5.md#get_lighting_dir)
+ - [get_local_discord_id](functions-5.md#get_local_discord_id)
- [get_network_area_timer](functions-5.md#get_network_area_timer)
- [get_os_name](functions-5.md#get_os_name)
- [get_save_file_modified](functions-5.md#get_save_file_modified)
diff --git a/lang/English.ini b/lang/English.ini
index 4b8e14fd..de97a088 100644
--- a/lang/English.ini
+++ b/lang/English.ini
@@ -150,7 +150,7 @@ DJUI_THEME = "DJUI Theme"
DJUI_SCALE = "DJUI Scale"
DJUI_FONT = "DJUI Font"
AUTO = "Auto"
-CENTER = "Center"
+CENTER = "DJUI Center"
FONT_NORMAL = "Normal"
FONT_ALIASED = "Aliased"
LIGHT_THEME = "Light"
diff --git a/src/pc/djui/djui.c b/src/pc/djui/djui.c
index 5f573a64..6b2b72c7 100644
--- a/src/pc/djui/djui.c
+++ b/src/pc/djui/djui.c
@@ -124,8 +124,9 @@ void djui_connect_menu_open(void) {
djui_panel_join_message_create(NULL);
}
-void djui_lua_error(char* text) {
+void djui_lua_error(char* text, struct DjuiColor color) {
if (!sDjuiLuaError) { return; }
+ djui_base_set_color(&sDjuiLuaError->base, color.r, color.g, color.b, color.a);
djui_text_set_text(sDjuiLuaError, text);
djui_base_set_visible(&sDjuiLuaError->base, true);
sDjuiLuaErrorTimeout = 30 * 5;
diff --git a/src/pc/djui/djui.h b/src/pc/djui/djui.h
index 9cc37ba0..a3dca5cf 100644
--- a/src/pc/djui/djui.h
+++ b/src/pc/djui/djui.h
@@ -43,7 +43,7 @@ extern bool gDjuiDisabled;
void djui_init(void);
void djui_init_late(void);
void djui_connect_menu_open(void);
-void djui_lua_error(char* text);
+void djui_lua_error(char* text, struct DjuiColor color);
void djui_render(void);
void djui_reset_hud_params(void);
diff --git a/src/pc/lua/smlua.c b/src/pc/lua/smlua.c
index a459d5fd..6c0a0b3d 100644
--- a/src/pc/lua/smlua.c
+++ b/src/pc/lua/smlua.c
@@ -23,7 +23,18 @@ void smlua_mod_error(void) {
if (mod == NULL) { return; }
char txt[255] = { 0 };
snprintf(txt, 254, "'%s\\#ff0000\\' has script errors!", mod->name);
- djui_lua_error(txt);
+ static const struct DjuiColor color = { 255, 0, 0, 255 };
+ djui_lua_error(txt, color);
+}
+
+void smlua_mod_warning(void) {
+ struct Mod* mod = gLuaActiveMod;
+ if (mod == NULL) { mod = gLuaLastHookMod; }
+ if (mod == NULL) { return; }
+ char txt[255] = { 0 };
+ snprintf(txt, 254, "'%s\\#ffe600\\' is using deprecated functions!", mod->name);
+ static const struct DjuiColor color = { 255, 230, 0, 255 };
+ djui_lua_error(txt, color);
}
int smlua_error_handler(lua_State* L) {
diff --git a/src/pc/lua/smlua.h b/src/pc/lua/smlua.h
index aad8d9a2..b7b2eb62 100644
--- a/src/pc/lua/smlua.h
+++ b/src/pc/lua/smlua.h
@@ -39,6 +39,7 @@ extern struct Mod* gLuaActiveMod;
extern struct Mod* gLuaLastHookMod;
void smlua_mod_error(void);
+void smlua_mod_warning(void);
int smlua_error_handler(UNUSED lua_State* L);
int smlua_pcall(lua_State* L, int nargs, int nresults, int errfunc);
void smlua_exec_file(const char* path);
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 1fda6548..200b8672 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -29901,6 +29901,21 @@ int smlua_func_get_lighting_dir(lua_State* L) {
return 1;
}
+int smlua_func_get_local_discord_id(UNUSED lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 0) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_local_discord_id", 0, top);
+ return 0;
+ }
+
+
+ lua_pushstring(L, get_local_discord_id());
+
+ return 1;
+}
+
int smlua_func_get_network_area_timer(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@@ -34070,6 +34085,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "get_last_star_or_key", smlua_func_get_last_star_or_key);
smlua_bind_function(L, "get_lighting_color", smlua_func_get_lighting_color);
smlua_bind_function(L, "get_lighting_dir", smlua_func_get_lighting_dir);
+ smlua_bind_function(L, "get_local_discord_id", smlua_func_get_local_discord_id);
smlua_bind_function(L, "get_network_area_timer", smlua_func_get_network_area_timer);
smlua_bind_function(L, "get_os_name", smlua_func_get_os_name);
smlua_bind_function(L, "get_save_file_modified", smlua_func_get_save_file_modified);
diff --git a/src/pc/lua/utils/smlua_deprecated.c b/src/pc/lua/utils/smlua_deprecated.c
index 02920e00..ec3eb20f 100644
--- a/src/pc/lua/utils/smlua_deprecated.c
+++ b/src/pc/lua/utils/smlua_deprecated.c
@@ -8,6 +8,7 @@
#include "game/object_list_processor.h"
char* network_discord_id_from_local_index(UNUSED u8 localIndex) {
+ smlua_mod_warning();
#ifdef DISCORD_SDK
static char sDiscordId[64] = "";
if (localIndex == 0) {
@@ -19,25 +20,31 @@ char* network_discord_id_from_local_index(UNUSED u8 localIndex) {
}
void djui_hud_set_render_behind_hud(bool enable) {
+ smlua_mod_warning();
if (!gLuaActiveMod) { return; }
gLuaActiveMod->renderBehindHud = enable;
}
struct ModAudio* audio_stream_load_url(UNUSED const char* url) {
+ smlua_mod_warning();
return NULL;
}
f32 audio_stream_get_tempo(UNUSED struct ModAudio* audio) {
+ smlua_mod_warning();
return 1;
}
void audio_stream_set_tempo(UNUSED struct ModAudio* audio, UNUSED f32 tempo) {
+ smlua_mod_warning();
}
void audio_stream_set_speed(UNUSED struct ModAudio* audio, UNUSED f32 initial_freq, UNUSED f32 speed, UNUSED bool pitch) {
+ smlua_mod_warning();
}
f32 get_environment_region(u8 index) {
+ smlua_mod_warning();
s32 idx = 6 * index;
if (gEnvironmentRegions != NULL && index > 0 && index <= gEnvironmentRegions[0] && gEnvironmentRegionsLength > idx) {
return gEnvironmentRegions[idx];
@@ -46,6 +53,7 @@ f32 get_environment_region(u8 index) {
}
void set_environment_region(u8 index, s32 value) {
+ smlua_mod_warning();
s32 idx = 6 * index;
if (gEnvironmentRegions != NULL && index > 0 && index <= gEnvironmentRegions[0] && gEnvironmentRegionsLength > idx) {
gEnvironmentRegions[idx] = value;
@@ -53,6 +61,7 @@ void set_environment_region(u8 index, s32 value) {
}
void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color) {
+ smlua_mod_warning();
if (np == NULL || !(part < PLAYER_PART_MAX && part >= 0)) { return; }
np->palette.parts[part][0] = color[0];
@@ -62,6 +71,7 @@ void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart p
}
void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, Color out) {
+ smlua_mod_warning();
if (np == NULL || !(part < PLAYER_PART_MAX && part >= 0)) {
if (np == NULL) { // output config palette instead if np is NULL
out[0] = configPlayerPalette.parts[part][0];
diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c
index a51d2c48..474a65d0 100644
--- a/src/pc/lua/utils/smlua_misc_utils.c
+++ b/src/pc/lua/utils/smlua_misc_utils.c
@@ -25,6 +25,10 @@
#include "game/level_geo.h"
#include "game/first_person_cam.h"
+#ifdef DISCORD_SDK
+#include "pc/discord/discord.h"
+#endif
+
static struct DateTime sDateTime;
///
@@ -639,6 +643,18 @@ bool djui_is_playerlist_open(void) {
///
+const char* get_local_discord_id(void) {
+#ifdef DISCORD_SDK
+ static char sDiscordId[64] = "";
+ snprintf(sDiscordId, 64, "%" PRIu64 "", (uint64_t)discord_get_user_id());
+ return sDiscordId;
+#else
+ return NULL;
+#endif
+}
+
+///
+
void set_window_title(const char* title) {
WAPI.set_window_title(title);
}
diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h
index d8a93aa8..5f037083 100644
--- a/src/pc/lua/utils/smlua_misc_utils.h
+++ b/src/pc/lua/utils/smlua_misc_utils.h
@@ -167,6 +167,8 @@ s32 get_dialog_response(void);
bool djui_is_playerlist_open(void);
+const char* get_local_discord_id(void);
+
void set_window_title(const char* title);
void reset_window_title(void);