mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
26e1c28dc0
* Init Factorio 2.0 update * add credits * fix test module * I know luackeck, I know * Fixes * Fix bad event.player_index handling * Hotfixes * Remove all filter inserters * Migrate removed items * Deprecating spidertron control and landfill features
28 lines
778 B
Lua
28 lines
778 B
Lua
local Event = require 'utils.event'
|
|
local Server = require 'features.server'
|
|
|
|
local to_discord_bold = Server.to_discord_bold
|
|
local config = storage.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)
|