2018-11-18 18:12:00 +02:00
|
|
|
local Event = require 'utils.event'
|
|
|
|
|
|
|
|
local SetupPlayer = {}
|
2019-05-30 12:32:36 +02:00
|
|
|
local config
|
2018-11-18 18:12:00 +02:00
|
|
|
|
2019-05-30 12:32:36 +02:00
|
|
|
function SetupPlayer.register(cfg)
|
|
|
|
config = cfg
|
2019-04-22 20:21:04 +02:00
|
|
|
Event.add(
|
|
|
|
defines.events.on_player_created,
|
|
|
|
function()
|
|
|
|
local redmew_player_create = global.config.player_create
|
2018-11-18 18:12:00 +02:00
|
|
|
|
2019-05-30 12:32:36 +02:00
|
|
|
if #cfg.starting_items > 0 then
|
|
|
|
redmew_player_create.starting_items = cfg.starting_items
|
2019-04-22 20:21:04 +02:00
|
|
|
end
|
2018-12-08 22:52:40 +02:00
|
|
|
|
2019-04-22 20:21:04 +02:00
|
|
|
if not _DEBUG then
|
2019-05-30 12:32:36 +02:00
|
|
|
redmew_player_create.cheats = cfg.cheats
|
2019-04-22 20:21:04 +02:00
|
|
|
end
|
2018-12-08 22:52:40 +02:00
|
|
|
end
|
2019-04-22 20:21:04 +02:00
|
|
|
)
|
2018-11-18 18:12:00 +02:00
|
|
|
end
|
|
|
|
|
2019-05-30 12:32:36 +02:00
|
|
|
function SetupPlayer.on_init()
|
|
|
|
game.forces.player.manual_mining_speed_modifier = config.initial_mining_speed_bonus
|
2019-06-01 17:11:17 +02:00
|
|
|
game.forces.player.character_resource_reach_distance_bonus = 1
|
2019-05-30 12:32:36 +02:00
|
|
|
end
|
|
|
|
|
2018-11-18 18:12:00 +02:00
|
|
|
return SetupPlayer
|