From c21c255241a55f138e2f6821c6bc51ac6b1c0f5c Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Sat, 11 May 2024 16:48:59 -0400 Subject: [PATCH] Add gServerSettings.enableChat --- autogen/lua_definitions/structs.lua | 1 + docs/lua/structs.md | 1 + src/pc/djui/djui_interactable.c | 2 +- src/pc/lua/smlua_cobject_autogen.c | 3 ++- src/pc/network/network.c | 2 ++ src/pc/network/network.h | 1 + 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 3eb27ce4..f12facab 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -2001,6 +2001,7 @@ --- @class ServerSettings --- @field public bouncyLevelBounds BouncyLevelBounds --- @field public bubbleDeath integer +--- @field public enableChat integer --- @field public enableCheats integer --- @field public enablePlayerList integer --- @field public enablePlayersInLevelDisplay integer diff --git a/docs/lua/structs.md b/docs/lua/structs.md index d6f62fe7..8388c893 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -2514,6 +2514,7 @@ | ----- | ---- | ------ | | bouncyLevelBounds | [enum BouncyLevelBounds](constants.md#enum-BouncyLevelBounds) | | | bubbleDeath | `integer` | | +| enableChat | `integer` | | | enablePlayerList | `integer` | | | enablePlayersInLevelDisplay | `integer` | | | headlessServer | `integer` | | diff --git a/src/pc/djui/djui_interactable.c b/src/pc/djui/djui_interactable.c index 0a971125..c17b7ba0 100644 --- a/src/pc/djui/djui_interactable.c +++ b/src/pc/djui/djui_interactable.c @@ -223,7 +223,7 @@ bool djui_interactable_on_key_down(int scancode) { return true; } - if (gDjuiChatBox != NULL && !gDjuiChatBoxFocus) { + if (gDjuiChatBox != NULL && !gDjuiChatBoxFocus && gServerSettings.enableChat) { bool pressChat = false; for (int i = 0; i < MAX_BINDS; i++) { if (scancode == (int)configKeyChat[i]) { pressChat = true; } diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index ac929ca0..67789259 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -2195,10 +2195,11 @@ static struct LuaObjectField sRayIntersectionInfoFields[LUA_RAY_INTERSECTION_INF { "surface", LVT_COBJECT_P, offsetof(struct RayIntersectionInfo, surface), false, LOT_SURFACE }, }; -#define LUA_SERVER_SETTINGS_FIELD_COUNT 13 +#define LUA_SERVER_SETTINGS_FIELD_COUNT 14 static struct LuaObjectField sServerSettingsFields[LUA_SERVER_SETTINGS_FIELD_COUNT] = { { "bouncyLevelBounds", LVT_S32, offsetof(struct ServerSettings, bouncyLevelBounds), false, LOT_NONE }, { "bubbleDeath", LVT_U8, offsetof(struct ServerSettings, bubbleDeath), false, LOT_NONE }, + { "enableChat", LVT_U8, offsetof(struct ServerSettings, enableChat), false, LOT_NONE }, { "enableCheats", LVT_U8, offsetof(struct ServerSettings, enableCheats), false, LOT_NONE }, { "enablePlayerList", LVT_U8, offsetof(struct ServerSettings, enablePlayerList), false, LOT_NONE }, { "enablePlayersInLevelDisplay", LVT_U8, offsetof(struct ServerSettings, enablePlayersInLevelDisplay), false, LOT_NONE }, diff --git a/src/pc/network/network.c b/src/pc/network/network.c index 1b3f530b..7f6f504c 100644 --- a/src/pc/network/network.c +++ b/src/pc/network/network.c @@ -76,6 +76,7 @@ struct ServerSettings gServerSettings = { .bubbleDeath = TRUE, .enablePlayersInLevelDisplay = TRUE, .enablePlayerList = TRUE, + .enableChat = TRUE, .headlessServer = FALSE, .nametags = TRUE, .maxPlayers = MAX_PLAYERS, @@ -124,6 +125,7 @@ bool network_init(enum NetworkType inNetworkType, bool reconnecting) { gServerSettings.bubbleDeath = configBubbleDeath; gServerSettings.enablePlayersInLevelDisplay = TRUE; gServerSettings.enablePlayerList = TRUE; + gServerSettings.enableChat = TRUE; gServerSettings.nametags = configNametags; gServerSettings.maxPlayers = configAmountofPlayers; gServerSettings.pauseAnywhere = configPauseAnywhere; diff --git a/src/pc/network/network.h b/src/pc/network/network.h index 80703f88..56cbc5d9 100644 --- a/src/pc/network/network.h +++ b/src/pc/network/network.h @@ -79,6 +79,7 @@ struct ServerSettings { u8 bubbleDeath; u8 enablePlayersInLevelDisplay; u8 enablePlayerList; + u8 enableChat; u8 headlessServer; u8 nametags; u8 maxPlayers;