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

on-join -> welcome

This commit is contained in:
plague006 2019-02-22 17:28:41 -05:00
parent d4a6d2b237
commit ec7d638228
3 changed files with 16 additions and 14 deletions

View File

@ -11,12 +11,13 @@ local format = string.format
--- Saves the player's message
local function add_message(args, player, table_name)
local str = tostring(args.value)
if not str or str == 'false' then
if not str then
Game.player_print({'donator_commands.add_message_fail_not_string'}, Color.fail)
return
end
Donator.add_donator_message(player.name, table_name, str)
Game.player_print({'donator_commands.add_message_success'}, Color.success)
Game.player_print({'donator_commands.add_message_success', str}, Color.success)
end
--- Deletes one of the player's message
@ -38,12 +39,12 @@ end
--- Lists the player's messages
local function list_messages(player, table_name)
local messages = Donator.get_donator_messages(player.name, table_name)
if messages then
if messages and #messages > 0 then
for k, v in pairs(messages) do
Game.player_print(format('[%s] %s', k, v))
end
else
Game.player_print({'donator_commands.list_message_fail_no_messages'}, Color.warning)
Game.player_print({'donator_commands.list_message_no_messages'}, Color.info)
end
end
@ -61,8 +62,8 @@ local function command_path_decider(args, player, table_name)
end
--- Decides which function to call depending on the first arg to the command
local function donator_join_message_command(args, player)
local table_name = 'join_messages'
local function donator_welcome_message_command(args, player)
local table_name = 'welcome_messages'
command_path_decider(args, player, table_name)
end
@ -75,15 +76,15 @@ end
-- Commands
Command.add(
'donator-join-message',
'donator-welcome-message',
{
description = 'Adds, deletes, or lists donator on-join messages.',
description = 'Adds, deletes, or lists donator welcome messages.',
arguments = {'add|delete|list', 'value'},
default_values = {value = false},
capture_excess_arguments = true,
donator_only = true
},
donator_join_message_command
donator_welcome_message_command
)
Command.add(

View File

@ -29,13 +29,13 @@ whois_formatter=__1__\n__2__\n__3__\n__4__\n__5__\n__6__\n__7__\n__8__\n__9__\n_
[donator_commands]
add_message_fail_not_string=Must enter a value to set as message.
add_message_success=Join message added.
add_message_success=Message added: __1__
delete_message_fail_not_number=Must enter a number to delete.
delete_message_success=Message deleted: __1__
delete_message_fail_no_message=No message to delete.
list_message_fail_no_messages=No messages listed.
donator_message_wrong_arg1=Correct use: /donator-join-message add|delete|list
donator_join_message_help=Adds, deletes, or lists donator on-join messages.
list_message_no_messages=No messages listed.
donator_message_wrong_arg1=Correct use: /donator-welcome-message add|delete|list
donator_welcome_message_help=Adds, deletes, or lists donator on-welcome messages.
donator_death_message_help=Adds, deletes, or lists donator on-death messages.
[command]

View File

@ -158,5 +158,6 @@ return {
[30] = {r = 0.093, g = 0.768, b = 0.172}, -- admin
success = {r = 0, g = 255, b = 0},
warning = {r = 255, g = 255, b = 0},
fail = {r = 255, g = 0, b = 0}
fail = {r = 255, g = 0, b = 0},
info = {r = 255, g = 255, b = 255}
}