Updated research sync to handle infinite science and hopefully stop it from apply same research in a loop annoying everyone

This commit is contained in:
psihius committed 2019-07-14 01:25:48 +02:00
1 parent 1f8ac50950
commit 0afe35b67c
3 files changed
+40 -21

No files matched your search

@@ -1,14 +1,13 @@
/silent-command
if game.forces['player'].technologies['{tech_name}'] then
if game.forces['player'].technologies['{tech_name}'].researched ~= {tech_researched} then
game.forces['player'].technologies['{tech_name}'].researched = {tech_researched}
end
if game.forces['player'].technologies['{tech_name}'].level ~= {tech_level} then
if 1 == {tech_infinite} then
game.forces['player'].technologies['{tech_name}'].level = {tech_level}
else
game.forces['player'].technologies['{tech_name}'].researched = true
end
script.raise_event(defines.events.on_research_finished, {research=game.forces['player'].technologies['{tech_name}'], by_script=true})
game.play_sound({path="utility/research_completed"})
if game.forces['player'].technologies['{tech_name}'].researched == false then
if 1 == {tech_infinite} then
game.print("Technology {tech_name} synced at level {tech_level}")
else
game.print("Technology {tech_name} synced")