1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-17 20:58:13 +02:00
tiered worm turrets
decoratives for grassland biome
various roll values
This commit is contained in:
MewMew 2020-04-04 20:24:05 +02:00
parent 59933837b0
commit eb74c7daeb
10 changed files with 68 additions and 84 deletions

View File

@ -6,14 +6,6 @@ local table_remove = table.remove
local math_random = math.random
local math_abs = math.abs
local ores = {"iron-ore", "iron-ore", "iron-ore", "iron-ore", "copper-ore", "copper-ore", "copper-ore","coal", "coal", "stone", "stone","uranium-ore"}
local worms = {}
for _ = 1, 64, 1 do table_insert(worms, "small") end
for _ = 1, 8, 1 do table_insert(worms, "medium") end
for _ = 1, 4, 1 do table_insert(worms, "big") end
for _ = 1, 1, 1 do table_insert(worms, "behemoth") end
local size_of_worms = #worms
local function concrete(surface, room)
for _, tile in pairs(room.path_tiles) do
surface.set_tiles({{name = "concrete", position = tile.position}}, true)

View File

@ -9,12 +9,6 @@ local math_abs = math.abs
local ores = {"iron-ore", "iron-ore", "iron-ore", "iron-ore", "copper-ore", "copper-ore", "copper-ore","coal", "coal","stone", "stone"}
local trees = {"dead-dry-hairy-tree", "dead-grey-trunk", "dead-tree-desert", "dry-hairy-tree", "dry-tree"}
local size_of_trees = #trees
local worms = {}
for _ = 1, 64, 1 do table_insert(worms, "small") end
for _ = 1, 8, 1 do table_insert(worms, "medium") end
for _ = 1, 4, 1 do table_insert(worms, "big") end
for _ = 1, 1, 1 do table_insert(worms, "behemoth") end
local size_of_worms = #worms
local function desert(surface, room)
for _, tile in pairs(room.path_tiles) do
@ -47,8 +41,7 @@ local function desert(surface, room)
surface.create_entity({name = Functions.roll_spawner_name(), position = tile.position, force = "enemy"})
end
if math_random(1, 128) == 1 then
local turret_name = worms[math_random(1, size_of_worms)] .. "-worm-turret"
surface.create_entity({name = turret_name, position = tile.position, force = "enemy"})
surface.create_entity({name = Functions.roll_worm_name(), position = tile.position, force = "enemy"})
end
if math_random(1, 16) == 1 then
surface.create_entity({name = "mineable-wreckage", position = tile.position})
@ -71,7 +64,7 @@ local function desert(surface, room)
end
else
if math_random(1, 2) == 1 then
surface.create_entity({name = "crude-oil", position = room.center, amount = math_random(200000, 400000)})
surface.create_entity({name = "crude-oil", position = room.center, amount = Functions.get_crude_oil_amount()})
end
if math_random(1, 2) == 1 then
surface.create_entity({name = Functions.roll_spawner_name(), position = room.center})

View File

@ -6,15 +6,9 @@ local table_remove = table.remove
local math_random = math.random
local math_abs = math.abs
local ores = {"iron-ore", "iron-ore", "iron-ore", "iron-ore", "copper-ore", "copper-ore", "copper-ore","coal", "coal","stone", "stone","uranium-ore"}
local ores = {"iron-ore", "iron-ore", "iron-ore", "iron-ore", "copper-ore", "copper-ore", "copper-ore","coal", "coal","stone", "stone"}
local trees = {"dead-dry-hairy-tree", "dead-grey-trunk", "dead-tree-desert", "dry-hairy-tree", "dry-tree"}
local size_of_trees = #trees
local worms = {}
for _ = 1, 64, 1 do table_insert(worms, "small") end
for _ = 1, 8, 1 do table_insert(worms, "medium") end
for _ = 1, 4, 1 do table_insert(worms, "big") end
for _ = 1, 1, 1 do table_insert(worms, "behemoth") end
local size_of_worms = #worms
local function dirtlands(surface, room)
local path_tile = "dirt-" .. math_random(1, 3)
@ -44,8 +38,7 @@ local function dirtlands(surface, room)
surface.create_entity({name = Functions.roll_spawner_name(), position = tile.position, force = "enemy"})
end
if math_random(1, 320) == 1 then
local turret_name = worms[math_random(1, size_of_worms)] .. "-worm-turret"
surface.create_entity({name = turret_name, position = tile.position, force = "enemy"})
surface.create_entity({name = Functions.roll_worm_name(), position = tile.position, force = "enemy"})
end
if math_random(1, 512) == 1 then
surface.create_entity({name = "mineable-wreckage", position = tile.position})
@ -68,7 +61,7 @@ local function dirtlands(surface, room)
end
else
if math_random(1, 24) == 1 then
surface.create_entity({name = "crude-oil", position = room.center, amount = math_random(200000, 400000)})
surface.create_entity({name = "crude-oil", position = room.center, amount = Functions.get_crude_oil_amount()})
end
if math_random(1, 2) == 1 then
surface.create_entity({name = Functions.roll_spawner_name(), position = room.center})

