Skip to content

チャットカテゴリー

チャットカテゴリ

カテゴリは、チャット入力欄にあるタブです。それぞれのタブが独自のカラー、タグ、権限、配信ルール、身分証明バッジを持つ独立したチャンネルとして機能します。これらは shared/config/categories.lua 内の config.chatCategories で定義されます。

組み込みのコマンドタブ

command カテゴリは、実行時に(shared/main.lua から)常に最初のタブとして自動挿入されます。自分で定義する必要はありません:

shared/main.lua
table.insert(config.chatCategories, 1, {
    label = "CATEGORY_COMMANDS_LABEL",
    type = "command",
    icon = "terminal",
    placeholder = "CATEGORY_COMMANDS_PLACEHOLDER",
})

このタブに入力された内容はすべてコマンドとして実行されます。config.allowNoSlashCommands = true が設定されている場合、スラッシュの有無に関わらず(例: me hi と入力すると /me hi が実行される)、既知のコマンド名が機能します。

デフォルトで有効な機能

初期状態では、config.chatCategories 内で Admin カテゴリのみが有効になっています。OOC (Global)OOC (Local/closest)PoliceEMSGang 用のすぐに使えるサンプルはファイル内に含まれていますが、コメントアウトされています。必要に応じてコメントアウトを解除し、調整してください。

カテゴリ type アクセス制限の方法
Commands command 常に存在(自動挿入)
Admin admin ACE権限 command / admin / adminchat
OOC (Global) ooc 全員に公開(サンプル)
OOC (Local) oocclosest 近接 — メートル単位の distance(サンプル)
Police pdchat jobs = { police = {...grades} }(サンプル)
EMS emschat jobs = { ambulance = true }(サンプル)
Gang gang gangs = { ... }(サンプル)

デフォルトカテゴリ

config.defaultChatCategory によって、チャットを開いたときにどのタブにフォーカスするかを決定します:

shared/config/general.lua
config.defaultChatCategory = "command"

スラッシュ付き vs スラッシュなしコマンド

shared/config/general.lua
--- true  = 先頭のスラッシュの有無に関わらずコマンドが機能します("me hi" で /me を実行)
--- false = 先頭のスラッシュがある場合のみコマンドがトリガーされます ("/me hi")
config.allowNoSlashCommands = true

カテゴリパラメータ

すべてのカテゴリは豊富なフィールドをサポートしています。簡略化したサンプル:

shared/config/categories.lua
{
    label = "CATEGORY_ADMIN_LABEL",  -- タブ名の翻訳キー
    type = "admin",                  -- このカテゴリのユニークID
    icon = "shield-alt",             -- FontAwesome アイコン
    webhookKey = "chatMessage",      -- Discordログのウェブhook(Discordロギングを参照)
    placeholder = "CATEGORY_ADMIN_PLACEHOLDER",
    permissions = { "command", "admin", "adminchat" }, -- 必要なACE権限
    maxLength = 500,                 -- 最大メッセージ文字数
    tags = {                         -- メッセージの前に表示される固定タグ
        { tag = "Admin", textColor = { 51, 51, 51 }, bgColor = { 255, 105, 97 } },
    },
    color = { 255, 105, 97 },        -- デフォルトのメッセージテキストカラー
    showPlayerName = { active = true, censored = false, showWearingMask = true },
    showPlayerId   = { active = false, type = "serverId" },
    showPlayerJob  = { active = false, showLabel = true, showGrade = false },
    discordTag     = { active = false, maxShow = 1, roles = { ... } },
    showHour       = { active = true },
}

完全なフィールドリファレンス(特記されていない限りすべてオプションです):

フィールド タイプ 説明
label string タブ表示名の翻訳キー
type string 必須。 カテゴリのユニーク識別子
icon string FontAwesome アイコン名
webhookKey string このカテゴリのメッセージをログに記録するための Discord ウェブhookキー
command string / string[] このカテゴリにルーティングするチャットコマンド
placeholder string 入力欄プレースホルダーの翻訳キー
distance number メートル単位の最大配信距離。グローバルにする場合は省略
maxLength number メッセージの最大文字数
permissions string[] カテゴリの表示/使用に必要な ACE 権限
jobs table 必要なジョブ — true = すべてのグレード、番地number[] = 特定のグレード
gangs table 必要なギャング — jobs と同じ形式
tags table[] メッセージの前に表示される固定タグ(tagtextColorbgColor
color RGB デフォルトのメッセージテキストカラー { r, g, b }
showPlayerName table activecensoredbgColortextColorshowWearingMask
showPlayerId table activetype = "serverId"、カラー
showPlayerJob table activeshowLabelshowGrade、カラー、ジョブごとの上書き設定
discordTag table activemaxShowroles[](Discordロール → タグ)
showHour table active、カラー — メッセージの送信時刻を追加します

名前の検閲はマスクされた名前を表示します(例: J*** D**)。プレイヤーがマスクを着用している場合、showWearingMask = true に設定されていない限り、名前は Unknown として非表示になります。マスクのチェックは general.lua 内の config.noneMask によって制御されます。