1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-19 21:10:19 +02:00

added sewer

This commit is contained in:
MewMew 2020-04-07 21:51:18 +02:00
parent 967b5b5bb4
commit 5875d3857f
5 changed files with 82 additions and 39 deletions

View File

@ -70,6 +70,7 @@ require "modules.autostash"
--require "maps.biter_battles_v2.main" --require "maps.biter_battles_v2.main"
--require "maps.native_war.main" --require "maps.native_war.main"
--require "maps.mountain_fortress_v2.main" --require "maps.mountain_fortress_v2.main"
--require "maps.dungeons.main"
--require "maps.island_troopers.main" --require "maps.island_troopers.main"
--require "maps.biter_hatchery.main" --require "maps.biter_hatchery.main"
--require "maps.junkyard_pvp.main" --require "maps.junkyard_pvp.main"
@ -105,7 +106,6 @@ require "modules.autostash"
--require "maps.spiral_troopers" --require "maps.spiral_troopers"
--require "maps.refactor-io" --require "maps.refactor-io"
--require "maps.desert_oasis" --require "maps.desert_oasis"
--require "maps.dungeons.main"
--require "maps.lost_desert" --require "maps.lost_desert"
--require "maps.stoneblock" --require "maps.stoneblock"
--require "maps.wave_defense" --require "maps.wave_defense"

View File

@ -64,10 +64,10 @@ local function dirtlands(surface, room)
if math_random(1, 256) == 1 then if math_random(1, 256) == 1 then
surface.create_entity({name = "rock-huge", position = tile.position}) surface.create_entity({name = "rock-huge", position = tile.position})
end end
if math_random(1, 256) == 1 then if math_random(1, 320) == 1 then
Functions.common_loot_crate(surface, tile.position) Functions.common_loot_crate(surface, tile.position)
else else
if math_random(1, 512) == 1 then if math_random(1, 640) == 1 then
Functions.uncommon_loot_crate(surface, tile.position) Functions.uncommon_loot_crate(surface, tile.position)
end end
end end

View File

@ -63,10 +63,10 @@ local function grasslands(surface, room)
if math_random(1, 1024) == 1 then if math_random(1, 1024) == 1 then
surface.create_entity({name = "rock-huge", position = tile.position}) surface.create_entity({name = "rock-huge", position = tile.position})
end end
if math_random(1, 256) == 1 then if math_random(1, 320) == 1 then
Functions.common_loot_crate(surface, tile.position) Functions.common_loot_crate(surface, tile.position)
else else
if math_random(1, 512) == 1 then if math_random(1, 640) == 1 then
Functions.uncommon_loot_crate(surface, tile.position) Functions.uncommon_loot_crate(surface, tile.position)
end end
end end

View File