View File

@ -9,12 +9,6 @@ local math_sqrt = math.sqrt
local math_floor = math.floor
local ores = {"iron-ore", "iron-ore", "iron-ore", "iron-ore", "copper-ore", "copper-ore", "copper-ore","coal", "coal","stone", "stone"}
local worms = {}
for _ = 1, 64, 1 do table_insert(worms, "small") end
for _ = 1, 8, 1 do table_insert(worms, "medium") end
for _ = 1, 4, 1 do table_insert(worms, "big") end
for _ = 1, 1, 1 do table_insert(worms, "behemoth") end
local size_of_worms = #worms
local function doom(surface, room)
for _, tile in pairs(room.path_tiles) do
@ -24,12 +18,11 @@ local function doom(surface, room)
if #room.room_tiles > 1 then table_shuffle_table(room.room_tiles) end
for key, tile in pairs(room.room_tiles) do
surface.set_tiles({{name = "red-refined-concrete", position = tile.position}}, true)
if math_random(1, 480) == 1 then
if math_random(1, 512) == 1 then
surface.create_entity({name = ores[math_random(1, #ores)], position = tile.position, amount = 99999999})
end
if math_random(1, 16) == 1 then
local turret_name = worms[math_random(1, size_of_worms)] .. "-worm-turret"
surface.create_entity({name = turret_name, position = tile.position})
surface.create_entity({name = Functions.roll_worm_name(), position = tile.position})
end
if key % 10 == 0 and math_random(1, 2) == 1 then
surface.create_entity({name = Functions.roll_spawner_name(), position = tile.position})

View File

@ -6,13 +6,7 @@ local table_remove = table.remove
local math_random = math.random
local math_abs = math.abs
local ores = {"iron-ore", "iron-ore", "iron-ore", "iron-ore", "copper-ore", "copper-ore", "copper-ore","coal", "coal", "stone", "stone","uranium-ore"}
local worms = {}
for _ = 1, 64, 1 do table_insert(worms, "small") end
for _ = 1, 8, 1 do table_insert(worms, "medium") end
for _ = 1, 4, 1 do table_insert(worms, "big") end
for _ = 1, 1, 1 do table_insert(worms, "behemoth") end
local size_of_worms = #worms
local ores = {"iron-ore", "copper-ore", "coal", "stone"}
local function glitch(surface, room)
for _, tile in pairs(room.path_tiles) do
@ -20,24 +14,15 @@ local function glitch(surface, room)
end
if not room.room_border_tiles[1] then return end
table_shuffle_table(room.room_border_tiles)
for key, tile in pairs(room.room_border_tiles) do
surface.set_tiles({{name = "lab-dark-2", position = tile.position}}, true)
if key < 7 then
surface.create_entity({name = "rock-big", position = tile.position})
end
end
table_shuffle_table(room.room_tiles)
for key, tile in pairs(room.room_tiles) do
surface.set_tiles({{name = "lab-dark-1", position = tile.position}}, true)
if math_random(1, 4) == 1 then
surface.create_entity({name = ores[math_random(1, #ores)], position = tile.position, amount = math_random(250, 750) + global.dungeons.depth * 10})
if math_random(1, 3) == 1 then
surface.create_entity({name = ores[math_random(1, #ores)], position = tile.position, amount = math_random(250, 500) + global.dungeons.depth * 10})
end
if math_random(1, 16) == 1 then
local turret_name = worms[math_random(1, size_of_worms)] .. "-worm-turret"
surface.create_entity({name = turret_name, position = tile.position})
surface.create_entity({name = Functions.roll_worm_name(), position = tile.position})
end
if math_random(1, 2048) == 1 then
surface.create_entity({name = "rock-huge", position = tile.position})
@ -59,10 +44,18 @@ local function glitch(surface, room)
end
else
if math_random(1, 4) == 1 then
surface.create_entity({name = "crude-oil", position = room.center, amount = math_random(200000, 400000)})
surface.create_entity({name = "crude-oil", position = room.center, amount = Functions.get_crude_oil_amount()})
end
end
end
table_shuffle_table(room.room_border_tiles)
for key, tile in pairs(room.room_border_tiles) do
surface.set_tiles({{name = "lab-dark-2", position = tile.position}}, true)
if key < 7 then
surface.create_entity({name = "rock-big", position = tile.position})
end
end
end
return glitch

View File

@ -1,4 +1,5 @@
local Functions = require "maps.dungeons.functions"
local Get_noise = require "utils.get_noise"
local table_shuffle_table = table.shuffle_table
local table_insert = table.insert
@ -8,34 +9,48 @@ local math_abs = math.abs
local math_sqrt = math.sqrt
local math_floor = math.floor
local decoratives = {"green-asterisk", "green-bush-mini", "green-carpet-grass", "green-hairy-grass", "green-small-grass"}
local ores = {"iron-ore", "iron-ore", "iron-ore", "iron-ore", "copper-ore", "copper-ore", "copper-ore","coal", "coal", "stone", "stone"}
local trees = {"tree-01", "tree-02", "tree-03", "tree-04", "tree-05"}
local size_of_trees = #trees
local worms = {}
for _ = 1, 64, 1 do table_insert(worms, "small") end
for _ = 1, 8, 1 do table_insert(worms, "medium") end
for _ = 1, 4, 1 do table_insert(worms, "big") end
for _ = 1, 1, 1 do table_insert(worms, "behemoth") end
local size_of_worms = #worms
local function draw_deco(surface, position, decorative_name, seed)
if surface.get_tile(position).name == "water" then return end
local noise = Get_noise("decoratives", position, seed)
if math_abs(noise) > 0.28 then
surface.create_decoratives{check_collision = false, decoratives = {{name = decorative_name, position = position, amount = math.floor(math.abs(noise * 3)) + 1}}}
end
end
local function draw_room_decoratives(surface, room)
local seed = game.surfaces[1].map_gen_settings.seed + math_random(1, 1000000)
local decorative_name = decoratives[math_random(1, #decoratives)]
for _, tile in pairs(room.path_tiles) do draw_deco(surface, tile.position, decorative_name, seed) end
for _, tile in pairs(room.room_border_tiles) do draw_deco(surface, tile.position, decorative_name, seed) end
for _, tile in pairs(room.room_tiles) do draw_deco(surface, tile.position, decorative_name, seed) end
end
local function grasslands(surface, room)
for _, tile in pairs(room.path_tiles) do
surface.set_tiles({{name = "grass-1", position = tile.position}}, true)
end
if #room.room_tiles > 1 then table_shuffle_table(room.room_tiles) end
if not room.room_tiles[1] then draw_room_decoratives(surface, room) return end
local tree_name = trees[math_random(1, size_of_trees)]
table_shuffle_table(room.room_tiles)
for key, tile in pairs(room.room_tiles) do
surface.set_tiles({{name = "grass-2", position = tile.position}}, true)
if math_random(1, 64) == 1 then
surface.create_entity({name = ores[math_random(1, #ores)], position = tile.position, amount = math_random(250, 500) + global.dungeons.depth * 10})
else
if math_random(1, 24) == 1 then
surface.create_entity({name = trees[math_random(1, size_of_trees)], position = tile.position})
if math_random(1, 12) == 1 then
surface.create_entity({name = tree_name, position = tile.position})
end
end
if math_random(1, 512) == 1 then
local turret_name = worms[math_random(1, size_of_worms)] .. "-worm-turret"
surface.create_entity({name = turret_name, position = tile.position})
if math_random(1, 256) == 1 then
surface.create_entity({name = Functions.roll_worm_name(), position = tile.position})
end
if math_random(1, 1024) == 1 then
surface.create_entity({name = "rock-huge", position = tile.position})
@ -61,17 +76,19 @@ local function grasslands(surface, room)
end
end
if #room.room_border_tiles > 1 then table_shuffle_table(room.room_border_tiles) end
table_shuffle_table(room.room_border_tiles)
for key, tile in pairs(room.room_border_tiles) do
surface.set_tiles({{name = "grass-3", position = tile.position}}, true)
if key < 9 then
if key % 8 == 1 then
surface.create_entity({name = "rock-big", position = tile.position})
else
if math_random(1, 8) == 1 then
surface.create_entity({name = trees[math_random(1, size_of_trees)], position = tile.position})
--surface.create_entity({name = tree_name, position = tile.position})
end
end
end
draw_room_decoratives(surface, room)
end
return grasslands

View File

@ -11,12 +11,6 @@ local math_floor = math.floor
local ores = {"iron-ore", "iron-ore", "iron-ore", "iron-ore", "copper-ore", "copper-ore", "copper-ore","coal", "coal","stone", "stone","uranium-ore"}
local trees = {"dead-dry-hairy-tree", "dead-grey-trunk", "dead-tree-desert", "dry-hairy-tree", "dry-tree"}
local size_of_trees = #trees
local worms = {}
for _ = 1, 64, 1 do table_insert(worms, "small") end
for _ = 1, 8, 1 do table_insert(worms, "medium") end
for _ = 1, 4, 1 do table_insert(worms, "big") end
for _ = 1, 1, 1 do table_insert(worms, "behemoth") end
local size_of_worms = #worms
local function red_desert(surface, room)
for _, tile in pairs(room.path_tiles) do
@ -37,8 +31,7 @@ local function red_desert(surface, room)
surface.create_entity({name = Functions.roll_spawner_name(), position = tile.position, force = "enemy"})
end
if math_random(1, 256) == 1 then
local turret_name = worms[math_random(1, size_of_worms)] .. "-worm-turret"
surface.create_entity({name = turret_name, position = tile.position, force = "enemy"})
surface.create_entity({name = Functions.roll_worm_name(), position = tile.position, force = "enemy"})
end
if math_random(1, 32) == 1 then
surface.create_entity({name = "rock-huge", position = tile.position})

View File

@ -1,5 +1,7 @@
local Public = {}
local BiterRaffle = require "functions.biter_raffle"
local table_insert = table.insert
local table_remove = table.remove
local math_random = math.random
@ -13,4 +15,12 @@ function Public.roll_spawner_name()
return "biter-spawner"
end
function Public.roll_worm_name()
return BiterRaffle.roll("worm", global.dungeons.depth * 0.002)
end
function Public.get_crude_oil_amount()
return math_random(200000, 400000) + global.dungeons.depth * 500
end
return Public

View File

@ -2,13 +2,12 @@
require "modules.mineable_wreckage_yields_scrap"
require "modules.biters_yield_ore"
require "modules.rpg"
require "modules.explosives"
local MapInfo = require "modules.map_info"
local Room_generator = require "functions.room_generator"
local RPG = require "modules.rpg"
local BiterHealthBooster = require "modules.biter_health_booster"
local BiterRaffle = require "functions.biter_raffle"
local Biomes = {}
Biomes.dirtlands = require "maps.dungeons.biome_dirtlands"
@ -42,7 +41,7 @@ local function get_biome(position)
if Get_noise("dungeons", position, seed + seed_addition * 1) > 0.59 then return "glitch" end
if Get_noise("dungeons", position, seed + seed_addition * 2) > 0.48 then return "doom" end
if Get_noise("dungeons", position, seed + seed_addition * 3) > 0.21 then return "grasslands" end
if Get_noise("dungeons", position, seed + seed_addition * 3) > 0.20 then return "grasslands" end
if Get_noise("dungeons", position, seed + seed_addition * 4) > 0.35 then return "red_desert" end
if Get_noise("dungeons", position, seed + seed_addition * 5) > 0.25 then return "desert" end
if Get_noise("dungeons", position, seed + seed_addition * 6) > 0.75 then return "concrete" end
@ -208,7 +207,7 @@ local function on_init()
surface.delete_chunk({chunk.x, chunk.y})
end
--game.forces.player.manual_mining_speed_modifier = 0
game.forces.player.manual_mining_speed_modifier = 0
global.dungeons = {}
global.dungeons.depth = 0

View File

@ -7,6 +7,7 @@ local noises = {
["cave_rivers_2"] = {{modifier = 0.003, weight = 1}, {modifier = 0.01, weight = 0.21}, {modifier = 0.05, weight = 0.01}},
["cave_rivers_3"] = {{modifier = 0.002, weight = 1}, {modifier = 0.01, weight = 0.15}, {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}},
["dungeons"] = {{modifier = 0.005, weight = 1}, {modifier = 0.01, weight = 0.25}},
["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}},