mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-03-17 21:08:08 +02:00
research_printer
This commit is contained in:
parent
2b8a2440ae
commit
e0dadb7de5
@ -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.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
27
features/research_printer.lua
Normal file
27
features/research_printer.lua
Normal 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)
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user