@ -101,6 +101,25 @@ local function expand(surface, position)
draw_depth_gui() draw_depth_gui()
end end
local function init_player(player)
if player.character then
player.disassociate_character(player.character)
player.character.destroy()
end
player.set_controller({type=defines.controllers.god})
player.create_character()
local surface = game.surfaces["dungeons"]
player.teleport(surface.find_non_colliding_position("character", {0, 0}, 50, 0.5), surface)
player.insert({name = "raw-fish", count = 8})
player.set_quick_bar_slot(1, "raw-fish")
player.insert({name = "pistol", count = 1})
player.insert({name = "firearm-magazine", count = 16})
draw_depth_gui()
end
local function draw_spawn_decoratives(surface) local function draw_spawn_decoratives(surface)
local decoratives = {"brown-hairy-grass", "brown-asterisk", "brown-fluff", "brown-fluff-dry", "brown-asterisk", "brown-fluff", "brown-fluff-dry"} local decoratives = {"brown-hairy-grass", "brown-asterisk", "brown-fluff", "brown-fluff-dry", "brown-asterisk", "brown-fluff", "brown-fluff-dry"}
local a = spawn_size * -1 + 1 local a = spawn_size * -1 + 1
@ -122,6 +141,10 @@ local function draw_spawn_decoratives(surface)
end end
local function draw_spawn(surface) local function draw_spawn(surface)
for _, e in pairs(surface.find_entities({{spawn_size * -1, spawn_size * -1}, {spawn_size, spawn_size}})) do
e.destroy()
end
local tiles = {} local tiles = {}
local i = 1 local i = 1
for x = spawn_size * -1, spawn_size, 1 do for x = spawn_size * -1, spawn_size, 1 do
@ -130,6 +153,9 @@ local function draw_spawn(surface)
if math_abs(position.x) < 2 or math_abs(position.y) < 2 then if math_abs(position.x) < 2 or math_abs(position.y) < 2 then
tiles[i] = {name = "stone-path", position = position} tiles[i] = {name = "stone-path", position = position}
i = i + 1 i = i + 1
else
tiles[i] = {name = "dirt-7", position = position}
i = i + 1
end end
end end
end end
@ -224,44 +250,65 @@ local function draw_spawn(surface)
end end
end end
surface.set_tiles(tiles, true) surface.set_tiles(tiles, true)
for _, p in pairs(game.connected_players) do
init_player(p)
end
end end
local function on_chunk_generated(event) local function on_chunk_generated(event)
local surface = event.surface local surface = event.surface
if surface.name ~= "dungeons" then return end
local left_top = event.area.left_top local left_top = event.area.left_top
if math_abs(left_top.x) > 256 or math_abs(left_top.y) > 256 then
local tiles = {}
local i = 1
for x = 0, 31, 1 do
for y = 0, 31, 1 do
local position = {x = left_top.x + x, y = left_top.y + y}
tiles[i] = {name = "out-of-map", position = position}
i = i + 1
end
end
surface.set_tiles(tiles, true)
return
end
local tiles = {} local tiles = {}
local i = 1 local i = 1
for x = 0, 31, 1 do for x = 0, 31, 1 do
for y = 0, 31, 1 do for y = 0, 31, 1 do
local position = {x = left_top.x + x, y = left_top.y + y} local position = {x = left_top.x + x, y = left_top.y + y}
if position.x > spawn_size or position.y > spawn_size or position.x < spawn_size * -1 or position.y < spawn_size * -1 then tiles[i] = {name = "out-of-map", position = position}
tiles[i] = {name = "out-of-map", position = position} i = i + 1
i = i + 1
else
tiles[i] = {name = "dirt-7", position = position}
i = i + 1
end
end end
end end
surface.set_tiles(tiles, true) surface.set_tiles(tiles, true)
local rock_positions = {}
local set_tiles = surface.set_tiles
local nauvis_seed = game.surfaces[1].map_gen_settings.seed
local s = math_floor(nauvis_seed * 0.1) + 50
for a = 1, 3, 1 do
local b = a * s
local c = a * 0.0077
local d = c * 0.5
local seed = nauvis_seed + b
if math_abs(Get_noise("dungeon_sewer", {x = left_top.x + 16, y = left_top.y + 16}, seed)) < 0.08 then
for x = 0, 31, 1 do
for y = 0, 31, 1 do
local position = {x = left_top.x + x, y = left_top.y + y}
local noise = math_abs(Get_noise("dungeon_sewer", position, seed))
if noise < c then
local tile_name = surface.get_tile(position).name
if noise > d and tile_name ~= "deepwater-green" then
set_tiles({{name = "water-green", position = position}}, true)
if math_random(1, 1024) == 1 then table_insert(rock_positions, position) end
else
set_tiles({{name = "deepwater-green", position = position}}, true)
if math_random(1, 64) == 1 then
surface.create_entity({name = "fish", position = position})
end
end
end
end
end
end
end
for _, p in pairs(rock_positions) do Functions.place_border_rock(surface, p) end
if left_top.x == 160 and left_top.y == 160 then if left_top.x == 160 and left_top.y == 160 then
draw_spawn(surface) draw_spawn(surface)
game.forces.player.chart(surface, {{-256, -256}, {256, 256}})
end end
end end
@ -299,18 +346,11 @@ local function on_entity_spawned(event)
end end
local function on_player_joined_game(event) local function on_player_joined_game(event)
if game.tick == 0 then return end
local player = game.players[event.player_index] local player = game.players[event.player_index]
local surface = game.surfaces["dungeons"]
if player.online_time == 0 then if player.online_time == 0 then
player.teleport(surface.find_non_colliding_position("character", {0, 0}, 50, 0.5), surface) init_player(player)
player.insert({name = "raw-fish", count = 8})
player.set_quick_bar_slot(1, "raw-fish")
player.insert({name = "pistol", count = 1})
player.insert({name = "firearm-magazine", count = 16})
end end
draw_depth_gui()
end end
local function spawner_death(entity) local function spawner_death(entity)
@ -329,7 +369,7 @@ local function spawner_death(entity)
end end
local function mining_events(entity) local function mining_events(entity)
if math_random(1, 8) == 1 then Functions.spawn_random_biter(entity.surface, entity.position) return end if math_random(1, 16) == 1 then Functions.spawn_random_biter(entity.surface, entity.position) return end
if math_random(1, 32) == 1 then Functions.common_loot_crate(entity.surface, entity.position) return end if math_random(1, 32) == 1 then Functions.common_loot_crate(entity.surface, entity.position) return end
if math_random(1, 128) == 1 then Functions.uncommon_loot_crate(entity.surface, entity.position) return end if math_random(1, 128) == 1 then Functions.uncommon_loot_crate(entity.surface, entity.position) return end
if math_random(1, 512) == 1 then Functions.rare_loot_crate(entity.surface, entity.position) return end if math_random(1, 512) == 1 then Functions.rare_loot_crate(entity.surface, entity.position) return end
@ -410,6 +450,8 @@ local function on_init()
T.localised_category = "dungeons" T.localised_category = "dungeons"
T.main_caption_color = {r = 0, g = 0, b = 0} T.main_caption_color = {r = 0, g = 0, b = 0}
T.sub_caption_color = {r = 150, g = 0, b = 20} T.sub_caption_color = {r = 150, g = 0, b = 20}
end end
local Event = require 'utils.event' local Event = require 'utils.event'

