1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

voidgears deathworld

This commit is contained in:
grilledham 2018-06-02 13:28:33 +01:00
parent 82adce0ffe
commit 1e77428b04
12 changed files with 1034 additions and 585 deletions

View File

@ -0,0 +1,102 @@
return {
height = 96,
width = 96,
data = {
{1,40,2,16,1,40,},
{1,40,2,16,1,40,},
{1,40,2,16,1,40,},
{1,39,2,18,1,39,},
{1,39,2,18,1,39,},
{1,39,2,18,1,39,},
{1,38,2,20,1,38,},
{1,38,2,20,1,38,},
{1,18,2,2,1,18,2,20,1,18,2,2,1,18,},
{1,17,2,5,1,16,2,20,1,17,2,4,1,17,},
{1,16,2,7,1,14,2,22,1,14,2,7,1,16,},
{1,15,2,10,1,11,2,24,1,11,2,10,1,15,},
{1,14,2,13,1,6,2,30,1,6,2,13,1,14,},
{1,13,2,16,1,2,2,34,1,2,2,16,1,13,},
{1,12,2,72,1,12,},
{1,11,2,74,1,11,},
{1,10,2,76,1,10,},
{1,9,2,78,1,9,},
{1,8,2,80,1,8,},
{1,9,2,78,1,9,},
{1,10,2,77,1,9,},
{1,10,2,76,1,10,},
{1,11,2,74,1,11,},
{1,11,2,74,1,11,},
{1,12,2,72,1,12,},
{1,12,2,72,1,12,},
{1,13,2,70,1,13,},
{1,13,2,70,1,13,},
{1,14,2,68,1,14,},
{1,14,2,68,1,14,},
{1,14,2,68,1,14,},
{1,13,2,31,1,8,2,31,1,13,},
{1,13,2,28,1,14,2,28,1,13,},
{1,12,2,27,1,18,2,27,1,12,},
{1,12,2,26,1,20,2,26,1,12,},
{1,12,2,25,1,22,2,25,1,12,},
{1,11,2,25,1,24,2,25,1,11,},
{1,8,2,27,1,26,2,27,1,8,},
{1,5,2,29,1,28,2,29,1,5,},
{1,2,2,31,1,30,2,31,1,2,},
{2,33,1,30,2,33,},
{2,32,1,32,2,32,},
{2,32,1,32,2,32,},
{2,32,1,32,2,32,},
{2,31,1,34,2,31,},
{2,31,1,34,2,31,},
{2,31,1,34,2,31,},
{2,31,1,34,2,31,},
{2,31,1,34,2,31,},
{2,31,1,34,2,31,},
{2,31,1,34,2,31,},
{2,31,1,34,2,31,},
{2,32,1,32,2,32,},
{2,32,1,32,2,32,},
{2,32,1,32,2,32,},
{1,1,2,32,1,30,2,32,1,1,},
{1,4,2,29,1,30,2,29,1,4,},
{1,8,2,26,1,28,2,26,1,8,},
{1,11,2,24,1,26,2,24,1,11,},
{1,11,2,25,1,24,2,25,1,11,},
{1,12,2,25,1,22,2,25,1,12,},
{1,12,2,26,1,20,2,26,1,12,},
{1,12,2,27,1,18,2,27,1,12,},
{1,13,2,28,1,14,2,28,1,13,},
{1,13,2,31,1,8,2,31,1,13,},
{1,14,2,68,1,14,},
{1,14,2,68,1,14,},
{1,13,2,70,1,13,},
{1,13,2,70,1,13,},
{1,12,2,72,1,12,},
{1,12,2,72,1,12,},
{1,11,2,74,1,11,},
{1,11,2,74,1,11,},
{1,10,2,76,1,10,},
{1,10,2,77,1,9,},
{1,9,2,78,1,9,},
{1,8,2,80,1,8,},
{1,8,2,80,1,8,},
{1,9,2,78,1,9,},
{1,10,2,76,1,10,},
{1,11,2,74,1,11,},
{1,12,2,72,1,12,},
{1,13,2,15,1,3,2,34,1,3,2,15,1,13,},
{1,14,2,12,1,7,2,30,1,7,2,12,1,14,},
{1,15,2,9,1,12,2,24,1,12,2,9,1,15,},
{1,16,2,6,1,15,2,22,1,15,2,6,1,16,},
{1,17,2,4,1,17,2,21,1,17,2,3,1,17,},
{1,18,2,1,1,19,2,20,1,19,2,1,1,18,},
{1,38,2,20,1,38,},
{1,38,2,20,1,38,},
{1,39,2,18,1,39,},
{1,39,2,18,1,39,},
{1,39,2,18,1,39,},
{1,40,2,16,1,40,},
{1,40,2,16,1,40,},
{1,40,2,16,1,40,},
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

After

Width:  |  Height:  |  Size: 223 KiB

101
map_gen/misc/loot_items.lua Normal file
View File

@ -0,0 +1,101 @@
local Token = require 'utils.global_token'
local item_pool = {
{name = 'firearm-magazine', count = 200, weight = 1250},
{name = 'land-mine', count = 100, weight = 250},
{name = 'shotgun-shell', count = 200, weight = 1250},
{name = 'piercing-rounds-magazine', count = 200, weight = 833.3333},
{name = 'grenade', count = 100, weight = 500},
{name = 'defender-capsule', count = 50, weight = 500},
{name = 'railgun-dart', count = 100, weight = 500},
{name = 'piercing-shotgun-shell', count = 200, weight = 312.5},
{name = 'steel-axe', count = 5, weight = 166.6667},
{name = 'submachine-gun', count = 1, weight = 166.6667},
{name = 'shotgun', count = 1, weight = 166.6667},
{name = 'uranium-rounds-magazine', count = 200, weight = 166.6667},
{name = 'cannon-shell', count = 100, weight = 166.6667},
{name = 'rocket', count = 100, weight = 166.6667},
{name = 'distractor-capsule', count = 25, weight = 166.6667},
{name = 'railgun', count = 1, weight = 100},
{name = 'flamethrower-ammo', count = 50, weight = 100},
{name = 'explosive-rocket', count = 100, weight = 100},
{name = 'explosive-cannon-shell', count = 100, weight = 100},
{name = 'cluster-grenade', count = 100, weight = 100},
{name = 'poison-capsule', count = 100, weight = 100},
{name = 'slowdown-capsule', count = 100, weight = 100},
{name = 'construction-robot', count = 50, weight = 100},
{name = 'solar-panel-equipment', count = 5, weight = 833.3333},
{name = 'artillery-targeting-remote', count = 1, weight = 50},
{name = 'tank-flamethrower', count = 1, weight = 33.3333},
{name = 'explosive-uranium-cannon-shell', count = 100, weight = 33.3333},
{name = 'destroyer-capsule', count = 10, weight = 33.3333},
{name = 'artillery-shell', count = 10, weight = 25},
{name = 'battery-equipment', count = 5, weight = 25},
{name = 'night-vision-equipment', count = 2, weight = 25},
{name = 'exoskeleton-equipment', count = 2, weight = 166.6667},
{name = 'rocket-launcher', count = 1, weight = 14.2857},
{name = 'combat-shotgun', count = 1, weight = 10},
{name = 'flamethrower', count = 1, weight = 10},
{name = 'tank-cannon', count = 1, weight = 10},
{name = 'modular-armor', count = 1, weight = 100},
{name = 'belt-immunity-equipment', count = 1, weight = 10},
{name = 'personal-roboport-equipment', count = 1, weight = 100},
{name = 'energy-shield-equipment', count = 2, weight = 100},
{name = 'personal-laser-defense-equipment', count = 2, weight = 100},
{name = 'battery-mk2-equipment', count = 1, weight = 40},
{name = 'tank-machine-gun', count = 1, weight = 3.3333},
{name = 'power-armor', count = 1, weight = 33.3333},
{name = 'fusion-reactor-equipment', count = 1, weight = 33.3333},
{name = 'artillery-turret', count = 1, weight = 2.5},
{name = 'artillery-wagon-cannon', count = 1, weight = 1},
{name = 'atomic-bomb', count = 1, weight = 1}
}
local total_weights = {}
local t = 0
for _, v in ipairs(item_pool) do
t = t + v.weight
table.insert(total_weights, t)
end
local callback =
Token.register(
function(entity)
local count = math.random(5, 11)
for _ = 1, count do
local i = math.random() * t
local index = table.binary_search(total_weights, i)
if (index < 0) then
index = bit32.bnot(index)
end
local loot = item_pool[index]
entity.insert(loot)
end
end
)
return function(x, y)
if math.random(4096) ~= 1 then
return nil
end
local d = math.sqrt(x * x + y * y)
local name
if d < 200 then
name = 'car'
else
if math.random(10) == 1 then
name = 'tank'
else
name = 'car'
end
end
-- neutral stops the biters attacking them.
local entity = {name = name, force = 'neutral', callback = callback}
return entity
end

View File

@ -40,7 +40,7 @@ local random = Random.new(seed1, seed2)
local total_weights = {}
local t = 0
for _, v in pairs(patches) do
for _, v in ipairs(patches) do
t = t + v[2]
table.insert(total_weights, t)
end

View File

@ -1,13 +1,209 @@
local b = require "map_gen.shared.builders"
local b = require 'map_gen.shared.builders'
local pic = require "map_gen.data.presets.void_gears"
local seed1 = 6666
local seed2 = 9999
local pic = require 'map_gen.data.presets.void_gears'
pic = b.decompress(pic)
local shape = b.picture(pic)
shape = b.invert(shape)
local map = b.single_pattern(shape, pic.width, pic.height)
map = b.translate(map, -100, 120)
map = b.scale(map, 2, 2)
map = b.translate(map, -102, 133)
map = b.scale(map, 1.75, 1.75)
return map
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)
local gear_small = b.scale(gear_big, 1 / 3)
local value = b.manhattan_value
local ores = {
{resource_type = 'iron-ore', value = value(250, 1.5)},
{resource_type = 'copper-ore', value = value(250, 1.5)},
{resource_type = 'stone', value = value(250, 1)},
{resource_type = 'coal', value = value(250, 1)},
{resource_type = 'uranium-ore', value = value(125, 1)},
{resource_type = 'crude-oil', value = value(50000, 250)}
}
local function striped(shape)
return function(x, y, world)
if not shape(x, y) then
return nil
end
local t = (world.x + world.y) % 4 + 1
local ore = ores[t]
return {
name = ore.resource_type,
position = {world.x, world.y},
amount = 3 * ore.value(world.x, world.y)
}
end
end
local function sprinkle(shape)
return function(x, y, world)
if not shape(x, y) then
return nil
end
local t = math.random(1, 4)
local ore = ores[t]
return {
name = ore.resource_type,
position = {world.x, world.y},
amount = 3 * ore.value(world.x, world.y)
}
end
end
local function radial(shape, radius)
local stone_r = radius * 0.55
local coal_r = radius * 0.65
local copper_r = radius * 0.8
return function(x, y, world)
if not shape(x, y) then
return nil
end
local d = math.sqrt(x * x + y * y)
local ore
if d < stone_r then
ore = ores[4]
elseif d < coal_r then
ore = ores[3]
elseif d < copper_r then
ore = ores[2]
else
ore = ores[1]
end
return {
name = ore.resource_type,
position = {world.x, world.y},
amount = 3 * ore.value(world.x, world.y)
}
end
end
local big_patches = {
{b.no_entity, 220},
{b.resource(gear_big, ores[1].resource_type, ores[1].value), 20},
{b.resource(gear_big, ores[2].resource_type, ores[2].value), 12},
{b.resource(gear_big, ores[3].resource_type, ores[3].value), 4},
{b.resource(gear_big, ores[4].resource_type, ores[4].value), 6},
{b.resource(gear_big, ores[5].resource_type, ores[5].value), 2},
{b.resource(b.throttle_world_xy(gear_big, 1, 8, 1, 8), ores[6].resource_type, ores[6].value), 6},
{striped(gear_big), 1},
{sprinkle(gear_big), 1},
{radial(gear_big, 48), 1}
}
big_patches[#big_patches + 1] = {
b.segment_pattern({big_patches[2][1], big_patches[3][1], big_patches[4][1], big_patches[5][1]}),
1
}
local medium_patches = {
{b.no_entity, 150},
{b.resource(gear_medium, ores[1].resource_type, ores[1].value), 20},
{b.resource(gear_medium, ores[2].resource_type, ores[2].value), 12},
{b.resource(gear_medium, ores[3].resource_type, ores[3].value), 4},
{b.resource(gear_medium, ores[4].resource_type, ores[4].value), 6},
{b.resource(gear_medium, ores[5].resource_type, ores[5].value), 2},
{b.resource(b.throttle_world_xy(gear_medium, 1, 8, 1, 8), ores[6].resource_type, ores[6].value), 6},
{striped(gear_medium), 1},
{sprinkle(gear_medium), 1},
{radial(gear_medium, 32), 1}
}
medium_patches[#medium_patches + 1] = {
b.segment_pattern({medium_patches[2][1], medium_patches[3][1], medium_patches[4][1], medium_patches[5][1]}),
1
}
local small_patches = {
{b.no_entity, 85},
{b.resource(gear_small, ores[1].resource_type, value(350, 2)), 20},
{b.resource(gear_small, ores[2].resource_type, value(350, 2)), 12},
{b.resource(gear_small, ores[3].resource_type, value(350, 2)), 4},
{b.resource(gear_small, ores[4].resource_type, value(350, 2)), 6},
{b.resource(gear_small, ores[5].resource_type, value(250, 2)), 2},
{b.resource(b.throttle_world_xy(gear_small, 1, 4, 1, 4), ores[6].resource_type, ores[6].value), 6},
{striped(gear_small), 1},
{sprinkle(gear_small), 1},
{radial(gear_small, 16), 1}
}
small_patches[#small_patches + 1] = {
b.segment_pattern({small_patches[2][1], small_patches[3][1], small_patches[4][1], small_patches[5][1]}),
1
}
local Random = require 'map_gen.shared.random'
local random = Random.new(seed1, seed2)
local p_cols = 50
local p_rows = 50
local function do_patches(patches, offset)
local total_weights = {}
local t = 0
for _, v in ipairs(patches) do
t = t + v[2]
table.insert(total_weights, t)
end
local pattern = {}
for _ = 1, p_cols do
local row = {}
table.insert(pattern, row)
for _ = 1, p_rows do
local i = random:next_int(1, t)
local index = table.binary_search(total_weights, i)
if (index < 0) then
index = bit32.bnot(index)
end
local shape = patches[index][1]
local x = random:next_int(-offset, offset)
local y = random:next_int(-offset, offset)
shape = b.translate(shape, x, y)
table.insert(row, shape)
end
end
return pattern
end
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)
medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 128, 128)
small_patches = do_patches(small_patches, 32)
small_patches = b.grid_pattern_full_overlap(small_patches, p_cols, p_rows, 64, 64)
--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_segmented = b.segment_pattern({start_stone, start_coal, start_copper, start_iron})
local start_gear = b.apply_entity(gear_big, start_segmented)
map = b.if_else(start_gear, map)
return map

