1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-14 10:13:13 +02:00
RedMew/map_gen/maps/fractal_balls.lua

192 lines
5.8 KiB
Lua
Raw Normal View History

2018-07-21 13:29:46 +02:00
local b = require 'map_gen.shared.builders'
local RS = require 'map_gen.shared.redmew_surface'
local MGSP = require 'resources.map_gen_settings'
2018-11-06 14:08:33 +02:00
local degrees = require "utils.math".degrees
local ScenarioInfo = require 'features.gui.info'
local Event = require 'utils.event'
2018-05-08 22:23:07 +02:00
RS.set_map_gen_settings(
{
MGSP.ore_oil_none, -- Comment this if you want to enable vanilla ore generation in some of the rings.
MGSP.cliff_none,
MGSP.water_none
}
)
ScenarioInfo.set_map_name('Fractal Balls')
ScenarioInfo.set_map_description(
[[
Circular groups of ore islands linked by paths arranged in a fractal,
expanding pattern.
]]
)
ScenarioInfo.add_map_extra_info(
[[
A space limited start leads players to explore larger and larger rings of
biter infested map.
Each ore patch upon its own island must be belted out to a production area
or loaded on to trains.
This map encourages use of trains similar to RSO due to the spread out nature of
the ores, with islands only accessible by bots encouraging the player to revisit
exhausted ore areas later in the game to extract more resources.
]]
)
ScenarioInfo.set_new_info(
[[
2019-09-11 - Jayefuu
- Updated map descriptions
- Disabled landfill to prevent cheating
- Added config example to disable vanilla ores. Balances map better if the rings aren't full of ore.
]]
)
2018-02-13 02:49:57 +02:00
local function value(base, mult)
2018-07-21 13:29:46 +02:00
return function(x, y)
2018-02-13 02:49:57 +02:00
return mult * (math.abs(x) + math.abs(y)) + base
end
end
-- bot_islands_flag true if you want to add islands of ores only reachable by robots
2018-11-12 00:28:49 +02:00
local bot_islands_flag = true
2018-05-08 22:23:07 +02:00
local arm1 = b.translate(b.rectangle(2, 3), 0, -5)
local arm2 = b.translate(b.rectangle(6, 2), 0, 22)
2018-02-13 02:49:57 +02:00
2018-05-08 22:23:07 +02:00
local inner = b.circle(22)
local outer = b.circle(24)
2018-07-21 13:29:46 +02:00
local ring = b.all {outer, b.invert(inner)}
2018-02-07 02:26:51 +02:00
2018-07-21 13:29:46 +02:00
local arms = b.any {arm1, arm2}
2018-05-08 22:23:07 +02:00
arms = b.translate(arms, 0, -16)
2018-07-21 13:29:46 +02:00
arms =
b.any {
arms,
2018-05-08 22:23:07 +02:00
b.rotate(arms, degrees(120)),
b.rotate(arms, degrees(-120))
2018-02-07 02:26:51 +02:00
}
2018-07-21 13:29:46 +02:00
local frame = b.any {arms, ring}
2018-02-07 02:26:51 +02:00
2018-05-08 22:23:07 +02:00
local ball = b.circle(8)
2018-02-07 02:26:51 +02:00
2018-07-21 13:29:46 +02:00
local iron = b.resource(b.circle(6), 'iron-ore', value(1000, 1))
local copper = b.resource(b.circle(6), 'copper-ore', value(800, 0.8))
local stone = b.resource(b.circle(4), 'stone', value(500, .5))
local coal = b.resource(b.circle(6), 'coal', value(600, 0.6))
local uranium = b.resource(b.circle(4), 'uranium-ore', value(400, 1))
local oil = b.resource(b.throttle_world_xy(b.circle(6), 1, 4, 1, 4), 'crude-oil', value(100000, 50))
--[[ local iron_ball = b.change_map_gen_collision_tile(b.apply_entity(ball, iron), 'water-tile', 'grass-1')
local copper_ball = b.change_map_gen_collision_tile(b.apply_entity(ball, copper), 'water-tile', 'grass-1')
local stone_ball = b.change_map_gen_collision_tile(b.apply_entity(ball, stone), 'water-tile', 'grass-1')
local coal_ball = b.change_map_gen_collision_tile(b.apply_entity(ball, coal), 'water-tile', 'grass-1')
local uranium_ball = b.change_map_gen_collision_tile(b.apply_entity(ball, uranium), 'water-tile', 'grass-1')
local oil_ball = b.change_map_gen_collision_tile(b.apply_entity(ball, oil), 'water-tile', 'grass-1') ]]
local iron_ball = b.apply_entity(ball, iron)
local copper_ball = b.apply_entity(ball, copper)
local stone_ball = b.apply_entity(ball, stone)
local coal_ball = b.apply_entity(ball, coal)
local uranium_ball = b.apply_entity(ball, uranium)
local oil_ball = b.apply_entity(ball, oil)
local balls1 =
b.any {
2018-05-08 22:23:07 +02:00
b.translate(iron_ball, 0, -12),
b.rotate(b.translate(copper_ball, 0, -12), degrees(120)),
2018-07-21 13:29:46 +02:00
b.rotate(b.translate(coal_ball, 0, -12), degrees(-120)),
2018-02-13 02:49:57 +02:00
frame
}
2018-05-08 22:23:07 +02:00
--shape = b.rotate(shape, degrees(rot))
balls1 = b.rotate(balls1, degrees(180))
balls1 = b.choose(outer, balls1, b.empty_shape)
balls1 = b.translate(balls1, 0, -36)
2018-02-07 02:26:51 +02:00
2018-07-21 13:29:46 +02:00
local balls2 =
b.any {
2018-05-08 22:23:07 +02:00
b.translate(iron_ball, 0, -12),
b.rotate(b.translate(copper_ball, 0, -12), degrees(120)),
2018-07-21 13:29:46 +02:00
b.rotate(b.translate(stone_ball, 0, -12), degrees(-120)),
2018-02-13 02:49:57 +02:00
frame
}
2018-05-08 22:23:07 +02:00
balls2 = b.rotate(balls2, degrees(180))
2018-07-21 13:29:46 +02:00
balls2 = b.choose(outer, balls2, b.empty_shape)
2018-05-08 22:23:07 +02:00
balls2 = b.translate(balls2, 0, -36)
balls2 = b.rotate(balls2, degrees(120))
2018-02-07 02:26:51 +02:00
2018-07-21 13:29:46 +02:00
local balls3 =
b.any {
2018-05-08 22:23:07 +02:00
b.translate(iron_ball, 0, -12),
b.rotate(b.translate(uranium_ball, 0, -12), degrees(120)),
2018-07-21 13:29:46 +02:00
b.rotate(b.translate(oil_ball, 0, -12), degrees(-120)),
2018-02-13 02:49:57 +02:00
frame
}
2018-05-08 22:23:07 +02:00
balls3 = b.rotate(balls3, degrees(180))
2018-07-21 13:29:46 +02:00
balls3 = b.choose(outer, balls3, b.empty_shape)
2018-05-08 22:23:07 +02:00
balls3 = b.translate(balls3, 0, -36)
balls3 = b.rotate(balls3, degrees(-120))
2018-02-07 02:26:51 +02:00
2018-07-21 13:29:46 +02:00
local balls4 =
b.any {
2018-02-13 02:49:57 +02:00
balls1,
balls2,
balls3,
2018-05-08 22:23:07 +02:00
b.scale(frame, 3, 3)
2018-02-07 02:26:51 +02:00
}
2018-05-08 22:23:07 +02:00
balls4 = b.rotate(balls4, degrees(180))
if bot_islands_flag == true then
balls4 =
b.any {
2018-11-21 15:42:39 +02:00
balls4,
b.translate(iron_ball, 0, 0),
b.rotate(b.translate(coal_ball, 0, -40), degrees(120)),
b.rotate(b.translate(iron_ball, 0, -40), degrees(-120)),
b.translate(copper_ball, 0, -40)
2018-11-21 15:42:39 +02:00
}
end
balls4 = b.remove_map_gen_resources(balls4)
2018-05-08 22:23:07 +02:00
balls4 = b.choose(b.scale(outer, 3, 3), balls4, b.empty_shape)
2018-02-07 02:26:51 +02:00
2018-02-13 02:49:57 +02:00
local function make_ball(shape, sf)
2018-05-08 22:23:07 +02:00
local s1 = b.translate(shape, 0, -12 * sf)
shape =
2018-07-21 13:29:46 +02:00
b.any {
s1,
2018-05-08 22:23:07 +02:00
b.rotate(s1, degrees(120)),
b.rotate(s1, degrees(-120)),
b.scale(frame, sf, sf)
2018-02-07 02:26:51 +02:00
}
2018-05-08 22:23:07 +02:00
shape = b.rotate(shape, degrees(180))
2018-02-07 02:26:51 +02:00
2018-05-08 22:23:07 +02:00
local bound = b.scale(outer, sf, sf)
2018-02-07 02:26:51 +02:00
2018-07-21 13:29:46 +02:00
return b.choose(bound, shape, b.empty_shape)
2018-02-07 02:26:51 +02:00
end
2018-07-21 13:29:46 +02:00
local ratio = 24 / 8
2018-02-13 02:49:57 +02:00
local map = balls4
local total_sf = 1 * ratio * ratio
2018-07-21 13:29:46 +02:00
for i = 1, 6 do
map = make_ball(map, total_sf)
2018-02-07 02:26:51 +02:00
total_sf = ratio * total_sf
end
2018-07-21 13:29:46 +02:00
map = b.translate(map, 0, -19669)
map = b.scale(map, 2, 2)
map = b.change_map_gen_collision_tile(map, 'water-tile', 'grass-1')
map = b.change_tile(map, false, 'water')
map = b.fish(map, 0.0025)
2018-02-07 02:26:51 +02:00
-- Disable landfill technology
local function on_init()
local player_force = game.forces.player
player_force.technologies['landfill'].enabled = false -- disable landfill
end
Event.on_init(on_init)
2018-02-07 02:26:51 +02:00
return map