1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-14 10:13:13 +02:00

Merge pull request #763 from plague006/disable_command_search

Disable command search, and autoformat
This commit is contained in:
Matthew 2019-02-16 20:12:22 -05:00 committed by GitHub
commit 52ef181117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@ local Rank = require 'features.rank_system'
local Donator = require 'features.donator'
local format = string.format
local ceil = math.ceil
-- local ceil = math.ceil
local concat = table.concat
local pcall = pcall
local tostring = tostring
@ -154,7 +154,11 @@ local function server_time(_, player)
end
end
local function search_command(arguments)
local function search_command(arguments) -- TODO: Re-enable this when (locale) has been properly integrated
Game.player_print('Sorry, search is temporarily out of order')
return arguments -- return args so that we avoid a lint warning
--[[
local keyword = arguments.keyword
local p = Game.player_print
if #keyword < 2 then
@ -200,6 +204,7 @@ local function search_command(arguments)
p(format('[%d] /%s', i, matches[i]))
end
p(format('-------- Page %d / %d --------', page, pages))
--[[]]
end
local function list_seeds()
@ -255,7 +260,7 @@ local function print_player_info(args, player)
{'format.1_colon_2', 'Coin spent', PlayerStats.get_coin_spent(index)},
{'format.1_colon_2', 'Deaths', PlayerStats.get_death_count(index)},
{'format.1_colon_2', 'Crafted items', PlayerStats.get_crafted_item(index)},
{'format.1_colon_2', 'Chat messages', PlayerStats.get_console_chat(index)},
{'format.1_colon_2', 'Chat messages', PlayerStats.get_console_chat(index)}
}
Game.player_print(info_t)
@ -380,16 +385,23 @@ Command.add(
)
-- No man's land / free for all
Command.add('redmew-setting-set', {
Command.add(
'redmew-setting-set',
{
description = 'Set a setting for yourself',
arguments = {'setting_name', 'new_value'},
capture_excess_arguments = true,
}, function (arguments, player)
capture_excess_arguments = true
},
function(arguments, player)
local value
local setting_name = arguments.setting_name
local success, data = pcall(function()
local success,
data =
pcall(
function()
value = Settings.set(player.index, setting_name, arguments.new_value)
end)
end
)
if not success then
local i = data:find('%s')
@ -398,17 +410,25 @@ Command.add('redmew-setting-set', {
end
player.print(format('Changed "%s" to: "%s"', setting_name, value))
end)
end
)
Command.add('redmew-setting-get', {
Command.add(
'redmew-setting-get',
{
description = 'Display a setting value for yourself',
arguments = {'setting_name'},
}, function (arguments, player)
arguments = {'setting_name'}
},
function(arguments, player)
local value
local setting_name = arguments.setting_name
local success, data = pcall(function()
local success,
data =
pcall(
function()
value = Settings.get(player.index, setting_name)
end)
end
)
if not success then
local i = data:find('%s')
@ -417,12 +437,17 @@ Command.add('redmew-setting-get', {
end
player.print(format('Setting "%s" has a value of: "%s"', setting_name, value))
end)
end
)
Command.add('redmew-setting-all', {
description = 'Display all settings for yourself',
}, function (_, player)
Command.add(
'redmew-setting-all',
{
description = 'Display all settings for yourself'
},
function(_, player)
for name, value in pairs(Settings.all(player.index)) do
player.print(format('%s=%s', name, value))
end
end)
end
)