1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00
RedMew/features/research_printer.lua
2020-01-01 15:04:33 +00:00

28 lines
777 B
Lua

local Event = require 'utils.event'
local Server = require 'features.server'
local to_discord_bold = Server.to_discord_bold
local config = global.config.research_printer
local template = {'research_printer.research_finished', nil}
local function research_finished(event)
if config.ignore_script and event.by_script then
return
end
local research = event.research
local research_name = research.name
local force = research.force
if config.print_to_force then
template[2] = research_name
force.print(template)
end
if config.print_to_discord and force.name == 'player' then
to_discord_bold(research_name .. ' has been researched.')
end
end
Event.add(defines.events.on_research_finished, research_finished)