mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-06 00:23:49 +02:00
room tweaks
This commit is contained in:
parent
e80864933c
commit
4a44a3dc45
@ -67,8 +67,11 @@ room.biters = function(surface, cell_left_top, direction)
|
|||||||
table.shuffle_table(tile_positions)
|
table.shuffle_table(tile_positions)
|
||||||
|
|
||||||
for _, pos in pairs(tile_positions) do
|
for _, pos in pairs(tile_positions) do
|
||||||
surface.create_entity({name = get_biter(), position = pos, force = "enemy"})
|
local enemy = get_biter()
|
||||||
amount = amount - 1
|
if surface.can_place_entity({name = enemy, position = pos}) then
|
||||||
|
surface.create_entity({name = enemy, position = pos, force = "enemy"})
|
||||||
|
amount = amount - 1
|
||||||
|
end
|
||||||
if amount < 1 then break end
|
if amount < 1 then break end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -87,8 +90,11 @@ room.spitters = function(surface, cell_left_top, direction)
|
|||||||
table.shuffle_table(tile_positions)
|
table.shuffle_table(tile_positions)
|
||||||
|
|
||||||
for _, pos in pairs(tile_positions) do
|
for _, pos in pairs(tile_positions) do
|
||||||
surface.create_entity({name = get_spitter(), position = pos, force = "enemy"})
|
local enemy = get_spitter()
|
||||||
amount = amount - 1
|
if surface.can_place_entity({name = enemy, position = pos}) then
|
||||||
|
surface.create_entity({name = enemy, position = pos, force = "enemy"})
|
||||||
|
amount = amount - 1
|
||||||
|
end
|
||||||
if amount < 1 then break end
|
if amount < 1 then break end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -157,7 +163,7 @@ room.tons_of_trees = function(surface, cell_left_top, direction)
|
|||||||
for x = 0.5, grid_size - 0.5, 1 do
|
for x = 0.5, grid_size - 0.5, 1 do
|
||||||
for y = 0.5, grid_size - 0.5, 1 do
|
for y = 0.5, grid_size - 0.5, 1 do
|
||||||
local pos = {left_top.x + x, left_top.y + y}
|
local pos = {left_top.x + x, left_top.y + y}
|
||||||
if math.random(1,3) == 1 then
|
if math.random(1,4) == 1 then
|
||||||
surface.create_entity({name = tree, position = pos, force = "neutral"})
|
surface.create_entity({name = tree, position = pos, force = "neutral"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -177,6 +183,7 @@ end
|
|||||||
room.single_rock = function(surface, cell_left_top, direction)
|
room.single_rock = function(surface, cell_left_top, direction)
|
||||||
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
||||||
surface.create_entity({name = rock_raffle[math.random(1, #rock_raffle)], position = {left_top.x + grid_size * 0.5, left_top.y + grid_size * 0.5}, force = "neutral"})
|
surface.create_entity({name = rock_raffle[math.random(1, #rock_raffle)], position = {left_top.x + grid_size * 0.5, left_top.y + grid_size * 0.5}, force = "neutral"})
|
||||||
|
room.biters(surface, cell_left_top, direction)
|
||||||
end
|
end
|
||||||
|
|
||||||
room.three_rocks = function(surface, cell_left_top, direction)
|
room.three_rocks = function(surface, cell_left_top, direction)
|
||||||
@ -258,6 +265,7 @@ room.tons_of_scrap = function(surface, cell_left_top, direction)
|
|||||||
end
|
end
|
||||||
|
|
||||||
room.pond = function(surface, cell_left_top, direction)
|
room.pond = function(surface, cell_left_top, direction)
|
||||||
|
local tree = tree_raffle[math.random(1, #tree_raffle)]
|
||||||
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
||||||
map_functions.draw_noise_tile_circle({x = left_top.x + grid_size * 0.5, y = left_top.y + grid_size * 0.5}, "water", surface, grid_size * 0.3)
|
map_functions.draw_noise_tile_circle({x = left_top.x + grid_size * 0.5, y = left_top.y + grid_size * 0.5}, "water", surface, grid_size * 0.3)
|
||||||
for x = 0.5, grid_size - 0.5, 1 do
|
for x = 0.5, grid_size - 0.5, 1 do
|
||||||
@ -268,6 +276,11 @@ room.pond = function(surface, cell_left_top, direction)
|
|||||||
surface.create_entity({name = "fish", position = pos, force = "neutral"})
|
surface.create_entity({name = "fish", position = pos, force = "neutral"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if math.random(1,40) == 1 then
|
||||||
|
if surface.can_place_entity({name = tree, position = pos, force = "neutral"}) then
|
||||||
|
surface.create_entity({name = tree, position = pos, force = "neutral"})
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -278,18 +291,18 @@ local room_weights = {
|
|||||||
|
|
||||||
{func = room.tons_of_trees, weight = 15},
|
{func = room.tons_of_trees, weight = 15},
|
||||||
|
|
||||||
{func = room.lots_of_rocks, weight = 25},
|
{func = room.lots_of_rocks, weight = 15},
|
||||||
{func = room.tons_of_rocks, weight = 15},
|
{func = room.tons_of_rocks, weight = 15},
|
||||||
{func = room.quad_rocks, weight = 10},
|
{func = room.quad_rocks, weight = 10},
|
||||||
{func = room.three_rocks, weight = 3},
|
{func = room.three_rocks, weight = 3},
|
||||||
{func = room.single_rock, weight = 10},
|
{func = room.single_rock, weight = 10},
|
||||||
|
|
||||||
{func = room.checkerboard_ore, weight = 5},
|
{func = room.checkerboard_ore, weight = 7},
|
||||||
{func = room.single_oil, weight = 5},
|
{func = room.single_oil, weight = 5},
|
||||||
--{func = room.some_scrap, weight = 10},
|
--{func = room.some_scrap, weight = 10},
|
||||||
{func = room.lots_of_scrap, weight = 5},
|
{func = room.lots_of_scrap, weight = 5},
|
||||||
--{func = room.tons_of_scrap, weight = 2},
|
--{func = room.tons_of_scrap, weight = 2},
|
||||||
{func = room.empty, weight = 1},
|
--{func = room.empty, weight = 1},
|
||||||
|
|
||||||
{func = room.pond, weight = 10},
|
{func = room.pond, weight = 10},
|
||||||
|
|
||||||
|
@ -123,6 +123,23 @@ room.spitters_and_biters = function(surface, cell_left_top, direction)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
room.random_enemies = function(surface, cell_left_top, direction)
|
||||||
|
local tree = tree_raffle[math.random(1, #tree_raffle)]
|
||||||
|
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
||||||
|
if math.random(1,2) == 1 then room.nests(surface, cell_left_top, direction) end
|
||||||
|
for x = 0.5, grid_size * 2 - 0.5, 1 do
|
||||||
|
for y = 0.5, grid_size * 2 - 0.5, 1 do
|
||||||
|
local pos = {left_top.x + x, left_top.y + y}
|
||||||
|
if math.random(1, math.random(32, 64)) == 1 then surface.create_entity({name = tree, position = pos, force = "neutral"}) end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if math.random(1,4) == 1 then room.worms(surface, cell_left_top, direction) end
|
||||||
|
if math.random(1,2) == 1 then room.biters(surface, cell_left_top, direction) end
|
||||||
|
if math.random(1,2) == 1 then room.spitters(surface, cell_left_top, direction) end
|
||||||
|
if math.random(1,2) == 1 then room.spitters_and_biters(surface, cell_left_top, direction) end
|
||||||
|
end
|
||||||
|
|
||||||
room.stone_block = function(surface, cell_left_top, direction)
|
room.stone_block = function(surface, cell_left_top, direction)
|
||||||
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
local left_top = {x = cell_left_top.x * grid_size, y = cell_left_top.y * grid_size}
|
||||||
for x = 4.5, grid_size * 2 - 4.5, 1 do
|
for x = 4.5, grid_size * 2 - 4.5, 1 do
|
||||||
@ -179,6 +196,10 @@ room.circle_pond_with_trees = function(surface, cell_left_top, direction)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if math.random(1,4) == 1 then room.worms(surface, cell_left_top, direction) end
|
||||||
|
if math.random(1,2) == 1 then room.biters(surface, cell_left_top, direction) end
|
||||||
|
if math.random(1,2) == 1 then room.spitters(surface, cell_left_top, direction) end
|
||||||
|
if math.random(1,2) == 1 then room.spitters_and_biters(surface, cell_left_top, direction) end
|
||||||
end
|
end
|
||||||
|
|
||||||
room.checkerboard_ore = function(surface, cell_left_top, direction)
|
room.checkerboard_ore = function(surface, cell_left_top, direction)
|
||||||
@ -206,6 +227,10 @@ room.checkerboard_ore = function(surface, cell_left_top, direction)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if math.random(1,4) == 1 then room.worms(surface, cell_left_top, direction) end
|
||||||
|
if math.random(1,2) == 1 then room.biters(surface, cell_left_top, direction) end
|
||||||
|
if math.random(1,2) == 1 then room.spitters(surface, cell_left_top, direction) end
|
||||||
|
if math.random(1,2) == 1 then room.spitters_and_biters(surface, cell_left_top, direction) end
|
||||||
end
|
end
|
||||||
|
|
||||||
room.minefield_chest = function(surface, cell_left_top, direction)
|
room.minefield_chest = function(surface, cell_left_top, direction)
|
||||||
@ -249,10 +274,7 @@ local room_weights = {
|
|||||||
{func = room.minefield_chest, weight = 5},
|
{func = room.minefield_chest, weight = 5},
|
||||||
{func = room.checkerboard_ore, weight = 3},
|
{func = room.checkerboard_ore, weight = 3},
|
||||||
|
|
||||||
{func = room.biters, weight = 3},
|
{func = room.random_enemies, weight = 20}
|
||||||
{func = room.spitters, weight = 3},
|
|
||||||
{func = room.spitters_and_biters, weight = 3},
|
|
||||||
{func = room.nests, weight = 8}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local room_shuffle = {}
|
local room_shuffle = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user