diff --git a/features/admin_commands.lua b/features/admin_commands.lua index 8745dd8f..8a353a8e 100644 --- a/features/admin_commands.lua +++ b/features/admin_commands.lua @@ -376,7 +376,7 @@ Event.add(defines.events.on_built_entity, built_entity) Command.add( 'a', { - description = 'Admin chat. Messages all other admins.', + description = {'command_description.a'}, arguments = {'msg'}, required_rank = Ranks.admin, capture_excess_arguments = true, @@ -388,7 +388,7 @@ Command.add( Command.add( 'dc', { - description = 'silent-command', + description = {'command_description.dc'}, arguments = {'str'}, required_rank = Ranks.admin, capture_excess_arguments = true, @@ -400,7 +400,7 @@ Command.add( Command.add( 'hax', { - description = 'Toggles your hax (makes recipes cost nothing)', + description = {'command_description.hax'}, required_rank = Ranks.admin }, toggle_cheat_mode @@ -409,7 +409,7 @@ Command.add( Command.add( 'regular', { - description = 'Gives a player the regualar rank.', + description = {'command_description.regular'}, arguments = {'player'}, required_rank = Ranks.admin, allowed_by_server = true @@ -420,7 +420,7 @@ Command.add( Command.add( 'regular-remove', { - description = 'Demotes a player from regular to the next lowest rank', + description = {'command_description.regular_remove'}, arguments = {'player'}, required_rank = Ranks.admin, allowed_by_server = true @@ -431,7 +431,7 @@ Command.add( Command.add( 'probation', { - description = 'Put player on probation. (They will be unable to use redmew commands and will never gain auto-trusted rank.)', + description = {'command_description.probation'}, arguments = {'player'}, required_rank = Ranks.admin, allowed_by_server = true @@ -442,7 +442,7 @@ Command.add( Command.add( 'probation-remove', { - description = 'Remove player from probation.', + description = {'command_description.probation_remove'}, arguments = {'player'}, required_rank = Ranks.admin, allowed_by_server = true @@ -453,7 +453,7 @@ Command.add( Command.add( 'showreports', { - description = 'Shows user reports', + description = {'command_description.showreports'}, required_rank = Ranks.admin }, show_reports @@ -462,7 +462,7 @@ Command.add( Command.add( 'jail', { - description = 'Puts a player in jail', + description = {'command_description.jail'}, arguments = {'player'}, required_rank = Ranks.admin, allowed_by_server = true @@ -473,7 +473,7 @@ Command.add( Command.add( 'unjail', { - description = 'Removes a player from jail', + description = {'command_description.unjail'}, arguments = {'player'}, required_rank = Ranks.admin, allowed_by_server = true @@ -484,7 +484,7 @@ Command.add( Command.add( 'tempban', { - description = 'Temporarily bans a player', + description = {'command_description.tempban'}, arguments = {'player', 'minutes'}, required_rank = Ranks.admin, allowed_by_server = true @@ -495,7 +495,7 @@ Command.add( Command.add( 'pool', { - description = 'Spawns a pool of water', + description = {'command_description.pool'}, required_rank = Ranks.admin }, pool @@ -504,7 +504,7 @@ Command.add( Command.add( 'invoke', { - description = 'Teleports the player to you.', + description = {'command_description.invoke'}, arguments = {'player'}, required_rank = Ranks.admin }, @@ -526,7 +526,7 @@ Command.add( Command.add( 'revive-ghosts', { - description = 'Revives the ghosts within the provided radius around you', + description = {'command_description.revive_ghosts'}, arguments = {'radius'}, default_values = {radius = 10}, required_rank = Ranks.admin @@ -537,7 +537,7 @@ Command.add( Command.add( 'destroy', { - description = 'Destroys the entity under your cursor when you run this command', + description = {'command_description.destroy'}, required_rank = Ranks.admin }, destroy_selected diff --git a/features/apocalypse.lua b/features/apocalypse.lua index bf886831..39e50a62 100644 --- a/features/apocalypse.lua +++ b/features/apocalypse.lua @@ -103,8 +103,8 @@ end Command.add( 'apocalypse', { - description = "This really ends the map. When you first run it, the game will save. When run a second time, the apocalypse will begin.", - required_rank = Ranks.admin, + description = {'command_description.apocalypse'}, + required_rank = Ranks.admin }, Public.begin_apocalypse ) diff --git a/features/create_particles.lua b/features/create_particles.lua index e7b19338..b0023cbc 100644 --- a/features/create_particles.lua +++ b/features/create_particles.lua @@ -53,7 +53,7 @@ Event.on_nth_tick(63, function () end) Command.add('particle-scale', { - description = 'Provide a fraction between 0 and 1 to lower or increase the amount of (max) particles. Leave empty to view the current values.', + description = {'command_description.particle_scale'}, arguments = {'fraction'}, default_values = {fraction = false}, required_rank = Ranks.admin, diff --git a/features/donator_commands.lua b/features/donator_commands.lua index a4010203..8f6273ee 100644 --- a/features/donator_commands.lua +++ b/features/donator_commands.lua @@ -78,7 +78,7 @@ end Command.add( 'donator-welcome-message', { - description = 'Adds, deletes, or lists donator welcome messages.', + description = {'command_description.donator_welcome_message'}, arguments = {'add|delete|list', 'value'}, default_values = {value = false}, capture_excess_arguments = true, @@ -90,7 +90,7 @@ Command.add( Command.add( 'donator-death-message', { - description = 'Adds, deletes, or lists donator death messages.', + description = {'command_description.donator_death_message'}, arguments = {'add|delete|list', 'value'}, default_values = {value = false}, capture_excess_arguments = true, diff --git a/features/gui/camera.lua b/features/gui/camera.lua index bb6a09b0..672cc3d5 100644 --- a/features/gui/camera.lua +++ b/features/gui/camera.lua @@ -193,7 +193,7 @@ end Command.add( 'watch', { - description = 'Allows you to watch other players.', + description = {'command_description.watch'}, arguments = {'target'}, default_values = {target = false} }, diff --git a/features/gui/debug/command.lua b/features/gui/debug/command.lua index 24a39949..93f36a5e 100644 --- a/features/gui/debug/command.lua +++ b/features/gui/debug/command.lua @@ -4,8 +4,8 @@ local Command = require 'utils.command' Command.add( 'debug', { - debug_only = true, - description = 'Opens the debugger' + description = {'command_descriptiondebuger'}, + debug_only = true }, function(_, player) DebugView.open_dubug(player) diff --git a/features/gui/info.lua b/features/gui/info.lua index 4d2517a4..5c410ced 100644 --- a/features/gui/info.lua +++ b/features/gui/info.lua @@ -20,7 +20,6 @@ local focus_color = Color.dark_orange local unfocus_color = Color.black local reward_amount = 2 -local reward_plural_indicator = reward_amount > 1 and 's' or '' local reward_token = PlayerRewards.get_reward() local info_tab_flags = { 0x1, -- welcome @@ -81,8 +80,7 @@ end local changelog_callback = Token.register(process_changelog) local function prepare_title() - local welcome_title = - [[ + local welcome_title = [[ 111111 1111111 111111 111 111 1111111 11 11 11 11 11 11 11 1111 1111 11 11 11 111111 11111 11 11 11 1111 11 11111 11 1 11 @@ -182,54 +180,29 @@ local pages = { parent_style = parent.style parent_style.vertically_stretchable = false - header_label(parent, 'Welcome to Redmew!') - centered_label( - parent, - [[ -Redmew is a community for players of all skill levels committed to pushing the limits of Factorio Multiplayer through custom scripts and crazy map designs. + header_label(parent, {'info.welcome_header'}) + centered_label(parent, {'info.welcome_text'}) -We are a friendly bunch, our objective is to have as much fun as possible and we hope you will too. - ]] - ) - - header_label(parent, 'How To Chat') - centered_label( - parent, - [[ -To chat with other players, press the "grave" key on your keyboard. -It is below the ESC key on English keyboards and looks like ~ or ` -This can be changed in options -> controls -> "toggle lua console". - ]] - ) + header_label(parent, {'info.chatting_header'}) + centered_label(parent, {'info.chatting_text', {'gui-menu.settings'}, {'gui-menu.controls'}, {'controls.toggle-console'}}) if config_prewards.enabled and config_prewards.info_player_reward then - local string = - format( - 'You have been given %s %s%s for looking at the welcome tab.\nChecking each tab will reward you %s more %s%s.\n', - reward_amount, - reward_token, - reward_plural_indicator, - reward_amount, - reward_token, - reward_plural_indicator - ) - header_label(parent, 'Free Coins') - centered_label(parent, string) + header_label(parent, {'info.free_coin_header'}) + centered_label(parent, {'info.free_coin_text', reward_amount, reward_token, reward_amount, reward_token}) end - header_label(parent, 'Useful Links') - centered_label(parent, [[Check out our discord for new map info and to suggest new maps / ideas.]]) + header_label(parent, {'info.links_header'}) + centered_label(parent, {'info.links_discord'}) local discord_textbox_flow = parent.add {type = 'flow'} local discord_textbox_flow_style = discord_textbox_flow.style discord_textbox_flow_style.horizontal_align = 'center' discord_textbox_flow_style.horizontally_stretchable = true discord_textbox_flow.add({type = 'label', caption = 'Discord: '}).style.font = 'default-bold' - local discord_textbox = - discord_textbox_flow.add {type = 'text-box', text = 'https://www.redmew.com/discord '} + local discord_textbox = discord_textbox_flow.add {type = 'text-box', text = 'https://www.redmew.com/discord '} discord_textbox.read_only = true discord_textbox.style.width = 235 discord_textbox.style.height = 28 - centered_label(parent, 'Contribute to our Patreon to receive special perks and help maintain our servers.') + centered_label(parent, {'info.links_patreon'}) local patreon_flow = parent.add {type = 'flow', direction = 'horizontal'} local patreon_flow_style = patreon_flow.style patreon_flow_style.horizontal_align = 'center' @@ -239,7 +212,7 @@ This can be changed in options -> controls -> "toggle lua console". patreon_textbox.read_only = true patreon_textbox.style.width = 235 patreon_textbox.style.height = 28 - centered_label(parent, 'Download our maps, start and finish state, from our website.') + centered_label(parent, {'info.links_saves'}) local save_textbox_flow = parent.add {type = 'flow'} local save_textbox_flow_style = save_textbox_flow.style save_textbox_flow_style.horizontal_align = 'center' @@ -249,14 +222,13 @@ This can be changed in options -> controls -> "toggle lua console". save_textbox.read_only = true save_textbox.style.width = 235 save_textbox.style.height = 28 - centered_label(parent, 'View our past maps as a Google Map.') + centered_label(parent, {'info.links_factoriomaps'}) local maps_textbox_flow = parent.add {type = 'flow'} local maps_textbox_flow_style = maps_textbox_flow.style maps_textbox_flow_style.horizontal_align = 'center' maps_textbox_flow_style.horizontally_stretchable = true maps_textbox_flow.add({type = 'label', caption = 'Maps: '}).style.font = 'default-bold' - local maps_textbox = - maps_textbox_flow.add {type = 'text-box', text = 'https://factoriomaps.com/browse/redmew.html '} + local maps_textbox = maps_textbox_flow.add {type = 'text-box', text = 'https://factoriomaps.com/browse/redmew.html '} maps_textbox.read_only = true maps_textbox.style.width = 315 maps_textbox.style.height = 28 @@ -284,23 +256,14 @@ This can be changed in options -> controls -> "toggle lua console". parent_style.vertically_stretchable = false parent_style.width = 600 - header_label(parent, 'Rules') + header_label(parent, {'info.rules_header'}) - centered_label( - parent, - [[ -Have fun and play nice. Remember we are all just here to have fun so let’s keep it that way. - -No hateful content or personal attacks. - -If you suspect someone is griefing, notify the admin team by using /report or by clicking the report button next to the player in the player list. - ]] - ) + centered_label(parent, {'info.rules_text'}) end }, { tab_button = function(parent) - local button = parent.add {type = 'button', name = tab_button_name, caption = 'Map Info'} + local button = parent.add {type = 'button', name = tab_button_name, caption = {'info.map_info_button'}} return button end, content = function(parent, player) @@ -312,7 +275,7 @@ If you suspect someone is griefing, notify the admin team by using /report or by top_flow_style.horizontal_align = 'center' top_flow_style.horizontally_stretchable = true - local top_label = top_flow.add {type = 'label', caption = 'Map Information'} + local top_label = top_flow.add {type = 'label', caption = {'info.map_info_header'}} local top_label_style = top_label.style top_label_style.font = 'default-dialog-button' @@ -320,7 +283,7 @@ If you suspect someone is griefing, notify the admin team by using /report or by local grid_style = grid.style grid_style.horizontally_stretchable = true - grid.add {type = 'label', caption = 'Map name: '} + grid.add {type = 'label', caption = {'info.map_name_label'}} local map_name_textbox = grid.add({type = 'flow'}).add { type = 'text-box', @@ -336,7 +299,7 @@ If you suspect someone is griefing, notify the admin team by using /report or by Gui.set_data(map_name_textbox, map_name_key) - grid.add {type = 'label', caption = 'Map description: '} + grid.add {type = 'label', caption = {'info.map_desc_label'}} local map_description_textbox = grid.add({type = 'flow'}).add { type = 'text-box', @@ -354,7 +317,7 @@ If you suspect someone is griefing, notify the admin team by using /report or by Gui.set_data(map_description_textbox, map_description_key) - grid.add {type = 'label', caption = 'Extra Info: '} + grid.add {type = 'label', caption = {'info.map_extra_info_label'}} local map_extra_info_textbox = grid.add({type = 'flow'}).add { type = 'text-box', @@ -373,7 +336,7 @@ If you suspect someone is griefing, notify the admin team by using /report or by }, { tab_button = function(parent) - local button = parent.add {type = 'button', name = tab_button_name, caption = 'Scenario Mods'} + local button = parent.add {type = 'button', name = tab_button_name, caption = {'info.softmods_button'}} return button end, content = function(parent, player) @@ -391,7 +354,7 @@ If you suspect someone is griefing, notify the admin team by using /report or by parent_style = parent.style parent_style.vertically_stretchable = true - header_label(parent, 'Soft Mods and Server Plugins') + header_label(parent, {'info.softmods_header'}) local grid = parent.add {type = 'table', column_count = 3} local grid_style = grid.style @@ -407,16 +370,12 @@ If you suspect someone is griefing, notify the admin team by using /report or by local ranks_label = ranks_flow.add { type = 'label', - caption = [[ -We have a basic rank system to prevent griefing. You can't use nukes or the -deconstruction planner if you are a guest. If you play for a couple of hours an -admin will promote you to regular. You may also ask an admin for a promotion if -you're working on a project which requires it.]] + caption = {'info.softmods_rank_text'} } local ranks_label_style = ranks_label.style ranks_label_style.single_line = false local player_rank_flow = ranks_flow.add {type = 'flow', direction = 'horizontal'} - player_rank_flow.add {type = 'label', caption = 'Your rank is:'} + player_rank_flow.add {type = 'label', caption = {'info.softmods_rank_is'}} local player_name = player.name local rank_label = player_rank_flow.add {type = 'label', caption = Rank.get_player_rank_name(player_name)} @@ -428,61 +387,47 @@ you're working on a project which requires it.]] end grid.add {type = 'sprite', sprite = 'entity/market'} - local market = grid.add {type = 'label', caption = 'Market'} + local market = grid.add {type = 'label', caption = {'info.softmods_market_label'}} market.style.font = 'default-listbox' local market_label = grid.add { type = 'label', - caption = [[ -On most maps you will find a market near spawn where you can use coins to -make purchases. Coins are acquired by chopping trees, hand crafting items and -destroying biter nests. Most items in the market are constant but some are -map-specific (usually landfill) and will rotate in and out from time to time.]] + caption = {'info.softmods_market_text'} } market_label.style.single_line = false grid.add {type = 'sprite', sprite = 'item/small-plane'} - local train_savior = grid.add {type = 'label', caption = 'Train\nsavior'} + local train_savior = grid.add {type = 'label', caption = {'info.softmods_saviour_label'}} local train_savior_style = train_savior.style train_savior_style.font = 'default-listbox' train_savior_style.single_line = false local train_savior_label = grid.add { type = 'label', - caption = [[ -Trains are a factorio players' worst enemy. If you have at least one small plane -in your inventory and would be killed by a train, your life will be spared -but you will lose a small plane. You can get planes from the market. - ]] + caption = {'info.softmods_saviour_text'} } train_savior_label.style.single_line = false if config.player_list.enabled then grid.add {type = 'sprite', sprite = 'entity/player'} - local player_list = grid.add {type = 'label', caption = 'Player\nlist'} + local player_list = grid.add {type = 'label', caption = {'info.softmods_plist_label'}} player_list.style.font = 'default-listbox' player_list.style.single_line = false local player_list_label = grid.add { type = 'label', - caption = [[ -Lists all players on the server and shows some stats. You can sort the list by -clicking on the column headers. You can also poke people, which throws a random -noun in the chat.]] + caption = {'info.softmods_plist_text'} } player_list_label.style.single_line = false end if config.poll.enabled then grid.add {type = 'sprite', sprite = 'item/programmable-speaker'} - local poll = grid.add {type = 'label', caption = 'Polls'} + local poll = grid.add {type = 'label', caption = {'info.softmods_polls_label'}} poll.style.font = 'default-listbox' local poll_label = grid.add { type = 'label', - caption = [[ -Polls help players get consensus for major actions. Want to improve an important -build? Make a poll to check everyone is ok with that. You need to be a regular -to make new polls.]] + caption = {'info.softmods_polls_text'} } poll_label.style.single_line = false end @@ -492,36 +437,31 @@ to make new polls.]] local tag_button_style = tag_button.style tag_button_style.font = 'default-listbox' tag_button_style.font_color = Color.black - local tag = grid.add {type = 'label', caption = 'Tags'} + local tag = grid.add {type = 'label', caption = {'info.softmods_tags_label'}} tag.style.font = 'default-listbox' local tag_label = grid.add { type = 'label', - caption = [[ -You can assign yourself a role with tags to let other players know what you are -doing. Or just use the tag as decoration. Regulars can create new custom tags, -be sure to show off your creatively.]] + caption = {'info.softmods_tags_text'} } tag_label.style.single_line = false end if config.tasklist.enabled then grid.add {type = 'sprite', sprite = 'item/repair-pack'} - local task = grid.add {type = 'label', caption = 'Tasks'} + local task = grid.add {type = 'label', caption = {'info.softmods_tasks_label'}} task.style.font = 'default-listbox' local task_label = grid.add { type = 'label', - caption = [[ -Not sure what you should be working on, why not look at the tasks and see what -needs doing. Regulars can add new tasks.]] + caption = {'info.softmods_tasks_text'} } task_label.style.single_line = false end if config.blueprint_helper.enabled then grid.add {type = 'sprite', sprite = 'item/blueprint'} - local blueprint = grid.add {type = 'label', caption = 'BP\nhelper'} + local blueprint = grid.add {type = 'label', caption = {'info.softmods_bp_label'}} local blueprint_style = blueprint.style blueprint_style.font = 'default-listbox' blueprint_style.single_line = false @@ -529,22 +469,19 @@ needs doing. Regulars can add new tasks.]] local blueprint_label = grid.add { type = 'label', - caption = [[ -The Blueprint helper™ lets you flip blueprints horizontally or vertically and lets you -converter the entities used in the blueprint e.g. turn yellow belts into red belts.]] + caption = {'info.softmods_bp_text'} } blueprint_label.style.single_line = false end if config.score.enabled then grid.add {type = 'sprite', sprite = 'item/rocket-silo'} - local score = grid.add {type = 'label', caption = 'Score'} + local score = grid.add {type = 'label', caption = {'info.softmods_score_label'}} score.style.font = 'default-listbox' local score_label = grid.add { type = 'label', - caption = [[ -Shows number of rockets launched and biters liberated.]] + caption = {'info.softmods_score_text'} } score_label.style.single_line = false end @@ -552,7 +489,7 @@ Shows number of rockets launched and biters liberated.]] }, { tab_button = function(parent) - local button = parent.add {type = 'button', name = tab_button_name, caption = "What's New"} + local button = parent.add {type = 'button', name = tab_button_name, caption = {'info.whats_new_button'}} return button end, content = function(parent, player) @@ -667,7 +604,7 @@ local function draw_main_frame(center, player) bottom_flow_style.top_padding = 8 bottom_flow_style.horizontally_stretchable = true - bottom_flow.add {type = 'button', name = main_button_name, caption = 'Close'} + bottom_flow.add {type = 'button', name = main_button_name, caption = {'common.close_button'}} player.opened = frame end @@ -793,15 +730,8 @@ Gui.on_click( Gui.clear(content) pages[index].content(content, player) - local string = - format( - '%s %s%s awarded for reading a tab on the info screen.', - reward_amount, - reward_token, - reward_plural_indicator - ) if rewarded_players[player.index] then - reward_player(player, index, string) + reward_player(player, index, {'info.free_coin_print', reward_amount, reward_token}) end end ) diff --git a/features/gui/poll.lua b/features/gui/poll.lua index 7d14c31e..ea30490e 100644 --- a/features/gui/poll.lua +++ b/features/gui/poll.lua @@ -1329,11 +1329,11 @@ end Command.add( 'poll', { + description = {'command_description.poll'}, arguments = {'poll'}, required_rank = Ranks.regular, allowed_by_server = true, - description = 'Creates a new poll', - custom_help_text = '<{question = "question", answers = {"answer 1", "answer 2"}, duration = 300}>', + custom_help_text = {'command_custom_help.poll'}, log_command = true, capture_excess_arguments = true }, @@ -1343,7 +1343,7 @@ Command.add( Command.add( 'poll-result', { - description = 'Prints the result for the given poll number.', + description = {'command_description.poll_result'}, arguments = {'poll'}, allowed_by_server = true }, diff --git a/features/gui/popup.lua b/features/gui/popup.lua index 92eb959a..59016617 100644 --- a/features/gui/popup.lua +++ b/features/gui/popup.lua @@ -145,7 +145,7 @@ end Command.add( 'popup', { - description = 'Shows a popup to all connected players', + description = {'command_description.popup'}, arguments = {'message'}, required_rank = Ranks.admin, capture_excess_arguments = true, @@ -157,7 +157,7 @@ Command.add( Command.add( 'popup-update', { - description = 'Shows an update popup to all connected players', + description = {'command_description.popup_update'}, arguments = {'version'}, required_rank = Ranks.admin, capture_excess_arguments = true, @@ -169,7 +169,7 @@ Command.add( Command.add( 'popup-player', { - description = 'Shows a popup to the player.', + description = {'command_description.popup_player'}, arguments = {'player', 'message'}, required_rank = Ranks.admin, capture_excess_arguments = true, diff --git a/features/gui/tag_group.lua b/features/gui/tag_group.lua index e1125c80..5edb3717 100644 --- a/features/gui/tag_group.lua +++ b/features/gui/tag_group.lua @@ -688,7 +688,7 @@ end Command.add( 'tag', { - description = "Sets a player's tag", + description = {"command_description.tag"}, arguments = {'player', 'tag'}, required_rank = Ranks.admin, capture_excess_arguments = true, diff --git a/features/gui/tasklist.lua b/features/gui/tasklist.lua index aaef636e..75bfbace 100644 --- a/features/gui/tasklist.lua +++ b/features/gui/tasklist.lua @@ -1075,7 +1075,7 @@ Gui.allow_player_to_toggle_top_element_visibility(main_button_name) Command.add( 'task', { - description = 'Creates a new task.', + description = {'command_description.task'}, arguments = {'task'}, required_rank = Ranks.regular, allowed_by_server = true, diff --git a/features/gui/toast.lua b/features/gui/toast.lua index abdac854..ba611701 100644 --- a/features/gui/toast.lua +++ b/features/gui/toast.lua @@ -11,7 +11,6 @@ local Ranks = require 'resources.ranks' local pairs = pairs local next = next -local format = string.format local toast_volume_name = 'toast-volume' Settings.register(toast_volume_name, 'fraction', 1.0) @@ -255,7 +254,7 @@ end Command.add( 'toast', { - description = 'Sends a toast to all players', + description = {'command_description.toast'}, arguments = {'msg'}, capture_excess_arguments = true, required_rank = Ranks.admin, @@ -263,14 +262,14 @@ Command.add( }, function(args) Public.toast_all_players(15, args.msg) - Utils.print_admins(format('%s sent a toast to all players', Utils.get_actor())) + Utils.print_admins({'command_description.sent_all_toast', Utils.get_actor()}) end ) Command.add( 'toast-player', { - description = 'Sends a toast to a specific player', + description = {'command_description.toast_player'}, arguments = {'player', 'msg'}, capture_excess_arguments = true, required_rank = Ranks.admin, @@ -281,7 +280,7 @@ Command.add( local target = game.players[target_name] if target then Public.toast_player(target, 15, args.msg) - Utils.print_admins(format('%s sent a toast to %s', Utils.get_actor(), target_name)) + Utils.print_admins({'command_description.sent_player_toast', Utils.get_actor(), target_name}) else Game.player_print({'common.fail_no_target', target_name}, Color.yellow) end diff --git a/features/lazy_bastard.lua b/features/lazy_bastard.lua index 8b20c3a6..7141649c 100644 --- a/features/lazy_bastard.lua +++ b/features/lazy_bastard.lua @@ -105,7 +105,7 @@ Event.add(defines.events.on_built_entity, function(event) end) Command.add('lazy-bastard-bootstrap', { - description = 'Puts down the minimum requirements to get started', + description = {'command_description.lazy_bastard_bootstrap'}, required_rank = Ranks.admin, }, function(_, player) local surface = player.surface diff --git a/features/market.lua b/features/market.lua index 6e4a4967..77522ed5 100644 --- a/features/market.lua +++ b/features/market.lua @@ -312,7 +312,7 @@ end Command.add( 'market', { - description = 'Places a market near you. Use /market removeall to remove all markets on a map', + description = {'command_description.market'}, arguments = {'removeall'}, default_values = {removeall = false}, required_rank = Ranks.admin diff --git a/features/performance.lua b/features/performance.lua index 69cab2c3..4ca23c33 100644 --- a/features/performance.lua +++ b/features/performance.lua @@ -7,26 +7,29 @@ local format = string.format local Performance = {} local mining_efficiency = { - active_modifier = 0, + active_modifier = 0 } local craft_bonus = { - active_modifier = 0, + active_modifier = 0 } local running_bonus = { - active_modifier = 0, + active_modifier = 0 } -Global.register({ - mining_efficiency = mining_efficiency, - craft_bonus = craft_bonus, - running_bonus = running_bonus -}, function(tbl) - mining_efficiency = tbl.mining_efficiency - craft_bonus = tbl.craft_bonus - running_bonus = tbl.running_bonus -end) +Global.register( + { + mining_efficiency = mining_efficiency, + craft_bonus = craft_bonus, + running_bonus = running_bonus + }, + function(tbl) + mining_efficiency = tbl.mining_efficiency + craft_bonus = tbl.craft_bonus + running_bonus = tbl.running_bonus + end +) ---Sets the scale of performance. ---1 means the game runs at normal game speed with normal walking speed @@ -63,7 +66,7 @@ end Command.add( 'performance-scale-set', { - description = 'Sets the performance scale between 0.05 and 1. Will alter the game speed, manual mining speed, manual crafting speed and character running speed per force.', + description = {'command_description.performance_scale_set'}, arguments = {'scale'}, required_rank = Ranks.admin, allowed_by_server = true @@ -71,31 +74,31 @@ Command.add( function(arguments, player) local scale = tonumber(arguments.scale) if scale == nil or scale < 0.05 or scale > 1 then - player.print('Scale must be a valid number ranging from 0.05 to 1') + player.print({'performance.fail_wrong_argument'}) return end Performance.set_time_scale(scale) local p = game.print local stat_mod = Performance.get_player_stat_modifier() - p('## - Game speed changed to compensate for UPS drops and players trying to catch up.') - p(format('## - Game speed: %.2f', Performance.get_time_scale())) - p(format('## - Running speed: %.2f', stat_mod)) - p(format('## - Manual mining speed: %.2f', stat_mod)) - p(format('## - Manual crafting speed: %.2f', stat_mod)) + p({'performance.stat_preamble'}) + p({'performance.generic_stat', {'performance.game_speed'}, format('%.2f', Performance.get_time_scale())}) + local stat_string = format('%.2f', stat_mod) + p({'performance.output_formatter', {'performance.game_speed'}, stat_string, {'performance.manual_mining_speed'}, stat_string, {'performance.manual_crafting_speed'}, stat_string}) end ) Command.add( 'performance-scale-get', { - description = 'Shows the current performance scale.' + description = {'command_description.performance_scale_get'} }, function(_, player) local p = player.print local stat_mod = Performance.get_player_stat_modifier() - p(format('Game speed: %.2f', Performance.get_time_scale())) - p(format('Running speed: %.2f -- mining speed: %.2f -- crafting speed: %.2f', stat_mod, stat_mod, stat_mod)) + p({'performance.generic_stat', {'performance.game_speed'}, format('%.2f', Performance.get_time_scale())}) + local stat_string = format('%.2f', stat_mod) + p({'performance.output_formatter', {'performance.game_speed'}, stat_string, {'performance.manual_mining_speed'}, stat_string, {'performance.manual_crafting_speed'}, stat_string}) end ) diff --git a/features/player_colors.lua b/features/player_colors.lua index 53fffb9e..99715b96 100644 --- a/features/player_colors.lua +++ b/features/player_colors.lua @@ -43,7 +43,7 @@ end Command.add( 'redmew-color', { - description = 'Set will save your current color for future maps. Reset will erase your saved color. Random will give you a random color.', + description = {'command_description.redmew_color'}, arguments = {'set-reset-random'}, required_rank = Ranks.regular }, @@ -56,16 +56,16 @@ Command.add( chat_color = player.chat_color } Server.set_data('colors', player_name, data) - player.print('Your color has been saved. Any time you join a redmew server your color will automatically be set.') - Utils.print_except(player_name .. ' has saved their color server-side for future maps. You can do the same! Check out /help redmew-color', player) + player.print({'player_colors.color_saved'}) + Utils.print_except({'player_colors.color_saved_advert, player'}) elseif arg == 'reset' then Server.set_data('colors', player_name, nil) - player.print('Your saved color (if you had one) has been removed.') + player.print({'player_colors.color_reset'}) elseif arg == 'random' then local color_data = Public.set_random_color(player) - player.print('Your color has been changed to: ' .. serialize(color_data)) + player.print({'player_colors.color_random', serialize(color_data)}) else - player.print('Only set, reset, and random are accepted arguments') + player.print({'player_colors.fail_wrong_argument'}) end end ) diff --git a/features/reactor_meltdown.lua b/features/reactor_meltdown.lua index 3bb146b0..c45c18a9 100644 --- a/features/reactor_meltdown.lua +++ b/features/reactor_meltdown.lua @@ -7,8 +7,8 @@ local Event = require 'utils.event' local Game = require 'utils.game' local Command = require 'utils.command' local Global = require 'utils.global' - local Ranks = require 'resources.ranks' +local Color = require 'resources.color_presets' local primitives = {reactors_enabled = global.config.reactor_meltdown.on_by_default} local wastelands = {} @@ -164,40 +164,48 @@ local function entity_build(event) end end -local function reactor_toggle() - primitives.reactors_enabled = not primitives.reactors_enabled +--- Prints whether meltdown is on or off +local function get_meltdown() if primitives.reactors_enabled then - game.print('Reactor meltdown activated.') + Game.player_print({'meltdown.is_enabled'}) else - game.print('Reactor meltdown deactivated.') + Game.player_print({'meltdown.is_disabled'}) end end -local function is_meltdown() - if primitives.reactors_enabled then - Game.player_print('Reactor meltdown is enabled.') +--- Toggles meltdown on or off +local function set_meltdown(args) + local on_off = args['on|off'] + if on_off == 'on' then + primitives.reactors_enabled = true + game.print({'meltdown.enable'}) + elseif on_off == 'off' then + primitives.reactors_enabled = nil + game.print({'meltdown.disable'}) else - Game.player_print('Reactor meltdown is disabled.') + Game.player_print({'meltdown.error_not_on_off'}, Color.fail) end end + Command.add( - 'meltdown', + 'meltdown-get', { - description = 'Toggles if reactors blow up', - required_rank = Ranks.admin, - allowed_by_server = true, - log_command = true + description = {'command_description.meltdown_get'}, + allowed_by_server = true }, - reactor_toggle + get_meltdown ) Command.add( - 'is-meltdown', + 'meltdown-set', { - description = 'Prints if meltdown is enabled', - allowed_by_server = true + description = {'command_description.meltdown_set'}, + arguments = {'on|off'}, + allowed_by_server = true, + required_rank = Ranks.admin, + log_command = true }, - is_meltdown + set_meltdown ) Event.on_nth_tick(60, on_tick) diff --git a/features/redmew_commands.lua b/features/redmew_commands.lua index b4d7a381..8cd1a881 100644 --- a/features/redmew_commands.lua +++ b/features/redmew_commands.lua @@ -10,7 +10,6 @@ local Rank = require 'features.rank_system' local Donator = require 'features.donator' local format = string.format --- local ceil = math.ceil local concat = table.concat local pcall = pcall local tostring = tostring @@ -154,59 +153,6 @@ local function server_time(_, player) end end -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 - p('Keyword should be 2 characters or more') - return - end - - local per_page = 7 - local matches = Command.search(keyword) - local count = #matches - - if count == 0 then - p('---- 0 Search Results ----') - p(format('No commands found matching "%s"', keyword)) - p('-------------------------') - return - end - - local page = tonumber(arguments.page) - local pages = ceil(count / per_page) - - if nil == page then - p('Page should be a valid number') - return - end - - -- just show the last page - if page > pages then - page = pages - end - - if page < 1 then - page = 1 - end - - local page_start = per_page * (page - 1) + 1 - local page_end = per_page * page - page_end = page_end <= count and page_end or count - - p(format('---- %d Search %s -----', count, count == 1 and 'Result' or 'Results')) - p(format('Searching for: "%s"', keyword)) - for i = page_start, page_end do - p(format('[%d] /%s', i, matches[i])) - end - p(format('-------- Page %d / %d --------', page, pages)) - --[[]] -end - local function list_seeds() local seeds = {} local count_of_seeds = 0 @@ -278,7 +224,7 @@ end Command.add( 'kill', { - description = 'Will kill you.', + description = {'command_description.kill'}, arguments = {'player'}, default_values = {player = false}, allowed_by_server = true @@ -289,7 +235,7 @@ Command.add( Command.add( 'afk', { - description = 'Shows how long players have been afk.', + description = {'command_description.afk'}, allowed_by_server = true }, afk @@ -298,7 +244,7 @@ Command.add( Command.add( 'zoom', { - description = 'Sets your zoom.', + description = {'command_description.zoom'}, arguments = {'zoom'} }, zoom @@ -307,7 +253,7 @@ Command.add( Command.add( 'find', { - description = 'shows an alert on the map where the player is located', + description = {'command_description.find'}, arguments = {'player'} }, find_player @@ -316,7 +262,7 @@ Command.add( Command.add( 'show-rail-block', { - description = 'Toggles rail block visualisation.' + description = {'command_description.show_rail_block'} }, show_rail_block ) @@ -324,27 +270,16 @@ Command.add( Command.add( 'server-time', { - description = "Prints the server's time.", + description = {"command_description.server_time"}, allowed_by_server = true }, server_time ) -Command.add( - 'search-command', - { - description = 'Search for commands matching the keyword in name or description', - arguments = {'keyword', 'page'}, - default_values = {page = 1}, - allowed_by_server = true - }, - search_command -) - Command.add( 'seeds', { - description = 'List the seeds of all surfaces', + description = {'command_description.seeds'}, allowed_by_server = true }, list_seeds @@ -353,7 +288,7 @@ Command.add( Command.add( 'redmew-version', { - description = 'Prints the version of the RedMew scenario', + description = {'command_description.redmew_version'}, allowed_by_server = true }, print_version @@ -362,7 +297,7 @@ Command.add( Command.add( 'whois', { - description = 'provides information about a given player, admins can see the inventory of a player by adding "yes" as a second argument', + description = {'command_description.whois'}, arguments = {'player', 'inventory'}, default_values = {inventory = false}, allowed_by_server = true @@ -374,7 +309,7 @@ Command.add( Command.add( 'redmew-setting-set', { - description = 'Set a setting for yourself', + description = {'command_description.redmew_setting_set'}, arguments = {'setting_name', 'new_value'}, capture_excess_arguments = true }, @@ -402,7 +337,7 @@ Command.add( Command.add( 'redmew-setting-get', { - description = 'Display a setting value for yourself', + description = {'command_description.redmew_setting_get'}, arguments = {'setting_name'} }, function(arguments, player) @@ -429,7 +364,7 @@ Command.add( Command.add( 'redmew-setting-all', { - description = 'Display all settings for yourself' + description = {'command_description.redmew_setting_all'}, }, function(_, player) for name, value in pairs(Settings.all(player.index)) do diff --git a/features/report.lua b/features/report.lua index 3e3890d1..28bf856e 100644 --- a/features/report.lua +++ b/features/report.lua @@ -428,7 +428,7 @@ Gui.on_click( Command.add( 'report', { - description = 'Reports a user to admins', + description = {'command_description.report'}, arguments = {'player', 'message'}, capture_excess_arguments = true }, diff --git a/features/scenario_data_manipulation.lua b/features/scenario_data_manipulation.lua index 4219062c..0cb574e8 100644 --- a/features/scenario_data_manipulation.lua +++ b/features/scenario_data_manipulation.lua @@ -145,7 +145,7 @@ end Command.add( 'dataset-copy', { - description = 'Copies a dataset', + description = {'command_description.dataset_copy'}, arguments = {'dataset', 'destination'}, required_rank = Ranks.admin, debug_only = true, @@ -157,7 +157,7 @@ Command.add( Command.add( 'dataset-move', { - description = 'Moves a dataset', + description = {'command_description.dataset_move'}, arguments = {'dataset', 'destination'}, required_rank = Ranks.admin, debug_only = true, @@ -169,7 +169,7 @@ Command.add( Command.add( 'dataset-delete', { - description = 'Deletes a dataset', + description = {'command_description.dataset_delete'}, arguments = {'dataset'}, required_rank = Ranks.admin, debug_only = true, @@ -276,7 +276,7 @@ end Command.add( 'dataset-transform', { - description = 'Transforms a dataset and writes it to the target dataset. Calls global.transform_function and sends the table of entries while expecting a table to return.', + description = {'command_description.dataset_transform'}, arguments = {'dataset', 'destination'}, required_rank = Ranks.admin, debug_only = true, @@ -288,7 +288,7 @@ Command.add( Command.add( 'dataset-transform-test', { - description = 'Shows the resulting data set from a transform operation. See /help dataset-transform for more information.', + description = {'command_description.dataset_transform_test'}, arguments = {'dataset'}, required_rank = Ranks.admin, debug_only = true, diff --git a/locale/en/redmew_command_text.cfg b/locale/en/redmew_command_text.cfg index 0352951b..3c06efa0 100644 --- a/locale/en/redmew_command_text.cfg +++ b/locale/en/redmew_command_text.cfg @@ -1,7 +1,71 @@ # This file holds all the locale strings for command help and descriptions +# Ideally, string keys match command names (with - turned to _) [command_description] +reward=Gives a reward to a target player (removes if quantity is negative) +diggy_clear_void=Clears the void in a given area but still triggers all events Diggy would when clearing void. +crash_site_restart=Restarts the crashsite scenario. +crash_site_restart_abort=Aborts the restart of the crashsite scenario. +dataset_copy=Copies a dataset +dataset_move=Moves a dataset +dataset_delete=Deletes a dataset +dataset_transform=Transforms a dataset and writes it to the target dataset. Calls global.transform_function and sends the table of entries while expecting a table to return. +dataset_transform_test=Shows the resulting data set from a transform operation. See /help dataset-transform for more information. +report=Reports a user to admins +kill=Will kill you. +afk=Shows how long players have been afk. +zoom=Sets your zoom. +find=Shows an alert on the map where the player is located +show_rail_block=Toggles rail block visualisation. +server_time=Prints the server's time. +seeds=List the seeds of all surfaces +redmew_version=Prints the version of the RedMew scenario +whois=provides information about a given player, admins can see the inventory of a player by adding "yes" as a second argument +redmew_setting_set=Set a setting for yourself +redmew_setting_get=Display a setting value for yourself +redmew_setting_all=Display all settings for yourself +meltdown_get=Gets the status of meltdown. +meltdown_set=Sets the status of meltdown. +redmew_color=Set will save your current color for future maps. Reset will erase your saved color. Random will give you a random color. +performance_scale_set=Sets the performance scale between 0.05 and 1. Will alter the game speed, manual mining speed, manual crafting speed and character running speed per force. +performance_scale_get=Shows the current performance scale. +market=Places a market near you. Use /market removeall to remove all markets on a map +lazy_bastard_bootstrap=Puts down the minimum requirements to get started +toast=Sends a toast to all players +toast_player=Sends a toast to a specific player +sent_all_toast=__1__ sent a toast to all players +sent_player_toast=__1__ sent a toast to __2__ +task=Creates a new task. +tag=Sets a player's tag +popup=Shows a popup to all connected players +popup_update=Shows an update popup to all connected players +popup_player=Shows a popup to the player. +poll=Creates a new poll +poll_result=Prints the result for the given poll number. +debug=Opens the debugger +watch=Allows you to watch other players. +donator_welcome_message=Adds, deletes, or lists donator welcome messages. +donator_death_message=Adds, deletes, or lists donator death messages. +reveal=Reveals radius around user +particle_scale=Provide a fraction between 0 and 1 to lower or increase the amount of (max) particles. Leave empty to view the current values. +apocalypse=This really ends the map. When you first run it, the game will save. When run a second time, the apocalypse will begin. +a=Admin chat. Messages all other admins. +dc=silent-command +hax=Toggles your hax (makes recipes cost nothing) +regular=Gives a player the regualar rank. +regular_remove=Demotes a player from regular to the next lowest rank +probation=Put player on probation. (They will be unable to use redmew commands and will never gain auto-trusted rank.) +probation_remove=Remove player from probation. +showreports=Shows user reports +jail=Puts a player in jail +unjail=Removes a player from jail +tempban=Temporarily bans a player +pool=Spawns a pool of water +invoke=Teleports the player to you. tp=If blank, teleport to selected entity. mode = toggle tp mode where you can teleport to a placed ghost. player = teleport to player. +revive_ghosts=Revives the ghosts within the provided radius around you +destroy=Destroys the entity under your cursor when you run this command [command_custom_help] tp= 3 different uses: "/tp" to tp to selected entity. "/tp mode" to toggle tp mode. "/tp Newcott" to tp to Newcott. +poll=<{question = "question", answers = {"answer 1", "answer 2"}, duration = 300}> diff --git a/locale/en/redmew_features.cfg b/locale/en/redmew_features.cfg index 1fcce9f0..2c5ce814 100644 --- a/locale/en/redmew_features.cfg +++ b/locale/en/redmew_features.cfg @@ -1,4 +1,4 @@ -# This file holds all the locale strings for features +# This file holds all the locale strings for non-gui features [donator] death_message=__1__ has perished and will be missed by all, but wanted to share this last message: @@ -49,3 +49,27 @@ train_warning=__1__ used a train to destroy another train and has been warned. train_player_warning=You have destroyed another train with yours.\nRepeated infractions will be punished. train_jailing=__1__ used a train to destroy another train and has been jailed. multiple_passengers=Note: There were __1__ players in the train and any could have been controlling it: __2__ + +[meltdown] +is_enabled=Reactor meltdown is enabled. +is_disabled=Reactor meltdown is disabled. +enable=Reactor meltdown enabled. +disable=Reactor meltdown disabled. +error_not_on_off=You must set meltdown to on or off. + +[player_colors] +color_saved=Your color has been saved. Any time you join a redmew server your color will automatically be set. +color_saved_advert=__1__ has saved their color server-side for future maps. You can do the same! Check out /help redmew-color +color_reset=Your saved color (if you had one) has been removed. +color_random=Your color has been changed to: __1__ +fail_wrong_argument=Only set, reset, and random are accepted arguments + +[performance] +fail_wrong_argument=Scale must be a valid number ranging from 0.05 to 1 +stat_preamble=## - Game speed changed to compensate for UPS drops and players trying to catch up. +generic_stat=## - __1__: __2__ +output_formatter=## - __1__: __2__ -- __3__: __4__ -- __5__: __6__ +game_speed=Game speed +running_speed=Running speed +manual_mining_speed=Manual mining speed +manual_crafting_speed=Manual crafting speed diff --git a/locale/en/redmew_gui.cfg b/locale/en/redmew_gui.cfg new file mode 100644 index 00000000..e995dd38 --- /dev/null +++ b/locale/en/redmew_gui.cfg @@ -0,0 +1,4 @@ +# This file holds all the locale strings for guis + +[tasklist] +init_announcements='There are no announcements.' diff --git a/map_gen/maps/crash_site/blueprint_extractor.lua b/map_gen/maps/crash_site/blueprint_extractor.lua index a3faab1e..c0d36a91 100644 --- a/map_gen/maps/crash_site/blueprint_extractor.lua +++ b/map_gen/maps/crash_site/blueprint_extractor.lua @@ -207,7 +207,7 @@ local function extract4(args, player) end Command.add( - 'extract1', + 'crash-site-extract1', { arguments = {'size'}, default_values = {size = 6}, @@ -216,7 +216,7 @@ Command.add( extract1 ) Command.add( - 'extract4', + 'crash-site-extract4', { arguments = {'size'}, default_values = {size = 6}, diff --git a/map_gen/maps/crash_site/commands.lua b/map_gen/maps/crash_site/commands.lua index c2f68ca3..a892b079 100644 --- a/map_gen/maps/crash_site/commands.lua +++ b/map_gen/maps/crash_site/commands.lua @@ -47,10 +47,10 @@ callback = ) Command.add( - 'restart', + 'crash-site-restart', { - description = 'Restarts the crashsite scenario.', - arguments = {'scenario_name'}, + description = {'command_description.'}, + arguments = {'scenario_name.crash_site_restart'}, default_values = {scenario_name = 'crashsite'}, required_rank = Ranks.admin, allowed_by_server = true @@ -81,9 +81,9 @@ Command.add( ) Command.add( - 'abort', + 'crash-site-restart-abort', { - description = 'Aborts the restart of the crashsite scenario.', + description = {'command_description.crash_site_restart_abort'}, required_rank = Ranks.admin, allowed_by_server = true }, diff --git a/map_gen/maps/diggy/feature/diggy_hole.lua b/map_gen/maps/diggy/feature/diggy_hole.lua index f3f22ba7..8d2affa7 100644 --- a/map_gen/maps/diggy/feature/diggy_hole.lua +++ b/map_gen/maps/diggy/feature/diggy_hole.lua @@ -127,7 +127,7 @@ local function on_mined_tile(surface, tiles) Template.insert(surface, new_tiles, {}) end Command.add('diggy-clear-void', { - description = 'Clears the void in a given area but still triggers all events Diggy would when clearing void.', + description = {'command_description.diggy_clear_void'}, arguments = {'left_top_x', 'left_top_y', 'width', 'height', 'surface_index'}, debug_only = true, required_rank = Ranks.admin, diff --git a/utils/command.lua b/utils/command.lua index b3bdbee0..aab4d0e7 100644 --- a/utils/command.lua +++ b/utils/command.lua @@ -237,8 +237,7 @@ function Command.add(command_name, options, callback) else server_time = '' end - - log({'command.log_entry', server_time, tick, (options.required_rank >= Ranks.admin) and 'Admin' or 'Player', player_name, command_name, serialize(named_arguments)}) + log({'command.log_entry', server_time, tick, (required_rank >= Ranks.admin) and 'Admin' or 'Player', player_name, command_name, serialize(named_arguments)}) end local success, error = diff --git a/utils/player_rewards.lua b/utils/player_rewards.lua index 69da941c..89b3d291 100644 --- a/utils/player_rewards.lua +++ b/utils/player_rewards.lua @@ -108,7 +108,7 @@ end Command.add( 'reward', { - description = 'Gives a reward to a target player (removes if quantity is negative)', + description = {'command_description.reward'}, arguments = {'target', 'quantity', 'reason'}, default_values = {reason = false}, required_rank = Ranks.admin,