View File

@ -9,6 +9,7 @@ local noises = {
["cave_rivers_4"] = {{modifier = 0.001, weight = 1}, {modifier = 0.01, weight = 0.11}, {modifier = 0.05, weight = 0.01}}, ["cave_rivers_4"] = {{modifier = 0.001, weight = 1}, {modifier = 0.01, weight = 0.11}, {modifier = 0.05, weight = 0.01}},
["decoratives"] = {{modifier = 0.03, weight = 1}, {modifier = 0.05, weight = 0.25}, {modifier = 0.1, weight = 0.05}}, ["decoratives"] = {{modifier = 0.03, weight = 1}, {modifier = 0.05, weight = 0.25}, {modifier = 0.1, weight = 0.05}},
["dungeons"] = {{modifier = 0.005, weight = 1}, {modifier = 0.01, weight = 0.25}}, ["dungeons"] = {{modifier = 0.005, weight = 1}, {modifier = 0.01, weight = 0.25}},
["dungeon_sewer"] = {{modifier = 0.0005, weight = 1}, {modifier = 0.005, weight = 0.025}, {modifier = 0.025, weight = 0.0025}},
["large_caves"] = {{modifier = 0.0033, weight = 1}, {modifier = 0.01, weight = 0.22}, {modifier = 0.05, weight = 0.05}, {modifier = 0.1, weight = 0.04}}, ["large_caves"] = {{modifier = 0.0033, weight = 1}, {modifier = 0.01, weight = 0.22}, {modifier = 0.05, weight = 0.05}, {modifier = 0.1, weight = 0.04}},
["n1"] = {{modifier = 0.0001, weight = 1}}, ["n1"] = {{modifier = 0.0001, weight = 1}},
["n2"] = {{modifier = 0.001, weight = 1}}, ["n2"] = {{modifier = 0.001, weight = 1}},