mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-03-03 14:53:01 +02:00
updates
This commit is contained in:
parent
b6fbebfd44
commit
dac7c534a2
@ -6,12 +6,13 @@ This map has isolated areas, it's recommend turning biters to peaceful to reduce
|
|||||||
local b = require 'map_gen.shared.builders'
|
local b = require 'map_gen.shared.builders'
|
||||||
|
|
||||||
-- change these to change the pattern.
|
-- change these to change the pattern.
|
||||||
local seed1 = 99999
|
local seed1 = 17000
|
||||||
local seed2 = 66666
|
local seed2 = seed1 * 2
|
||||||
|
|
||||||
local function value(base, mult)
|
local function value(base, mult, pow)
|
||||||
return function(x, y)
|
return function(x, y)
|
||||||
return mult * (math.abs(x) + math.abs(y)) + base
|
local d = math.sqrt(x * x + y * y)
|
||||||
|
return base + mult * d ^ pow
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -21,12 +22,12 @@ local small_circle = b.circle(24)
|
|||||||
local ring = b.all {big_circle, b.invert(small_circle)}
|
local ring = b.all {big_circle, b.invert(small_circle)}
|
||||||
|
|
||||||
local ores = {
|
local ores = {
|
||||||
{resource_type = 'iron-ore', value = value(125, 0.5)},
|
{resource_type = 'iron-ore', value = value(75, 0.25, 1.15)},
|
||||||
{resource_type = 'copper-ore', value = value(100, 0.4)},
|
{resource_type = 'copper-ore', value = value(65, 0.2, 1.15)},
|
||||||
{resource_type = 'stone', value = value(100, 0.2)},
|
{resource_type = 'stone', value = value(50, 0.2, 1.1)},
|
||||||
{resource_type = 'coal', value = value(100, 0.1)},
|
{resource_type = 'coal', value = value(50, 0.15, 1.1)},
|
||||||
{resource_type = 'uranium-ore', value = value(50, 0.1)},
|
{resource_type = 'uranium-ore', value = value(50, 0.1, 1.075)},
|
||||||
{resource_type = 'crude-oil', value = value(10000, 50)}
|
{resource_type = 'crude-oil', value = value(17500, 25, 1.15)}
|
||||||
}
|
}
|
||||||
|
|
||||||
local iron = b.resource(b.full_shape, ores[1].resource_type, ores[1].value)
|
local iron = b.resource(b.full_shape, ores[1].resource_type, ores[1].value)
|
||||||
@ -34,7 +35,7 @@ local copper = b.resource(b.full_shape, ores[2].resource_type, ores[2].value)
|
|||||||
local stone = b.resource(b.full_shape, ores[3].resource_type, ores[3].value)
|
local stone = b.resource(b.full_shape, ores[3].resource_type, ores[3].value)
|
||||||
local coal = b.resource(b.full_shape, ores[4].resource_type, ores[4].value)
|
local coal = b.resource(b.full_shape, ores[4].resource_type, ores[4].value)
|
||||||
local uranium = b.resource(b.full_shape, ores[5].resource_type, ores[5].value)
|
local uranium = b.resource(b.full_shape, ores[5].resource_type, ores[5].value)
|
||||||
local oil = b.resource(b.throttle_world_xy(b.full_shape, 1, 4, 1, 4), ores[6].resource_type, ores[6].value)
|
local oil = b.resource(b.throttle_world_xy(b.full_shape, 1, 8, 1, 8), ores[6].resource_type, ores[6].value)
|
||||||
|
|
||||||
local function striped(_, _, world)
|
local function striped(_, _, world)
|
||||||
local t = (world.x + world.y) % 4 + 1
|
local t = (world.x + world.y) % 4 + 1
|
||||||
@ -43,7 +44,7 @@ local function striped(_, _, world)
|
|||||||
return {
|
return {
|
||||||
name = ore.resource_type,
|
name = ore.resource_type,
|
||||||
position = {world.x, world.y},
|
position = {world.x, world.y},
|
||||||
amount = 3 * ore.value(world.x, world.y)
|
amount = 5 * ore.value(world.x, world.y)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ local function sprinkle(_, _, world)
|
|||||||
return {
|
return {
|
||||||
name = ore.resource_type,
|
name = ore.resource_type,
|
||||||
position = {world.x, world.y},
|
position = {world.x, world.y},
|
||||||
amount = 3 * ore.value(world.x, world.y)
|
amount = 5 * ore.value(world.x, world.y)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -70,37 +71,60 @@ local segmented = b.segment_pattern({iron, copper, stone, coal})
|
|||||||
|
|
||||||
local tree = b.entity(b.throttle_world_xy(b.full_shape, 1, 3, 1, 3), 'tree-01')
|
local tree = b.entity(b.throttle_world_xy(b.full_shape, 1, 3, 1, 3), 'tree-01')
|
||||||
|
|
||||||
local start_iron = b.resource(ring, ores[1].resource_type, value(500, 0.5))
|
local function constant(x)
|
||||||
local start_copper = b.resource(ring, ores[2].resource_type, value(400, 0.5))
|
return function()
|
||||||
local start_stone = b.resource(ring, ores[3].resource_type, value(300, 0.5))
|
return x
|
||||||
local start_coal = b.resource(ring, ores[4].resource_type, value(300, 0.5))
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local tree_shape = b.throttle_world_xy(big_circle, 1, 3, 1, 3)
|
||||||
|
tree_shape = b.subtract(tree_shape, b.translate(b.circle(6), 0, 32))
|
||||||
|
|
||||||
|
local start_iron = b.resource(small_circle, ores[1].resource_type, constant(750))
|
||||||
|
local start_copper = b.resource(small_circle, ores[2].resource_type, constant(600))
|
||||||
|
local start_stone = b.resource(small_circle, ores[3].resource_type, constant(600))
|
||||||
|
local start_coal = b.resource(small_circle, ores[4].resource_type, constant(600))
|
||||||
local start_segmented = b.segment_pattern({start_iron, start_copper, start_stone, start_coal})
|
local start_segmented = b.segment_pattern({start_iron, start_copper, start_stone, start_coal})
|
||||||
local start_tree = b.entity(b.throttle_world_xy(small_circle, 1, 3, 1, 3), 'tree-01')
|
local start_tree = b.entity(tree_shape, 'tree-01')
|
||||||
|
|
||||||
|
local worm_names = {
|
||||||
|
'small-worm-turret',
|
||||||
|
'medium-worm-turret',
|
||||||
|
'big-worm-turret'
|
||||||
|
}
|
||||||
|
|
||||||
|
local max_worm_chance = 1 / 128
|
||||||
|
local worm_chance_factor = 1 / (192 * 512)
|
||||||
|
|
||||||
local worm_names = {'small-worm-turret', 'medium-worm-turret', 'big-worm-turret'}
|
|
||||||
local factor = 1 / (1024 * 32)
|
|
||||||
local max_chance = 1 / 8
|
|
||||||
local function worms(_, _, world)
|
local function worms(_, _, world)
|
||||||
local d = math.sqrt(world.x * world.x + world.y * world.y)
|
local wx, wy = world.x, world.y
|
||||||
|
local d = math.sqrt(wx * wx + wy * wy)
|
||||||
|
|
||||||
if d < 64 then
|
local worm_chance = d - 128
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local lvl
|
if worm_chance > 0 then
|
||||||
if d < 192 then
|
worm_chance = worm_chance * worm_chance_factor
|
||||||
lvl = 1
|
worm_chance = math.min(worm_chance, max_worm_chance)
|
||||||
elseif d < 384 then
|
|
||||||
lvl = 2
|
|
||||||
else
|
|
||||||
lvl = 3
|
|
||||||
end
|
|
||||||
|
|
||||||
local chance = math.min(max_chance, d * factor)
|
if math.random() < worm_chance then
|
||||||
|
if d < 256 then
|
||||||
if math.random() < chance then
|
return {name = 'small-worm-turret'}
|
||||||
local worm_id = math.random(1, lvl)
|
else
|
||||||
return {name = worm_names[worm_id]}
|
local max_lvl
|
||||||
|
local min_lvl
|
||||||
|
if d < 512 then
|
||||||
|
max_lvl = 2
|
||||||
|
min_lvl = 1
|
||||||
|
else
|
||||||
|
max_lvl = 3
|
||||||
|
min_lvl = 2
|
||||||
|
end
|
||||||
|
local lvl = math.random() ^ (512 / d) * max_lvl
|
||||||
|
lvl = math.ceil(lvl)
|
||||||
|
lvl = math.clamp(lvl, min_lvl, 3)
|
||||||
|
return {name = worm_names[lvl]}
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -113,21 +137,22 @@ local oil_loop = b.apply_entities(ring, {oil, worms})
|
|||||||
local striped_loop = b.apply_entities(ring, {striped, worms})
|
local striped_loop = b.apply_entities(ring, {striped, worms})
|
||||||
local sprinkle_loop = b.apply_entities(ring, {sprinkle, worms})
|
local sprinkle_loop = b.apply_entities(ring, {sprinkle, worms})
|
||||||
local segmented_loop = b.apply_entities(ring, {segmented, worms})
|
local segmented_loop = b.apply_entities(ring, {segmented, worms})
|
||||||
local tree_loop = b.apply_entity(ring, tree)
|
local tree_loop = b.apply_entities(ring, {tree, worms})
|
||||||
local rock_loop = b.apply_entity(ring, rocks)
|
local rock_loop = b.apply_entities(ring, {rocks, worms})
|
||||||
local start_loop = b.apply_entity(big_circle, b.any {start_segmented, start_tree})
|
local start_loop = b.apply_entities(big_circle, {start_segmented, start_tree})
|
||||||
|
start_loop = b.translate(start_loop, 0, -32)
|
||||||
|
|
||||||
local loops = {
|
local loops = {
|
||||||
{striped_loop, 3},
|
{striped_loop, 3},
|
||||||
{sprinkle_loop, 3},
|
{sprinkle_loop, 3},
|
||||||
{segmented_loop, 3},
|
{segmented_loop, 3},
|
||||||
{tree_loop, 6},
|
{tree_loop, 9},
|
||||||
{rock_loop, 6},
|
{rock_loop, 9},
|
||||||
{iron_loop, 20},
|
{iron_loop, 20},
|
||||||
{copper_loop, 12},
|
{copper_loop, 12},
|
||||||
{stone_loop, 9},
|
{stone_loop, 9},
|
||||||
{coal_loop, 9},
|
{coal_loop, 9},
|
||||||
{uranium_loop, 3},
|
{uranium_loop, 1},
|
||||||
{oil_loop, 9}
|
{oil_loop, 9}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user