View File

@ -26,13 +26,17 @@ local Builders = {}
-- shape builders
function Builders.empty_shape()
return nil
return false
end
function Builders.full_shape()
return true
end
function Builders.no_entity()
return nil
end
function Builders.tile(tile)
return function()
return tile

View File

@ -0,0 +1,35 @@
local worm_names = {'small-worm-turret', 'medium-worm-turret', 'big-worm-turret'}
local spawner_names = {'biter-spawner', 'spitter-spawner'}
local factor = 8 / (1024 * 32)
local max_chance = 1/8
return function(_, _, world)
local d = math.sqrt(world.x * world.x + world.y * world.y)
if d < 300 then
return nil
end
if math.random(8) == 1 then
local lvl
if d < 400 then
lvl = 1
elseif d < 550 then
lvl = 2
else
lvl = 3
end
local chance = math.min(max_chance, d * factor)
if math.random() < chance then
local worm_id = math.random(1, lvl)
return {name = worm_names[worm_id]}
end
else
local chance = math.min(max_chance, d * factor)
if math.random() < chance then
local spawner_id = math.random(2)
return {name = spawner_names[spawner_id]}
end
end
end

View File

@ -48,7 +48,7 @@ Event.add(defines.events.on_player_died, player_died)
return function(x, y)
local distance = math.sqrt(x * x + y * y)
if distance <= 100 then
if distance <= 210 then
return nil
end

