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

29 lines
1.1 KiB
Lua
Raw Normal View History

2019-07-03 13:35:38 +02:00
local GameGui = require 'features.snake.gui'
local Game = require 'features.snake.game'
local Public = {}
2019-07-03 16:45:34 +02:00
--- Starts snake game.
-- Note when players join the game they will lose thier character.
-- @param surface <LuaSurface> Surface that the board is placed on.
-- @param top_left_position <Position> Position where board is placed. Defaults to {x = 1, y = 1}.
2019-07-03 20:36:44 +02:00
-- @param size <int> size of board in board tiles. Note that the actual size of the board will be (2 * size) + 1 in
-- factorio tiles. Defaults to 15.
2019-07-03 16:45:34 +02:00
-- @param update_rate <int> number of ticks between updates. Defaults to 30.
-- @param <int> maximun food on the board. Defaults to 6.
2019-07-03 13:35:38 +02:00
function Public.start_game(surface, top_left_position, size, update_rate, max_food)
Game.start_game(surface, top_left_position, size, update_rate, max_food)
GameGui.show()
end
2019-07-03 16:45:34 +02:00
--- Ends the snake game. This will clean up any snake and food entities but will not restore the tiles nor
-- give players thier character back.
2019-07-03 13:35:38 +02:00
function Public.end_game()
Game.end_game()
GameGui.destroy()
end
remote.add_interface('snake', Public)
return Public