mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
Add redmew_surface to maps, clean up linting, clean up broken maps
This commit is contained in:
parent
3f8be3151a
commit
a6f1d6895c
@ -3,6 +3,11 @@
|
||||
-- Use water only in starting area as map setting!!!
|
||||
local perlin = require 'map_gen.shared.perlin_noise'
|
||||
local Token = require 'utils.token'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local insert = table.insert
|
||||
local random = math.random
|
||||
|
||||
local wreck_item_pool = {
|
||||
{name = 'iron-gear-wheel', count = 32},
|
||||
@ -34,14 +39,16 @@ local wreck_item_pool = {
|
||||
{name = 'explosive-rocket', count = 32}
|
||||
}
|
||||
|
||||
RS.set_map_gen_settings({MGSP.water_none})
|
||||
|
||||
local ship_callback =
|
||||
Token.register(
|
||||
function(entity)
|
||||
entity.health = math.random(entity.health)
|
||||
entity.health = random(entity.health)
|
||||
|
||||
entity.insert(wreck_item_pool[math.random(#wreck_item_pool)])
|
||||
entity.insert(wreck_item_pool[math.random(#wreck_item_pool)])
|
||||
entity.insert(wreck_item_pool[math.random(#wreck_item_pool)])
|
||||
entity.insert(wreck_item_pool[random(#wreck_item_pool)])
|
||||
entity.insert(wreck_item_pool[random(#wreck_item_pool)])
|
||||
entity.insert(wreck_item_pool[random(#wreck_item_pool)])
|
||||
end
|
||||
)
|
||||
|
||||
@ -54,31 +61,24 @@ local function do_clear_entities(world)
|
||||
end
|
||||
end
|
||||
|
||||
local random_health =
|
||||
Token.register(
|
||||
function(e)
|
||||
e.health = math.random(e.health)
|
||||
end
|
||||
)
|
||||
|
||||
local medium_health =
|
||||
Token.register(
|
||||
function(e)
|
||||
e.health = math.random(math.floor(e.health * 0.333), math.floor(e.health * 0.666))
|
||||
e.health = random(math.floor(e.health * 0.333), math.floor(e.health * 0.666))
|
||||
end
|
||||
)
|
||||
|
||||
local low_health =
|
||||
Token.register(
|
||||
function(e)
|
||||
e.health = math.random(math.floor(e.health * 0.033), math.floor(e.health * 0.330))
|
||||
e.health = random(math.floor(e.health * 0.033), math.floor(e.health * 0.330))
|
||||
end
|
||||
)
|
||||
|
||||
local turrent_callback =
|
||||
Token.register(
|
||||
function(e)
|
||||
if math.random(1, 3) == 1 then
|
||||
if random(1, 3) == 1 then
|
||||
e.insert('piercing-rounds-magazine')
|
||||
else
|
||||
e.insert('firearm-magazine')
|
||||
@ -86,10 +86,9 @@ local turrent_callback =
|
||||
end
|
||||
)
|
||||
|
||||
return function(x, y, world)
|
||||
return function(_, _, world)
|
||||
local entities = {}
|
||||
|
||||
local area = world.area
|
||||
local surface = world.surface
|
||||
|
||||
if not world.island_resort_cleared then
|
||||
@ -123,12 +122,12 @@ return function(x, y, world)
|
||||
local noise_walls = noise_walls_1 + noise_walls_2 * 0.1 + noise_walls_3 * 0.03
|
||||
|
||||
if noise_borg_defense > 0.66 then
|
||||
if math.random(25) == 1 then
|
||||
table.insert(entities, {name = 'big-ship-wreck-1', force = 'player', callback = ship_callback})
|
||||
elseif math.random(25) == 1 then
|
||||
table.insert(entities, {name = 'big-ship-wreck-2', force = 'player', callback = ship_callback})
|
||||
elseif math.random(25) == 1 then
|
||||
table.insert(entities, {name = 'big-ship-wreck-3', force = 'player', callback = ship_callback})
|
||||
if random(25) == 1 then
|
||||
insert(entities, {name = 'big-ship-wreck-1', force = 'player', callback = ship_callback})
|
||||
elseif random(25) == 1 then
|
||||
insert(entities, {name = 'big-ship-wreck-2', force = 'player', callback = ship_callback})
|
||||
elseif random(25) == 1 then
|
||||
insert(entities, {name = 'big-ship-wreck-3', force = 'player', callback = ship_callback})
|
||||
end
|
||||
end
|
||||
|
||||
@ -142,70 +141,70 @@ return function(x, y, world)
|
||||
tile_to_insert = 'stone-path'
|
||||
end
|
||||
if noise_borg_defense > 0.65 and noise_borg_defense < 0.66 then
|
||||
table.insert(entities, {name = 'substation', force = 'enemy'})
|
||||
insert(entities, {name = 'substation', force = 'enemy'})
|
||||
end
|
||||
if noise_borg_defense >= 0.54 and noise_borg_defense < 0.65 then
|
||||
table.insert(entities, {name = 'solar-panel', force = 'enemy'})
|
||||
insert(entities, {name = 'solar-panel', force = 'enemy'})
|
||||
end
|
||||
if noise_borg_defense > 0.53 and noise_borg_defense < 0.54 then
|
||||
table.insert(entities, {name = 'substation', force = 'enemy'})
|
||||
insert(entities, {name = 'substation', force = 'enemy'})
|
||||
end
|
||||
if noise_borg_defense >= 0.51 and noise_borg_defense < 0.53 then
|
||||
table.insert(entities, {name = 'accumulator', force = 'enemy'})
|
||||
insert(entities, {name = 'accumulator', force = 'enemy'})
|
||||
end
|
||||
if noise_borg_defense >= 0.50 and noise_borg_defense < 0.51 then
|
||||
table.insert(entities, {name = 'substation', force = 'enemy'})
|
||||
insert(entities, {name = 'substation', force = 'enemy'})
|
||||
end
|
||||
if noise_borg_defense >= 0.487 and noise_borg_defense < 0.50 then
|
||||
table.insert(entities, {name = 'laser-turret', force = 'enemy'})
|
||||
insert(entities, {name = 'laser-turret', force = 'enemy'})
|
||||
end
|
||||
if noise_borg_defense >= 0.485 and noise_borg_defense < 0.487 then
|
||||
table.insert(entities, {name = 'substation', force = 'enemy'})
|
||||
insert(entities, {name = 'substation', force = 'enemy'})
|
||||
end
|
||||
if noise_borg_defense >= 0.45 and noise_borg_defense < 0.484 then
|
||||
table.insert(entities, {name = 'stone-wall', force = 'enemy'})
|
||||
insert(entities, {name = 'stone-wall', force = 'enemy'})
|
||||
end
|
||||
|
||||
if noise_trees > 0.2 and tile_to_insert == 'sand-3' then
|
||||
if math.random(1, 15) == 1 then
|
||||
if math.random(1, 5) == 1 then
|
||||
table.insert(entities, {name = 'dry-hairy-tree'})
|
||||
if random(1, 15) == 1 then
|
||||
if random(1, 5) == 1 then
|
||||
insert(entities, {name = 'dry-hairy-tree'})
|
||||
else
|
||||
table.insert(entities, {name = 'dry-tree'})
|
||||
insert(entities, {name = 'dry-tree'})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if math.random(35000) == 1 then
|
||||
table.insert(entities, {name = 'big-ship-wreck-1', force = 'player', callback = ship_callback})
|
||||
elseif math.random(45000) == 1 then
|
||||
table.insert(entities, {name = 'big-ship-wreck-2', force = 'player', callback = ship_callback})
|
||||
elseif math.random(55000) == 1 then
|
||||
table.insert(entities, {name = 'big-ship-wreck-3', force = 'player', callback = ship_callback})
|
||||
elseif noise_walls > -0.03 and noise_walls < 0.03 and math.random(40) == 1 then
|
||||
table.insert(entities, {name = 'gun-turret', force = 'enemy', callback = turrent_callback})
|
||||
elseif noise_borg_defense > 0.41 and noise_borg_defense < 0.45 and math.random(15) == 1 then
|
||||
table.insert(entities, {name = 'gun-turret', force = 'enemy', callback = turrent_callback})
|
||||
elseif math.random(7500) == 1 then
|
||||
table.insert(entities, {name = 'pipe-to-ground', force = 'enemy'})
|
||||
elseif tile_to_insert ~= 'stone-path' and tile_to_insert ~= 'concrete' and math.random(1500) == 1 then
|
||||
table.insert(entities, {name = 'dead-dry-hairy-tree'})
|
||||
elseif tile_to_insert ~= 'stone-path' and tile_to_insert ~= 'concrete' and math.random(1500) == 1 then
|
||||
table.insert(entities, {name = 'dead-grey-trunk'})
|
||||
elseif math.random(25000) == 1 then
|
||||
table.insert(entities, {name = 'medium-ship-wreck', force = 'player', callback = medium_health})
|
||||
elseif math.random(15000) == 1 then
|
||||
table.insert(entities, {name = 'small-ship-wreck', force = 'player', callback = medium_health})
|
||||
elseif math.random(150000) == 1 then
|
||||
table.insert(entities, {name = 'car', force = 'player', callback = low_health})
|
||||
elseif math.random(100000) == 1 then
|
||||
table.insert(entities, {name = 'laser-turret', force = 'enemy', callback = low_health})
|
||||
elseif math.random(1000000) == 1 then
|
||||
table.insert(entities, {name = 'nuclear-reactor', force = 'enemy', callback = medium_health})
|
||||
if random(35000) == 1 then
|
||||
insert(entities, {name = 'big-ship-wreck-1', force = 'player', callback = ship_callback})
|
||||
elseif random(45000) == 1 then
|
||||
insert(entities, {name = 'big-ship-wreck-2', force = 'player', callback = ship_callback})
|
||||
elseif random(55000) == 1 then
|
||||
insert(entities, {name = 'big-ship-wreck-3', force = 'player', callback = ship_callback})
|
||||
elseif noise_walls > -0.03 and noise_walls < 0.03 and random(40) == 1 then
|
||||
insert(entities, {name = 'gun-turret', force = 'enemy', callback = turrent_callback})
|
||||
elseif noise_borg_defense > 0.41 and noise_borg_defense < 0.45 and random(15) == 1 then
|
||||
insert(entities, {name = 'gun-turret', force = 'enemy', callback = turrent_callback})
|
||||
elseif random(7500) == 1 then
|
||||
insert(entities, {name = 'pipe-to-ground', force = 'enemy'})
|
||||
elseif tile_to_insert ~= 'stone-path' and tile_to_insert ~= 'concrete' and random(1500) == 1 then
|
||||
insert(entities, {name = 'dead-dry-hairy-tree'})
|
||||
elseif tile_to_insert ~= 'stone-path' and tile_to_insert ~= 'concrete' and random(1500) == 1 then
|
||||
insert(entities, {name = 'dead-grey-trunk'})
|
||||
elseif random(25000) == 1 then
|
||||
insert(entities, {name = 'medium-ship-wreck', force = 'player', callback = medium_health})
|
||||
elseif random(15000) == 1 then
|
||||
insert(entities, {name = 'small-ship-wreck', force = 'player', callback = medium_health})
|
||||
elseif random(150000) == 1 then
|
||||
insert(entities, {name = 'car', force = 'player', callback = low_health})
|
||||
elseif random(100000) == 1 then
|
||||
insert(entities, {name = 'laser-turret', force = 'enemy', callback = low_health})
|
||||
elseif random(1000000) == 1 then
|
||||
insert(entities, {name = 'nuclear-reactor', force = 'enemy', callback = medium_health})
|
||||
end
|
||||
|
||||
if noise_trees < -0.5 and (tile_to_insert == 'sand-3' or tile_to_insert == 'sand-1') and math.random(15) == 1 then
|
||||
table.insert(entities, {name = 'rock-big'})
|
||||
if noise_trees < -0.5 and (tile_to_insert == 'sand-3' or tile_to_insert == 'sand-1') and random(15) == 1 then
|
||||
insert(entities, {name = 'rock-big'})
|
||||
end
|
||||
|
||||
local noise_water_1 = perlin.noise(((world.x + seed) / 200), ((world.y + seed) / 200), 0)
|
||||
@ -228,10 +227,7 @@ return function(x, y, world)
|
||||
seed = seed + seed_increment_number
|
||||
noise_water_2 = noise_water_1 + noise_water_2 + noise_water_3 * 0.07 + noise_water_4 * 0.07
|
||||
|
||||
if
|
||||
tile_to_insert ~= 'stone-path' and tile_to_insert ~= 'concrete' and noise_water > -0.15 and noise_water < 0.15 and
|
||||
noise_water_2 > 0.5
|
||||
then
|
||||
if tile_to_insert ~= 'stone-path' and tile_to_insert ~= 'concrete' and noise_water > -0.15 and noise_water < 0.15 and noise_water_2 > 0.5 then
|
||||
tile_to_insert = 'water-green'
|
||||
end
|
||||
|
||||
@ -239,7 +235,7 @@ return function(x, y, world)
|
||||
local a = -0.01
|
||||
local b = 0.01
|
||||
if noise_walls > a and noise_walls < b then
|
||||
table.insert(entities, {name = 'stone-wall', force = 'enemy'})
|
||||
insert(entities, {name = 'stone-wall', force = 'enemy'})
|
||||
end
|
||||
if noise_walls >= a and noise_walls <= b then
|
||||
tile_to_insert = 'concrete'
|
||||
@ -261,10 +257,7 @@ return function(x, y, world)
|
||||
|
||||
local decoratives
|
||||
if noise_decoratives > 0.3 and noise_decoratives < 0.5 then
|
||||
if
|
||||
tile_to_insert ~= 'stone-path' and tile_to_insert ~= 'concrete' and tile_to_insert ~= 'water-green' and
|
||||
math.random(10) == 1
|
||||
then
|
||||
if tile_to_insert ~= 'stone-path' and tile_to_insert ~= 'concrete' and tile_to_insert ~= 'water-green' and random(10) == 1 then
|
||||
decoratives = {name = 'red-desert-bush', amount = 1}
|
||||
end
|
||||
end
|
||||
|
@ -1,628 +0,0 @@
|
||||
--Author: MewMew
|
||||
-- Threaded by Tris
|
||||
-- !! ATTENTION !!
|
||||
-- Use water only in starting area as map setting!!!
|
||||
local perlin = require 'map_gen.shared.perlin_noise'
|
||||
local Task = require 'utils.task'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
wreck_item_pool = {}
|
||||
wreck_item_pool = {
|
||||
{name = 'iron-gear-wheel', count = 32},
|
||||
{name = 'iron-plate', count = 64},
|
||||
{name = 'rocket-control-unit', count = 1},
|
||||
{name = 'coal', count = 4},
|
||||
{name = 'rocket-launcher', count = 1},
|
||||
{name = 'rocket', count = 32},
|
||||
{name = 'copper-cable', count = 128},
|
||||
{name = 'land-mine', count = 64},
|
||||
{name = 'railgun', count = 1},
|
||||
{name = 'railgun-dart', count = 128},
|
||||
{name = 'fast-inserter', count = 8},
|
||||
{name = 'stack-filter-inserter', count = 2},
|
||||
{name = 'belt-immunity-equipment', count = 1},
|
||||
{name = 'fusion-reactor-equipment', count = 1},
|
||||
{name = 'electric-engine-unit', count = 8},
|
||||
{name = 'exoskeleton-equipment', count = 1},
|
||||
{name = 'rocket-fuel', count = 10},
|
||||
{name = 'used-up-uranium-fuel-cell', count = 3},
|
||||
{name = 'uranium-fuel-cell', count = 2}
|
||||
}
|
||||
|
||||
local function place_entities(surface, entity_list)
|
||||
local directions = {
|
||||
defines.direction.north,
|
||||
defines.direction.east,
|
||||
defines.direction.south,
|
||||
defines.direction.west
|
||||
}
|
||||
for _, entity in pairs(entity_list) do
|
||||
local r = math.random(1, entity.chance)
|
||||
if r == 1 then
|
||||
if not entity.force then
|
||||
entity.force = 'player'
|
||||
end
|
||||
local r = math.random(1, 4)
|
||||
if
|
||||
surface.can_place_entity {
|
||||
name = entity.name,
|
||||
position = entity.pos,
|
||||
direction = directions[r],
|
||||
force = entity.force
|
||||
}
|
||||
then
|
||||
local e =
|
||||
surface.create_entity {
|
||||
name = entity.name,
|
||||
position = entity.pos,
|
||||
direction = directions[r],
|
||||
force = entity.force
|
||||
}
|
||||
if entity.health then
|
||||
if entity.health == 'low' then
|
||||
e.health = ((e.health / 1000) * math.random(33, 330))
|
||||
end
|
||||
if entity.health == 'medium' then
|
||||
e.health = ((e.health / 1000) * math.random(333, 666))
|
||||
end
|
||||
if entity.health == 'high' then
|
||||
e.health = ((e.health / 1000) * math.random(666, 999))
|
||||
end
|
||||
if entity.health == 'random' then
|
||||
e.health = ((e.health / 1000) * math.random(1, 1000))
|
||||
end
|
||||
end
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function auto_place_entity_around_target(entity, scan_radius, mode, density, surface)
|
||||
local x = entity.pos.x
|
||||
local y = entity.pos.y
|
||||
if not surface then
|
||||
surface = RS.get_surface()
|
||||
end
|
||||
if not scan_radius then
|
||||
scan_radius = 6
|
||||
end
|
||||
if not entity then
|
||||
return
|
||||
end
|
||||
if not mode then
|
||||
mode = 'ball'
|
||||
end
|
||||
if not density then
|
||||
density = 1
|
||||
end
|
||||
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
|
||||
local i = 2
|
||||
local r = 1
|
||||
|
||||
if mode == 'ball' then
|
||||
if math.random(1, 2) == 1 then
|
||||
density = density * -1
|
||||
end
|
||||
r = math.random(1, 4)
|
||||
end
|
||||
if mode == 'line' then
|
||||
density = 1
|
||||
r = math.random(1, 4)
|
||||
end
|
||||
if mode == 'line_down' then
|
||||
density = density * -1
|
||||
r = math.random(1, 4)
|
||||
end
|
||||
if mode == 'line_up' then
|
||||
density = 1
|
||||
r = math.random(1, 4)
|
||||
end
|
||||
if mode == 'block' then
|
||||
r = 1
|
||||
density = 1
|
||||
end
|
||||
|
||||
if r == 1 then
|
||||
--start placing at -1,-1
|
||||
while i <= scan_radius do
|
||||
y = y - density
|
||||
x = x - density
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
x = x + density
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
y = y + density
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
x = x - density
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
y = y - density
|
||||
end
|
||||
i = i + 2
|
||||
end
|
||||
end
|
||||
|
||||
if r == 2 then
|
||||
--start placing at 0,-1
|
||||
while i <= scan_radius do
|
||||
y = y - density
|
||||
x = x - density
|
||||
for a = 1, i, 1 do
|
||||
x = x + density
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
y = y + density
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
x = x - density
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
y = y - density
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
i = i + 2
|
||||
end
|
||||
end
|
||||
|
||||
if r == 3 then
|
||||
--start placing at 1,-1
|
||||
while i <= scan_radius do
|
||||
y = y - density
|
||||
x = x + density
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
y = y + density
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
x = x - density
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
y = y - density
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
x = x + density
|
||||
end
|
||||
i = i + 2
|
||||
end
|
||||
end
|
||||
|
||||
if r == 4 then
|
||||
--start placing at 1,0
|
||||
while i <= scan_radius do
|
||||
y = y - density
|
||||
x = x + density
|
||||
for a = 1, i, 1 do
|
||||
y = y + density
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
x = x - density
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
y = y - density
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
for a = 1, i, 1 do
|
||||
x = x + density
|
||||
if surface.can_place_entity {name = entity.name, position = {x, y}} then
|
||||
local e = surface.create_entity {name = entity.name, position = {x, y}}
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
i = i + 2
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
local function create_tree_cluster(pos, amount)
|
||||
if not pos then
|
||||
return false
|
||||
end
|
||||
if amount == nil then
|
||||
amount = 7
|
||||
end
|
||||
local scan_radius = amount * 2
|
||||
--local mode = "line_down"
|
||||
--if math.random(1,2) == 1 then mode = "line_up" end
|
||||
local mode = 'ball'
|
||||
local entity = {}
|
||||
entity.pos = pos
|
||||
for i = 1, amount, 1 do
|
||||
entity.name = 'tree-06'
|
||||
local density = 2
|
||||
if 1 == math.random(1, 20) then
|
||||
entity.name = 'tree-07'
|
||||
end
|
||||
if 1 == math.random(1, 70) then
|
||||
entity.name = 'tree-09'
|
||||
end
|
||||
if 1 == math.random(1, 10) then
|
||||
entity.name = 'tree-04'
|
||||
end
|
||||
if 1 == math.random(1, 9) then
|
||||
density = 1
|
||||
end
|
||||
if 1 == math.random(1, 3) then
|
||||
density = 3
|
||||
end
|
||||
if 1 == math.random(1, 3) then
|
||||
density = 4
|
||||
end
|
||||
|
||||
local b, e = auto_place_entity_around_target(entity, scan_radius, mode, density)
|
||||
if b == true then
|
||||
if 1 == math.random(1, 3) then
|
||||
entity.pos = e.position
|
||||
end
|
||||
end
|
||||
end
|
||||
return b, e
|
||||
end
|
||||
|
||||
global.swamp_tiles_hold = {}
|
||||
global.swamp_decoratives_hold = {}
|
||||
|
||||
function run_swamp_init(params)
|
||||
global.swamp_tiles_hold = {}
|
||||
global.swamp_decoratives_hold = {}
|
||||
end
|
||||
|
||||
function run_swamp_place_tiles(params)
|
||||
local surface = params.surface
|
||||
surface.set_tiles(global.swamp_tiles_hold)
|
||||
for _, deco in pairs(global.swamp_decoratives_hold) do
|
||||
surface.create_decoratives {check_collision = false, decoratives = {deco}}
|
||||
end
|
||||
end
|
||||
|
||||
function run_swamp_river(params)
|
||||
local area = params.area
|
||||
local surface = params.surface
|
||||
|
||||
local x = params.x
|
||||
local pos_x = area.left_top.x + x
|
||||
local seed = params.seed
|
||||
|
||||
for y = 0, 31, 1 do
|
||||
local pos_y = area.left_top.y + y
|
||||
local noise_terrain_1 = perlin.noise(((pos_x + seed) / 150), ((pos_y + seed) / 150), 0)
|
||||
local noise_terrain_2 = perlin.noise(((pos_x + seed) / 75), ((pos_y + seed) / 75), 0)
|
||||
local noise_terrain_3 = perlin.noise(((pos_x + seed) / 50), ((pos_y + seed) / 50), 0)
|
||||
local noise_terrain_4 = perlin.noise(((pos_x + seed) / 7), ((pos_y + seed) / 7), 0)
|
||||
local noise_terrain =
|
||||
noise_terrain_1 + (noise_terrain_2 * 0.2) + (noise_terrain_3 * 0.1) + (noise_terrain_4 * 0.02)
|
||||
local tile_to_insert
|
||||
if noise_terrain > -0.03 and noise_terrain < 0.03 then
|
||||
tile_to_insert = 'water-green'
|
||||
local a = pos_x + 1
|
||||
table.insert(global.swamp_tiles_hold, {name = tile_to_insert, position = {a, pos_y}})
|
||||
local a = pos_y + 1
|
||||
table.insert(global.swamp_tiles_hold, {name = tile_to_insert, position = {pos_x, a}})
|
||||
local a = pos_x - 1
|
||||
table.insert(global.swamp_tiles_hold, {name = tile_to_insert, position = {a, pos_y}})
|
||||
local a = pos_y - 1
|
||||
table.insert(global.swamp_tiles_hold, {name = tile_to_insert, position = {pos_x, a}})
|
||||
table.insert(global.swamp_tiles_hold, {name = tile_to_insert, position = {pos_x, pos_y}})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function run_swamp_destroy_trees(params)
|
||||
local entities = surface.find_entities(area)
|
||||
for _, entity in pairs(entities) do
|
||||
if entity.type == 'simple-entity' or entity.type == 'tree' then
|
||||
if entity.name ~= 'tree-09' and entity.name ~= 'tree-07' and entity.name ~= 'tree-06' then --and entity.name ~= "tree-04"
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function run_swamp_entities(params)
|
||||
local area = params.area
|
||||
local surface = params.surface
|
||||
|
||||
local x = params.x
|
||||
local pos_x = area.left_top.x + x
|
||||
local forest_cluster = params.forest_cluster
|
||||
|
||||
for y = 0, 31, 1 do
|
||||
local pos_y = area.left_top.y + y
|
||||
local pos = {x = pos_x, y = pos_y}
|
||||
local tile = surface.get_tile(pos_x, pos_y)
|
||||
local tile_to_insert = tile
|
||||
local entity_placed = false
|
||||
-- or tile.name == "grass-2"
|
||||
--if tile.name ~= "water" and tile.name ~= "deepwater" and tile.name ~= "water-green" then
|
||||
if tile.name ~= 'water-green' then
|
||||
table.insert(global.swamp_tiles_hold, {name = 'grass-1', position = {pos_x, pos_y}})
|
||||
|
||||
local entity_list = {}
|
||||
table.insert(
|
||||
entity_list,
|
||||
{name = 'big-ship-wreck-1', pos = {pos_x, pos_y}, chance = 65000, health = 'random'}
|
||||
)
|
||||
table.insert(
|
||||
entity_list,
|
||||
{name = 'big-ship-wreck-2', pos = {pos_x, pos_y}, chance = 65000, health = 'random'}
|
||||
)
|
||||
table.insert(
|
||||
entity_list,
|
||||
{name = 'big-ship-wreck-3', pos = {pos_x, pos_y}, chance = 65000, health = 'random'}
|
||||
)
|
||||
local b, placed_entity = place_entities(surface, entity_list)
|
||||
if b == true then
|
||||
placed_entity.insert(wreck_item_pool[math.random(1, #wreck_item_pool)])
|
||||
placed_entity.insert(wreck_item_pool[math.random(1, #wreck_item_pool)])
|
||||
placed_entity.insert(wreck_item_pool[math.random(1, #wreck_item_pool)])
|
||||
end
|
||||
|
||||
local entity_list = {}
|
||||
table.insert(entity_list, {name = 'tree-04', pos = {pos_x, pos_y}, chance = 400})
|
||||
table.insert(entity_list, {name = 'tree-09', pos = {pos_x, pos_y}, chance = 1000})
|
||||
table.insert(entity_list, {name = 'tree-07', pos = {pos_x, pos_y}, chance = 400})
|
||||
table.insert(entity_list, {name = 'tree-06', pos = {pos_x, pos_y}, chance = 150})
|
||||
table.insert(entity_list, {name = 'rock-big', pos = {pos_x, pos_y}, chance = 400})
|
||||
table.insert(entity_list, {name = 'green-coral', pos = {pos_x, pos_y}, chance = 10000})
|
||||
table.insert(
|
||||
entity_list,
|
||||
{name = 'medium-ship-wreck', pos = {pos_x, pos_y}, chance = 25000, health = 'random'}
|
||||
)
|
||||
table.insert(
|
||||
entity_list,
|
||||
{name = 'small-ship-wreck', pos = {pos_x, pos_y}, chance = 25000, health = 'random'}
|
||||
)
|
||||
table.insert(entity_list, {name = 'car', pos = {pos_x, pos_y}, chance = 125000, health = 'low'})
|
||||
table.insert(
|
||||
entity_list,
|
||||
{name = 'stone-furnace', pos = {pos_x, pos_y}, chance = 100000, health = 'random', force = 'enemy'}
|
||||
)
|
||||
local b, placed_entity = place_entities(surface, entity_list)
|
||||
|
||||
if forest_cluster == true then
|
||||
if math.random(1, 800) == 1 then
|
||||
create_tree_cluster(pos, 120)
|
||||
end
|
||||
end
|
||||
else
|
||||
--if tile.name == "water" then tile_to_insert = "water" end
|
||||
--if tile.name == "deepwater" then tile_to_insert = "deepwater" end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function run_combined_module(event)
|
||||
-- Generate Rivers
|
||||
if not global.perlin_noise_seed then
|
||||
global.perlin_noise_seed = math.random(1000, 1000000)
|
||||
end
|
||||
|
||||
local seed = global.perlin_noise_seed
|
||||
local tiles = {}
|
||||
|
||||
Task.queue_task('run_swamp_init', {})
|
||||
for x = 0, 31, 1 do
|
||||
Task.queue_task('run_swamp_river', {area = event.area, surface = event.surface, x = x, seed = seed})
|
||||
end
|
||||
Task.queue_task('run_swamp_place_tiles', {surface = event.surface})
|
||||
|
||||
-- Generate other thingies
|
||||
Task.queue_task('run_swamp_destroy_trees', {area = event.area, surface = event.surface, x = x})
|
||||
|
||||
local forest_cluster = true
|
||||
if math.random(1, 4) == 1 then
|
||||
forest_cluster = false
|
||||
end
|
||||
|
||||
Task.queue_task('run_swamp_init', {})
|
||||
|
||||
for x = 0, 31, 1 do
|
||||
Task.queue_task(
|
||||
'run_swamp_entities',
|
||||
{area = event.area, surface = event.surface, x = x, forest_cluster = forest_cluster}
|
||||
)
|
||||
end
|
||||
Task.queue_task('run_swamp_place_tiles', {surface = event.surface})
|
||||
|
||||
Task.queue_task('run_swamp_cleanup', {area = event.area, surface = event.surface})
|
||||
|
||||
Task.queue_task('run_chart_update', {area = event.area, surface = event.surface})
|
||||
end
|
||||
|
||||
function run_chart_update(params)
|
||||
local x = params.area.left_top.x / 32
|
||||
local y = params.area.left_top.y / 32
|
||||
if game.forces.player.is_chunk_charted(params.surface, {x, y}) then
|
||||
-- Don't use full area, otherwise adjacent chunks get charted
|
||||
game.forces.player.chart(
|
||||
params.surface,
|
||||
{
|
||||
{params.area.left_top.x, params.area.left_top.y},
|
||||
{params.area.left_top.x + 30, params.area.left_top.y + 30}
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function run_swamp_cleanup(params)
|
||||
local area = params.area
|
||||
local surface = params.surface
|
||||
local decoratives = {}
|
||||
|
||||
--check for existing chunk if you would overwrite decoratives
|
||||
local for_start_x = 0
|
||||
local for_end_x = 31
|
||||
local for_start_y = 0
|
||||
local for_end_y = 31
|
||||
local testing_pos = area.left_top.x - 1
|
||||
local tile = surface.get_tile(testing_pos, area.left_top.y)
|
||||
if tile.name then
|
||||
for_start_x = -1
|
||||
end
|
||||
local testing_pos = area.left_top.y - 1
|
||||
local tile = surface.get_tile(area.left_top.x, testing_pos)
|
||||
if tile.name then
|
||||
for_start_y = -1
|
||||
end
|
||||
local testing_pos = area.right_bottom.x
|
||||
local tile = surface.get_tile(testing_pos, area.right_bottom.y)
|
||||
if tile.name then
|
||||
for_end_x = 32
|
||||
end
|
||||
local testing_pos = area.right_bottom.y
|
||||
local tile = surface.get_tile(area.right_bottom.x, testing_pos)
|
||||
if tile.name then
|
||||
for_end_y = 32
|
||||
end
|
||||
|
||||
for x = for_start_x, for_end_x, 1 do
|
||||
for y = for_start_y, for_end_y, 1 do
|
||||
local pos_x = area.left_top.x + x
|
||||
local pos_y = area.left_top.y + y
|
||||
local tile = surface.get_tile(pos_x, pos_y)
|
||||
local decal_has_been_placed = false
|
||||
|
||||
if tile.name == 'grass-1' then
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1, 3)
|
||||
if r == 1 then
|
||||
table.insert(
|
||||
decoratives,
|
||||
{name = 'green-carpet-grass-1', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1, 7)
|
||||
if r == 1 then
|
||||
table.insert(decoratives, {name = 'green-hairy-grass-1', position = {pos_x, pos_y}, amount = 1})
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1, 10)
|
||||
if r == 1 then
|
||||
table.insert(decoratives, {name = 'green-bush-mini', position = {pos_x, pos_y}, amount = 1})
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1, 6)
|
||||
if r == 1 then
|
||||
table.insert(decoratives, {name = 'green-pita', position = {pos_x, pos_y}, amount = 1})
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1, 12)
|
||||
if r == 1 then
|
||||
table.insert(decoratives, {name = 'green-small-grass-1', position = {pos_x, pos_y}, amount = 1})
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1, 25)
|
||||
if r == 1 then
|
||||
table.insert(decoratives, {name = 'green-asterisk', position = {pos_x, pos_y}, amount = 1})
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
end
|
||||
if tile.name == 'water' or tile.name == 'water-green' then
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1, 18)
|
||||
if r == 1 then
|
||||
table.insert(
|
||||
decoratives,
|
||||
{name = 'green-carpet-grass-1', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1, 950)
|
||||
if r == 1 then
|
||||
table.insert(decoratives, {name = 'green-small-grass-1', position = {pos_x, pos_y}, amount = 1})
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
if decal_has_been_placed == false then
|
||||
local r = math.random(1, 150)
|
||||
if r == 1 then
|
||||
table.insert(decoratives, {name = 'green-bush-mini', position = {pos_x, pos_y}, amount = 1})
|
||||
decal_has_been_placed = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, deco in pairs(decoratives) do
|
||||
surface.create_decoratives {check_collision = false, decoratives = {deco}}
|
||||
end
|
||||
end
|
@ -1,27 +1,26 @@
|
||||
--Author: MewMew
|
||||
local perlin = require 'map_gen.shared.perlin_noise'
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings' -- map gen settings presets
|
||||
|
||||
local radius = 129
|
||||
local radsquare = radius * radius
|
||||
|
||||
local start_seed = 1234567
|
||||
|
||||
local clear_types = {'simple-entity', 'resource', 'tree'}
|
||||
|
||||
local function do_clear_entities(world)
|
||||
local entities = world.surface.find_entities_filtered({area = world.area, type = clear_types})
|
||||
for _, entity in ipairs(entities) do
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
function map(x, y, world)
|
||||
if not world.island_resort_cleared then
|
||||
world.island_resort_cleared = true
|
||||
do_clear_entities(world)
|
||||
end
|
||||
-- Cannot use waterworld as we need the biter generation.
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.tree_none,
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.enemy_very_high,
|
||||
MGSP.cliff_none,
|
||||
MGSP.grass_only
|
||||
}
|
||||
)
|
||||
|
||||
local function map(x, y, world)
|
||||
local entities = {}
|
||||
local decoratives = {}
|
||||
|
||||
@ -42,9 +41,7 @@ function map(x, y, world)
|
||||
local noise_island_iron_and_copper_2 = perlin.noise(((x + seed) / 40), ((y + seed) / 40), 0)
|
||||
seed = seed + seed_increment
|
||||
local noise_island_iron_and_copper_3 = perlin.noise(((x + seed) / 10), ((y + seed) / 10), 0)
|
||||
local noise_island_iron_and_copper =
|
||||
noise_island_iron_and_copper_1 + (noise_island_iron_and_copper_2 * 0.1) +
|
||||
(noise_island_iron_and_copper_3 * 0.05)
|
||||
local noise_island_iron_and_copper = noise_island_iron_and_copper_1 + (noise_island_iron_and_copper_2 * 0.1) + (noise_island_iron_and_copper_3 * 0.05)
|
||||
|
||||
seed = seed + seed_increment
|
||||
local noise_island_stone_and_coal_1 = perlin.noise(((x + seed) / 300), ((y + seed) / 300), 0)
|
||||
@ -52,8 +49,7 @@ function map(x, y, world)
|
||||
local noise_island_stone_and_coal_2 = perlin.noise(((x + seed) / 40), ((y + seed) / 40), 0)
|
||||
seed = seed + seed_increment
|
||||
local noise_island_stone_and_coal_3 = perlin.noise(((x + seed) / 10), ((y + seed) / 10), 0)
|
||||
local noise_island_stone_and_coal =
|
||||
noise_island_stone_and_coal_1 + (noise_island_stone_and_coal_2 * 0.1) + (noise_island_stone_and_coal_3 * 0.05)
|
||||
local noise_island_stone_and_coal = noise_island_stone_and_coal_1 + (noise_island_stone_and_coal_2 * 0.1) + (noise_island_stone_and_coal_3 * 0.05)
|
||||
|
||||
seed = seed + seed_increment
|
||||
local noise_island_oil_and_uranium_1 = perlin.noise(((x + seed) / 300), ((y + seed) / 300), 0)
|
||||
@ -61,9 +57,7 @@ function map(x, y, world)
|
||||
local noise_island_oil_and_uranium_2 = perlin.noise(((x + seed) / 40), ((y + seed) / 40), 0)
|
||||
seed = seed + seed_increment
|
||||
local noise_island_oil_and_uranium_3 = perlin.noise(((x + seed) / 10), ((y + seed) / 10), 0)
|
||||
local noise_island_oil_and_uranium =
|
||||
noise_island_oil_and_uranium_1 + (noise_island_oil_and_uranium_2 * 0.1) +
|
||||
(noise_island_oil_and_uranium_3 * 0.05)
|
||||
local noise_island_oil_and_uranium = noise_island_oil_and_uranium_1 + (noise_island_oil_and_uranium_2 * 0.1) + (noise_island_oil_and_uranium_3 * 0.05)
|
||||
|
||||
seed = seed + seed_increment
|
||||
local noise_island_resource = perlin.noise(((x + seed) / 60), ((y + seed) / 60), 0)
|
||||
@ -86,9 +80,9 @@ function map(x, y, world)
|
||||
local tile_to_insert = 'water'
|
||||
|
||||
--Create starting Island
|
||||
local a = y * y
|
||||
local b = x * x
|
||||
local tile_distance_to_center = a + b
|
||||
local dist_1 = y * y
|
||||
local dist_2 = x * x
|
||||
local tile_distance_to_center = dist_1 + dist_2
|
||||
if tile_distance_to_center + noise_island_starting <= radsquare then
|
||||
tile_to_insert = 'grass-1'
|
||||
end
|
||||
@ -206,8 +200,7 @@ function map(x, y, world)
|
||||
|
||||
local resource_amount_distance_multiplicator = (((c + 1) / 75) / 75) + 1
|
||||
local noise_resource_amount_modifier = perlin.noise(((world.x + seed) / 200), ((world.y + seed) / 200), 0)
|
||||
local resource_amount =
|
||||
1 + ((500 + (500 * noise_resource_amount_modifier * 0.2)) * resource_amount_distance_multiplicator)
|
||||
local resource_amount = 1 + ((500 + (500 * noise_resource_amount_modifier * 0.2)) * resource_amount_distance_multiplicator)
|
||||
|
||||
if tile_to_insert == 'sand-1' or tile_to_insert == 'sand-3' then
|
||||
if noise_island_iron_and_copper > 0.5 and noise_island_resource > 0.2 then
|
||||
@ -239,28 +232,16 @@ function map(x, y, world)
|
||||
noise_island_starting = noise_island_starting * 0.08
|
||||
--Starting Resources
|
||||
if tile_distance_to_center <= radsquare then
|
||||
if
|
||||
tile_distance_to_center + noise_island_starting > radsquare * 0.09 and
|
||||
tile_distance_to_center + noise_island_starting <= radsquare * 0.15
|
||||
then
|
||||
if tile_distance_to_center + noise_island_starting > radsquare * 0.09 and tile_distance_to_center + noise_island_starting <= radsquare * 0.15 then
|
||||
table.insert(entities, {name = 'stone', amount = resource_amount * 1.5})
|
||||
end
|
||||
if
|
||||
tile_distance_to_center + noise_island_starting > radsquare * 0.05 and
|
||||
tile_distance_to_center + noise_island_starting <= radsquare * 0.09
|
||||
then
|
||||
if tile_distance_to_center + noise_island_starting > radsquare * 0.05 and tile_distance_to_center + noise_island_starting <= radsquare * 0.09 then
|
||||
table.insert(entities, {name = 'coal', amount = resource_amount * 1.5})
|
||||
end
|
||||
if
|
||||
tile_distance_to_center + noise_island_starting > radsquare * 0.02 and
|
||||
tile_distance_to_center + noise_island_starting <= radsquare * 0.05
|
||||
then
|
||||
if tile_distance_to_center + noise_island_starting > radsquare * 0.02 and tile_distance_to_center + noise_island_starting <= radsquare * 0.05 then
|
||||
table.insert(entities, {name = 'iron-ore', amount = resource_amount * 1.5})
|
||||
end
|
||||
if
|
||||
tile_distance_to_center + noise_island_starting > radsquare * 0.003 and
|
||||
tile_distance_to_center + noise_island_starting <= radsquare * 0.02
|
||||
then
|
||||
if tile_distance_to_center + noise_island_starting > radsquare * 0.003 and tile_distance_to_center + noise_island_starting <= radsquare * 0.02 then
|
||||
table.insert(entities, {name = 'copper-ore', amount = resource_amount * 1.5})
|
||||
end
|
||||
if tile_distance_to_center + noise_island_starting <= radsquare * 0.002 then
|
||||
|
@ -47,7 +47,7 @@ local function get_resource(x, y)
|
||||
value = value + 1
|
||||
value = value * 500
|
||||
|
||||
local name = ''
|
||||
local name
|
||||
|
||||
if value < 450 then
|
||||
return nil
|
||||
@ -70,7 +70,7 @@ local function get_resource(x, y)
|
||||
return {name = name, position = {x, y}, amount = value}
|
||||
end
|
||||
|
||||
function run_combined_module(event)
|
||||
function run_combined_module(event) -- luacheck: ignore global run_combined_module
|
||||
if not global.blocks then
|
||||
init_blocks()
|
||||
end
|
||||
@ -131,7 +131,7 @@ end
|
||||
local function do_strike()
|
||||
local block = get_block()
|
||||
|
||||
function add(x, y)
|
||||
local function add(x, y)
|
||||
local key = x .. ',' .. y
|
||||
if not global.used_blocks[key] then
|
||||
table.insert(global.blocks, {x = x, y = y})
|
||||
|
@ -1,533 +0,0 @@
|
||||
--Author: MewMew
|
||||
|
||||
-- !! ATTENTION !!
|
||||
-- Use water only in starting area as map setting!!!
|
||||
|
||||
local perlin = require 'map_gen.shared.perlin_noise'
|
||||
local Task = require 'utils.task'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
|
||||
wreck_item_pool = {}
|
||||
wreck_item_pool = {
|
||||
{name = 'iron-gear-wheel', count = 32},
|
||||
{name = 'iron-plate', count = 64},
|
||||
{name = 'rocket-control-unit', count = 1},
|
||||
{name = 'coal', count = 4},
|
||||
{name = 'rocket-launcher', count = 1},
|
||||
{name = 'rocket', count = 32},
|
||||
{name = 'copper-cable', count = 128},
|
||||
{name = 'land-mine', count = 64},
|
||||
{name = 'railgun', count = 1},
|
||||
{name = 'railgun-dart', count = 128},
|
||||
{name = 'fast-inserter', count = 8},
|
||||
{name = 'stack-filter-inserter', count = 2},
|
||||
{name = 'belt-immunity-equipment', count = 1},
|
||||
{name = 'fusion-reactor-equipment', count = 1},
|
||||
{name = 'electric-engine-unit', count = 8},
|
||||
{name = 'exoskeleton-equipment', count = 1},
|
||||
{name = 'rocket-fuel', count = 10},
|
||||
{name = 'used-up-uranium-fuel-cell', count = 3},
|
||||
{name = 'uranium-fuel-cell', count = 2}
|
||||
}
|
||||
|
||||
local function place_entities(surface, entity_list)
|
||||
local directions = {
|
||||
defines.direction.north,
|
||||
defines.direction.east,
|
||||
defines.direction.south,
|
||||
defines.direction.west
|
||||
}
|
||||
for _, entity in pairs(entity_list) do
|
||||
local r = math.random(1, entity.chance)
|
||||
if r == 1 then
|
||||
if not entity.force then
|
||||
entity.force = 'player'
|
||||
end
|
||||
local r = math.random(1, 4)
|
||||
if
|
||||
surface.can_place_entity {
|
||||
name = entity.name,
|
||||
position = entity.pos,
|
||||
direction = directions[r],
|
||||
force = entity.force
|
||||
}
|
||||
then
|
||||
local e =
|
||||
surface.create_entity {
|
||||
name = entity.name,
|
||||
position = entity.pos,
|
||||
direction = directions[r],
|
||||
force = entity.force
|
||||
}
|
||||
if entity.health then
|
||||
if entity.health == 'low' then
|
||||
e.health = ((e.health / 1000) * math.random(33, 330))
|
||||
end
|
||||
if entity.health == 'medium' then
|
||||
e.health = ((e.health / 1000) * math.random(333, 666))
|
||||
end
|
||||
if entity.health == 'high' then
|
||||
e.health = ((e.health / 1000) * math.random(666, 999))
|
||||
end
|
||||
if entity.health == 'random' then
|
||||
e.health = ((e.health / 1000) * math.random(1, 1000))
|
||||
end
|
||||
end
|
||||
return true, e
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local c = 0.5
|
||||
local resource_amount_distance_multiplicator = (((c + 1) / 75) / 75) + 1
|
||||
|
||||
function run_combined_module(event)
|
||||
if not global.perlin_noise_seed then
|
||||
global.perlin_noise_seed = math.random(1000, 1000000)
|
||||
end
|
||||
local surface = RS.get_surface()
|
||||
|
||||
local entities = surface.find_entities(event.area)
|
||||
for _, entity in pairs(entities) do
|
||||
if entity.type == 'simple-entity' or entity.type == 'resource' or entity.type == 'tree' then
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
Task.queue_task('run_planet_init', {})
|
||||
--run_planet_init()
|
||||
for x = 0, 31, 1 do
|
||||
Task.queue_task('run_planet', {area = event.area, surface = event.surface, x = x})
|
||||
--run_planet( {area = event.area, surface = event.surface, x = x})
|
||||
end
|
||||
--run_planet_place_tiles( {surface = event.surface} )
|
||||
Task.queue_task('run_planet_place_tiles', {surface = event.surface})
|
||||
end
|
||||
|
||||
global.planet_tiles_hold = {}
|
||||
global.planet_decoratives_hold = {}
|
||||
|
||||
function run_planet_init(params)
|
||||
global.planet_tiles_hold = {}
|
||||
global.planet_decoratives_hold = {}
|
||||
end
|
||||
|
||||
function run_planet_place_tiles(params)
|
||||
local surface = params.surface
|
||||
surface.set_tiles(global.planet_tiles_hold)
|
||||
for _, deco in pairs(global.planet_decoratives_hold) do
|
||||
surface.create_decoratives {check_collision = false, decoratives = {deco}}
|
||||
end
|
||||
end
|
||||
|
||||
function run_planet(params)
|
||||
local tree_to_place = {'dry-tree', 'dry-hairy-tree', 'tree-06', 'tree-06', 'tree-01', 'tree-02', 'tree-03'}
|
||||
local area = params.area
|
||||
local surface = params.surface
|
||||
|
||||
local x = params.x
|
||||
local pos_x = area.left_top.x + x
|
||||
|
||||
for y = 0, 31, 1 do
|
||||
local pos_y = area.left_top.y + y
|
||||
local seed = surface.map_gen_settings.seed
|
||||
local tile = surface.get_tile(pos_x, pos_y)
|
||||
local tile_to_insert = 'concrete'
|
||||
|
||||
local a = pos_x
|
||||
local b = pos_y
|
||||
local resource_entity_placed = false
|
||||
|
||||
local entity_list = {}
|
||||
table.insert(entity_list, {name = 'big-ship-wreck-1', pos = {pos_x, pos_y}, chance = 65000, health = 'random'})
|
||||
table.insert(entity_list, {name = 'big-ship-wreck-2', pos = {pos_x, pos_y}, chance = 65000, health = 'random'})
|
||||
table.insert(entity_list, {name = 'big-ship-wreck-3', pos = {pos_x, pos_y}, chance = 65000, health = 'random'})
|
||||
table.insert(entity_list, {name = 'medium-ship-wreck', pos = {pos_x, pos_y}, chance = 25000, health = 'medium'})
|
||||
table.insert(entity_list, {name = 'small-ship-wreck', pos = {pos_x, pos_y}, chance = 15000, health = 'medium'})
|
||||
table.insert(entity_list, {name = 'car', pos = {pos_x, pos_y}, chance = 150000, health = 'low'})
|
||||
table.insert(
|
||||
entity_list,
|
||||
{name = 'laser-turret', pos = {pos_x, pos_y}, chance = 100000, force = 'enemy', health = 'low'}
|
||||
)
|
||||
table.insert(
|
||||
entity_list,
|
||||
{name = 'nuclear-reactor', pos = {pos_x, pos_y}, chance = 1000000, force = 'enemy', health = 'medium'}
|
||||
)
|
||||
local b, placed_entity = place_entities(surface, entity_list)
|
||||
if b == true then
|
||||
if
|
||||
placed_entity.name == 'big-ship-wreck-1' or placed_entity.name == 'big-ship-wreck-2' or
|
||||
placed_entity.name == 'big-ship-wreck-3'
|
||||
then
|
||||
placed_entity.insert(wreck_item_pool[math.random(1, #wreck_item_pool)])
|
||||
placed_entity.insert(wreck_item_pool[math.random(1, #wreck_item_pool)])
|
||||
placed_entity.insert(wreck_item_pool[math.random(1, #wreck_item_pool)])
|
||||
end
|
||||
end
|
||||
|
||||
local seed_increment_number = 10000
|
||||
|
||||
local noise_terrain_1 = perlin.noise(((pos_x + seed) / 400), ((pos_y + seed) / 400), 0)
|
||||
noise_terrain_1 = noise_terrain_1 * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_terrain_2 = perlin.noise(((pos_x + seed) / 250), ((pos_y + seed) / 250), 0)
|
||||
noise_terrain_2 = noise_terrain_2 * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_terrain_3 = perlin.noise(((pos_x + seed) / 100), ((pos_y + seed) / 100), 0)
|
||||
noise_terrain_3 = noise_terrain_3 * 50
|
||||
seed = seed + seed_increment_number
|
||||
local noise_terrain_4 = perlin.noise(((pos_x + seed) / 20), ((pos_y + seed) / 20), 0)
|
||||
noise_terrain_4 = noise_terrain_4 * 10
|
||||
seed = seed + seed_increment_number
|
||||
local noise_terrain_5 = perlin.noise(((pos_x + seed) / 5), ((pos_y + seed) / 5), 0)
|
||||
noise_terrain_5 = noise_terrain_5 * 4
|
||||
seed = seed + seed_increment_number
|
||||
local noise_sand = perlin.noise(((pos_x + seed) / 18), ((pos_y + seed) / 18), 0)
|
||||
noise_sand = noise_sand * 10
|
||||
|
||||
--DECORATIVES
|
||||
seed = seed + seed_increment_number
|
||||
local noise_decoratives_1 = perlin.noise(((pos_x + seed) / 20), ((pos_y + seed) / 20), 0)
|
||||
noise_decoratives_1 = noise_decoratives_1
|
||||
seed = seed + seed_increment_number
|
||||
local noise_decoratives_2 = perlin.noise(((pos_x + seed) / 30), ((pos_y + seed) / 30), 0)
|
||||
noise_decoratives_2 = noise_decoratives_2
|
||||
seed = seed + seed_increment_number
|
||||
local noise_decoratives_3 = perlin.noise(((pos_x + seed) / 30), ((pos_y + seed) / 30), 0)
|
||||
noise_decoratives_3 = noise_decoratives_3
|
||||
|
||||
seed = seed + seed_increment_number
|
||||
local noise_water_1 = perlin.noise(((pos_x + seed) / 250), ((pos_y + seed) / 300), 0)
|
||||
noise_water_1 = noise_water_1 * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_water_2 = perlin.noise(((pos_x + seed) / 100), ((pos_y + seed) / 150), 0)
|
||||
noise_water_2 = noise_water_2 * 50
|
||||
|
||||
--RESOURCES
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resources = perlin.noise(((pos_x + seed) / 100), ((pos_y + seed) / 100), 0)
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resources_2 = perlin.noise(((pos_x + seed) / 40), ((pos_y + seed) / 40), 0)
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resources_3 = perlin.noise(((pos_x + seed) / 20), ((pos_y + seed) / 20), 0)
|
||||
noise_resources = noise_resources * 50 + noise_resources_2 * 20 + noise_resources_3 * 20
|
||||
noise_resources = noise_resources_2 * 100
|
||||
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resource_amount_modifier = perlin.noise(((pos_x + seed) / 200), ((pos_y + seed) / 200), 0)
|
||||
local resource_amount =
|
||||
1 + ((400 + (400 * noise_resource_amount_modifier * 0.2)) * resource_amount_distance_multiplicator)
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resources_iron_and_copper = perlin.noise(((pos_x + seed) / 250), ((pos_y + seed) / 250), 0)
|
||||
noise_resources_iron_and_copper = noise_resources_iron_and_copper * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resources_coal_and_uranium = perlin.noise(((pos_x + seed) / 250), ((pos_y + seed) / 250), 0)
|
||||
noise_resources_coal_and_uranium = noise_resources_coal_and_uranium * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_resources_stone_and_oil = perlin.noise(((pos_x + seed) / 150), ((pos_y + seed) / 150), 0)
|
||||
noise_resources_stone_and_oil = noise_resources_stone_and_oil * 100
|
||||
|
||||
seed = seed + seed_increment_number
|
||||
local noise_red_desert_rocks_1 = perlin.noise(((pos_x + seed) / 20), ((pos_y + seed) / 20), 0)
|
||||
noise_red_desert_rocks_1 = noise_red_desert_rocks_1 * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_red_desert_rocks_2 = perlin.noise(((pos_x + seed) / 10), ((pos_y + seed) / 10), 0)
|
||||
noise_red_desert_rocks_2 = noise_red_desert_rocks_2 * 50
|
||||
seed = seed + seed_increment_number
|
||||
local noise_red_desert_rocks_3 = perlin.noise(((pos_x + seed) / 5), ((pos_y + seed) / 5), 0)
|
||||
noise_red_desert_rocks_3 = noise_red_desert_rocks_3 * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_forest = perlin.noise(((pos_x + seed) / 100), ((pos_y + seed) / 100), 0)
|
||||
noise_forest = noise_forest * 100
|
||||
seed = seed + seed_increment_number
|
||||
local noise_forest_2 = perlin.noise(((pos_x + seed) / 20), ((pos_y + seed) / 20), 0)
|
||||
noise_forest_2 = noise_forest_2 * 20
|
||||
|
||||
local terrain_smoothing = math.random(0, 1)
|
||||
local place_tree_number
|
||||
|
||||
if noise_terrain_1 < 8 + terrain_smoothing + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 then
|
||||
tile_to_insert = 'red-desert-1'
|
||||
if
|
||||
noise_water_1 + noise_water_2 + noise_sand > -10 and noise_water_1 + noise_water_2 + noise_sand < 25 and
|
||||
noise_terrain_1 < -52 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 + noise_terrain_5
|
||||
then
|
||||
tile_to_insert = 'sand-1'
|
||||
place_tree_number = math.random(3, #tree_to_place)
|
||||
else
|
||||
place_tree_number = math.random(1, (#tree_to_place - 3))
|
||||
end
|
||||
|
||||
if
|
||||
noise_water_1 + noise_water_2 > 0 and noise_water_1 + noise_water_2 < 15 and
|
||||
noise_terrain_1 < -60 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 + noise_terrain_5
|
||||
then
|
||||
tile_to_insert = 'water'
|
||||
local a = pos_x + 1
|
||||
table.insert(global.planet_tiles_hold, {name = tile_to_insert, position = {a, pos_y}})
|
||||
local a = pos_y + 1
|
||||
table.insert(global.planet_tiles_hold, {name = tile_to_insert, position = {pos_x, a}})
|
||||
local a = pos_x - 1
|
||||
table.insert(global.planet_tiles_hold, {name = tile_to_insert, position = {a, pos_y}})
|
||||
local a = pos_y - 1
|
||||
table.insert(global.planet_tiles_hold, {name = tile_to_insert, position = {pos_x, a}})
|
||||
if noise_water_1 + noise_water_2 < 2 or noise_water_1 + noise_water_2 > 13 then
|
||||
if math.random(1, 15) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'green-carpet-grass', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if tile_to_insert ~= 'water' then
|
||||
if
|
||||
noise_water_1 + noise_water_2 > 16 and noise_water_1 + noise_water_2 < 25 and
|
||||
noise_terrain_1 < -55 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 + noise_terrain_5
|
||||
then
|
||||
if math.random(1, 35) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'brown-carpet-grass', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
end
|
||||
if
|
||||
noise_water_1 + noise_water_2 > -10 and noise_water_1 + noise_water_2 < -1 and
|
||||
noise_terrain_1 < -55 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 + noise_terrain_5
|
||||
then
|
||||
if math.random(1, 35) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'brown-carpet-grass', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
end
|
||||
if noise_decoratives_1 > 0.5 and noise_decoratives_1 <= 0.8 then
|
||||
if math.random(1, 12) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'red-desert-bush', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
end
|
||||
if noise_decoratives_1 > 0.4 and noise_decoratives_1 <= 0.5 then
|
||||
if math.random(1, 4) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'red-desert-bush', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--HAPPY TREES
|
||||
if noise_terrain_1 < -30 + noise_terrain_2 + noise_terrain_3 + noise_terrain_5 + noise_forest_2 then
|
||||
if noise_forest > 0 and noise_forest <= 10 then
|
||||
if math.random(1, 50) == 1 then
|
||||
if surface.can_place_entity {name = tree_to_place[place_tree_number], position = {pos_x, pos_y}} then
|
||||
surface.create_entity {name = tree_to_place[place_tree_number], position = {pos_x, pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
if noise_forest > 10 and noise_forest <= 20 then
|
||||
if math.random(1, 25) == 1 then
|
||||
if surface.can_place_entity {name = tree_to_place[place_tree_number], position = {pos_x, pos_y}} then
|
||||
surface.create_entity {name = tree_to_place[place_tree_number], position = {pos_x, pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
if noise_forest > 20 then
|
||||
if math.random(1, 10) == 1 then
|
||||
if surface.can_place_entity {name = tree_to_place[place_tree_number], position = {pos_x, pos_y}} then
|
||||
surface.create_entity {name = tree_to_place[place_tree_number], position = {pos_x, pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if tile_to_insert ~= 'water' then
|
||||
if
|
||||
noise_terrain_1 < 8 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4 and
|
||||
noise_terrain_1 > -5 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4
|
||||
then
|
||||
if math.random(1, 180) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'rock-medium', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
if math.random(1, 80) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'sand-rock-small', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
else
|
||||
if math.random(1, 1500) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'rock-medium', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
if math.random(1, 180) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'sand-rock-small', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
tile_to_insert = 'red-desert-0'
|
||||
end
|
||||
if
|
||||
resource_entity_placed == false and noise_resources_coal_and_uranium + noise_resources < -72 and
|
||||
noise_terrain_1 > 65 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4
|
||||
then
|
||||
if surface.can_place_entity {name = 'uranium-ore', position = {pos_x, pos_y}} then
|
||||
surface.create_entity {name = 'uranium-ore', position = {pos_x, pos_y}, amount = resource_amount}
|
||||
resource_entity_placed = true
|
||||
end
|
||||
end
|
||||
if
|
||||
resource_entity_placed == false and noise_resources_iron_and_copper + noise_resources > 72 and
|
||||
noise_terrain_1 > 15 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4
|
||||
then
|
||||
if surface.can_place_entity {name = 'iron-ore', position = {pos_x, pos_y}} then
|
||||
surface.create_entity {name = 'iron-ore', position = {pos_x, pos_y}, amount = resource_amount}
|
||||
resource_entity_placed = true
|
||||
end
|
||||
end
|
||||
if
|
||||
resource_entity_placed == false and noise_resources_coal_and_uranium + noise_resources > 70 and
|
||||
noise_terrain_1 > 15 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4
|
||||
then
|
||||
if surface.can_place_entity {name = 'coal', position = {pos_x, pos_y}} then
|
||||
surface.create_entity {name = 'coal', position = {pos_x, pos_y}, amount = resource_amount}
|
||||
resource_entity_placed = true
|
||||
end
|
||||
end
|
||||
if
|
||||
resource_entity_placed == false and noise_resources_iron_and_copper + noise_resources < -72 and
|
||||
noise_terrain_1 > 15 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4
|
||||
then
|
||||
if surface.can_place_entity {name = 'copper-ore', position = {pos_x, pos_y}} then
|
||||
surface.create_entity {name = 'copper-ore', position = {pos_x, pos_y}, amount = resource_amount}
|
||||
resource_entity_placed = true
|
||||
end
|
||||
end
|
||||
if
|
||||
resource_entity_placed == false and noise_resources_stone_and_oil + noise_resources > 72 and
|
||||
noise_terrain_1 > 15 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4
|
||||
then
|
||||
if surface.can_place_entity {name = 'stone', position = {pos_x, pos_y}} then
|
||||
surface.create_entity {name = 'stone', position = {pos_x, pos_y}, amount = resource_amount}
|
||||
resource_entity_placed = true
|
||||
end
|
||||
end
|
||||
if
|
||||
resource_entity_placed == false and noise_resources_stone_and_oil + noise_resources < -70 and
|
||||
noise_terrain_1 < -50 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4
|
||||
then
|
||||
if math.random(1, 42) == 1 then
|
||||
if surface.can_place_entity {name = 'crude-oil', position = {pos_x, pos_y}} then
|
||||
surface.create_entity {
|
||||
name = 'crude-oil',
|
||||
position = {pos_x, pos_y},
|
||||
amount = (resource_amount * 500)
|
||||
}
|
||||
resource_entity_placed = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if
|
||||
resource_entity_placed == false and
|
||||
noise_red_desert_rocks_1 + noise_red_desert_rocks_2 + noise_red_desert_rocks_3 > 20 and
|
||||
noise_red_desert_rocks_1 + noise_red_desert_rocks_2 < 60 and
|
||||
noise_terrain_1 > 7 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4
|
||||
then
|
||||
if math.random(1, 3) == 1 then
|
||||
if math.random(1, 3) == 1 then
|
||||
if surface.can_place_entity {name = 'sand-rock-big', position = {pos_x, pos_y}} then
|
||||
surface.create_entity {name = 'sand-rock-big', position = {pos_x, pos_y}}
|
||||
end
|
||||
else
|
||||
if surface.can_place_entity {name = 'sand-rock-big', position = {pos_x, pos_y}} then
|
||||
surface.create_entity {name = 'sand-rock-big', position = {pos_x, pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if
|
||||
noise_red_desert_rocks_1 + noise_red_desert_rocks_2 + noise_red_desert_rocks_3 + noise_terrain_4 >= 10 and
|
||||
noise_red_desert_rocks_1 + noise_red_desert_rocks_2 + noise_red_desert_rocks_3 < 20 and
|
||||
noise_terrain_1 > 7 + noise_terrain_2 + noise_terrain_3 + noise_terrain_4
|
||||
then
|
||||
if math.random(1, 5) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'rock-medium', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
else
|
||||
if tile_to_insert ~= 'water' and tile_to_insert ~= 'sand-1' then
|
||||
if math.random(1, 15) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'sand-rock-small', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
else
|
||||
if math.random(1, 8) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'sand-rock-small', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if tile_to_insert ~= 'water' then
|
||||
if noise_decoratives_2 > 0.6 then
|
||||
if math.random(1, 9) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'red-asterisk', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
else
|
||||
if noise_decoratives_2 > 0.4 then
|
||||
if math.random(1, 17) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'red-asterisk', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
if noise_decoratives_3 < -0.6 then
|
||||
if math.random(1, 2) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'brown-fluff-dry', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
else
|
||||
if noise_decoratives_3 < -0.4 then
|
||||
if math.random(1, 5) == 1 then
|
||||
table.insert(
|
||||
global.planet_decoratives_hold,
|
||||
{name = 'brown-fluff-dry', position = {pos_x, pos_y}, amount = 1}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
table.insert(global.planet_tiles_hold, {name = tile_to_insert, position = {pos_x, pos_y}})
|
||||
end
|
||||
end
|
@ -2,7 +2,6 @@ local Event = require 'utils.event'
|
||||
local Token = require 'utils.token'
|
||||
local Task = require 'utils.task'
|
||||
local Global = require 'utils.global'
|
||||
local Game = require 'utils.game'
|
||||
local Debug = require 'utils.debug'
|
||||
local Map = require 'map_gen.combined.tetris.shape'
|
||||
local Tetrimino = require 'map_gen.combined.tetris.tetrimino'(Map)
|
||||
@ -10,6 +9,8 @@ local View = require 'map_gen.combined.tetris.view'
|
||||
local InfinityChest = require 'features.infinite_storage_chest'
|
||||
local states = require 'map_gen.combined.tetris.states'
|
||||
local StateMachine = require 'utils.state_machine'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local tetriminos = {}
|
||||
local primitives = {
|
||||
@ -68,7 +69,7 @@ local machine = StateMachine.new(states.voting)
|
||||
|
||||
local player_zoom = {}
|
||||
local player_force = nil
|
||||
local nauvis = nil
|
||||
local play_surface = nil
|
||||
Global.register(
|
||||
{
|
||||
tetriminos = tetriminos,
|
||||
@ -90,6 +91,10 @@ local point_table = {1, 3, 5, 9}
|
||||
local tetris_tick_duration = 61
|
||||
global.vote_delay = 10
|
||||
|
||||
-- Use redmew_surface to give us a waterworld and a spawn location
|
||||
RS.set_spawn_position({x = 8, y = 8})
|
||||
RS.set_map_gen_settings({MGSP.waterworld})
|
||||
|
||||
local function calculate_winner()
|
||||
if StateMachine.in_state(machine, states.down) then --TODO: Fix
|
||||
return --Halt vote if in down mode
|
||||
@ -156,7 +161,7 @@ for option_index, option in pairs(options) do
|
||||
end
|
||||
|
||||
local function spawn_new_tetrimino()
|
||||
table.insert(tetriminos, Tetrimino.new(nauvis, {x = 0, y = primitives.tetri_spawn_y_position}))
|
||||
table.insert(tetriminos, Tetrimino.new(play_surface, {x = 0, y = primitives.tetri_spawn_y_position}))
|
||||
end
|
||||
|
||||
local function collect_full_row_resources(tetri)
|
||||
@ -261,7 +266,7 @@ local move_down =
|
||||
chart_area,
|
||||
{
|
||||
force = player_force,
|
||||
surface = nauvis,
|
||||
surface = play_surface,
|
||||
area = {
|
||||
{pos.x - 32, pos.y - 32},
|
||||
{pos.x + 64, pos.y + 64}
|
||||
@ -313,8 +318,8 @@ local spawn_new_tetrimino_token = Token.register(spawn_new_tetrimino)
|
||||
Event.on_init(
|
||||
function()
|
||||
player_force = game.forces.player
|
||||
nauvis = game.surfaces.nauvis
|
||||
player_force.chart(nauvis, {{-192, -432}, {160, 0}})
|
||||
play_surface = RS.get_surface()
|
||||
player_force.chart(play_surface, {{-192, -432}, {160, 0}})
|
||||
Task.set_timeout_in_ticks(30 * tetris_tick_duration - 15, spawn_new_tetrimino_token)
|
||||
View.enable_vote_buttons(true)
|
||||
end
|
||||
@ -423,15 +428,4 @@ Event.add(
|
||||
end
|
||||
)
|
||||
|
||||
Event.add(
|
||||
defines.events.on_player_created,
|
||||
function(event)
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
|
||||
local position = player.surface.find_non_colliding_position('player', {8, 8}, 3, 1)
|
||||
if position then
|
||||
player.teleport(position)
|
||||
end
|
||||
end
|
||||
)
|
||||
return Map.get_map()
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 236 KiB |
Binary file not shown.
Before Width: | Height: | Size: 67 KiB |
@ -1,10 +1,20 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local degrees = require "utils.math".degrees
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = require "utils.math".degrees
|
||||
|
||||
local ore_seed = 3000
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local wave = b.sine_wave(64, 16, 4)
|
||||
|
||||
local waves = b.single_y_pattern(wave, 64)
|
||||
|
@ -3,6 +3,7 @@ local perlin = require 'map_gen.shared.perlin_noise'
|
||||
local Global = require 'utils.global'
|
||||
local math = require 'utils.math'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
local table = require 'utils.table'
|
||||
|
||||
local sand_width = 512
|
||||
@ -21,6 +22,13 @@ local water_noise_level = noise_level * 1.35
|
||||
local perlin_seed_1 = nil
|
||||
local perlin_seed_2 = nil
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
Global.register_init(
|
||||
{},
|
||||
function(tbl)
|
||||
|
@ -9,10 +9,7 @@ local Event = require 'utils.event'
|
||||
local ScenarioInfo = require 'features.gui.info'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local table = require 'utils.table'
|
||||
|
||||
ScenarioInfo.set_map_name('Christmas Tree of Terror')
|
||||
ScenarioInfo.set_map_description("Triangle of death's Christmas cousin")
|
||||
ScenarioInfo.add_map_extra_info('Christmas tree shaped death world with plenty of loot to fight for.\nCan you reach the presents at the base of the tree?')
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
-- change these to change the pattern.
|
||||
local ore_seed1 = 30000
|
||||
@ -20,6 +17,17 @@ local ore_seed2 = 2 * ore_seed1
|
||||
local enemy_seed = 420420
|
||||
local loot_seed = 2000
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
ScenarioInfo.set_map_name('Christmas Tree of Terror')
|
||||
ScenarioInfo.set_map_description("Triangle of death's Christmas cousin")
|
||||
ScenarioInfo.add_map_extra_info('Christmas tree shaped death world with plenty of loot to fight for.\nCan you reach the presents at the base of the tree?')
|
||||
|
||||
local generator
|
||||
local ammos = {
|
||||
'artillery-shell',
|
||||
@ -48,13 +56,6 @@ local function init_weapon_damage()
|
||||
end
|
||||
end
|
||||
|
||||
local function no_resources(_, _, world, tile)
|
||||
for _, e in ipairs(world.surface.find_entities_filtered({type = 'resource', area = {{world.x, world.y}, {world.x + 1, world.y + 1}}})) do
|
||||
e.destroy()
|
||||
end
|
||||
return tile
|
||||
end
|
||||
|
||||
Event.add(
|
||||
defines.events.on_research_finished,
|
||||
function(event)
|
||||
@ -393,7 +394,6 @@ local map = b.any{
|
||||
|
||||
map = b.apply_entity(map, loot)
|
||||
map = b.apply_entity(map, enemy)
|
||||
map = b.apply_effect(map, no_resources)
|
||||
|
||||
local function on_init()
|
||||
game.forces['player'].technologies['landfill'].enabled = false
|
||||
|
@ -2,6 +2,8 @@ local b = require 'map_gen.shared.builders'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local math = require "utils.math"
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local ore_seed1 = 11000
|
||||
local ore_seed2 = ore_seed1 * 2
|
||||
@ -11,13 +13,13 @@ local ore_block_size = 32
|
||||
local random_ore = Random.new(ore_seed1, ore_seed2)
|
||||
local degrees = math.degrees
|
||||
|
||||
local function no_enemies(x, y, world, tile)
|
||||
for _, e in ipairs(world.surface.find_entities_filtered({force = 'enemy', position = {world.x, world.y}})) do
|
||||
e.destroy()
|
||||
end
|
||||
|
||||
return tile
|
||||
end
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none,
|
||||
MGSP.enemy_none
|
||||
}
|
||||
)
|
||||
|
||||
local small_ore_patch = b.circle(12)
|
||||
local medium_ore_patch = b.circle(24)
|
||||
@ -36,7 +38,7 @@ for _, v in ipairs(ore_patches) do
|
||||
table.insert(total_ore_patch_weights, square_t)
|
||||
end
|
||||
|
||||
value = b.exponential_value
|
||||
local value = b.exponential_value
|
||||
|
||||
local function non_transform(shape)
|
||||
return shape
|
||||
@ -209,7 +211,6 @@ d2_arm = b.rotate(d2_arm, degrees(-45))
|
||||
local arms2 = b.any {d1_arm, d2_arm}
|
||||
|
||||
local shape = b.any {b.translate(arms2, 480, 0), b.translate(arms2, -480, 0), mediumn_dot, arms}
|
||||
shape = b.apply_effect(shape, no_enemies)
|
||||
|
||||
local shape2 = b.all {big_dot, b.invert(small_dot)}
|
||||
shape2 = b.choose(big_dot, shape2, b.any {arms, arms2})
|
||||
@ -221,7 +222,7 @@ iron =
|
||||
b.resource(
|
||||
iron,
|
||||
'iron-ore',
|
||||
function(x, y)
|
||||
function()
|
||||
return 700
|
||||
end
|
||||
)
|
||||
@ -233,7 +234,7 @@ copper =
|
||||
b.resource(
|
||||
copper,
|
||||
'copper-ore',
|
||||
function(x, y)
|
||||
function()
|
||||
return 600
|
||||
end
|
||||
)
|
||||
@ -245,7 +246,7 @@ stone =
|
||||
b.resource(
|
||||
stone,
|
||||
'stone',
|
||||
function(x, y)
|
||||
function()
|
||||
return 1500
|
||||
end
|
||||
)
|
||||
@ -257,7 +258,7 @@ coal =
|
||||
b.resource(
|
||||
coal,
|
||||
'coal',
|
||||
function(x, y)
|
||||
function()
|
||||
return 850
|
||||
end
|
||||
)
|
||||
@ -270,12 +271,12 @@ oil =
|
||||
b.resource(
|
||||
oil,
|
||||
'crude-oil',
|
||||
function(x, y)
|
||||
function()
|
||||
return 60000
|
||||
end
|
||||
)
|
||||
|
||||
start = b.apply_entity(mediumn_dot, b.any {iron, copper, stone, coal, oil})
|
||||
local start = b.apply_entity(mediumn_dot, b.any {iron, copper, stone, coal, oil})
|
||||
|
||||
local pattern = {
|
||||
{shape, b.empty_shape},
|
||||
|
@ -1,10 +1,20 @@
|
||||
local b = require "map_gen.shared.builders"
|
||||
local degrees = require "utils.math".degrees
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = require "utils.math".degrees
|
||||
|
||||
local seed1 = 666
|
||||
local seed2 = 999
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local function value()
|
||||
return 1000000
|
||||
end
|
||||
|
@ -7,12 +7,13 @@ local Global = require('utils.global')
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local OutpostBuilder = require 'map_gen.presets.crash_site.outpost_builder'
|
||||
local math = require 'utils.math'
|
||||
local degrees = math.degrees
|
||||
local ScenarioInfo = require 'features.gui.info'
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = math.degrees
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.grass_only,
|
||||
@ -36,7 +37,7 @@ ScenarioInfo.add_map_extra_info(
|
||||
|
||||
global.config.market.enabled = false
|
||||
|
||||
-- leave seeds nil to have them filled in based on teh map seed.
|
||||
-- leave seeds nil to have them filled in based on the map seed.
|
||||
local outpost_seed = nil --91000
|
||||
local ore_seed = nil --92000
|
||||
|
||||
|
@ -1,9 +1,18 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
|
||||
local pic = require 'map_gen.data.presets.creation_of_adam2'
|
||||
local degrees = require "utils.math".degrees
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
--local pic = require "map_gen.data.presets.sistine_chapel_ceiling"
|
||||
|
||||
local degrees = require "utils.math".degrees
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = b.picture(pic)
|
||||
|
@ -4,6 +4,8 @@ local Global = require 'utils.global'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local math = require "utils.math"
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local oil_seed
|
||||
local uranium_seed
|
||||
@ -19,6 +21,13 @@ local density_scale = 1 / 48
|
||||
local density_threshold = 0.5
|
||||
local density_multiplier = 50
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
Global.register_init(
|
||||
{},
|
||||
function(tbl)
|
||||
|
@ -3,8 +3,8 @@ Inspired/copied from Beach/Double beach by GrilledHam
|
||||
Creates a diagonal, wavy ribbon world with only tiles. Vanilla ore and biter generation are unaffected.
|
||||
|
||||
Post-mortum analysis after 2018-11-15 run:
|
||||
Exchange string used was: >>>eNptUT1IAzEY/T7T01pFCnYRVBy6VkQdFKQXQXAQR6FuXnupHLR3ctcO6qCDgoMiiIsudhXBzUFcBEEUFKpObhUXB0VF0EWoSZv0SvFB3r18L/l+cgBhGAIAQtoDKcfIBIgWSjkLC8yNOS7ju9aUmzdZzLGE1Wwyj7k5QkjAtCrfELNZdjGWNDymEaLNu4bn8XDQch1bZgh4hm3ymOblHFsEtJzLmDjVlncN28pn5UHA5tHP4upaL4hVXoGBclksroq8RbE4EJAHFLRUxkqnAVYnAPrGEXE5cjz5tLSrY9Xvp1J8yEjiTEZK61IkjqTYuJCCHiixosQ2xaEKvnRfVGvleGZZJEh9UTXXhIm49XZS+LksxvH38PN+Ojmno9UzMx3Ov8e52SKmaqrR/p7AqZoAVM6SLq1HHW9vBF511MSNiCA6wul8igCGO7gqbHLq6wbVWlyliVBMV/CtJnlW4kFvnCNKcUwk7xV0JahSsNYZSjlLq0aX7/Krg1Bf3vSHu1YVL+pKN/QQVT0M039GaIhE6x4+JOqYNXohtSb4CxZb1I7/WwI+PvSdROfdH4nTkzI=<<<
|
||||
With seed: 2963296099
|
||||
|
||||
|
||||
The players expanded the base easily and had too much access to resources. The biter frequency should be increased and the ore richness and/or size decreased.
|
||||
There was a lot of space in the North-South direction for building, so play_area_width should be turned down significantly.
|
||||
]]--
|
||||
@ -13,9 +13,10 @@ local perlin = require 'map_gen.shared.perlin_noise'
|
||||
local Global = require 'utils.global'
|
||||
local math = require 'utils.math'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
-- A "very small" starting area is advised at the default 100 width.
|
||||
local play_area_width = 100 -- The approximate width of the play area
|
||||
local play_area_width = 50 -- The approximate width of the play area
|
||||
local oob_tile = 'out-of-map' -- The tiles that make up the out of bounds/world border. Recommended are out-of-map or water.
|
||||
|
||||
local oob_width = 233
|
||||
@ -29,6 +30,45 @@ local oob_noise_level = 15.25 --Factor for the magnitude of the curve
|
||||
local perlin_seed_1 = nil
|
||||
local perlin_seed_2 = nil
|
||||
|
||||
local custom_oregen = {
|
||||
autoplace_controls = {
|
||||
coal = {
|
||||
frequency = 'high',
|
||||
richness = 'poor',
|
||||
size = 'low'
|
||||
},
|
||||
['copper-ore'] = {
|
||||
frequency = 'high',
|
||||
richness = 'poor',
|
||||
size = 'low'
|
||||
},
|
||||
['crude-oil'] = {
|
||||
frequency = 'high',
|
||||
richness = 'poor',
|
||||
size = 'low'
|
||||
},
|
||||
['iron-ore'] = {
|
||||
frequency = 'high',
|
||||
richness = 'poor',
|
||||
size = 'low'
|
||||
},
|
||||
['uranium-ore'] = {
|
||||
frequency = 'normal',
|
||||
richness = 'poor',
|
||||
size = 'low'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.starting_area_very_low,
|
||||
MGSP.cliff_none,
|
||||
MGSP.enemy_very_high,
|
||||
custom_oregen
|
||||
}
|
||||
)
|
||||
|
||||
Global.register_init(
|
||||
{},
|
||||
function(tbl)
|
||||
|
@ -1,10 +1,16 @@
|
||||
--[[
|
||||
This map uses custom ore gen. When generating the map, under the resource settings tab use Size = 'None' for iron, copper, stone and coal.
|
||||
]]
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = require "utils.math".degrees
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local body = b.rotate(b.oval(128,256), degrees(20))
|
||||
local butt = b.translate(b.rotate(b.oval(180, 128), degrees(30)), 130,100)
|
||||
|
||||
|
@ -1,11 +1,21 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local Event = require 'utils.event'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local degrees = require "utils.math".degrees
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = require "utils.math".degrees
|
||||
|
||||
local seed = 1000
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
Event.on_init(
|
||||
function()
|
||||
local rs = game.forces.player.recipes
|
||||
|
@ -1,9 +1,15 @@
|
||||
--[[
|
||||
This map uses custom ore gen. When generating the map, under the resource settings tab use Size = 'None' for all resources.
|
||||
]]
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local math = require "utils.math"
|
||||
local math = require 'utils.math'
|
||||
local degrees = math.degrees
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local ball_r = 16
|
||||
local big_circle = b.circle(ball_r)
|
||||
@ -77,7 +83,7 @@ for i = 1, count - 1 do
|
||||
local c = lines_circle
|
||||
c = b.apply_entity(c, resources[i])
|
||||
c = b.change_map_gen_collision_tile(c, 'water-tile', 'grass-1')
|
||||
local c = b.translate(c, x, 0)
|
||||
c = b.translate(c, x, 0)
|
||||
|
||||
table.insert(lines, c)
|
||||
table.insert(lines, l)
|
||||
|
@ -1,7 +1,16 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
|
||||
local beach = require 'map_gen.presets.beach'
|
||||
local degrees = require "utils.math".degrees
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = require 'utils.math'.degrees
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local start_pound = b.circle(6)
|
||||
start_pound = b.translate(start_pound, 0, -16)
|
||||
|
@ -1,19 +1,24 @@
|
||||
--[[
|
||||
This map uses custom ore gen. When generating the map, under the resource settings tab use Size = 'None' for all resources.
|
||||
This map removes and adds it's own water, in terrain settings use water frequency = very low and water size = only in starting area.
|
||||
This map has isolated areas, it's recommend turning biters to peaceful to reduce stress on the pathfinder.
|
||||
]]
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local math = require "utils.math"
|
||||
local degrees = math.degrees
|
||||
local math = require 'utils.math'
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
-- change these to change the pattern.
|
||||
local degrees = math.degrees
|
||||
|
||||
-- change these to change the pattern and scale
|
||||
local seed1 = 12345
|
||||
local seed2 = 56789
|
||||
|
||||
local fish_scale = 1.75
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.peaceful_mode_on,
|
||||
MGSP.water_none
|
||||
}
|
||||
)
|
||||
|
||||
local value = b.exponential_value
|
||||
|
||||
local pic = require 'map_gen.data.presets.fish'
|
||||
|
@ -1,24 +1,23 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = require "utils.math".degrees
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none,
|
||||
MGSP.water_none
|
||||
}
|
||||
)
|
||||
|
||||
local function value(base, mult)
|
||||
return function(x, y)
|
||||
return mult * (math.abs(x) + math.abs(y)) + base
|
||||
end
|
||||
end
|
||||
|
||||
local function no_resources(_, _, world, tile)
|
||||
for _, e in ipairs(
|
||||
world.surface.find_entities_filtered(
|
||||
{type = 'resource', area = {{world.x, world.y}, {world.x + 1, world.y + 1}}}
|
||||
)
|
||||
) do
|
||||
e.destroy()
|
||||
end
|
||||
|
||||
return tile
|
||||
end
|
||||
|
||||
-- bot_islands_flag true if you want to add islands of ores only reachable by robots
|
||||
local bot_islands_flag = true
|
||||
|
||||
|
@ -1,16 +1,21 @@
|
||||
--[[
|
||||
This map uses custom ore gen. When generating the map, under the resource settings tab use Size = 'None' for all resources.
|
||||
This map removes and adds it's own water, in terrain settings use water frequency = very low and water size = only in starting area.
|
||||
This map has isolated areas, it's recommend turning biters to peaceful to reduce stress on the pathfinder.
|
||||
]]
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local math = require "utils.math"
|
||||
local math = require 'utils.math'
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
-- change these to change the pattern.
|
||||
local seed1 = 17000
|
||||
local seed2 = seed1 * 2
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.peaceful_mode_on,
|
||||
MGSP.water_none
|
||||
}
|
||||
)
|
||||
|
||||
local function value(base, mult, pow)
|
||||
return function(x, y)
|
||||
local d_sq = x * x + y * y
|
||||
|
@ -1,10 +1,16 @@
|
||||
--[[
|
||||
This map removes and adds it's own water, in terrain settings use water frequency = very low and water size = only in starting area.
|
||||
]]
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.gears"
|
||||
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.water_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = b.picture(pic)
|
||||
@ -16,4 +22,4 @@ map = b.scale(map, 4, 4)
|
||||
map = b.change_tile(map, false, "water")
|
||||
map = b.change_map_gen_collision_tile(map, "water-tile", "grass-1")
|
||||
|
||||
return map
|
||||
return map
|
||||
|
@ -1,13 +1,21 @@
|
||||
--[[
|
||||
This map uses custom ore gen. When generating the map, under the resource settings tab use Size = 'None' for all resources.
|
||||
]]
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = require "utils.math".degrees
|
||||
|
||||
local ore_seed1 = 1000
|
||||
local ore_seed2 = ore_seed1 * 2
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local h_track = {
|
||||
b.line_x(2),
|
||||
b.translate(b.line_x(2), 0, -3),
|
||||
|
@ -12,6 +12,8 @@ local b = require 'map_gen.shared.builders'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local math = require "utils.math"
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = math.rad
|
||||
|
||||
@ -19,6 +21,13 @@ local ore_seed1 = 1000
|
||||
local ore_seed2 = ore_seed1 * 2
|
||||
local island_separation = 350
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local track = {
|
||||
b.translate(b.line_x(3), 0, -3),
|
||||
b.translate(b.line_x(3), 0, 3),
|
||||
|
@ -1,5 +1,15 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local math = require "utils.math"
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none,
|
||||
MGSP.enemy_none
|
||||
}
|
||||
)
|
||||
|
||||
local value = b.exponential_value
|
||||
|
||||
|
@ -1,9 +1,19 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = require "utils.math".degrees
|
||||
|
||||
local ore_seed = 4000
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local function no_enemies(_, _, world, tile)
|
||||
for _, e in ipairs(world.surface.find_entities_filtered({force = 'enemy', position = {world.x, world.y}})) do
|
||||
e.destroy()
|
||||
|
@ -1,10 +1,20 @@
|
||||
local b = require "map_gen.shared.builders"
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = require "utils.math".degrees
|
||||
|
||||
local seed1 = 420420
|
||||
local seed2 = 696969
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local ball = b.circle(16)
|
||||
local line1 = b.translate(b.rectangle(42, 8), 34, 0)
|
||||
local line2 = b.translate(b.rectangle(8, 42), 0, -34)
|
||||
|
@ -2,8 +2,18 @@ local b = require 'map_gen.shared.builders'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local table = require 'utils.table'
|
||||
local math = require "utils.math"
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = math.degrees
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local seed1 = 17000
|
||||
local seed2 = seed1 * 2
|
||||
|
||||
@ -157,7 +167,7 @@ local function constant(x)
|
||||
end
|
||||
end
|
||||
|
||||
local small_circle = b.circle(32)
|
||||
small_circle = b.circle(32)
|
||||
local start_iron = b.resource(small_circle, ores[1].resource, constant(900))
|
||||
local start_copper = b.resource(small_circle, ores[2].resource, constant(600))
|
||||
local start_stone = b.resource(small_circle, ores[3].resource, constant(400))
|
||||
|
@ -1,7 +1,9 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local table = require 'utils.table'
|
||||
local math = require "utils.math"
|
||||
local math = require 'utils.math'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local track_seed1 = 37000
|
||||
local track_seed2 = track_seed1 * 2
|
||||
@ -17,6 +19,14 @@ local number_blocks = 25
|
||||
local ore_blocks = 32
|
||||
local ore_block_size = 30
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none,
|
||||
MGSP.enemy_none
|
||||
}
|
||||
)
|
||||
|
||||
local blocks_size = track_lines * block_size
|
||||
local offset = (track_lines * 0.5 + 0.5) * block_size
|
||||
|
||||
|
@ -2,9 +2,21 @@
|
||||
-- Map in the shape of a maltese cross, with narrow water bridges around the spawn to force "interesting" transfer of materials
|
||||
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local math = require "utils.math"
|
||||
local math = require 'utils.math'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = math.rad
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none,
|
||||
MGSP.grass_only,
|
||||
MGSP.water_none
|
||||
}
|
||||
)
|
||||
|
||||
local function value(base, mult, pow)
|
||||
return function(x, y)
|
||||
local d_sq = x * x + y * y
|
||||
@ -16,22 +28,7 @@ local function no_trees(world, tile)
|
||||
if not tile then
|
||||
return
|
||||
end
|
||||
for _, e in ipairs(
|
||||
world.surface.find_entities_filtered(
|
||||
{type = 'tree', area = {{world.x, world.y}, {world.x + 1, world.y + 1}}}
|
||||
)
|
||||
) do
|
||||
e.destroy()
|
||||
end
|
||||
return tile
|
||||
end
|
||||
|
||||
local function no_resources(world, tile)
|
||||
for _, e in ipairs(
|
||||
world.surface.find_entities_filtered(
|
||||
{type = 'resource', area = {{world.x, world.y}, {world.x + 1, world.y + 1}}}
|
||||
)
|
||||
) do
|
||||
for _, e in ipairs(world.surface.find_entities_filtered({type = 'tree', area = {{world.x, world.y}, {world.x + 1, world.y + 1}}})) do
|
||||
e.destroy()
|
||||
end
|
||||
return tile
|
||||
@ -42,46 +39,47 @@ local starting_area = 59
|
||||
local gradient = 0.05
|
||||
local tiles_half = (starting_area) * 0.5
|
||||
|
||||
local function maltese_cross(x,y)
|
||||
local function maltese_cross(x, y)
|
||||
--Create maltese shape
|
||||
|
||||
local abs_x = math.abs(x)
|
||||
local abs_y = math.abs(y)
|
||||
|
||||
return not (abs_x > (tiles_half+(abs_y*gradient)) and abs_y > (tiles_half+(abs_x*gradient)))
|
||||
return not (abs_x > (tiles_half + (abs_y * gradient)) and abs_y > (tiles_half + (abs_x * gradient)))
|
||||
end
|
||||
|
||||
-- create water crossings and pattern
|
||||
local water_line =
|
||||
b.any {
|
||||
b.rectangle(10,8)
|
||||
}
|
||||
b.any {
|
||||
b.rectangle(10, 8)
|
||||
}
|
||||
water_line = b.change_tile(water_line, true, 'water')
|
||||
|
||||
local waters = b.single_y_pattern(water_line, 9)
|
||||
local bounds = b.rectangle(10, starting_area+1)
|
||||
local bounds = b.rectangle(10, starting_area + 1)
|
||||
waters = b.choose(bounds, waters, b.empty_shape)
|
||||
waters = b.translate(waters,34,0)
|
||||
waters = b.translate(waters, 34, 0)
|
||||
|
||||
local water_pattern = b.any{
|
||||
waters,
|
||||
b.rotate(waters,degrees(90)),
|
||||
b.rotate(waters,degrees(180)),
|
||||
b.rotate(waters,degrees(270))
|
||||
}
|
||||
local water_pattern =
|
||||
b.any {
|
||||
waters,
|
||||
b.rotate(waters, degrees(90)),
|
||||
b.rotate(waters, degrees(180)),
|
||||
b.rotate(waters, degrees(270))
|
||||
}
|
||||
|
||||
-- create the starting area as a grass square
|
||||
local starting_square = b.rectangle(60, 60)
|
||||
local starting_square = b.rectangle(60, 60)
|
||||
starting_square = b.change_tile(starting_square, true, 'grass-1')
|
||||
|
||||
local starting_patch = b.circle(20)
|
||||
local starting_coal = b.resource(starting_patch, 'coal', value(1800, 0.8, 1.5))
|
||||
local starting_iron = b.resource(starting_patch, 'iron-ore', value(3000, 0.8, 1.5))
|
||||
local starting_copper = b.resource(starting_patch, 'copper-ore', value(2200, 0.75, 1.5))
|
||||
local starting_stone = b.resource(starting_patch, 'stone', value(1100, 0.75, 1.5))
|
||||
local starting_copper = b.resource(starting_patch, 'copper-ore', value(2200, 0.75, 1.5))
|
||||
local starting_stone = b.resource(starting_patch, 'stone', value(1100, 0.75, 1.5))
|
||||
local null = b.no_entity
|
||||
local starting_resources = b.segment_pattern({null,starting_coal,null,starting_copper,null,starting_stone,null,starting_iron})
|
||||
starting_resources = b.rotate(starting_resources, degrees(45/2))
|
||||
local starting_resources = b.segment_pattern({null, starting_coal, null, starting_copper, null, starting_stone, null, starting_iron})
|
||||
starting_resources = b.rotate(starting_resources, degrees(45 / 2))
|
||||
-- starting_circle = b.circle(14)
|
||||
|
||||
-- ore generation
|
||||
@ -90,40 +88,40 @@ local small_patch = b.circle(8)
|
||||
local patches = b.single_pattern(patch, 220, 220)
|
||||
|
||||
local stone = b.resource(patch, 'stone', value(100, 0.75, 1.1))
|
||||
local oil = b.resource(b.throttle_world_xy(small_patch,1,4,1,4), 'crude-oil', value(33000, 50, 1.05))
|
||||
local coal = b.resource(patch, 'coal', value(100, 0.75, 1.1))
|
||||
local oil = b.resource(b.throttle_world_xy(small_patch, 1, 4, 1, 4), 'crude-oil', value(33000, 50, 1.05))
|
||||
local coal = b.resource(patch, 'coal', value(100, 0.75, 1.1))
|
||||
local uranium = b.resource(small_patch, 'uranium-ore', value(200, 0.75, 1.1))
|
||||
|
||||
local pattern1 =
|
||||
{
|
||||
{stone, oil,stone},
|
||||
local pattern1 = {
|
||||
{stone, oil, stone},
|
||||
{stone, oil, oil},
|
||||
{stone, stone, stone}
|
||||
}
|
||||
local stone_arm = b.grid_pattern(pattern1, 3, 3, 220,220)
|
||||
local stone_arm = b.grid_pattern(pattern1, 3, 3, 220, 220)
|
||||
|
||||
local pattern2 =
|
||||
{
|
||||
local pattern2 = {
|
||||
{coal, coal, coal},
|
||||
{coal, coal, coal},
|
||||
{coal, coal, uranium}
|
||||
}
|
||||
local coal_arm = b.grid_pattern(pattern2, 3, 3, 220, 220)
|
||||
local coal_arm = b.grid_pattern(pattern2, 3, 3, 220, 220)
|
||||
local iron = b.resource(patches, 'iron-ore', value(500, 0.8, 1.075))
|
||||
local copper = b.resource(patches, 'copper-ore', value(400, 0.75, 1.1))
|
||||
local copper = b.resource(patches, 'copper-ore', value(400, 0.75, 1.1))
|
||||
|
||||
local resources = b.segment_pattern({null,coal_arm,null,copper,null,stone_arm,null,iron})
|
||||
resources = b.rotate(resources, degrees(45/2))
|
||||
local resources = b.segment_pattern({null, coal_arm, null, copper, null, stone_arm, null, iron})
|
||||
resources = b.rotate(resources, degrees(45 / 2))
|
||||
|
||||
-- worm islands
|
||||
local worm_island = b.rectangle(20,300)
|
||||
local worm_island = b.rectangle(20, 300)
|
||||
local worm_island_end = b.circle(10)
|
||||
worm_island = b.any{
|
||||
worm_island =
|
||||
b.any {
|
||||
worm_island_end,
|
||||
b.translate(worm_island,0,-150),
|
||||
b.translate(worm_island_end,0,-300)
|
||||
b.translate(worm_island, 0, -150),
|
||||
b.translate(worm_island_end, 0, -300)
|
||||
}
|
||||
worm_island = b.change_tile(worm_island, true, 'grass-1')
|
||||
--
|
||||
|
||||
--[[
|
||||
local worm_names = {
|
||||
@ -131,9 +129,7 @@ local worm_names = {
|
||||
'medium-worm-turret',
|
||||
'big-worm-turret'
|
||||
}
|
||||
]]--
|
||||
|
||||
local max_worm_chance = 64 / 128
|
||||
]] local max_worm_chance = 64 / 128
|
||||
local worm_chance_factor = 1 --/ (192 * 512)
|
||||
local function worms(_, _, world)
|
||||
local wx, wy = world.x, world.y
|
||||
@ -144,7 +140,6 @@ local function worms(_, _, world)
|
||||
worm_chance = math.min(worm_chance, max_worm_chance)
|
||||
if math.random() < worm_chance then
|
||||
return {name = 'big-worm-turret'}
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -152,11 +147,12 @@ end
|
||||
worm_island = b.apply_entity(worm_island, worms)
|
||||
worm_island = b.apply_effect(worm_island, no_trees)
|
||||
|
||||
local worm_islands = b.any{
|
||||
b.rotate(b.translate(worm_island,0,-110),degrees(45)),
|
||||
b.rotate(b.translate(worm_island,0,-110),degrees(45+90)),
|
||||
b.rotate(b.translate(worm_island,0,-110),degrees(45+180)),
|
||||
b.rotate(b.translate(worm_island,0,-110),degrees(45+270))
|
||||
local worm_islands =
|
||||
b.any {
|
||||
b.rotate(b.translate(worm_island, 0, -110), degrees(45)),
|
||||
b.rotate(b.translate(worm_island, 0, -110), degrees(45 + 90)),
|
||||
b.rotate(b.translate(worm_island, 0, -110), degrees(45 + 180)),
|
||||
b.rotate(b.translate(worm_island, 0, -110), degrees(45 + 270))
|
||||
}
|
||||
|
||||
-- create the start area using the water and grass square
|
||||
@ -167,12 +163,11 @@ local start_area =
|
||||
}
|
||||
|
||||
-- finalising some bits
|
||||
start_area = b.apply_entity(start_area, starting_resources) -- adds a different density ore patch to start
|
||||
start_area = b.apply_entity(start_area, starting_resources) -- adds a different density ore patch to start
|
||||
maltese_cross = b.change_tile(maltese_cross, true, 'grass-1')
|
||||
maltese_cross = b.apply_entity(maltese_cross, resources) -- adds our custom ore gen
|
||||
local sea = b.change_tile(b.full_shape, true, 'water') -- turn the void to water
|
||||
sea = b.fish(sea, 0.00125) -- feesh!
|
||||
local map = b.any{worm_islands, start_area, maltese_cross, sea} -- combine everything
|
||||
map = b.apply_effect(map, no_resources) -- removes vanilla ores
|
||||
maltese_cross = b.apply_entity(maltese_cross, resources) -- adds our custom ore gen
|
||||
local sea = b.change_tile(b.full_shape, true, 'water') -- turn the void to water
|
||||
sea = b.fish(sea, 0.00125) -- feesh!
|
||||
local map = b.any {worm_islands, start_area, maltese_cross, sea} -- combine everything
|
||||
|
||||
return map
|
||||
return map
|
||||
|
@ -1,10 +1,15 @@
|
||||
--[[
|
||||
This map removes and adds it's own water, in terrain settings use water frequency = very low and water size = only in starting area.
|
||||
]]
|
||||
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.misc_stuff"
|
||||
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.water_none
|
||||
}
|
||||
)
|
||||
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = b.picture(pic)
|
||||
@ -15,4 +20,4 @@ map = b.change_tile(map, false, "water")
|
||||
|
||||
map = b.scale(map, 5, 5)
|
||||
|
||||
return map
|
||||
return map
|
||||
|
@ -15,7 +15,7 @@ line1 = b.rotate(line1, degrees(45))
|
||||
line1 = b.translate(line1, 66.5, 12.6875)
|
||||
|
||||
local line2 = b.rectangle(45, 16)
|
||||
local line2 = b.rotate(line2, degrees(-45))
|
||||
line2 = b.rotate(line2, degrees(-45))
|
||||
line2 = b.translate(line2, 55.5, -23.6875)
|
||||
|
||||
--line2 =b.change_tile(line2, true, "water")
|
||||
@ -35,20 +35,8 @@ end
|
||||
|
||||
Event.add(defines.events.on_research_finished, research_finished)
|
||||
|
||||
local function max_axis_distance(world_x, world_y, target_x, target_y)
|
||||
local x = math.abs(world_x - target_x)
|
||||
local y = math.abs(world_y - target_y)
|
||||
|
||||
return math.max(x, y)
|
||||
end
|
||||
|
||||
local function distance(world_x, world_y, target_x, target_y)
|
||||
return math.abs(world_x - target_x) + math.abs(world_y - target_y)
|
||||
end
|
||||
|
||||
local init = false
|
||||
local safe_distance = 480
|
||||
local function effect(x, y, world, tile)
|
||||
local function effect(_, _, world, tile)
|
||||
if not init then
|
||||
init = true
|
||||
game.forces['player'].chart(world.surface, {{-32, -32}, {31, 31}})
|
||||
|
@ -1,3 +1,5 @@
|
||||
-- luacheck: ignore
|
||||
-- please remove luacheck ignore when map is complete/functional
|
||||
local b = require "map_gen.shared.builders"
|
||||
local degrees = require "utils.math".degrees
|
||||
|
||||
|
@ -13,7 +13,7 @@ box = b.any{box, line}
|
||||
|
||||
local boxes = {}
|
||||
for i = 0, 3 do
|
||||
local b = b.rotate(box, degrees(i*90))
|
||||
local b = b.rotate(box, degrees(i*90)) -- luacheck:ignore 421
|
||||
table.insert(boxes, b)
|
||||
end
|
||||
|
||||
|
@ -6,14 +6,26 @@
|
||||
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local math = require "utils.math"
|
||||
local degrees = math.rad
|
||||
local table = require 'utils.table'
|
||||
local Event = require 'utils.event'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = math.rad
|
||||
|
||||
-- change these to change the pattern.
|
||||
local seed1 = 20000
|
||||
local seed2 = seed1 * 2
|
||||
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none,
|
||||
MGSP.enemy_none
|
||||
}
|
||||
)
|
||||
|
||||
local military_techs = {
|
||||
'artillery',
|
||||
'artillery-shell-range-1',
|
||||
@ -206,34 +218,6 @@ local function value(base, mult, pow)
|
||||
end
|
||||
end
|
||||
|
||||
local names = {
|
||||
'biter-spawner',
|
||||
'spitter-spawner'
|
||||
}
|
||||
|
||||
-- removes spawners when called
|
||||
local function no_spawners(_, _, world, tile)
|
||||
for _, e in ipairs(
|
||||
world.surface.find_entities_filtered(
|
||||
{force = 'enemy', name = names, position = {world.x, world.y}}
|
||||
)
|
||||
) do
|
||||
e.destroy()
|
||||
end
|
||||
return tile
|
||||
end
|
||||
|
||||
local function no_resources(_, _, world, tile)
|
||||
for _, e in ipairs(
|
||||
world.surface.find_entities_filtered(
|
||||
{type = 'resource', area = {{world.x, world.y}, {world.x + 1, world.y + 1}}}
|
||||
)
|
||||
) do
|
||||
e.destroy()
|
||||
end
|
||||
return tile
|
||||
end
|
||||
|
||||
local apple = b.translate(b.circle(20),0,-90)
|
||||
local tree = b.picture(require 'map_gen.data.presets.tree')
|
||||
tree = b.scale(tree,0.6,0.6)
|
||||
@ -397,8 +381,6 @@ end
|
||||
local map = b.grid_pattern_full_overlap(pattern, p_cols, p_rows, 500, 500)
|
||||
|
||||
map = b.change_map_gen_collision_tile(map, 'water-tile', 'grass-1')
|
||||
map = b.apply_effect(map, no_resources)
|
||||
map = b.apply_effect(map, no_spawners)
|
||||
|
||||
local sea = b.change_tile(apple, false, 'water')
|
||||
sea = b.fish(sea, 0.005)
|
||||
|
@ -1,8 +1,5 @@
|
||||
-- Map by Jayefuu and grilled ham, concept by claude47, 2018-12-02
|
||||
|
||||
-- SETUP INSTRUCTIONS:
|
||||
-- This map preset will remove biters everywhere except near the ores.
|
||||
|
||||
-- Add market with /market
|
||||
-- Hover over the market and run:
|
||||
-- /silent-command game.player.selected.add_market_item{price={{MARKET_ITEM, 100}}, offer={type="give-item", item="landfill"}}
|
||||
@ -12,9 +9,22 @@ local b = require 'map_gen.shared.builders'
|
||||
local math = require "utils.math"
|
||||
local Perlin = require 'map_gen.shared.perlin_noise'
|
||||
local Event = require 'utils.event'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = math.rad
|
||||
|
||||
local enemy_seed = 420420
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none,
|
||||
MGSP.enemy_none,
|
||||
MGSP.peaceful_mode_on
|
||||
}
|
||||
)
|
||||
|
||||
local function value(base, mult, pow)
|
||||
return function(x, y)
|
||||
local d_sq = x * x + y * y
|
||||
@ -22,37 +32,6 @@ local function value(base, mult, pow)
|
||||
end
|
||||
end
|
||||
|
||||
local function no_resources(_, _, world, tile)
|
||||
for _, e in ipairs(
|
||||
world.surface.find_entities_filtered(
|
||||
{type = 'resource', area = {{world.x, world.y}, {world.x + 1, world.y + 1}}}
|
||||
)
|
||||
) do
|
||||
e.destroy()
|
||||
end
|
||||
return tile
|
||||
end
|
||||
|
||||
local names = {
|
||||
'biter-spawner',
|
||||
'spitter-spawner',
|
||||
'small-worm-turret',
|
||||
'medium-worm-turret',
|
||||
'big-worm-turret'
|
||||
}
|
||||
|
||||
-- removes spawners when called so we can place our own
|
||||
local function no_spawners(_, _, world, tile)
|
||||
for _, e in ipairs(
|
||||
world.surface.find_entities_filtered(
|
||||
{force = 'enemy', name = names, position = {world.x, world.y}}
|
||||
)
|
||||
) do
|
||||
e.destroy()
|
||||
end
|
||||
return tile
|
||||
end
|
||||
|
||||
local spiral = b.circular_spiral(80, 90)
|
||||
spiral = b.any {spiral, b.translate(b.circle(128), 12, -12)}
|
||||
|
||||
@ -194,8 +173,6 @@ local map = b.any{
|
||||
water_cross
|
||||
}
|
||||
map = b.apply_entity(map,start_ore_patch)
|
||||
map = b.apply_effect(map, no_resources)
|
||||
map = b.apply_effect(map, no_spawners) -- remove all spawners and worms
|
||||
map = b.apply_entity(map, enemy) -- add the enemies we generated
|
||||
|
||||
local function on_init()
|
||||
|
@ -1,9 +1,20 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local table = require 'utils.table'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local ore_seed1 = 2000
|
||||
local ore_seed2 = ore_seed1 * 2
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none,
|
||||
MGSP.enemy_none
|
||||
}
|
||||
)
|
||||
|
||||
local random = Random.new(ore_seed1, ore_seed2)
|
||||
|
||||
local spiral = b.rectangular_spiral(1)
|
||||
|
@ -1,9 +1,19 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local table = require 'utils.table'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local seed1 = 320420
|
||||
local seed2 = 420320
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local patch = b.rectangular_spiral(5)
|
||||
local bounds = b.rectangle(46, 43)
|
||||
bounds = b.translate(bounds, 0, 3)
|
||||
@ -36,7 +46,6 @@ local patches = {
|
||||
{oil, 4}
|
||||
}
|
||||
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local random = Random.new(seed1, seed2)
|
||||
|
||||
local total_weights = {}
|
||||
|
@ -1,7 +1,7 @@
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.template"
|
||||
local pic = b.decompress(pic)
|
||||
pic = b.decompress(pic)
|
||||
local map = b.picture(pic)
|
||||
|
||||
-- this builds the map by duplicating the pic in every direction
|
||||
@ -16,4 +16,4 @@ local map = b.picture(pic)
|
||||
-- this sets the tile outside the bounds of the map to deepwater, remove this and it will be void.
|
||||
--map = b.change_tile(map, false, "deepwater")
|
||||
|
||||
return map
|
||||
return map
|
||||
|
@ -1,6 +1,7 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local Event = require 'utils.event'
|
||||
local Perlin = require 'map_gen.shared.perlin_noise'
|
||||
|
||||
local match = string.match
|
||||
local remove = table.remove
|
||||
|
||||
|
@ -4,8 +4,11 @@ local Perlin = require 'map_gen.shared.perlin_noise'
|
||||
local Token = require 'utils.token'
|
||||
local Global = require 'utils.global'
|
||||
local Event = require 'utils.event'
|
||||
local degrees = require "utils.math".degrees
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local degrees = require "utils.math".degrees
|
||||
|
||||
-- change these to change the pattern.
|
||||
local ore_seed1 = 30000
|
||||
@ -13,6 +16,13 @@ local ore_seed2 = 2 * ore_seed1
|
||||
local enemy_seed = 420420
|
||||
local loot_seed = 1000
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local generator
|
||||
|
||||
local ammos = {
|
||||
@ -243,8 +253,8 @@ local item_pool = {
|
||||
{name = 'space-science-pack', count = 200, weight = 10}
|
||||
}
|
||||
|
||||
local total_weights = {}
|
||||
local t = 0
|
||||
total_weights = {}
|
||||
t = 0
|
||||
for _, v in ipairs(item_pool) do
|
||||
t = t + v.weight
|
||||
table.insert(total_weights, t)
|
||||
|
@ -1,10 +1,18 @@
|
||||
local b = require "map_gen.shared.builders"
|
||||
|
||||
local pic = require "map_gen.data.presets.turkey"
|
||||
local pic = b.decompress(pic)
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = b.picture(pic)
|
||||
local shape = b.scale(shape, 4, 4)
|
||||
local shape = b.translate(shape, -300, 500)
|
||||
shape = b.scale(shape, 4, 4)
|
||||
shape = b.translate(shape, -300, 500)
|
||||
|
||||
return shape
|
||||
|
@ -1,10 +1,21 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local table = require 'utils.table'
|
||||
local pic = require 'map_gen.data.presets.void_gears'
|
||||
local gear = require 'map_gen.data.presets.gear_96by96'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local seed1 = 6666
|
||||
local seed2 = 9999
|
||||
|
||||
local pic = require 'map_gen.data.presets.void_gears'
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
pic = b.decompress(pic)
|
||||
|
||||
local shape = b.picture(pic)
|
||||
@ -14,7 +25,6 @@ local map = b.single_pattern(shape, pic.width, pic.height)
|
||||
map = b.translate(map, -102, 133)
|
||||
map = b.scale(map, 1.75, 1.75)
|
||||
|
||||
local gear = require 'map_gen.data.presets.gear_96by96'
|
||||
gear = b.decompress(gear)
|
||||
local gear_big = b.picture(gear)
|
||||
local gear_medium = b.scale(gear_big, 2 / 3)
|
||||
@ -64,7 +74,6 @@ local function sprinkle(shape) -- luacheck: ignore 431
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function radial(shape, radius) -- luacheck: ignore 431
|
||||
local stone_r_sq = radius * 0.3025 -- radius * 0.55
|
||||
local coal_r_sq = radius * 0.4225 -- radius * 0.65
|
||||
@ -147,7 +156,6 @@ small_patches[#small_patches + 1] = {
|
||||
1
|
||||
}
|
||||
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local random = Random.new(seed1, seed2)
|
||||
|
||||
local p_cols = 50
|
||||
@ -187,7 +195,7 @@ local function do_patches(patches, offset)
|
||||
return pattern
|
||||
end
|
||||
|
||||
big_patches = do_patches(big_patches, 96 )
|
||||
big_patches = do_patches(big_patches, 96)
|
||||
big_patches = b.grid_pattern_full_overlap(big_patches, p_cols, p_rows, 192, 192)
|
||||
|
||||
medium_patches = do_patches(medium_patches, 64)
|
||||
@ -199,10 +207,38 @@ small_patches = b.grid_pattern_full_overlap(small_patches, p_cols, p_rows, 64, 6
|
||||
--map = b.apply_entity(map, small_patches)
|
||||
map = b.apply_entities(map, {big_patches, medium_patches, small_patches})
|
||||
|
||||
local start_stone = b.resource(gear_big, 'stone', function() return 400 end)
|
||||
local start_coal = b.resource(gear_big, 'coal', function() return 800 end)
|
||||
local start_copper = b.resource(gear_big, 'copper-ore', function() return 800 end)
|
||||
local start_iron = b.resource(gear_big, 'iron-ore', function() return 1600 end)
|
||||
local start_stone =
|
||||
b.resource(
|
||||
gear_big,
|
||||
'stone',
|
||||
function()
|
||||
return 400
|
||||
end
|
||||
)
|
||||
local start_coal =
|
||||
b.resource(
|
||||
gear_big,
|
||||
'coal',
|
||||
function()
|
||||
return 800
|
||||
end
|
||||
)
|
||||
local start_copper =
|
||||
b.resource(
|
||||
gear_big,
|
||||
'copper-ore',
|
||||
function()
|
||||
return 800
|
||||
end
|
||||
)
|
||||
local start_iron =
|
||||
b.resource(
|
||||
gear_big,
|
||||
'iron-ore',
|
||||
function()
|
||||
return 1600
|
||||
end
|
||||
)
|
||||
local start_segmented = b.segment_pattern({start_stone, start_coal, start_copper, start_iron})
|
||||
local start_gear = b.apply_entity(gear_big, start_segmented)
|
||||
|
||||
|
@ -30,8 +30,8 @@ local leg = b.rectangle(32,480)
|
||||
local head = b.translate (b.oval(32, 64), 0, -64)
|
||||
local body = b.translate (b.circle(64), 0, 64)
|
||||
|
||||
local count = 10
|
||||
local angle = 360 / count
|
||||
count = 10
|
||||
angle = 360 / count
|
||||
local list = { head, body }
|
||||
for i = 1, (count / 2) - 1 do
|
||||
local shape = b.rotate(leg, degrees(i * angle))
|
||||
|
@ -5,36 +5,31 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local Random = require 'map_gen.shared.random'
|
||||
local table = require 'utils.table'
|
||||
local RS = require 'map_gen.shared.redmew_surface'
|
||||
local MGSP = require 'resources.map_gen_settings'
|
||||
|
||||
local ore_seed = 3000
|
||||
|
||||
local function no_resources(x, y, world, tile)
|
||||
for _, e in ipairs(
|
||||
world.surface.find_entities_filtered(
|
||||
{type = 'resource', area = {{world.x, world.y}, {world.x + 1, world.y + 1}}}
|
||||
)
|
||||
) do
|
||||
e.destroy()
|
||||
end
|
||||
return tile
|
||||
end
|
||||
RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.ore_oil_none,
|
||||
MGSP.cliff_none
|
||||
}
|
||||
)
|
||||
|
||||
local world_pic = require 'map_gen.data.presets.world-map'
|
||||
local map = b.picture(world_pic)
|
||||
|
||||
|
||||
local pic = require 'map_gen.data.presets.turkey_bw'
|
||||
local turkey = b.picture(pic)
|
||||
turkey = b.invert(turkey)
|
||||
local bounds = b.rectangle(pic.width, pic.height)
|
||||
turkey = b.all{bounds, turkey}
|
||||
|
||||
turkey = b.all {bounds, turkey}
|
||||
|
||||
local ham = b.picture(require 'map_gen.data.presets.ham')
|
||||
|
||||
|
||||
ham = b.scale(ham, 64 / 127) --0.5
|
||||
turkey = b.scale(turkey,0.2)
|
||||
turkey = b.scale(turkey, 0.2)
|
||||
|
||||
local function value(base, mult, pow)
|
||||
return function(x, y)
|
||||
@ -158,5 +153,4 @@ map = b.translate(map, 756.5, 564)
|
||||
|
||||
map = b.scale(map, 2, 2)
|
||||
map = b.apply_entity(map, ore_grid)
|
||||
map = b.apply_effect(map, no_resources)
|
||||
return map
|
||||
|
@ -10,24 +10,18 @@ require 'utils.table'
|
||||
global.map = {}
|
||||
global.map.terraforming = {}
|
||||
|
||||
local shape
|
||||
local shape = nil
|
||||
local regen_decoratives = false
|
||||
local tiles_per_tick = 32
|
||||
|
||||
--combined--
|
||||
--shape = require "map_gen.combined.island_resort"
|
||||
--require "map_gen.combined.red_planet_v2"
|
||||
--shape = require 'map_gen.combined.borg_planet_v2'
|
||||
--require "map_gen.combined.dimensions"
|
||||
--require "map_gen.combined.dagobah_swamp"
|
||||
--require "map_gen.combined.meteor_strike" --unfinished
|
||||
--require "map_gen.combined.diggy"
|
||||
|
||||
--presets--
|
||||
--shape = require "map_gen.presets.template"
|
||||
--shape = require "map_gen.presets.web" --unfinished
|
||||
--shape = require "map_gen.presets.rings_and_boxes" --unfinished
|
||||
--shape = require "map_gen.presets.ring_of_balls" --unfinished
|
||||
--shape = require "map_gen.presets.dna"
|
||||
--shape = require "map_gen.presets.lines_and_balls"
|
||||
--shape = require "map_gen.presets.mobius_strip"
|
||||
@ -40,8 +34,8 @@ local tiles_per_tick = 32
|
||||
--shape = require "map_gen.presets.maori"
|
||||
--shape = require "map_gen.presets.goat"
|
||||
--shape = require "map_gen.presets.GoT"
|
||||
--shape = require "map_gen.presets.turkey" -- needs to be rebuilt from missing source image.
|
||||
--shape = require "map_gen.presets.north_america" -- needs to be rebuilt from missing source image.
|
||||
--shape = require "map_gen.presets.turkey"
|
||||
--shape = require "map_gen.presets.north_america"
|
||||
--shape = require "map_gen.presets.UK"
|
||||
--shape = require "map_gen.presets.venice"
|
||||
--shape = require "map_gen.presets.goats_on_goats"
|
||||
@ -94,6 +88,12 @@ local tiles_per_tick = 32
|
||||
--shape = require "map_gen.presets.spiral_crossings"
|
||||
--shape = require "map_gen.presets.test"
|
||||
|
||||
--WIP maps--
|
||||
--require "map_gen.combined.meteor_strike" --unfinished
|
||||
--shape = require "map_gen.presets.web" --unfinished
|
||||
--shape = require "map_gen.presets.rings_and_boxes" --unfinished
|
||||
--shape = require "map_gen.presets.ring_of_balls" --unfinished
|
||||
|
||||
--shapes--
|
||||
--shape = require "map_gen.shape.left"
|
||||
--shape = require "map_gen.shape.right"
|
||||
@ -161,7 +161,7 @@ end
|
||||
|
||||
if shape then
|
||||
local surfaces = {
|
||||
[RS.get_surface_name()] = shape,
|
||||
[RS.get_surface_name()] = shape
|
||||
}
|
||||
|
||||
require('map_gen.shared.generate')({surfaces = surfaces, regen_decoratives = regen_decoratives, tiles_per_tick = tiles_per_tick})
|
||||
|
@ -193,7 +193,7 @@ return {
|
||||
},
|
||||
-- no water
|
||||
water_none = {
|
||||
terrain_segmentation = 'normal',
|
||||
terrain_segmentation = 'very-low',
|
||||
water = 'none'
|
||||
},
|
||||
-- very low water
|
||||
|
Loading…
Reference in New Issue
Block a user