local check = require(mod_name .. ".lualib.check") local tracker = require(mod_name .. ".lualib.player_tracker") local story = require("story_2") local conditions = {} conditions['explore'] = function() local supplies = check.chests_emptied({'wreck-1','wreck-2'},2) local salvage = check.entities_removed_from_area('mineable-wreckage','starting-area',1,1) return supplies and salvage end conditions['handmining'] = function() check.player_crafted_list({{name='stone-furnace',goal=1}}) local placed = check.entity_placed('stone-furnace') check.times_behavior_observed('mined_stone',1) return placed end conditions['smelting'] = function() check.furnace_setup_correct() local crafted = check.player_crafted_list({ {name='burner-mining-drill',goal=1}, {name='iron-plate',goal=3}, }) return crafted end conditions['automining'] = function() local coal_obtain = check.player_inventory_contains( { {name='coal',goal=5}, }) local coal_exploit = check.resources_exploited_by_miners({'coal'},9) return coal_obtain and coal_exploit end conditions['handcrafting'] = function() local box_has = check.compi_box_contains({ {name='burner-mining-drill',goal=1}, {name='stone-furnace',goal=1}, {name='transport-belt',goal=2}, }) return box_has end conditions['trigger-build'] = function() local arrive = check.player_inside_area('compi-trigger-cutscene-crash', false) return arrive end conditions['repair-assembler'] = function() local default = 0 local feed, count = check.items_fed_in('gear-feed',{{name='iron-plate',goal=50}}) count = count or default if count > 0 then tracker.log_behavior('gear_has_been_fed',1) end return feed end conditions['repair-lab'] = function() local default = 0 local feed, count = check.items_fed_in('lab-feed',{ {name='iron-gear-wheel',goal=50}, {name='copper-plate',goal=50}, }) count = count or default if count > 0 then tracker.log_behavior('lab_has_been_fed',1) end return feed end conditions['load-lab'] = function() check.bottles_and_tech_started('starting-area','basic-electronics') local researched = check.research_list_complete({'basic-electronics'}) return researched end conditions['electronics'] = function() local built = check.entity_placed_and_powered('assembling-machine-1') local circuits = check.player_crafted_list({{name='electronic-circuit',goal=5}}) return (built and circuits ) end conditions['build-radar'] = function() check.research_list_complete({'basic-mapping'}) local built = check.entity_placed_and_powered('radar') return built end conditions['scan-radar'] = function() local built = check.entity_placed_and_powered('radar') local scanned = check.any_sector_scanned(built) return scanned end conditions['trigger-radar'] = function() local arrive = check.player_inside_area('compi-trigger-cutscene-crash') return arrive end conditions['scan-wreck'] = function() local researched = check.research_list_complete({'analyse-ship'}) return researched end conditions['trigger-attacks'] = function() local arrive = check.player_inside_area('compi-trigger-cutscene-crash') return arrive end conditions['prepare'] = function() local power = check.player_inventory_contains( { {name='assembling-machine-1',goal=3}, {name='lab',goal=1}, {name='offshore-pump',goal=1}, {name='boiler',goal=1}, {name='steam-engine',goal=1}, {name='small-electric-pole',goal=4}, }) return power end conditions['leave'] = function() local ran = check.player_inside_area('exit-right', false) return ran end conditions['reach-pond'] = function() return check.player_inside_area('pond', false) end conditions['rebuild'] = function(event) -- these checks are expensive, so only do them once a second if event.tick % 60 ~= 0 then return end check.steam_engine_operational() check.entity_powered('lab') local researched = check.research_list_complete({'improved-equipment'}) return researched end conditions['military'] = function() local researched = check.research_list_complete({'basic-military'}) local crafted = check.player_crafted_list( { {name='pistol',goal=1}, {name='firearm-magazine',goal=10} }) local loaded = check.player_is_loaded() return researched and crafted and loaded end conditions['entrench'] = function(event) -- these checks are expensive, so only do them once a second if event.tick % 60 ~= 0 then return end local stockpile = check.player_stockpiled_list( { {name='firearm-magazine',goal=100} }) local loaded = check.number_of_loaded_turrets_in_areas({'east-expansion'},1) local researched = check.research_list_complete({'active-defense'}) return researched and loaded and stockpile end conditions['trigger-second-wave'] = function() local arrive = check.player_inside_area('compi-trigger-cutscene-pond') return arrive end conditions['fortify'] = function() local circuits = check.item_produced_per_time('electronic-circuit',defines.flow_precision_index.one_minute,15) local firearm = check.item_produced_per_time('firearm-magazine',defines.flow_precision_index.one_minute,25) local packs = check.item_produced_per_time('automation-science-pack',defines.flow_precision_index.one_minute,6) local time = story.check_seconds_passed('main_story',120) return circuits and firearm and packs and time end conditions['survive'] = function() local researched = check.research_list_complete({'demo-science-pack'}) check.loaded_turrets_in_area('east-expansion') return researched end return conditions