mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-18 06:43:13 +09:00
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
4fe9148ab7
commit
a6c453a88e
5 files changed
+83
-33
No files matched your search
@@ -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<string, LocalisedString | fun(player: LuaPlayer, is_command: boolean): LocalisedString>
|
||||
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" },
|
||||
|
||||
Reference in new issue
Block a user