local effect = require(mod_name .. ".lualib.effects") local popup = require(mod_name .. ".lualib.popup") local attack = require(mod_name .. ".lualib.attacks") local locations = require(mod_name .. ".lualib.locations") local cutscene = require(mod_name .. ".lualib.cutscene") local scenes = require 'scenes' local waves = require 'waves' local expansions = require(mod_name .. '.lualib.npe.expansions') local util = require("util") local story = require("story_2") local campaign_util = require(mod_name .. ".lualib.campaign_util") local nodes = {} nodes['biters-from-east'] = { init = function() local spawn = locations.get_pos('spawn-2') local rally = locations.get_pos('rally-2') local target = locations.get_pos('target-4') if spawn and rally and target then --make some biters! global.pollution_unspent = global.pollution_unspent - 2400*5*5 attack.spawn_attack_wave(5,spawn,rally,rally,'enemy') end popup.clear_all() cutscene.play(scenes['biters-from-east']) end, condition = function() return not cutscene.is_any_cutscene_playing() end } nodes['final-expansion'] = { init = function() effect.expand_map(expansions['final']) end, condition = function() return not cutscene.is_any_cutscene_playing() end } nodes['congrats'] = { init = function() campaign_util.flying_congrats(game.players[1].position) game.forces.player.play_sound({ path = "utility/achievement_unlocked" }) end, condition = function () return story.check_seconds_passed("main_story",2) end, } nodes['intermission'] = { condition = function() return story.check_seconds_passed("main_story",2) end, } nodes['victory-screen'] = { init = function() popup.clear_all() effect.show_text_window({'victory.heading'},{ {'victory.text'}, {'victory.option-heading'}, {'victory.option-1'}, {'victory.option-2'}, {'victory.option-3'}, {'victory.thanks'}, }) game.tick_paused = true end, condition = function() return global.player_closed_text_window end, action = function() global.player_closed_text_window = nil end } nodes['intro-screen'] = { init = function() local force = game.forces.player; force.set_hand_crafting_disabled_for_recipe('electronic-circuit', true) force.set_hand_crafting_disabled_for_recipe('copper-cable', true) force.set_hand_crafting_disabled_for_recipe('iron-gear-wheel', true) force.set_hand_crafting_disabled_for_recipe('automation-science-pack', true) force.set_hand_crafting_disabled_for_recipe('iron-stick', true) game.forces.player.item_production_statistics.set_output_count('coal', 0) --local gear_feed = locations.get_surface_ent_from_tag(global.main_surface,'gear-feed') --gear_feed.destroy() --local lab_feed = locations.get_surface_ent_from_tag(global.main_surface,'lab-feed') --lab_feed.destroy() local compi_box = locations.get_surface_ent_from_tag(global.main_surface,'compi-box') compi_box.destroy() effect.activate_research(false) effect.activate_side_menu(false) effect.activate_quick_bar(false) effect.activate_shortcut_bar(false) effect.activate_controller_gui(false) -- Remove the copper setup - compi will build it later local copper_ents = global.main_surface.find_entities_filtered { force = 'player', area = locations.get_area('iron-patch-construction') } for _, ent in pairs(copper_ents) do ent.destroy() end game.forces.player.technologies['basic-mining'].researched = true game.forces.player.technologies['basic-logistics'].researched = true popup.clear_all() effect.show_text_window({'introduction.heading'},{ {'introduction.text-1'}, {'introduction.text-2'}, {'introduction.text-3'}, {'introduction.thanks'}, }) game.tick_paused = true end, condition = function() return global.player_closed_text_window end, action = function() global.player_closed_text_window = nil effect.activate_controller_gui(true) end } nodes['victory'] = { init = function() game.set_game_state({game_finished=true, player_won=true, can_continue=true}) print('triggered game state victory') end, } nodes['freeplay'] = { init = function() popup.create_technology_popup(main_player(),'improved-equipment') effect.unlock_technologies({'demo-science-pack','demo-logistics','demo-productivity-1'}) end, condition = function() return false end, update = function () attack.check_spawn_wave(waves['fortify-4']) end } local story_nodes = {} -- Get a deep copy of the given node. unique_section is for nodes like 'intermission', where we will use the node -- multiple times. Because the story system requires each node to have a unique name, we append a unique_section -- string. It is an optional param if tou only use the node once. story_nodes.get = function(name, unique_section) local node_copy = util.table.deepcopy(nodes[name]) node_copy.name = name if unique_section then node_copy.name = name .. "_" .. unique_section end return node_copy end return story_nodes