mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-03-03 14:53:01 +02:00
Add Creepy map preset
This commit is contained in:
parent
64788b7646
commit
488a38f89b
95
map_gen/presets/creepy.lua
Normal file
95
map_gen/presets/creepy.lua
Normal file
@ -0,0 +1,95 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
|
||||
local function value(base, mult)
|
||||
return function(x, y)
|
||||
return mult * (math.abs(x) + math.abs(y)) + base
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
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
|
||||
for _, e in ipairs(
|
||||
world.surface.find_entities_filtered(
|
||||
{type = 'rock', area = {{world.x, world.y}, {world.x + 1, world.y + 1}}}
|
||||
)
|
||||
) do
|
||||
e.destroy()
|
||||
end
|
||||
|
||||
return tile
|
||||
end
|
||||
|
||||
--[[local function no_trees(x, y, world, tile)
|
||||
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]]--
|
||||
|
||||
-- create a square on which to place each ore
|
||||
local square = b.rectangle(12,12)
|
||||
square = b.change_tile(square, true, 'concrete')
|
||||
|
||||
-- set the ore weights and sizes
|
||||
local iron = b.resource(b.rectangle(12,12), 'iron-ore', value(200, 1))
|
||||
local copper = b.resource(b.rectangle(12,12), 'copper-ore', value(150, 0.8))
|
||||
local stone = b.resource(b.rectangle(12,12), 'stone', value(100, .5))
|
||||
local coal = b.resource(b.rectangle(12,12), 'coal', value(100, 0.6))
|
||||
|
||||
-- place each ore on the square
|
||||
local iron_sq = b.apply_entity(square, iron)
|
||||
local copper_sq = b.apply_entity(square, copper)
|
||||
local stone_sq = b.apply_entity(square, stone)
|
||||
local coal_sq = b.apply_entity(square, coal)
|
||||
|
||||
-- create starting water square and change the type to water
|
||||
local water_start =
|
||||
b.any {
|
||||
b.rectangle(12, 12)
|
||||
}
|
||||
water_start = b.change_tile(water_start, true, 'water')
|
||||
|
||||
-- create the large concrete square
|
||||
local concrete_square = b.rectangle(80, 80)
|
||||
concrete_square = b.change_tile(concrete_square, true, 'concrete')
|
||||
|
||||
-- create the start area using the ore, water and concrete squares
|
||||
local ore_distance = 24
|
||||
local start_area =
|
||||
b.any {
|
||||
b.translate(iron_sq, -ore_distance, -ore_distance),
|
||||
b.translate(copper_sq, -ore_distance, ore_distance),
|
||||
b.translate(stone_sq, ore_distance, -ore_distance),
|
||||
b.translate(coal_sq, ore_distance, ore_distance),
|
||||
water_start,
|
||||
concrete_square
|
||||
}
|
||||
start_area = b.apply_effect(start_area, no_resources)
|
||||
--start_area = b.apply_effect(start_area, no_trees)
|
||||
|
||||
|
||||
local map = start_area
|
||||
map = b.change_map_gen_collision_tile(map, 'water-tile', 'grass-1')
|
||||
map = b.change_tile(map, false, 'sand-1')
|
||||
map = b.translate(map, 6, -10) -- translate the whole map away, otherwise we'll spawn in the water
|
||||
|
||||
--return start_area
|
||||
return map
|
@ -77,11 +77,12 @@ local tiles_per_tick = 32
|
||||
--shape = require "map_gen.presets.spiral_of_spirals"
|
||||
--shape = require "map_gen.presets.crash_site"
|
||||
--shape = require "map_gen.presets.dino_island"
|
||||
--shape = require "map_gen.presets.toxic_jungle"
|
||||
--shape = require "map_gen.presets.danger_ores"
|
||||
--shape = require "map_gen.presets.bacon_islands"
|
||||
--shape = require "map_gen.presets.toxic_jungle"
|
||||
--shape = require "map_gen.presets.danger_ores"
|
||||
--shape = require "map_gen.presets.bacon_islands"
|
||||
--shape = require "map_gen.presets.spiral"
|
||||
--shape = require "map_gen.presets.hub_spiral"
|
||||
--shape = require "map_gen.presets.creepy"
|
||||
--shape = require "map_gen.presets.vanilla"
|
||||
--shape = require "map_gen.presets.test"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user