mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Add Command Description Locale (#323)
* Update admin-chat.lua * Update admin-markers.lua * Update artillery.lua * Update bot-queue.lua * Update cheat-mode.lua * Update clear-inventory.lua * Update connect.lua * Update debug.lua * Update enemy.lua * Update find.lua * Update friendly-fire.lua * Update help.lua * Update home.lua * Update interface.lua * Update jail.lua * Update kill.lua * Update last-location.lua * Update me.lua * Update pollution.lua * Update protection.lua * Update rainbow.lua * Update ratio.lua * Update repair.lua * Update reports.lua * Update research.lua * Update roles.lua * Update roles.lua * Update search.lua * Update spawn.lua * Update spectate.lua * Update speed.lua * Update surface-clearing.lua * Update teleport.lua * Update train.lua * Update vlayer.lua * Update warnings.lua * Update waterfill.lua * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update commands.cfg * Update commands.cfg * Update commands.cfg * Update connect.lua * Update cheat-mode.lua * Update commands.cfg * Update commands.cfg * Update commands.cfg * Update commands.cfg * Update commands.cfg * Update commands.cfg * Update admin-chat.lua * Update admin-markers.lua * Update vlayer.lua * Update artillery.lua * Update bot-queue.lua * Update cheat-mode.lua * Update clear-inventory.lua * Update connect.lua * Update debug.lua * Update enemy.lua * Update find.lua * Update friendly-fire.lua * Update help.lua * Update home.lua * Update interface.lua * Update jail.lua * Update kill.lua * Update last-location.lua * Update me.lua * Update pollution.lua * Update protection.lua * Update rainbow.lua * Update ratio.lua * Update repair.lua * Update reports.lua * Update research.lua * Update roles.lua * Update search.lua * Update spawn.lua * Update spectate.lua * Update speed.lua * Update surface-clearing.lua * Update teleport.lua * Update train.lua * Update warnings.lua * Update waterfill.lua * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update commands.cfg * Update commands.cfg * Update addons.cfg * Update addons.cfg * Update data.cfg * Update data.cfg * Update gui.cfg * Update gui.cfg * Update data.cfg * Update data.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update gui.cfg * Update commands.lua * Update admin-chat.lua * Update admin-markers.lua * Update artillery.lua * Update bot-queue.lua * Update cheat-mode.lua * Update clear-inventory.lua * Update connect.lua * Update debug.lua * Update enemy.lua * Update find.lua * Update help.lua * Update interface.lua * Update home.lua * Update jail.lua * Update kill.lua * Update last-location.lua * Update me.lua * Update pollution.lua * Update protection.lua * Update rainbow.lua * Update ratio.lua * Update repair.lua * Update reports.lua * Update research.lua * Update roles.lua * Update search.lua * Update spawn.lua * Update spectate.lua * Update speed.lua * Update surface-clearing.lua * Update teleport.lua * Update train.lua * Update vlayer.lua * Update warnings.lua * Update waterfill.lua * Update commands.cfg * Update commands.cfg * Update enemy.lua * Update friendly-fire.lua * Update roles.lua * Update spectate.lua * Update spectate.lua
This commit is contained in:
@@ -393,13 +393,19 @@ local commands = Commands.get()
|
||||
]]
|
||||
function Commands.get(player)
|
||||
player = Game.get_player_from_any(player)
|
||||
if not player then return Commands.commands end
|
||||
|
||||
if not player then
|
||||
return Commands.commands
|
||||
end
|
||||
|
||||
local allowed = {}
|
||||
|
||||
for name, command_data in pairs(Commands.commands) do
|
||||
if Commands.authorize(player, name) then
|
||||
allowed[name] = command_data
|
||||
end
|
||||
end
|
||||
|
||||
return allowed
|
||||
end
|
||||
|
||||
@@ -419,14 +425,17 @@ function Commands.search(keyword, player)
|
||||
local custom_commands = Commands.get(player)
|
||||
local matches = {}
|
||||
keyword = keyword:lower()
|
||||
|
||||
-- Loops over custom commands
|
||||
for name, command_data in pairs(custom_commands) do
|
||||
-- combines name help and aliases into one message to be searched
|
||||
local search = string.format('%s %s %s', name, command_data.help, table.concat(command_data.aliases, ' '))
|
||||
local search = string.format('%s %s %s %s', name, command_data.help, command_data.searchable_description, table.concat(command_data.aliases, ' '))
|
||||
|
||||
if search:lower():match(keyword) then
|
||||
matches[name] = command_data
|
||||
end
|
||||
end
|
||||
|
||||
-- Loops over the names of game commands
|
||||
for name, description in pairs(commands.game_commands) do
|
||||
if name:lower():match(keyword) then
|
||||
@@ -439,6 +448,7 @@ function Commands.search(keyword, player)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
return matches
|
||||
end
|
||||
|
||||
@@ -455,10 +465,11 @@ end
|
||||
Commands.new_command('repeat-name', 'Will repeat you name a number of times in chat.')
|
||||
|
||||
]]
|
||||
function Commands.new_command(name, help)
|
||||
function Commands.new_command(name, help, descr)
|
||||
local command = setmetatable({
|
||||
name = name,
|
||||
help = help,
|
||||
searchable_description = descr or '',
|
||||
callback = function() Commands.internal_error(false, name, 'No callback registered') end,
|
||||
auto_concat = false,
|
||||
min_param_count = 0,
|
||||
@@ -469,7 +480,9 @@ function Commands.new_command(name, help)
|
||||
}, {
|
||||
__index = Commands._prototype
|
||||
})
|
||||
|
||||
Commands.commands[name] = command
|
||||
|
||||
return command
|
||||
end
|
||||
|
||||
@@ -867,4 +880,4 @@ function Commands.run_command(command_event)
|
||||
command_log(player, command_data, 'Success', raw_params, raw_input)
|
||||
end
|
||||
|
||||
return Commands
|
||||
return Commands
|
||||
|
||||
Reference in New Issue
Block a user