From a6c453a88e97a6f416ff587ee4338f7cbb1e152a Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Wed, 14 Oct 2026 21:42:14 +0000 Subject: [PATCH 1/2] Add a community_details feature for the community name and links The community name, Discord, website, status, GitHub, and Patreon links lived in exp_legacy/config/server_detail.lua, so changing them meant editing the scenario. They are now the community_details feature and can be edited from the Scenario Features page. Chat auto reply, help bubbles, and the readme read the live config instead of copying the values when the file loads, so an edit shows up without a restart. Help bubbles store the location name in their task and build the messages each cycle; the readme tab tooltip can be a function which is called when the readme opens. Every feature gets an enabled switch from the framework. There is no sensible meaning for a disabled community name, so the values are always used and the feature description says the switch does nothing. Co-Authored-By: Claude Opus 5.5 --- exp_scenario/features.ts | 13 ++++++ .../module/config/chat_auto_reply.lua | 25 +++++++---- exp_scenario/module/config/server_details.lua | 14 ++++++ exp_scenario/module/control/help_bubbles.lua | 43 +++++++++++-------- exp_scenario/module/gui/readme.lua | 21 +++++---- 5 files changed, 83 insertions(+), 33 deletions(-) create mode 100644 exp_scenario/module/config/server_details.lua diff --git a/exp_scenario/features.ts b/exp_scenario/features.ts index 294ee9bf..9c1e70a9 100644 --- a/exp_scenario/features.ts +++ b/exp_scenario/features.ts @@ -81,6 +81,19 @@ export const features: Feature[] = [ str("command_prefix", "Command prefix", "Prefix for chat commands, and for key words to reply to everyone", "!"), ], }, + { + name: "community_details", + title: "Community Details", + description: "The community name and links shown in chat, the readme, help bubbles, and the greeting. These are always used, the switch has no effect", + fields: [ + str("community_name", "Community name", "Name of the community", "Explosive Gaming"), + str("discord", "Discord", "Invite link to the Discord server", "https://discord.explosivegaming.nl"), + str("website", "Website", "Link to the website", "https://www.explosivegaming.nl"), + str("status", "Status page", "Link to the server status page", "https://status.explosivegaming.nl"), + str("github", "GitHub", "Link to the source code", "https://github.com/explosivegaming/ExpCluster"), + str("patreon", "Patreon", "Link to donate", "https://www.patreon.com/ExpGaming"), + ], + }, { name: "custom_start", title: "Custom Start", diff --git a/exp_scenario/module/config/chat_auto_reply.lua b/exp_scenario/module/config/chat_auto_reply.lua index a9e627b9..3ad54776 100644 --- a/exp_scenario/module/config/chat_auto_reply.lua +++ b/exp_scenario/module/config/chat_auto_reply.lua @@ -4,7 +4,7 @@ local ExpUtil = require("modules/exp_util") local Feature = require("modules/exp_scenario/features") local Async = require("modules/exp_util/async") -local config_server_detail = require("modules.exp_legacy.config.server_detail") --- @dep config.server_detail +local community_details = require("modules/exp_scenario/config/community_details").config local floor = math.floor local random = math.random @@ -20,6 +20,15 @@ local send_message_async = end end) +--- Reply with a link from community_details, read when the reply is sent +--- @param key string +--- @return fun(): LocalisedString +local function server_link(key) + return function() + return { "info." .. key, community_details[key] } + end +end + local afk_time_units = { minutes = true, seconds = true, @@ -28,13 +37,13 @@ local afk_time_units = { return Feature.register("chat_auto_reply", { --- @type table messages = { -- will trigger when ever the word is said - ["discord"] = { "info.discord", config_server_detail["discord"] }, - ["expgaming"] = { "info.website", config_server_detail["website"] }, - ["website"] = { "info.website", config_server_detail["website"] }, - ["status"] = { "info.status", config_server_detail["status"] }, - ["github"] = { "info.github", config_server_detail["github"] }, - ["patreon"] = { "info.patreon", config_server_detail["patreon"] }, - ["donate"] = { "info.patreon", config_server_detail["patreon"] }, + ["discord"] = server_link("discord"), + ["expgaming"] = server_link("website"), + ["website"] = server_link("website"), + ["status"] = server_link("status"), + ["github"] = server_link("github"), + ["patreon"] = server_link("patreon"), + ["donate"] = server_link("patreon"), ["command"] = { "info.custom-commands" }, ["commands"] = { "info.custom-commands" }, ["softmod"] = { "info.softmod" }, diff --git a/exp_scenario/module/config/server_details.lua b/exp_scenario/module/config/server_details.lua new file mode 100644 index 00000000..e7dfc9e8 --- /dev/null +++ b/exp_scenario/module/config/server_details.lua @@ -0,0 +1,14 @@ +--- Names and links of the community, shown in chat, the readme, and the greeting +-- @config Community-Details + +local Feature = require("modules/exp_scenario/features") + +--- The values are always used, disabling the feature changes nothing +return Feature.register("community_details", { + community_name = "Explosive Gaming", + discord = "https://discord.explosivegaming.nl", + website = "https://www.explosivegaming.nl", + status = "https://status.explosivegaming.nl", + github = "https://github.com/explosivegaming/ExpCluster", + patreon = "https://www.patreon.com/ExpGaming", +}) diff --git a/exp_scenario/module/control/help_bubbles.lua b/exp_scenario/module/control/help_bubbles.lua index 51f8a12f..45bafb88 100644 --- a/exp_scenario/module/control/help_bubbles.lua +++ b/exp_scenario/module/control/help_bubbles.lua @@ -5,7 +5,7 @@ Adds friendly biters that walk around and give helpful messages local Async = require("modules/exp_util/async") local Storage = require("modules/exp_util/storage") local Feature = require("modules/exp_scenario/features") -local config_server_detail = require("modules.exp_legacy.config.server_detail") +local community_details = require("modules/exp_scenario/config/community_details").config local feature = Feature.register("help_bubbles") @@ -17,18 +17,21 @@ local locations = { spawn_position = { x = 0, y = 0 }, spawn_surface = "nauvis", entity_name = "small-biter", - messages = { - { "info.website", config_server_detail["website"] }, - { "info.read-readme" }, - { "info.discord", config_server_detail["discord"] }, - { "info.softmod" }, - { "info.redmew" }, - { "info.custom-commands" }, - { "info.status", config_server_detail["status"] }, - { "info.lhd" }, - { "info.github", config_server_detail["github"] }, - { "info.patreon", config_server_detail["patreon"] }, - }, + --- Built each cycle so changes to community_details show without a restart + messages = function() + return { + { "info.website", community_details.website }, + { "info.read-readme" }, + { "info.discord", community_details.discord }, + { "info.softmod" }, + { "info.redmew" }, + { "info.custom-commands" }, + { "info.status", community_details.status }, + { "info.lhd" }, + { "info.github", community_details.github }, + { "info.patreon", community_details.patreon }, + } + end, } } @@ -41,7 +44,8 @@ end) --- @class speech_bubble_task_param --- @field entity LuaEntity ---- @field messages LocalisedString[] +--- @field messages LocalisedString[]? +--- @field location string? Used when there are no messages, a key of locations --- @field previous_message LuaEntity? --- @field current_message_index number @@ -60,8 +64,9 @@ local speech_bubble_task = return Async.status.complete() end + local messages = task.messages or locations[task.location].messages() local index = task.current_message_index - if index > #task.messages then + if index > #messages then index = 1 end @@ -71,7 +76,7 @@ local speech_bubble_task = end speech_bubble_param.source = entity - speech_bubble_param.text = task.messages[index] + speech_bubble_param.text = messages[index] task.previous_message = entity.surface.create_entity(speech_bubble_param) task.current_message_index = index + 1 @@ -114,7 +119,11 @@ local function check_persistent_locations() goto continue end - persistent_locations[name] = register_entity(entity, location.messages) + persistent_locations[name] = speech_bubble_task{ + entity = entity, + location = name, + current_message_index = 1, + } ::continue:: end end diff --git a/exp_scenario/module/gui/readme.lua b/exp_scenario/module/gui/readme.lua index b0d4e510..19c21eac 100644 --- a/exp_scenario/module/gui/readme.lua +++ b/exp_scenario/module/gui/readme.lua @@ -8,7 +8,7 @@ local Roles = require("modules/exp_roles") local Commands = require("modules/exp_commands") local PlayerData = require("modules.exp_legacy.expcore.player_data") local ExpServerList = require("modules/exp_server_list") -local config_server_detail = require("modules.exp_legacy.config.server_detail") --- @dep config.server_detail +local community = require("modules/exp_scenario/config/community_details").config local format_number = require("util").format_number local format_time = ExpUtil.format_time_factory_locale{ format = "long", days = true, hours = true, minutes = true } @@ -37,12 +37,12 @@ end --- @class ExpGui_Readme.elements local Elements = {} ---- @type table +--- @type table local tabs = {} --- Register a readme tab --- @param caption LocalisedString ---- @param tooltip LocalisedString +--- @param tooltip LocalisedString | fun(): LocalisedString Functions are called when the readme opens --- @param element ExpElement local function define_tab(caption, tooltip, element) tabs[#tabs + 1] = { caption = caption, tooltip = tooltip, element = element } @@ -202,13 +202,13 @@ end --- Welcome tab define_tab( { "exp-gui_readme.welcome-tab" }, - { "exp-gui_readme.welcome-tooltip", config_server_detail["community_name"] }, + function() return { "exp-gui_readme.welcome-tooltip", community.community_name } end, Gui.define("readme/welcome") :draw(function(_, parent) local player = Gui.get_player(parent) local server_details = { - name = config_server_detail["community_name"] .. " S0 - Local", + name = community.community_name .. " S0 - Local", welcome = "Failed to load description: disconnected from the controller.", reset_time = "Not Set", } @@ -248,7 +248,7 @@ define_tab( frame_width, { "exp-gui_readme.welcome-general", - config_server_detail["community_name"], + community.community_name, format_time(game.tick), server_details.reset_time, } @@ -353,7 +353,7 @@ define_tab( local external_links = Elements.title_table(scroll_pane, 235, { "exp-gui_readme.servers-external" }, 2) for _, key in ipairs{ "discord", "website", "patreon", "status", "github" } do Gui.elements.centered_label(external_links, 110, key:gsub("^%l", string.upper)) - Gui.elements.centered_label(external_links, 460, config_server_detail[key], { "exp-gui_readme.servers-open-in-browser" }) + Gui.elements.centered_label(external_links, 460, community[key], { "exp-gui_readme.servers-open-in-browser" }) end return container @@ -651,11 +651,16 @@ Elements.container = Gui.define("readme/container") } for _, tab in ipairs(tabs) do + local tooltip = tab.tooltip + if type(tooltip) == "function" then + tooltip = tooltip() + end + local gui_tab = pane.add{ type = "tab", style = "frame_tab", caption = tab.caption, - tooltip = tab.tooltip, + tooltip = tooltip, } pane.add_tab(gui_tab, tab.element(pane)) From 4d3c4de5b177dfff33a9a1a49cb6ba3bfb9b3a85 Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Wed, 14 Oct 2026 21:42:14 +0000 Subject: [PATCH 2/2] Move greetings to exp_scenario and drop preset colours The greeting reads the community name and Discord link from the new community_details feature, which exp_legacy can not depend on, so it moves to exp_scenario/control/greetings.lua along with its commands and locale. The custom message still lives in PlayerData for now. The hardcoded per-player join messages in config/join_messages.lua are removed with their fallback, as are the preset player colours. Player sync already restores the colour of returning players, so new players keep the colour Factorio gives them. Co-Authored-By: Claude Opus 5.5 --- exp_legacy/module/config/_file_loader.lua | 2 - exp_legacy/module/config/join_messages.lua | 8 --- .../module/config/preset_player_colours.lua | 33 ------------ exp_legacy/module/config/server_detail.lua | 11 ---- exp_legacy/module/locale/en.cfg | 9 ---- exp_legacy/module/locale/zh-CN.cfg | 9 ---- exp_legacy/module/locale/zh-TW.cfg | 9 ---- exp_legacy/module/modules/data/greetings.lua | 50 ------------------- .../module/modules/data/player-colours.lua | 28 ----------- ...rver_details.lua => community_details.lua} | 0 exp_scenario/module/control.lua | 1 + exp_scenario/module/control/greetings.lua | 46 +++++++++++++++++ exp_scenario/module/locale/en.cfg | 9 ++++ exp_scenario/module/locale/zh-CN.cfg | 9 ++++ exp_scenario/module/locale/zh-TW.cfg | 9 ++++ 15 files changed, 74 insertions(+), 159 deletions(-) delete mode 100644 exp_legacy/module/config/join_messages.lua delete mode 100644 exp_legacy/module/config/preset_player_colours.lua delete mode 100644 exp_legacy/module/config/server_detail.lua delete mode 100644 exp_legacy/module/modules/data/greetings.lua delete mode 100644 exp_legacy/module/modules/data/player-colours.lua rename exp_scenario/module/config/{server_details.lua => community_details.lua} (100%) create mode 100644 exp_scenario/module/control/greetings.lua diff --git a/exp_legacy/module/config/_file_loader.lua b/exp_legacy/module/config/_file_loader.lua index 0e6fa332..b9e10b1d 100644 --- a/exp_legacy/module/config/_file_loader.lua +++ b/exp_legacy/module/config/_file_loader.lua @@ -8,7 +8,5 @@ return { --- Data "modules.data.statistics", - "modules.data.player-colours", - "modules.data.greetings", "modules.data.language", } diff --git a/exp_legacy/module/config/join_messages.lua b/exp_legacy/module/config/join_messages.lua deleted file mode 100644 index 61278a2f..00000000 --- a/exp_legacy/module/config/join_messages.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - Cooldude2606 = "Lua lets you set metatables on numbers, did you know that? Cooldude2606 knows this.", - samy115 = "Tremble in fear as the banhammer is now here, its owner: samy115", - XenoCyber = '"Fire Fire Fire" oops wrong game, have no fear XenoCyber is here', - HunterOfGames = "Unable to support HunterOfGames. You must construct additional miners.", - ookl = 'ookl says: "Pineapples are amazing, hello everyone!"', - arty714 = "Arty\'s Potato made it!", -} diff --git a/exp_legacy/module/config/preset_player_colours.lua b/exp_legacy/module/config/preset_player_colours.lua deleted file mode 100644 index 637799e8..00000000 --- a/exp_legacy/module/config/preset_player_colours.lua +++ /dev/null @@ -1,33 +0,0 @@ ---- Preset colours that players get when they join the server, if not in the list then will be given a random colour (which isnt disallowed) --- @config Preset-Player-Colours - -return { - players = { --- @setting players list of all players and the colour in rgb256 that they will recive upon joining - PHIDIAS0303 = { r = 255, g = 255, b = 255 }, - BADgamerNL = { r = 255, g = 20, b = 147 }, - arty714 = { r = 150, g = 68, b = 161 }, - Cooldude2606 = { r = 57, g = 192, b = 207 }, - mark9064 = { r = 99, g = 0, b = 255 }, - eissturm = { r = 25, g = 25, b = 112 }, - Sakama = { r = 20, g = 213, b = 80 }, - freek18 = { r = 50, g = 0, b = 255 }, - aldldl = { r = 0, g = 131, b = 255 }, - NAD4X4 = { r = 135, g = 206, b = 250 }, - cydes = { r = 82, g = 249, b = 155 }, - UUBlueFire = { r = 0, g = 204, b = 255 }, - CmonMate497 = { r = 103, g = 224, b = 194 }, - s4sh = { r = 255, g = 120, b = 0 }, - ArPiiX = { r = 0, g = 255, b = 0 }, - NextIdea = { r = 255, g = 255, b = 255 }, - hamsterbryan = { r = 0, g = 255, b = 0 }, - XenoCyber = { r = 0, g = 128, b = 255 }, - }, - disallow = { --- @setting disallow colours which will not given to players; the value does not matter it is only the key which is checked - black = { r = 0, g = 0, b = 0 }, - white = { r = 255, g = 255, b = 255 }, - success = { r = 0, g = 255, b = 0 }, - warning = { r = 255, g = 255, b = 0 }, - fail = { r = 255, g = 0, b = 0 }, - info = { r = 255, g = 255, b = 255 }, - }, -} diff --git a/exp_legacy/module/config/server_detail.lua b/exp_legacy/module/config/server_detail.lua deleted file mode 100644 index a50d8c7d..00000000 --- a/exp_legacy/module/config/server_detail.lua +++ /dev/null @@ -1,11 +0,0 @@ ---- Config file for the server detail --- @config Server - -return { - community_name = "Explosive Gaming", - discord = "https://discord.explosivegaming.nl", - website = "https://www.explosivegaming.nl", - status = "https://status.explosivegaming.nl", - github = "https://github.com/explosivegaming/ExpCluster", - patreon = "https://www.patreon.com/ExpGaming" -} diff --git a/exp_legacy/module/locale/en.cfg b/exp_legacy/module/locale/en.cfg index ef68c6c2..87766701 100644 --- a/exp_legacy/module/locale/en.cfg +++ b/exp_legacy/module/locale/en.cfg @@ -14,15 +14,6 @@ redmew=We don't talk about redmew here; they beat us to 1000 members ;-; lhd=All trains must be LHD! This is a long standing rule on our servers, please respect this. # data -[join-message] -description-add=Sets / Gets your custom join message. -description-remove=Removes you custom join message. -arg-message=Your custom join message. -greet=[color=0,1,0] Welcome to __1__ community server! If you like the server join our discord: __2__ [/color] -message-set=Your join message has been updated. -message-get=Your join message is: __1__ -message-cleared=Your join message has been cleared. - [exp-settings] JoinMessage=Join Message JoinMessage-tooltip=The message displayed when you join diff --git a/exp_legacy/module/locale/zh-CN.cfg b/exp_legacy/module/locale/zh-CN.cfg index bf97ce3f..990aafce 100644 --- a/exp_legacy/module/locale/zh-CN.cfg +++ b/exp_legacy/module/locale/zh-CN.cfg @@ -14,15 +14,6 @@ redmew=We don't talk about redmew here; they beat us to 1000 members ;-; lhd=列車必須是左則通行。這是本服務器長久以來的規則。 # data -[join-message] -description-add=設定 / 取得你的加入信息。 -description-remove=移除你的加入信息。 -arg-message=你的加入信息。 -greet=[color=0,1,0] 歡迎來到 __1__ 的服務器! 若果你喜歡本服務器可加入 Discord: __2__ [/color] -message-set=你的加入信息已更新。 -message-get=你的加入信息為: __1__ -message-cleared=你的加入信息已清除。 - [exp-settings] JoinMessage=加入信息 JoinMessage-tooltip=你加入時所顯示的信息 diff --git a/exp_legacy/module/locale/zh-TW.cfg b/exp_legacy/module/locale/zh-TW.cfg index bf97ce3f..990aafce 100644 --- a/exp_legacy/module/locale/zh-TW.cfg +++ b/exp_legacy/module/locale/zh-TW.cfg @@ -14,15 +14,6 @@ redmew=We don't talk about redmew here; they beat us to 1000 members ;-; lhd=列車必須是左則通行。這是本服務器長久以來的規則。 # data -[join-message] -description-add=設定 / 取得你的加入信息。 -description-remove=移除你的加入信息。 -arg-message=你的加入信息。 -greet=[color=0,1,0] 歡迎來到 __1__ 的服務器! 若果你喜歡本服務器可加入 Discord: __2__ [/color] -message-set=你的加入信息已更新。 -message-get=你的加入信息為: __1__ -message-cleared=你的加入信息已清除。 - [exp-settings] JoinMessage=加入信息 JoinMessage-tooltip=你加入時所顯示的信息 diff --git a/exp_legacy/module/modules/data/greetings.lua b/exp_legacy/module/modules/data/greetings.lua deleted file mode 100644 index 0ee062fa..00000000 --- a/exp_legacy/module/modules/data/greetings.lua +++ /dev/null @@ -1,50 +0,0 @@ ---- Greets players on join --- @data Greetings - -local config = require("modules.exp_legacy.config.join_messages") --- @dep config.join_messages -local config_server_detail = require("modules.exp_legacy.config.server_detail") --- @dep config.server_detail -local Commands = require("modules/exp_commands") - ---- Stores the join message that the player have -local PlayerData = require("modules.exp_legacy.expcore.player_data") --- @dep expcore.player_data -local CustomMessages = PlayerData.Settings:combine("JoinMessage") -CustomMessages:set_metadata{ - permission = "exp_scenario.command.set_join_message", -} - ---- When a players data loads show their message -CustomMessages:on_load(function(player_name, player_message) - local player = game.players[player_name] - local custom_message = player_message or config[player_name] - if custom_message then - game.print(custom_message, { color = player.color }) - else - player.print{ - "join-message.greet", - config_server_detail["community_name"], - config_server_detail["discord"] - } - end -end) - ---- Set your custom join message -Commands.new("set-join-message", { "join-message.description-add" }) - :optional("message", false, Commands.types.string_max_length(255)) - :enable_auto_concatenation() - :add_aliases{ "join-message" } - :register(function(player, message) - --- @cast message string? - if message then - CustomMessages:set(player, message) - return Commands.status.success{ "join-message.message-set" } - else - return Commands.status.success{ "join-message.message-get", CustomMessages:get(player) } - end - end) - ---- Removes your custom join message -Commands.new("remove-join-message", { "join-message.description-remove" }) - :register(function(player) - CustomMessages:remove(player) - return Commands.status.success{ "join-message.message-cleared" } - end) diff --git a/exp_legacy/module/modules/data/player-colours.lua b/exp_legacy/module/modules/data/player-colours.lua deleted file mode 100644 index 97a4a66d..00000000 --- a/exp_legacy/module/modules/data/player-colours.lua +++ /dev/null @@ -1,28 +0,0 @@ ---- Gives players random colours when they are created, also applies preset colours to those who have them ---- Inventory sync restores the colour of players who have played before --- @data Player-Colours - -local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event -local Colours = require("modules/exp_util/include/color") -local config = require("modules.exp_legacy.config.preset_player_colours") --- @dep config.preset_player_colours - ---- Returns a colour that is a bit lighter than the one given -local function lighten(c) - return { r = 255 - (255 - c.r) * 0.5, g = 255 - (255 - c.g) * 0.5, b = 255 - (255 - c.b) * 0.5, a = 255 } -end - ---- Apply the preset colour of the player, or a random one if there is none -Event.add(defines.events.on_player_created, function(event) - local player = game.players[event.player_index] - local colour = config.players[player.name] - if not colour then - local colour_name = "white" - while config.disallow[colour_name] do - colour_name = table.get_random(Colours, true) - end - colour = Colours[colour_name] - end - - player.color = colour - player.chat_color = lighten(colour) -end) diff --git a/exp_scenario/module/config/server_details.lua b/exp_scenario/module/config/community_details.lua similarity index 100% rename from exp_scenario/module/config/server_details.lua rename to exp_scenario/module/config/community_details.lua diff --git a/exp_scenario/module/control.lua b/exp_scenario/module/control.lua index 873dddeb..255806e9 100644 --- a/exp_scenario/module/control.lua +++ b/exp_scenario/module/control.lua @@ -52,6 +52,7 @@ add(require("modules/exp_scenario/control/discord_alerts")) add(require("modules/exp_scenario/control/features")) add(require("modules/exp_scenario/control/extra_logging")) add(require("modules/exp_scenario/control/fast_deconstruction")) +add(require("modules/exp_scenario/control/greetings")) add(require("modules/exp_scenario/control/help_bubbles")) add(require("modules/exp_scenario/control/inserter_pickup")) add(require("modules/exp_scenario/control/inventory_clear")) diff --git a/exp_scenario/module/control/greetings.lua b/exp_scenario/module/control/greetings.lua new file mode 100644 index 00000000..8b536879 --- /dev/null +++ b/exp_scenario/module/control/greetings.lua @@ -0,0 +1,46 @@ +--[[-- Control - Greetings +Greets players when they join, players can set a message shown to everyone instead +]] + +local Commands = require("modules/exp_commands") +local community_details = require("modules/exp_scenario/config/community_details").config + +local PlayerData = require("modules.exp_legacy.expcore.player_data") +local CustomMessages = PlayerData.Settings:combine("JoinMessage") +CustomMessages:set_metadata{ + permission = "exp_scenario.command.set_join_message", +} + +--- Show the message of a player once their data loads, or greet them +CustomMessages:on_load(function(player_name, player_message) + local player = assert(game.get_player(player_name)) + if player_message then + game.print(player_message, { color = player.color }) + else + player.print{ "exp_greetings.greet", community_details.community_name, community_details.discord } + end +end) + +--- Set your custom join message +Commands.new("set-join-message", { "exp_greetings.description-set" }) + :optional("message", { "exp_greetings.arg-message" }, Commands.types.string_max_length(255)) + :enable_auto_concatenation() + :add_aliases{ "join-message" } + :register(function(player, message) + --- @cast message string? + if message then + CustomMessages:set(player, message) + return Commands.status.success{ "exp_greetings.message-set" } + else + return Commands.status.success{ "exp_greetings.message-get", CustomMessages:get(player) or "" } + end + end) + +--- Removes your custom join message +Commands.new("remove-join-message", { "exp_greetings.description-remove" }) + :register(function(player) + CustomMessages:remove(player) + return Commands.status.success{ "exp_greetings.message-cleared" } + end) + +return {} diff --git a/exp_scenario/module/locale/en.cfg b/exp_scenario/module/locale/en.cfg index f5856db3..901c0e38 100644 --- a/exp_scenario/module/locale/en.cfg +++ b/exp_scenario/module/locale/en.cfg @@ -586,6 +586,15 @@ chat-enabled=enabled chat-disabled=disabled chat-toggle=Fast decon has been __1__ +[exp_greetings] +description-set=Sets / Gets your custom join message. +description-remove=Removes you custom join message. +arg-message=Your custom join message. +greet=[color=0,1,0] Welcome to __1__ community server! If you like the server join our discord: __2__ [/color] +message-set=Your join message has been updated. +message-get=Your join message is: __1__ +message-cleared=Your join message has been cleared. + [exp_nuke-protection] chat-found=You cannot have __1__ in your inventory, so it was placed into the chests at spawn. diff --git a/exp_scenario/module/locale/zh-CN.cfg b/exp_scenario/module/locale/zh-CN.cfg index 535b11fc..8315c280 100644 --- a/exp_scenario/module/locale/zh-CN.cfg +++ b/exp_scenario/module/locale/zh-CN.cfg @@ -578,6 +578,15 @@ chat-enabled=啟用 chat-disabled=停用 chat-toggle=樹木快速拆除已 __1__ +[exp_greetings] +description-set=設定 / 取得你的加入信息。 +description-remove=移除你的加入信息。 +arg-message=你的加入信息。 +greet=[color=0,1,0] 歡迎來到 __1__ 的服務器! 若果你喜歡本服務器可加入 Discord: __2__ [/color] +message-set=你的加入信息已更新。 +message-get=你的加入信息為: __1__ +message-cleared=你的加入信息已清除。 + [exp_nuke-protection] chat-found=你的用戶組不允許你有 __1__ ,所以該物品已放在出生點的箱子。 diff --git a/exp_scenario/module/locale/zh-TW.cfg b/exp_scenario/module/locale/zh-TW.cfg index 535b11fc..8315c280 100644 --- a/exp_scenario/module/locale/zh-TW.cfg +++ b/exp_scenario/module/locale/zh-TW.cfg @@ -578,6 +578,15 @@ chat-enabled=啟用 chat-disabled=停用 chat-toggle=樹木快速拆除已 __1__ +[exp_greetings] +description-set=設定 / 取得你的加入信息。 +description-remove=移除你的加入信息。 +arg-message=你的加入信息。 +greet=[color=0,1,0] 歡迎來到 __1__ 的服務器! 若果你喜歡本服務器可加入 Discord: __2__ [/color] +message-set=你的加入信息已更新。 +message-get=你的加入信息為: __1__ +message-cleared=你的加入信息已清除。 + [exp_nuke-protection] chat-found=你的用戶組不允許你有 __1__ ,所以該物品已放在出生點的箱子。