Move community details into a scenario feature and drop preset colours (#498)

* 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>

* 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 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cooldude2606andClaude Opus 5.5 authored and GitHub committed 2026-10-14 23:13:33 +01:00
commit 5180cc39d6
19 files changed
+157 -192

No files matched your search

@@ -8,7 +8,5 @@ return {
--- Data
"modules.data.statistics",
"modules.data.player-colours",
"modules.data.greetings",
"modules.data.language",
}
@@ -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!",
}
@@ -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 },
},
}
@@ -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"
}
-9
View File
@@ -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
-9
View File
@@ -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=你加入時所顯示的信息
-9
View File
@@ -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=你加入時所顯示的信息
@@ -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)
@@ -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)