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

41 lines
933 B
Lua
Raw Normal View History

2018-09-08 18:29:27 +02:00
--[[-- info
Provides the ability to setup a player when first joined.
]]
-- dependencies
local Event = require 'utils.event'
local Debug = require 'Diggy.Debug'
-- this
local SetupPlayer = {}
--[[--
Registers all event handlers.
]]
function SetupPlayer.register(config)
Event.add(defines.events.on_player_created, function (event)
local player = game.players[event.player_index]
2018-09-14 21:42:58 +02:00
for _, item in pairs(config.features.SetupPlayer.starting_items) do
player.insert(item)
end
player.teleport({x = 0, y = 0})
2018-09-08 18:29:27 +02:00
Debug.cheat(function()
2018-09-14 21:42:58 +02:00
player.force.manual_mining_speed_modifier = config.features.SetupPlayer.cheats.manual_mining_speed_modifier
2018-09-08 18:29:27 +02:00
end)
end)
end
--[[--
Initializes the Feature.
@param config Table {@see Diggy.Config}.
]]
function SetupPlayer.initialize(config)
end
return SetupPlayer