Merge branch 'explosivegaming:main' into aperx

This commit is contained in:
phidias authored and GitHub committed 2026-10-12 03:26:38 +09:00
commit 2dfbf970df
17 files changed
+103 -286

No files matched your search

+62
View File
@@ -0,0 +1,62 @@
--[[-- Commands - Tag
Adds commands to set the tag shown after your name, inventory sync keeps it between servers
]]
local Commands = require("modules/exp_commands")
local format_text = Commands.format_rich_text_color
local Roles = require("modules/exp_roles")
local player_has_permission = Roles.player_has_permission
--- Split a player tag into its text and colour
--- @param tag string
--- @return string, string?
local function parse_tag(tag)
local color, text = tag:match("^%- %[color=([^%]]*)%](.*)%[/color%]$")
if color then
--- @cast text string
return text, color
end
return tag:match("^%- (.*)$") or tag, nil
end
--- Sets your player tag
Commands.new("tag", { "exp-commands_tag.description" })
:argument("tag", { "exp-commands_tag.arg-tag" }, Commands.types.string_max_length(20))
:enable_auto_concatenation()
:register(function(player, tag)
--- @cast tag string
local _, color = parse_tag(player.tag)
if tag == "" then
player.tag = ""
elseif color then
player.tag = "- [color=" .. color .. "]" .. tag .. "[/color]"
else
player.tag = "- " .. tag
end
end)
--- Sets your player tag colour
Commands.new("tag-color", { "exp-commands_tag.description-color" })
:argument("color", { "exp-commands_tag.arg-color" }, Commands.types.color)
:register(function(player, color)
--- @cast color Color
local text = parse_tag(player.tag)
if text == "" then
return Commands.status.error{ "exp-commands_tag.no-tag" }
end
player.tag = "- " .. format_text(text, color)
end)
--- Clears your tag, or the tag of another player
Commands.new("tag-clear", { "exp-commands_tag.description-clear" })
:optional("player", { "exp-commands_tag.arg-player" }, Commands.types.lower_role_player)
:defaults{
player = function(player) return player end
}
:register(function(player, other_player)
--- @cast other_player LuaPlayer
if other_player ~= player and not player_has_permission(player, "exp_scenario.command.tag_clear.always") then
return Commands.status.unauthorised()
end
other_player.tag = ""
end)
+1
View File
@@ -34,6 +34,7 @@ require("modules/exp_scenario/commands/roles")
require("modules/exp_scenario/commands/search")
require("modules/exp_scenario/commands/spectate")
require("modules/exp_scenario/commands/surface")
require("modules/exp_scenario/commands/tag")
require("modules/exp_scenario/commands/teleport")
require("modules/exp_scenario/commands/trains")
require("modules/exp_scenario/commands/vlayer")
+9
View File
@@ -147,6 +147,15 @@ description=Sends an rainbow message in the chat
arg-message=Message to send in chat.
response=__1__: __2__
[exp-commands_tag]
description=Sets your player tag.
arg-tag=The tag shown after your name, leave empty to clear it.
description-color=Sets your player tag colour.
arg-color=Name of the colour to use.
description-clear=Clears your tag, or the tag of another player.
arg-player=Player whose tag to clear, defaults to you.
no-tag=You need to set a tag with /tag first.
[exp-commands_ratio]
description=This command will give the input and output ratios of the selected machine. Use the parameter for calculating the machines needed for that amount of items per second.
arg-items-per-second=Target items per second, defaults to output of a single machine.
+9
View File
@@ -146,6 +146,15 @@ description=在聊天中發送多色訊息
arg-message=訊息
response=__1__: __2__
[exp-commands_tag]
description=設定你的玩家標籤。
arg-tag=顯示在你名字後面的標籤,留空以清除。
description-color=設定你的玩家標籤顏色。
arg-color=要使用的顏色名稱。
description-clear=清除你或其他玩家的標籤。
arg-player=要清除標籤的玩家,預設為你。
no-tag=請先使用 /tag 設定標籤。
[exp-commands_ratio]
description=此指令將給出所選機器的輸入和輸出比率。使用此參數來計算每秒處理該數量的物品所需的機器。
arg-items-per-second=物品所需
+9
View File
@@ -146,6 +146,15 @@ description=在聊天中發送多色訊息
arg-message=訊息
response=__1__: __2__
[exp-commands_tag]
description=設定你的玩家標籤。
arg-tag=顯示在你名字後面的標籤,留空以清除。
description-color=設定你的玩家標籤顏色。
arg-color=要使用的顏色名稱。
description-clear=清除你或其他玩家的標籤。
arg-player=要清除標籤的玩家,預設為你。
no-tag=請先使用 /tag 設定標籤。
[exp-commands_ratio]
description=此指令將給出所選機器的輸入和輸出比率。使用此參數來計算每秒處理該數量的物品所需的機器。
arg-items-per-second=物品所需