1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-03 13:12:11 +02:00

new modules, new map

This commit is contained in:
MewMew 2019-02-16 17:36:12 +01:00
parent 6c40863cba
commit 99334cb284
11 changed files with 176 additions and 34 deletions

View File

@ -40,8 +40,8 @@ require "maps.modules.custom_death_messages"
--require "maps.tank_battles"
--require "maps.spiral_troopers"
--require "maps.fish_defender"
require "maps.mountain_fortress"
--require "maps.stoneblock"
--require "maps.mountain_fortress"
require "maps.stoneblock"
--require "maps.deep_jungle"
--require "maps.crossing"
--require "maps.anarchy"

View File

@ -0,0 +1,13 @@
-- enemy biters have double damage -- by mewmew
local event = require 'utils.event'
local function on_player_joined_game(event)
game.forces.enemy.set_ammo_damage_modifier("melee", 1)
game.forces.enemy.set_ammo_damage_modifier("biological", 1)
game.forces.enemy.set_ammo_damage_modifier("artillery-shell", 1)
game.forces.enemy.set_ammo_damage_modifier("flamethrower", 1)
game.forces.enemy.set_ammo_damage_modifier("laser-turret", 1)
end
event.add(defines.events.on_player_joined_game, on_player_joined_game)

View File

@ -0,0 +1,12 @@
-- enemy biters have pseudo double hp -- by mewmew
local event = require 'utils.event'
local function on_entity_damaged(event)
if not event.entity.valid then return end
if math.random(1,2) == 1 then return end
if event.entity.force.name ~= "enemy" then return end
event.entity.health = event.entity.health + event.final_damage_amount
end
event.add(defines.events.on_entity_damaged, on_entity_damaged)

View File

@ -415,6 +415,7 @@ end
----------share chat -------------------
local function on_console_chat(event)
if not event.message then return end
if event.message == "" then return end
if not event.player_index then return end
local player = game.players[event.player_index]

View File

@ -0,0 +1,47 @@
-- rocks heal over time -- by mewmew
local event = require 'utils.event'
local healing_amount = {
["rock-big"] = 4,
["sand-rock-big"] = 4,
["rock-huge"] = 16
}
local function heal_rocks()
for key, rock in pairs(global.damaged_rocks) do
if rock.last_damage + 3600 < game.tick then
if rock.entity then
if rock.entity.valid then
rock.entity.health = rock.entity.health + healing_amount[rock.entity.name]
if rock.entity.prototype.max_health == rock.entity.health then
global.damaged_rocks[key] = nil
end
else
global.damaged_rocks[key] = nil
end
else
global.damaged_rocks[key] = nil
end
end
end
end
local function on_entity_damaged(event)
if not event.entity.valid then return end
if not healing_amount[event.entity.name] then return end
global.damaged_rocks[tostring(event.entity.position.x) .. tostring(event.entity.position.y)] = {last_damage = game.tick, entity = event.entity}
end
local function on_player_joined_game(event)
if not global.damaged_rocks then global.damaged_rocks = {} end
end
local function on_tick(event)
if game.tick % 3600 ~= 1 then return end
heal_rocks()
end
event.add(defines.events.on_tick, on_tick)
event.add(defines.events.on_player_joined_game, on_player_joined_game)
event.add(defines.events.on_entity_damaged, on_entity_damaged)

View File

@ -0,0 +1,23 @@
-- spitters spit biters, because why not -- by mewmew
local event = require 'utils.event'
local radius = 3
local max_biters_in_radius = 3
local biters = {
["big-spitter"] = "small-biter",
["behemoth-spitter"] = "medium-biter"
}
local function on_entity_damaged(event)
if not event.cause then return end
if not event.cause.valid then return end
if not biters[event.cause.name] then return end
local area = {{event.entity.position.x - radius, event.entity.position.y - radius}, {event.entity.position.x + radius, event.entity.position.y + radius}}
if event.cause.surface.count_entities_filtered({area = area, name = biters[event.cause.name], limit = 3}) >= max_biters_in_radius then return end
local pos = event.cause.surface.find_non_colliding_position(biters[event.cause.name], event.entity.position, radius, 0.5)
if pos then event.cause.surface.create_entity({name = biters[event.cause.name], position = pos}) end
end
event.add(defines.events.on_entity_damaged, on_entity_damaged)

