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

Merge pull request #660 from plague006/seeds

Add seeds command
This commit is contained in:
Matthew 2019-01-24 18:14:47 -05:00 committed by GitHub
commit 9e05721170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ local Command = require 'utils.command'
local format = string.format
local ceil = math.ceil
local concat = table.concat
--- Kill a player with fish as the cause of death.
local function do_fish_kill(player, suicide)
@ -191,6 +192,22 @@ local function search_command(arguments)
p(format('-------- Page %d / %d --------', page, pages))
end
local function list_seeds()
local seeds = {}
local count_of_seeds = 0
for _, surface in pairs(game.surfaces) do
seeds[count_of_seeds + 1] = surface.name
seeds[count_of_seeds + 2] = ': '
seeds[count_of_seeds + 3] = tostring(surface.map_gen_settings.seed)
count_of_seeds = count_of_seeds + 4
seeds[count_of_seeds] = ', '
end
seeds[#seeds] = nil
seeds = concat(seeds)
Game.player_print(seeds)
end
-- Command registrations
Command.add(
@ -259,6 +276,15 @@ Command.add(
search_command
)
Command.add(
'seeds',
{
description = 'List the seeds of all surfaces',
allowed_by_server = true,
},
list_seeds
)
-- Commands with no functions, only calls to other modules
Command.add(