View File

@ -48,7 +48,7 @@ local tiles_per_tick = 32
--shape = require "map_gen.presets.misc_stuff"
--shape = require "map_gen.presets.lines"
--shape = require "map_gen.presets.dickbutt"
--shape = require "map_gen.presets.void_gears"
shape = require "map_gen.presets.void_gears"
--shape = require "map_gen.presets.gears"
--shape = require "map_gen.presets.factorio_logo"
--shape = require "map_gen.presets.factorio_logo2"
@ -90,10 +90,12 @@ local tiles_per_tick = 32
-- modules that only return max one entity per tile
local entity_modules = {
--require "map_gen.ores.glitter_ores",
--require "map_gen.terrain.mines",
require "map_gen.misc.loot_items",
require "map_gen.terrain.mines",
require "map_gen.terrain.deathworld",
--require "map_gen.ores.glitter_ores",
--require "map_gen.terrain.worms",
--require "map_gen.misc.wreck_items",
--require "map_gen.misc.wreck_items",
--require "map_gen.ores.neko_crazy_ores",
--require "map_gen.ores.fluffy_rainbows",
--require "map_gen.ores.harmonic_gen",
@ -124,6 +126,6 @@ if #terrain_modules > 0 then
end
if shape then
require('map_gen.shared.generate')({shape = shape, regen_decoratives = regen_decoratives, tiles_per_tick = tiles_per_tick})
--require ("map_gen.shared.generate_not_threaded")({shape = shape, regen_decoratives = regen_decoratives})
--require('map_gen.shared.generate')({shape = shape, regen_decoratives = regen_decoratives, tiles_per_tick = tiles_per_tick})
require ("map_gen.shared.generate_not_threaded")({shape = shape, regen_decoratives = regen_decoratives})
end

View File

@ -290,5 +290,14 @@ return {
['mh'] = true,
['vintageaura'] = true,
['wurzeltroll42'] = true,
['esperiom'] = true
['esperiom'] = true,
['standaardstefan'] = true,
['mauerstein10'] = true,
['vengefulpm'] = true,
['skilledspacepolice'] = true,
['the_ledgendary'] = true,
['capitansky'] = true,
['barnaba'] = true,
['drlloyd1337'] = true,
['twinotter'] = true
}