1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-03-17 21:08:08 +02:00

research_printer

This commit is contained in:
grilledham 2020-01-01 11:58:08 +00:00
parent 2b8a2440ae
commit e0dadb7de5
4 changed files with 39 additions and 0 deletions

View File

@ -416,6 +416,12 @@ global.config = {
['refined-flammables'] = {{turret_type = 'fluid-turret', amount = 60 * 17 / 7}},
['artillery-shell-speed'] = {{turret_type = 'artillery-turret', amount = 60 * 2}}
}
},
research_printer = {
enabled = true,
print_to_force = true, -- print a message to force chat when that force finishes a new research.
print_to_discord = true, -- print a message to the discord channel when the player force finishes a new research.
ignore_script = false -- ignore researches unlocked by commands or by code.
}
}

View File

@ -106,6 +106,9 @@ end
if config.autofill.enabled then
require 'features.gui.autofill'
end
if config.research_printer then
require 'features.research_printer'
end
-- GUIs
-- The order determines the order they appear from left to right.

View File

@ -0,0 +1,27 @@
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_finish', 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)

View File

@ -162,6 +162,9 @@ invalid_ammo_count=ammo count must be a positive integer
main_button_tooltip=Autofill settings
frame_name=Autofill
[research_printer]
research_finish=[technology=__1__] has been researched.
[snake]
name=Snake
spawn_snake_fail=Unable to spawn snake, please try again.