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

28 lines
777 B
Lua
Raw Normal View History

2020-01-01 13:58:08 +02:00
local Event = require 'utils.event'
local Server = require 'features.server'
local to_discord_bold = Server.to_discord_bold
local config = global.config.research_printer
2020-01-01 17:04:33 +02:00
local template = {'research_printer.research_finished', nil}
2020-01-01 13:58:08 +02:00
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)