mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-20 07:23:13 +09:00
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>
This commit is contained in:
1 parent
a6c453a88e
commit
4d3c4de5b1
15 files changed
+74
-159
No files matched your search
File renamed without changes.
@@ -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"))
|
||||
|
||||
@@ -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 {}
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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__ ,所以該物品已放在出生點的箱子。
|
||||
|
||||
|
||||
@@ -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__ ,所以該物品已放在出生點的箱子。
|
||||
|
||||
|
||||
Reference in new issue
Block a user