diff --git a/control.lua b/control.lua index 1ab332896..b7376af4c 100644 --- a/control.lua +++ b/control.lua @@ -13,7 +13,7 @@ require "score" ---- enable modules here ---- --require "maps.tools.map_pregen" --require "maps.modules.hunger" -require "maps.tools.cheat_mode" +--require "maps.tools.cheat_mode" --require "maps.modules.dynamic_landfill" --require "maps.modules.restrictive_fluid_mining" --require "maps.modules.fluids_are_explosive" diff --git a/maps/fish_defender.lua b/maps/fish_defender.lua index b27f6ad07..80306f4ab 100644 --- a/maps/fish_defender.lua +++ b/maps/fish_defender.lua @@ -5,8 +5,6 @@ require "maps.fish_defender_map_intro" require "maps.modules.railgun_enhancer" require "maps.modules.dynamic_landfill" -require "maps.modules.fluids_are_explosive" -require "maps.modules.explosives_are_explosive" local map_functions = require "maps.tools.map_functions" local math_random = math.random diff --git a/maps/modules/biters_yield_coins.lua b/maps/modules/biters_yield_coins.lua index 755f6f89e..cdf751241 100644 --- a/maps/modules/biters_yield_coins.lua +++ b/maps/modules/biters_yield_coins.lua @@ -7,11 +7,11 @@ local coin_yield = { ["small-biter"] = 1, ["medium-biter"] = 2, ["big-biter"] = 3, - ["behemoth-biter"] = 5, + ["behemoth-biter"] = 4, ["small-spitter"] = 1, ["medium-spitter"] = 2, ["big-spitter"] = 3, - ["behemoth-spitter"] = 5, + ["behemoth-spitter"] = 4, ["spitter-spawner"] = 32, ["biter-spawner"] = 32, ["small-worm-turret"] = 8, diff --git a/maps/modules/spawners_contain_biters.lua b/maps/modules/spawners_contain_biters.lua index ef3110453..ccc90db31 100644 --- a/maps/modules/spawners_contain_biters.lua +++ b/maps/modules/spawners_contain_biters.lua @@ -17,16 +17,14 @@ local biter_building_inhabitants = { } local function on_entity_died(event) - if event.entity.type == "unit-spawner" then - local e = math.ceil(game.forces.enemy.evolution_factor*10, 0) - for _, t in pairs (biter_building_inhabitants[e]) do - for x = 1, math_random(t[2],t[3]), 1 do - local p = event.entity.surface.find_non_colliding_position(t[1] , event.entity.position, 6, 1) - if p then event.entity.surface.create_entity {name=t[1], position=p} end - end + if event.entity.type ~= "unit-spawner" then return end + local e = math.ceil(game.forces.enemy.evolution_factor*10, 0) + for _, t in pairs (biter_building_inhabitants[e]) do + for x = 1, math_random(t[2],t[3]), 1 do + local p = event.entity.surface.find_non_colliding_position(t[1] , event.entity.position, 6, 1) + if p then event.entity.surface.create_entity {name=t[1], position=p} end end - return - end + end end event.add(defines.events.on_entity_died, on_entity_died) diff --git a/maps/nightfall.lua b/maps/nightfall.lua index e246b9436..aafa9a8b0 100644 --- a/maps/nightfall.lua +++ b/maps/nightfall.lua @@ -10,9 +10,44 @@ require "maps.modules.splice" require "maps.modules.explosive_biters" require "maps.modules.biters_yield_coins" require "maps.modules.spawners_contain_biters" +require "maps.modules.railgun_enhancer" +require "maps.modules.dynamic_landfill" local spawn_turret_amount = 8 +local market_items = { + {price = {{"coin", 3}}, offer = {type = 'give-item', item = "raw-fish", count = 1}}, + {price = {{"coin", 1}}, offer = {type = 'give-item', item = 'raw-wood', count = 4}}, + {price = {{"coin", 8}}, offer = {type = 'give-item', item = 'grenade', count = 1}}, + {price = {{"coin", 32}}, offer = {type = 'give-item', item = 'cluster-grenade', count = 1}}, + {price = {{"coin", 2}}, offer = {type = 'give-item', item = 'land-mine', count = 1}}, + {price = {{"coin", 80}}, offer = {type = 'give-item', item = 'car', count = 1}}, + {price = {{"coin", 50}}, offer = {type = 'give-item', item = 'gun-turret', count = 1}}, + {price = {{"coin", 2}}, offer = {type = 'give-item', item = 'firearm-magazine', count = 1}}, + {price = {{"coin", 5}}, offer = {type = 'give-item', item = 'piercing-rounds-magazine', count = 1}}, + {price = {{"coin", 2}}, offer = {type = 'give-item', item = 'shotgun-shell', count = 1}}, + {price = {{"coin", 6}}, offer = {type = 'give-item', item = 'piercing-shotgun-shell', count = 1}}, + {price = {{"coin", 35}}, offer = {type = 'give-item', item = "submachine-gun", count = 1}}, + {price = {{"coin", 250}}, offer = {type = 'give-item', item = 'combat-shotgun', count = 1}}, + {price = {{"coin", 450}}, offer = {type = 'give-item', item = 'flamethrower', count = 1}}, + {price = {{"coin", 25}}, offer = {type = 'give-item', item = 'flamethrower-ammo', count = 1}}, + {price = {{"coin", 185}}, offer = {type = 'give-item', item = 'rocket-launcher', count = 1}}, + {price = {{"coin", 2}}, offer = {type = 'give-item', item = 'rocket', count = 1}}, + {price = {{"coin", 7}}, offer = {type = 'give-item', item = 'explosive-rocket', count = 1}}, + {price = {{"coin", 7500}}, offer = {type = 'give-item', item = 'atomic-bomb', count = 1}}, + {price = {{"coin", 325}}, offer = {type = 'give-item', item = 'railgun', count = 1}}, + {price = {{"coin", 8}}, offer = {type = 'give-item', item = 'railgun-dart', count = 1}}, + {price = {{"coin", 4}}, offer = {type = 'give-item', item = 'defender-capsule', count = 1}}, + {price = {{"coin", 25}}, offer = {type = 'give-item', item = 'light-armor', count = 1}}, + {price = {{"coin", 250}}, offer = {type = 'give-item', item = 'heavy-armor', count = 1}}, + {price = {{"coin", 650}}, offer = {type = 'give-item', item = 'modular-armor', count = 1}}, + {price = {{"coin", 2500}}, offer = {type = 'give-item', item = 'power-armor', count = 1}}, + {price = {{"coin", 50}}, offer = {type = 'give-item', item = 'solar-panel-equipment', count = 1}}, + {price = {{"coin", 275}}, offer = {type = 'give-item', item = 'belt-immunity-equipment', count = 1}}, + {price = {{"coin", 250}}, offer = {type = 'give-item', item = 'personal-roboport-equipment', count = 1}}, + {price = {{"coin", 20}}, offer = {type = 'give-item', item = 'construction-robot', count = 1}} + } + local function shuffle(tbl) local size = #tbl for i = size, 1, -1 do @@ -62,7 +97,7 @@ local function send_attack_group(surface) unit_group.add_member(biters[i]) end - if global.rocket_silo.valid then + if global.market.valid then unit_group.set_command({ type = defines.command.compound, structure_type = defines.compound_command.return_last, @@ -75,7 +110,7 @@ local function send_attack_group(surface) }, { type = defines.command.attack, - target = global.rocket_silo, + target = global.market, distraction = defines.distraction.by_enemy } } @@ -216,16 +251,15 @@ local function generate_spawn_area(surface) end end - global.rocket_silo = surface.create_entity({name = "rocket-silo", position = {0, 0}, force = "player"}) - global.rocket_silo.minable = false - - local radius = 256 - game.forces.player.chart(surface, {{x = -1 * radius, y = -1 * radius}, {x = radius, y = radius}}) + global.market = surface.create_entity({name = "market", position = {0, 0}, force = "player"}) + global.market.minable = false + for _, item in pairs(market_items) do + global.market.add_market_item(item) + end end local function on_chunk_generated(event) local surface = game.surfaces["nightfall"] - --local seed = game.surfaces[1].map_gen_settings.seed if event.surface.name ~= surface.name then return end local left_top = event.area.left_top local tiles = {} @@ -239,11 +273,12 @@ local function on_chunk_generated(event) end local function on_entity_damaged(event) - if not event.cause then return end - if event.entity.valid then - if event.entity == global.rocket_silo then - if event.cause.force.name == "enemy" then return end - event.entity.health = event.entity.health + event.final_damage_amount + if event.cause then + if event.cause.force.name == "enemy" then return end + end + if event.entity.valid then + if event.entity.name == "market" then + event.entity.health = event.entity.health + event.final_damage_amount end end end @@ -260,20 +295,21 @@ local function on_tick(event) set_daytime_modifiers(surface) end - if global.rocket_silo then - if global.rocket_silo.valid then return end + if global.market then + if global.market.valid then return end end if game.tick < 3600 then return end if not global.game_restart_timer then global.game_restart_timer = 7200 + game.print("The market has fallen!", {r=0.22, g=0.88, b=0.22}) else if global.game_restart_timer < 0 then return end global.game_restart_timer = global.game_restart_timer - 600 end if global.game_restart_timer % 1800 == 0 then - if global.game_restart_timer > 0 then game.print("Map will restart in " .. global.game_restart_timer / 60 .. " seconds!", { r=0.22, g=0.88, b=0.22}) end + if global.game_restart_timer > 0 then game.print("Map will restart in " .. global.game_restart_timer / 60 .. " seconds!", {r=0.22, g=0.88, b=0.22}) end if global.game_restart_timer == 0 then game.print("Map is restarting!", { r=0.22, g=0.88, b=0.22}) game.write_file("commandPipe", ":loadscenario --force", false, 0) @@ -321,17 +357,18 @@ local function on_player_joined_game(event) player.insert({name = "pistol", count = 1}) player.insert({name = "iron-axe", count = 1}) player.insert({name = "raw-fish", count = 3}) - player.insert({name = "firearm-magazine", count = 16}) - player.insert({name = "iron-plate", count = 32}) + player.insert({name = "firearm-magazine", count = 32}) + player.insert({name = "iron-plate", count = 64}) + player.insert({name = "stone", count = 32}) if global.show_floating_killscore then global.show_floating_killscore[player.name] = false end end local surface = game.surfaces["nightfall"] if player.online_time < 2 and surface.is_chunk_generated({0,0}) then - player.teleport(surface.find_non_colliding_position("player", {0, 8}, 50, 1), "nightfall") + player.teleport(surface.find_non_colliding_position("player", {0, 16}, 50, 1), "nightfall") else if player.online_time < 2 then - player.teleport({0, 8}, "nightfall") + player.teleport({0, 16}, "nightfall") end end