View File

@ -66,12 +66,15 @@ local function secret_shop(pos, surface)
{price = {{"coin", math_random(300,500)}}, offer = {type = 'give-item', item = 'express-loader'}},
{price = {{"coin", math_random(100,200)}}, offer = {type = 'give-item', item = 'locomotive'}},
{price = {{"coin", math_random(75,150)}}, offer = {type = 'give-item', item = 'cargo-wagon'}},
{price = {{"coin", math_random(2,4)}}, offer = {type = 'give-item', item = 'rail'}},
{price = {{"coin", math_random(20,40)}}, offer = {type = 'give-item', item = 'train-stop'}},
{price = {{"coin", math_random(2,3)}}, offer = {type = 'give-item', item = 'rail'}},
--{price = {{"coin", math_random(20,40)}}, offer = {type = 'give-item', item = 'train-stop'}},
{price = {{"coin", math_random(4,12)}}, offer = {type = 'give-item', item = 'small-lamp'}},
{price = {{"coin", math_random(80,160)}}, offer = {type = 'give-item', item = 'car'}},
{price = {{"coin", math_random(300,600)}}, offer = {type = 'give-item', item = 'electric-furnace'}},
{price = {{"coin", math_random(300,600)}}, offer = {type = 'give-item', item = "assembling-machine-3"}},
--{price = {{"coin", math_random(300,600)}}, offer = {type = 'give-item', item = "assembling-machine-3"}},
{price = {{"coin", math_random(80,160)}}, offer = {type = 'give-item', item = 'effectivity-module'}},
{price = {{"coin", math_random(80,160)}}, offer = {type = 'give-item', item = 'productivity-module'}},
{price = {{"coin", math_random(80,160)}}, offer = {type = 'give-item', item = 'speed-module'}},
{price = {{"coin", math_random(5,10)}}, offer = {type = 'give-item', item = 'raw-wood', count = 50}},
{price = {{"coin", math_random(5,10)}}, offer = {type = 'give-item', item = 'iron-ore', count = 50}},
@ -102,7 +105,7 @@ local function on_player_joined_game(event)
if not global.surface_init_done then
local map_gen_settings = {}
map_gen_settings.water = "small"
map_gen_settings.water = "none"
map_gen_settings.height = 960
map_gen_settings.cliff_settings = {cliff_elevation_interval = 4, cliff_elevation_0 = 4}
map_gen_settings.autoplace_controls = {

View File

@ -7,11 +7,15 @@ local map_functions = require "maps.tools.map_functions"
local simplex_noise = require 'utils.simplex_noise'
local simplex_noise = simplex_noise.d2
require "maps.nightfall_map_intro"
require "maps.modules.splice"
require "maps.modules.splice_double"
require "maps.modules.spitters_spit_biters"
require "maps.modules.biters_double_hp"
require "maps.modules.biters_double_damage"
require "maps.modules.explosive_biters"
require "maps.modules.spawners_contain_biters"
require "maps.modules.railgun_enhancer"
require "maps.modules.dynamic_landfill"
require "maps.modules.satellite_score"
local spawn_turret_amount = 8
@ -213,7 +217,12 @@ local function clear_corpses(surface)
end
local function get_spawner(surface)
local spawners = surface.find_entities_filtered({type = "unit-spawner"})
local spawners = {}
for r = 512, 51200, 512 do
spawners = surface.find_entities_filtered({type = "unit-spawner", area = {{0 - r, 0 - r}, {0 + r, 0 + r}}})
if #spawners > 16 then break end
end
if not spawners[1] then return false end
spawners = shuffle(spawners)
@ -246,7 +255,7 @@ local function send_attack_group(surface)
local spawner = get_spawner(surface)
if not spawner then return false end
local biters = surface.find_enemy_units(spawner.position, 96, "player")
local biters = surface.find_enemy_units(spawner.position, 128, "player")
if not biters[1] then return end
biters = shuffle(biters)
@ -307,9 +316,9 @@ local function set_daytime_modifiers(surface)
if game.map_settings.enemy_expansion.enabled == false then return end
game.map_settings.enemy_expansion.enabled = false
surface.peaceful_mode = true
--surface.peaceful_mode = true
game.print(daytime_messages[math_random(1, #daytime_messages)], {r = 255, g = 255, b = 50})
--game.print(daytime_messages[math_random(1, #daytime_messages)], {r = 255, g = 255, b = 50})
clear_corpses(surface)
end
@ -325,13 +334,13 @@ local function set_nighttime_modifiers(surface)
if not global.night_count then
global.night_count = 1
global.splice_modifier = 1
--global.splice_modifier = 1
else
global.night_count = global.night_count + 1
if game.forces["enemy"].evolution_factor > 0.25 then
global.splice_modifier = global.splice_modifier + 0.05
if global.splice_modifier > 4 then global.splice_modifier = 4 end
end
--if game.forces["enemy"].evolution_factor > 0.25 then
--global.splice_modifier = global.splice_modifier + 0.05
--if global.splice_modifier > 4 then global.splice_modifier = 4 end
--end
end
for _, player in pairs(game.connected_players) do
@ -452,16 +461,42 @@ local function on_chunk_generated(event)
end
end
local out_of_map_start = 63
for x = 0, 31, 1 do
for y = 0, 31, 1 do
local pos = {x = left_top.x + x, y = left_top.y + y}
if math_random(1, 2048) == 1 then
local pos = {x = left_top.x + x, y = left_top.y + y}
local tile_to_insert = false
if global.out_of_map_position == 1 then
if pos.x > out_of_map_start then tile_to_insert = "out-of-map" end
if pos.y > out_of_map_start then tile_to_insert = "out-of-map" end
end
if global.out_of_map_position == 2 then
if pos.x < out_of_map_start * -1 then tile_to_insert = "out-of-map" end
if pos.y < out_of_map_start * -1 then tile_to_insert = "out-of-map" end
end
if global.out_of_map_position == 3 then
if pos.x > out_of_map_start then tile_to_insert = "out-of-map" end
if pos.y < out_of_map_start * -1 then tile_to_insert = "out-of-map" end
end
if global.out_of_map_position == 4 then
if pos.y > out_of_map_start then tile_to_insert = "out-of-map" end
if pos.x < out_of_map_start * -1 then tile_to_insert = "out-of-map" end
end
if tile_to_insert then insert(tiles, {name = "out-of-map", position = pos}) end
if math_random(1, 2500) == 1 and tile_to_insert == false then
--if surface.can_place_entity({name = "big-ship-wreck-1", position = pos}) then
spawn_shipwreck(surface, pos)
--end
end
end
end
if #tiles == 0 then return end
surface.set_tiles(tiles, true)
end
local function on_entity_damaged(event)
@ -501,7 +536,7 @@ local function on_tick(event)
if not global.game_restart_timer then
global.game_restart_timer = 7200
game.print("The Rocket Silo was destroyed!", {r=0.22, g=0.88, b=0.22})
game.print("The Rocket Silo 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
@ -539,14 +574,18 @@ local function on_player_joined_game(event)
game.create_surface("nightfall", map_gen_settings)
local surface = game.surfaces["nightfall"]
global.out_of_map_position = math_random(1,4)
surface.ticks_per_day = surface.ticks_per_day * 2
local radius = 512
game.forces.player.chart(surface, {{x = -1 * radius, y = -1 * radius}, {x = radius, y = radius}})
game.map_settings.enemy_evolution.destroy_factor = 0.004
game.map_settings.enemy_evolution.time_factor = 0.000008
game.map_settings.enemy_evolution.pollution_factor = 0.00003
game.map_settings.pollution.enabled = true
game.map_settings.enemy_evolution.enabled = true
game.map_settings.enemy_evolution.destroy_factor = 0.006
game.map_settings.enemy_evolution.time_factor = 0.00001
game.map_settings.enemy_evolution.pollution_factor = 0.00004
game.forces.player.set_ammo_damage_modifier("shotgun-shell", 1)

View File

@ -1,15 +1,13 @@
local event = require 'utils.event'
local main_caption = " --Nightfall-- "
local sub_caption = "*can you make it through the night*"
local sub_caption = "*can you make it through*"
local info = [[
They come out at night.
Trying to nom your rocket silo.
Maybe they just like the taste of the alloys, who knows.
They come out at night, trying to nom your rocket silo.
Fend them off as long as possible!
There seem to be shipwrecks of misfortunate explorers all over this place.
There seem to be shipwrecks of unfortunate explorers all over this place.
It might be worth scavenging a few.
Wreck loot quality increases with distance.

View File

@ -1,16 +1,18 @@
-- mountain digger fortress -- by mewmew --
-- digging thingie -- by mewmew --
require "maps.modules.satellite_score"
require "maps.modules.dynamic_landfill"
require "maps.modules.dynamic_player_spawn"
require "maps.modules.backpack_research"
require "maps.modules.rocks_broken_paint_tiles"
require "maps.modules.rocks_heal_over_time"
require "maps.modules.rocks_yield_ore_veins"
require "maps.modules.rocks_yield_ore"
require "maps.modules.biters_yield_coins"
require "maps.modules.explosive_biters"
require "maps.modules.spawners_contain_biters"
require "maps.modules.splice_double"
require "maps.modules.biters_double_hp"
require "maps.modules.biters_double_damage"
local event = require 'utils.event'
local math_random = math.random
@ -126,9 +128,9 @@ local function on_player_joined_game(event)
game.map_settings.pollution.enabled = true
game.map_settings.enemy_expansion.enabled = true
game.map_settings.enemy_evolution.destroy_factor = 0.004
game.map_settings.enemy_evolution.time_factor = 0.00002
game.map_settings.enemy_evolution.pollution_factor = 0.00003
game.map_settings.enemy_evolution.destroy_factor = 0.006
game.map_settings.enemy_evolution.time_factor = 0.00003
game.map_settings.enemy_evolution.pollution_factor = 0.00005
game.map_settings.enemy_expansion.max_expansion_distance = 15
game.map_settings.enemy_expansion.settler_group_min_size = 15
game.map_settings.enemy_expansion.settler_group_max_size = 30
@ -177,6 +179,10 @@ local function generate_north_chunk(area, surface)
local left_top = area.left_top
local tile_positions = {}
for _, e in pairs(surface.find_entities_filtered({area = event.area, type = "tree"})) do
e.destroy()
end
local tiles_to_set = {}
for x = 0, 31, 1 do
for y = 0, 31, 1 do
@ -234,7 +240,7 @@ local function generate_south_chunk(event, surface)
for _, e in pairs(surface.find_entities_filtered({area = event.area, type = "cliff"})) do
e.destroy()
end
local current_depth = math.sqrt(left_top.x^2 + left_top.y^2) * 0.05
local i = math.ceil(current_depth / 32)

View File

@ -24,7 +24,7 @@ function cheat_mode()
--surface.daytime = 1
--surface.freeze_daytime = 1
game.player.force.research_all_technologies()
game.forces["enemy"].evolution_factor = 0.5
game.forces["enemy"].evolution_factor = 0.9
local chart = 200
game.forces["player"].chart(surface, {lefttop = {x = chart*-1, y = chart*-1}, rightbottom = {x = chart, y = chart}})
end