From 05a4fe2964120052c3a4971c87940f7315ff73ae Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 24 Nov 2019 18:04:21 +0100 Subject: [PATCH 01/22] Custom map file Terra In order to explore beyond the grid you must obtain robot technology --- map_gen/maps/terra.lua | 431 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 431 insertions(+) create mode 100644 map_gen/maps/terra.lua diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua new file mode 100644 index 000000000..7032df17a --- /dev/null +++ b/map_gen/maps/terra.lua @@ -0,0 +1,431 @@ + + +local b = require "map_gen.shared.builders" +local Event = require 'utils.event' +local ScenarioInfo = require 'features.gui.info' +local Retailer = require('features.retailer') +local market_items = require 'resources.market_items' +local table = require 'utils.table' +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' + + --Map info +ScenarioInfo.set_map_name('Terra') +ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') +ScenarioInfo.add_map_extra_info( + [[ +Tar's additional info about gears: + +You start off on familiar grounds, but you must obtain robot technology +in order to explore beyond the grid. + + [item=rocket-silo] Regular rocket launch + [item=personal-roboport-equipment] Lazy starter equipment + [entity=small-biter] Biter activity high + [item=landfill] Landfill disabled + +Coded with love, but without lua experience: Blame Tar[technology=optics] for bugs. + ]]) +ScenarioInfo.set_new_info([[ +This map! This map is new! + +T-A-R will be thankful for any feedback on discord or as PM at the Factorio-Forums]]) + + +--Map generation settings +RS.set_map_gen_settings( + { + MGSP.ore_oil_none, + MGSP.cliff_none, + MGSP.water_none, + --MGSP.enemy_none, + + } + ) + + + + + +RS.set_difficulty_settings({{technology_price_multiplier = 1}}) + +RS.set_map_settings({map_settings}) +--Biter settings +local map_settings = { + pollution = { + enabled = true + }, + enemy_evolution = { + enabled = true, + time_factor = (0.0000001), + destroy_factor = (0.0002), + pollution_factor = (0.0000015) + }, + enemy_expansion = { + enabled = true, + max_expansion_distance = 7, + friendly_base_influence_radius = 2, + enemy_building_influence_radius = 2, + building_coefficient = 0.1, + other_base_coefficient = 2.0, + neighbouring_chunk_coefficient = 0.5, + neighbouring_base_chunk_coefficient = 0.4, + max_colliding_tiles_coefficient = 0.9, + settler_group_min_size = 5, + settler_group_max_size = 20, + min_expansion_cooldown = 60 * 3600, + max_expansion_cooldown = 180 * 3600 + } + +} +--Terraforming +local pic1 = require "map_gen.data.presets.factorio_logo2" --921x153 +pic1 = b.decompress(pic1) +local map1file = b.picture(pic1) --Logo2 +local fillerblock = b.translate(b.rectangle(14,12), 248,2) --land bridge to connect the logo gear island +--map = b.change_tile(fillerblock, true, "grass-4") +fillerblock = b.change_tile(fillerblock, true, "grass-4") -- same color as picture shade= 'grass-4' +local map1 = b.add(fillerblock, map1file) + + +map1 = b.scale(map1, 1, 1) + +-- Rotated logo's +map2 = b.rotate (map1, math.pi/2) + +--Corner pieces +local shap1 = b.translate(b.rectangle_diamond(26, 24), pic1.height/2,pic1.height/2) +local shap2 = b.rotate((shap1), math.pi/2) +local shap3 = b.rotate((shap2), math.pi/2) +local shap4 = b.rotate((shap3), math.pi/2) +local shap5 = b.invert(b.rectangle(pic1.height+1, pic1.height+1)) --size is related to ''factorio_logo2" +--Combining using all +local chamfer = b.invert(b.any({shap1, shap2, shap3, shap4, shap5})) --starter tile is a chamfered square + +local corner = chamfer +corner = b.change_tile(corner, true, "grass-4") + + +--Botland (robo islands) +-- creating the 4 shapes +local shape1 = b.translate(b.rectangle(250, 40), 74, 0) --bridge land +local shape2 = b.rotate((shape1), math.pi/2) +local shape3 = b.rotate((shape2), math.pi/2) +local shape4 = b.rotate((shape3), math.pi/2) +local shape5 = b.scale((chamfer), 1.4,1.4) --scaled up starter tile +--Combining using all +local botland = b.any({shape5, shape1, shape2, shape3, shape4}) + +--pave the shape + + +botland = b.scale(botland, 2.2,2.2) +botland = b.change_tile(botland, true, 'lab-dark-2') --replace to 'landfill' to absorb pollution +local pattern = { + {corner, map1}, + {map2,botland} +} + +local map = b.grid_pattern_overlap(pattern, 2, 2, 499,500) + + +local map = b.scale(map, 1.9,1.9) --Final map scaler######### + + +-- this sets the tile outside the bounds of the map to water, remove this and it will be void. +map = b.change_tile(map, false, "water") --"deepwater" shows borders (for debugging purposes) +map = b.fish(map, 0.0025) --So long + +local centre =b.circle(18) +--local centre = b.rectangle(5,5) +--local centre = b.scale(chamfer, 0.08,0.08) +map = b.if_else(centre, map) +centre = b.change_map_gen_collision_tile(centre, 'ground-tile', 'stone-path') + +-- the coordinates at which the standard market and spawn will be created +local startx = 0 +local starty = 0 + + --market +global.config.market.standard_market_location = {x = startx, y = starty} + + --player +local spawn_position = {x = startx, y = starty-3} +RS.set_spawn_position(spawn_position, surface) + +local function on_init() + local surface = RS.get_surface() + + + + +end + + + + --Ore generation -- Copy for "void gears' - altered seeds to create nice starting area - reduced amount of patches + local seed1 = 1410 -- random seeds (ore gears) --6666 + local seed2 = 12900 --9999 + +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) -- luacheck: ignore 431 + 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) -- luacheck: ignore 431 + 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) -- luacheck: ignore 431 + local stone_r_sq = radius * 0.3025 -- radius * 0.55 + local coal_r_sq = radius * 0.4225 -- radius * 0.65 + local copper_r_sq = radius * 0.64 -- radius * 0.8 + + return function(x, y, world) + if not shape(x, y) then + return nil + end + + local d_sq = x * x + y * y + + local ore + if d_sq < stone_r_sq then + ore = ores[4] + elseif d_sq < coal_r_sq then + ore = ores[3] + elseif d_sq < copper_r_sq 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 = 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] -- luacheck: ignore 431 + + 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, 192) --96 increased numbers to reduce generated patches +big_patches = b.grid_pattern_full_overlap(big_patches, p_cols, p_rows, 192, 192) + +medium_patches = do_patches(medium_patches, 128) --64 +medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 128, 128) + +small_patches = do_patches(small_patches, 128) --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) --- +start_gear = b.change_tile(start_gear, true, "grass-3") + + + + +map = b.if_else(start_gear, map) +map = b.if_else(centre, map) + --Starting equipment + +local player_create = global.config.player_create + +player_create.starting_items = { + -- {name = 'power-armor', count = 1}, --Small biters cant bite this + -- {name = 'fusion-reactor-equipment', count = 1}, --and modular wont with this combined with legs + {name = 'modular-armor', count = 1}, + {name = 'solar-panel-equipment', count = 7}, + {name = 'battery-mk2-equipment', count = 1}, + {name = 'personal-roboport-equipment', count = 1}, + {name = 'construction-robot', count = 10}, + {name = 'exoskeleton-equipment', count = 1}, + {name = 'iron-gear-wheel', count = 8}, + {name = 'iron-plate', count = 40}, + {name = 'copper-plate', count = 20}, + {name = 'car', count = 1}, + {name = 'coal', count = 5} +} +player_create.join_messages = { + 'Welcome to this map created by the RedMew community. You can join the discord at: redmew.com/discord', + 'Click the question mark in the top left corner for server information and map details.' +} + --Starting Techs + + +Event.on_init( + function() +local force = game.forces.player + force.technologies['automation'].researched = true + force.technologies['logistics'].researched = true + force.technologies['landfill'].enabled = false -- disable landfill + end +) + + +return map From edec37ea4440a5d292766b3d6622ff364619e0c5 Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 24 Nov 2019 18:27:40 +0100 Subject: [PATCH 02/22] Add files via upload edited comments. --- map_gen/maps/terra.lua | 52 +++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index 7032df17a..716fb958b 100644 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -40,15 +40,10 @@ RS.set_map_gen_settings( MGSP.ore_oil_none, MGSP.cliff_none, MGSP.water_none, - --MGSP.enemy_none, - + --MGSP.enemy_none, } ) - - - - RS.set_difficulty_settings({{technology_price_multiplier = 1}}) RS.set_map_settings({map_settings}) @@ -83,10 +78,10 @@ local map_settings = { --Terraforming local pic1 = require "map_gen.data.presets.factorio_logo2" --921x153 pic1 = b.decompress(pic1) -local map1file = b.picture(pic1) --Logo2 -local fillerblock = b.translate(b.rectangle(14,12), 248,2) --land bridge to connect the logo gear island +local map1file = b.picture(pic1) --Logo2 +local fillerblock = b.translate(b.rectangle(14,12), 248,2) --land bridge to connect the logo gear island --map = b.change_tile(fillerblock, true, "grass-4") -fillerblock = b.change_tile(fillerblock, true, "grass-4") -- same color as picture shade= 'grass-4' +fillerblock = b.change_tile(fillerblock, true, "grass-4") -- same color as picture shade= 'grass-4' local map1 = b.add(fillerblock, map1file) @@ -95,26 +90,26 @@ map1 = b.scale(map1, 1, 1) -- Rotated logo's map2 = b.rotate (map1, math.pi/2) ---Corner pieces +--Square minus corner pieces local shap1 = b.translate(b.rectangle_diamond(26, 24), pic1.height/2,pic1.height/2) local shap2 = b.rotate((shap1), math.pi/2) local shap3 = b.rotate((shap2), math.pi/2) local shap4 = b.rotate((shap3), math.pi/2) -local shap5 = b.invert(b.rectangle(pic1.height+1, pic1.height+1)) --size is related to ''factorio_logo2" +local shap5 = b.invert(b.rectangle(pic1.height+1, pic1.height+1)) --size is related to ''factorio_logo2" --Combining using all -local chamfer = b.invert(b.any({shap1, shap2, shap3, shap4, shap5})) --starter tile is a chamfered square +local chamfer = b.invert(b.any({shap1, shap2, shap3, shap4, shap5})) --starter tile is a chamfered square local corner = chamfer corner = b.change_tile(corner, true, "grass-4") --Botland (robo islands) --- creating the 4 shapes -local shape1 = b.translate(b.rectangle(250, 40), 74, 0) --bridge land +-- creating shapes +local shape1 = b.translate(b.rectangle(250, 40), 74, 0) --bridge land local shape2 = b.rotate((shape1), math.pi/2) local shape3 = b.rotate((shape2), math.pi/2) local shape4 = b.rotate((shape3), math.pi/2) -local shape5 = b.scale((chamfer), 1.4,1.4) --scaled up starter tile +local shape5 = b.scale((chamfer), 1.4,1.4) --scaled up starter tile --Combining using all local botland = b.any({shape5, shape1, shape2, shape3, shape4}) @@ -122,7 +117,7 @@ local botland = b.any({shape5, shape1, shape2, shape3, shape4}) botland = b.scale(botland, 2.2,2.2) -botland = b.change_tile(botland, true, 'lab-dark-2') --replace to 'landfill' to absorb pollution +botland = b.change_tile(botland, true, 'lab-dark-2') --replace to 'landfill' to absorb pollution local pattern = { {corner, map1}, {map2,botland} @@ -131,12 +126,13 @@ local pattern = { local map = b.grid_pattern_overlap(pattern, 2, 2, 499,500) -local map = b.scale(map, 1.9,1.9) --Final map scaler######### +local map = b.scale(map, 1.9,1.9) --Final map scaler######### -- this sets the tile outside the bounds of the map to water, remove this and it will be void. -map = b.change_tile(map, false, "water") --"deepwater" shows borders (for debugging purposes) -map = b.fish(map, 0.0025) --So long + +map = b.change_tile(map, false, "water") --"deepwater" shows borders (for debugging purposes) +map = b.fish(map, 0.0025) --So long local centre =b.circle(18) --local centre = b.rectangle(5,5) @@ -165,9 +161,9 @@ end - --Ore generation -- Copy for "void gears' - altered seeds to create nice starting area - reduced amount of patches - local seed1 = 1410 -- random seeds (ore gears) --6666 - local seed2 = 12900 --9999 + --Ore generation -- Copy for "void gears' - altered seeds to create nice starting area - reduced amount of patches + local seed1 = 1410 -- random seeds (ore gears) --6666 + local seed2 = 12900 --9999 gear = b.decompress(gear) local gear_big = b.picture(gear) @@ -339,13 +335,13 @@ local function do_patches(patches, offset) return pattern end -big_patches = do_patches(big_patches, 192) --96 increased numbers to reduce generated patches +big_patches = do_patches(big_patches, 192) --96 increased numbers to reduce generated patches big_patches = b.grid_pattern_full_overlap(big_patches, p_cols, p_rows, 192, 192) -medium_patches = do_patches(medium_patches, 128) --64 +medium_patches = do_patches(medium_patches, 128) --64 medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 128, 128) -small_patches = do_patches(small_patches, 128) --32 +small_patches = do_patches(small_patches, 128) --32 small_patches = b.grid_pattern_full_overlap(small_patches, p_cols, p_rows, 64, 64) --map = b.apply_entity(map, small_patches) @@ -384,7 +380,7 @@ local start_iron = 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) --- +local start_gear = b.apply_entity(gear_big, start_segmented) start_gear = b.change_tile(start_gear, true, "grass-3") @@ -397,8 +393,8 @@ map = b.if_else(centre, map) local player_create = global.config.player_create player_create.starting_items = { - -- {name = 'power-armor', count = 1}, --Small biters cant bite this - -- {name = 'fusion-reactor-equipment', count = 1}, --and modular wont with this combined with legs + -- {name = 'power-armor', count = 1}, --Small biters cant bite this + -- {name = 'fusion-reactor-equipment', count = 1}, --and modular wont with this combined with legs {name = 'modular-armor', count = 1}, {name = 'solar-panel-equipment', count = 7}, {name = 'battery-mk2-equipment', count = 1}, From 086e95b4f400b2066d163515630eb72dbe96f074 Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 24 Nov 2019 19:26:24 +0100 Subject: [PATCH 03/22] Custom map file Terra Fixed issues detected in PR#1008 --- map_gen/maps/terra.lua | 114 ++++++++++------------------------------- 1 file changed, 26 insertions(+), 88 deletions(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index 716fb958b..a2ccba41d 100644 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -1,16 +1,11 @@ - - local b = require "map_gen.shared.builders" local Event = require 'utils.event' local ScenarioInfo = require 'features.gui.info' -local Retailer = require('features.retailer') -local market_items = require 'resources.market_items' local table = require 'utils.table' 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' - --Map info ScenarioInfo.set_map_name('Terra') ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') @@ -18,9 +13,9 @@ ScenarioInfo.add_map_extra_info( [[ Tar's additional info about gears: -You start off on familiar grounds, but you must obtain robot technology -in order to explore beyond the grid. - +You start off on familiar grounds, but you must obtain robot technology +in order to explore beyond the grid. + [item=rocket-silo] Regular rocket launch [item=personal-roboport-equipment] Lazy starter equipment [entity=small-biter] Biter activity high @@ -29,24 +24,21 @@ in order to explore beyond the grid. Coded with love, but without lua experience: Blame Tar[technology=optics] for bugs. ]]) ScenarioInfo.set_new_info([[ -This map! This map is new! - -T-A-R will be thankful for any feedback on discord or as PM at the Factorio-Forums]]) - +This map! This map is new! +T-A-R will be thankful for any feedback on discord or as PM at the Factorio-Forums]]) --Map generation settings RS.set_map_gen_settings( { MGSP.ore_oil_none, MGSP.cliff_none, MGSP.water_none, - --MGSP.enemy_none, + --MGSP.enemy_none, } - ) - -RS.set_difficulty_settings({{technology_price_multiplier = 1}}) - + ) +--[[RS.set_difficulty_settings({{technology_price_multiplier = 1}}) --Set these on launch RS.set_map_settings({map_settings}) + --Biter settings local map_settings = { pollution = { @@ -73,23 +65,18 @@ local map_settings = { min_expansion_cooldown = 60 * 3600, max_expansion_cooldown = 180 * 3600 } - -} +}]] --Terraforming local pic1 = require "map_gen.data.presets.factorio_logo2" --921x153 pic1 = b.decompress(pic1) local map1file = b.picture(pic1) --Logo2 local fillerblock = b.translate(b.rectangle(14,12), 248,2) --land bridge to connect the logo gear island ---map = b.change_tile(fillerblock, true, "grass-4") -fillerblock = b.change_tile(fillerblock, true, "grass-4") -- same color as picture shade= 'grass-4' +--map = b.change_tile(fillerblock, true, "grass-4") +fillerblock = b.change_tile(fillerblock, true, "grass-4") -- same color as picture shade= 'grass-4' local map1 = b.add(fillerblock, map1file) - - map1 = b.scale(map1, 1, 1) - -- Rotated logo's -map2 = b.rotate (map1, math.pi/2) - +local map2 = b.rotate (map1, math.pi/2) --Square minus corner pieces local shap1 = b.translate(b.rectangle_diamond(26, 24), pic1.height/2,pic1.height/2) local shap2 = b.rotate((shap1), math.pi/2) @@ -98,80 +85,54 @@ local shap4 = b.rotate((shap3), math.pi/2) local shap5 = b.invert(b.rectangle(pic1.height+1, pic1.height+1)) --size is related to ''factorio_logo2" --Combining using all local chamfer = b.invert(b.any({shap1, shap2, shap3, shap4, shap5})) --starter tile is a chamfered square - local corner = chamfer corner = b.change_tile(corner, true, "grass-4") - - --Botland (robo islands) -- creating shapes -local shape1 = b.translate(b.rectangle(250, 40), 74, 0) --bridge land +local shape1 = b.translate(b.rectangle(250, 40), 74, 0) --bridge land local shape2 = b.rotate((shape1), math.pi/2) local shape3 = b.rotate((shape2), math.pi/2) local shape4 = b.rotate((shape3), math.pi/2) local shape5 = b.scale((chamfer), 1.4,1.4) --scaled up starter tile --Combining using all local botland = b.any({shape5, shape1, shape2, shape3, shape4}) - --pave the shape - - botland = b.scale(botland, 2.2,2.2) -botland = b.change_tile(botland, true, 'lab-dark-2') --replace to 'landfill' to absorb pollution +botland = b.change_tile(botland, true, 'lab-dark-2') --replace to 'landfill' to absorb pollution local pattern = { {corner, map1}, {map2,botland} } - local map = b.grid_pattern_overlap(pattern, 2, 2, 499,500) - - -local map = b.scale(map, 1.9,1.9) --Final map scaler######### - - +map = b.scale(map, 1.9,1.9) --Final map scaler######### -- this sets the tile outside the bounds of the map to water, remove this and it will be void. - map = b.change_tile(map, false, "water") --"deepwater" shows borders (for debugging purposes) -map = b.fish(map, 0.0025) --So long +map = b.fish(map, 0.0025) --So long local centre =b.circle(18) --local centre = b.rectangle(5,5) --local centre = b.scale(chamfer, 0.08,0.08) map = b.if_else(centre, map) -centre = b.change_map_gen_collision_tile(centre, 'ground-tile', 'stone-path') - +centre = b.change_map_gen_collision_tile(centre, 'ground-tile', 'stone-path') -- the coordinates at which the standard market and spawn will be created local startx = 0 local starty = 0 - --market global.config.market.standard_market_location = {x = startx, y = starty} - - --player -local spawn_position = {x = startx, y = starty-3} -RS.set_spawn_position(spawn_position, surface) - + --player local function on_init() - local surface = RS.get_surface() - - - - +local surface = RS.get_surface()local spawn_position = {x = startx, y = starty-3} +RS.set_spawn_position(spawn_position, surface) end - - - - --Ore generation -- Copy for "void gears' - altered seeds to create nice starting area - reduced amount of patches - local seed1 = 1410 -- random seeds (ore gears) --6666 + --Ore generation -- Copy for "void gears' - altered seeds to create nice starting area - reduced amount of ore patches + local seed1 = 1410 -- random seeds (ore gears) --6666 local seed2 = 12900 --9999 - 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 shape = map 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)}, @@ -196,16 +157,13 @@ local function striped(shape) -- luacheck: ignore 431 } end end - -local function sprinkle(shape) -- luacheck: ignore 431 +local function sprinkle(shape) -- luacheck: ignore 43 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}, @@ -213,17 +171,14 @@ 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 local copper_r_sq = radius * 0.64 -- radius * 0.8 - return function(x, y, world) if not shape(x, y) then return nil end - local d_sq = x * x + y * y local ore @@ -236,7 +191,6 @@ local function radial(shape, radius) -- luacheck: ignore 431 else ore = ores[1] end - return { name = ore.resource_type, position = {world.x, world.y}, @@ -244,7 +198,6 @@ local function radial(shape, radius) -- luacheck: ignore 431 } end end - local big_patches = { {b.no_entity, 220}, {b.resource(gear_big, ores[1].resource_type, ores[1].value), 20}, @@ -261,7 +214,6 @@ 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}, @@ -278,7 +230,6 @@ 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}, @@ -295,9 +246,7 @@ 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 = Random.new(seed1, seed2) - local p_cols = 50 local p_rows = 50 local function do_patches(patches, offset) @@ -307,41 +256,30 @@ local function do_patches(patches, offset) 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] -- luacheck: ignore 431 - 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, 192) --96 increased numbers to reduce generated patches big_patches = b.grid_pattern_full_overlap(big_patches, p_cols, p_rows, 192, 192) - medium_patches = do_patches(medium_patches, 128) --64 medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 128, 128) - -small_patches = do_patches(small_patches, 128) --32 +small_patches = do_patches(small_patches, 128) --32 small_patches = b.grid_pattern_full_overlap(small_patches, p_cols, p_rows, 64, 64) --map = b.apply_entity(map, small_patches) From 75a8aa9878af6041e069157e5168b3de285a6ca6 Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 24 Nov 2019 19:55:04 +0100 Subject: [PATCH 04/22] Terra map file errors fixed from PR#1010 --- map_gen/maps/terra.lua | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index a2ccba41d..018d258a5 100644 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -6,13 +6,13 @@ 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' - --Map info + --Map info ScenarioInfo.set_map_name('Terra') ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') ScenarioInfo.add_map_extra_info( [[ Tar's additional info about gears: - + You start off on familiar grounds, but you must obtain robot technology in order to explore beyond the grid. @@ -120,7 +120,7 @@ local starty = 0 --market global.config.market.standard_market_location = {x = startx, y = starty} --player -local function on_init() +--local function on_init() local surface = RS.get_surface()local spawn_position = {x = startx, y = starty-3} RS.set_spawn_position(spawn_position, surface) end @@ -131,7 +131,6 @@ 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 shape = map local value = b.manhattan_value local ores = { {resource_type = 'iron-ore', value = value(250, 1.5)}, @@ -320,16 +319,10 @@ local start_iron = local start_segmented = b.segment_pattern({start_stone, start_coal, start_copper, start_iron}) local start_gear = b.apply_entity(gear_big, start_segmented) start_gear = b.change_tile(start_gear, true, "grass-3") - - - - map = b.if_else(start_gear, map) map = b.if_else(centre, map) --Starting equipment - local player_create = global.config.player_create - player_create.starting_items = { -- {name = 'power-armor', count = 1}, --Small biters cant bite this -- {name = 'fusion-reactor-equipment', count = 1}, --and modular wont with this combined with legs From 50b024caec11b26a2e944cf4d74072ccd8535b8b Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 24 Nov 2019 20:07:12 +0100 Subject: [PATCH 05/22] Terra map file You start off on familiar grounds, but in order to explore beyond the grid, you must obtain robot technology. This should handle the last Travis error. --- map_gen/maps/terra.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index 018d258a5..8847601ee 100644 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -123,7 +123,7 @@ global.config.market.standard_market_location = {x = startx, y = starty} --local function on_init() local surface = RS.get_surface()local spawn_position = {x = startx, y = starty-3} RS.set_spawn_position(spawn_position, surface) -end +--end --Ore generation -- Copy for "void gears' - altered seeds to create nice starting area - reduced amount of ore patches local seed1 = 1410 -- random seeds (ore gears) --6666 local seed2 = 12900 --9999 From 5a73e2143a65ce4d264b7d4f8efd3ca6b729e539 Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 24 Nov 2019 20:18:03 +0100 Subject: [PATCH 06/22] Terra Map file removed trailing whitespaces --- terra.lua | 358 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 358 insertions(+) create mode 100644 terra.lua diff --git a/terra.lua b/terra.lua new file mode 100644 index 000000000..d7e1114a8 --- /dev/null +++ b/terra.lua @@ -0,0 +1,358 @@ +local b = require "map_gen.shared.builders" +local Event = require 'utils.event' +local ScenarioInfo = require 'features.gui.info' +local table = require 'utils.table' +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' + --Map info +ScenarioInfo.set_map_name('Terra') +ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') +ScenarioInfo.add_map_extra_info( + [[ +Tar's additional info about gears: + +You start off on familiar grounds, but you must obtain robot technology +in order to explore beyond the grid. + + [item=rocket-silo] Regular rocket launch + [item=personal-roboport-equipment] Lazy starter equipment + [entity=small-biter] Biter activity high + [item=landfill] Landfill disabled + +Coded with love, but without lua experience: Blame Tar[technology=optics] for bugs. + ]]) +ScenarioInfo.set_new_info([[ +This map! This map is new! + +T-A-R will be thankful for any feedback on discord or as PM at the Factorio-Forums]]) +--Map generation settings +RS.set_map_gen_settings( + { + MGSP.ore_oil_none, + MGSP.cliff_none, + MGSP.water_none, + --MGSP.enemy_none, + } + ) +--[[RS.set_difficulty_settings({{technology_price_multiplier = 1}}) --Set these on launch +RS.set_map_settings({map_settings}) + +--Biter settings +local map_settings = { + pollution = { + enabled = true + }, + enemy_evolution = { + enabled = true, + time_factor = (0.0000001), + destroy_factor = (0.0002), + pollution_factor = (0.0000015) + }, + enemy_expansion = { + enabled = true, + max_expansion_distance = 7, + friendly_base_influence_radius = 2, + enemy_building_influence_radius = 2, + building_coefficient = 0.1, + other_base_coefficient = 2.0, + neighbouring_chunk_coefficient = 0.5, + neighbouring_base_chunk_coefficient = 0.4, + max_colliding_tiles_coefficient = 0.9, + settler_group_min_size = 5, + settler_group_max_size = 20, + min_expansion_cooldown = 60 * 3600, + max_expansion_cooldown = 180 * 3600 + } +}]] +--Terraforming +local pic1 = require "map_gen.data.presets.factorio_logo2" --921x153 +pic1 = b.decompress(pic1) +local map1file = b.picture(pic1) --Logo2 +local fillerblock = b.translate(b.rectangle(14,12), 248,2) --land bridge to connect the logo gear island +--map = b.change_tile(fillerblock, true, "grass-4") +fillerblock = b.change_tile(fillerblock, true, "grass-4") -- same color as picture shade= 'grass-4' +local map1 = b.add(fillerblock, map1file) +map1 = b.scale(map1, 1, 1) +-- Rotated logo's +local map2 = b.rotate (map1, math.pi/2) +--Square minus corner pieces +local shap1 = b.translate(b.rectangle_diamond(26, 24), pic1.height/2,pic1.height/2) +local shap2 = b.rotate((shap1), math.pi/2) +local shap3 = b.rotate((shap2), math.pi/2) +local shap4 = b.rotate((shap3), math.pi/2) +local shap5 = b.invert(b.rectangle(pic1.height+1, pic1.height+1)) --size is related to ''factorio_logo2" +--Combining using all +local chamfer = b.invert(b.any({shap1, shap2, shap3, shap4, shap5})) --starter tile is a chamfered square +local corner = chamfer +corner = b.change_tile(corner, true, "grass-4") +--Botland (robo islands) +-- creating shapes +local shape1 = b.translate(b.rectangle(250, 40), 74, 0) --bridge land +local shape2 = b.rotate((shape1), math.pi/2) +local shape3 = b.rotate((shape2), math.pi/2) +local shape4 = b.rotate((shape3), math.pi/2) +local shape5 = b.scale((chamfer), 1.4,1.4) --scaled up starter tile +--Combining using all +local botland = b.any({shape5, shape1, shape2, shape3, shape4}) +--pave the shape +botland = b.scale(botland, 2.2,2.2) +botland = b.change_tile(botland, true, 'lab-dark-2') --replace to 'landfill' to absorb pollution +local pattern = { + {corner, map1}, + {map2,botland} +} +local map = b.grid_pattern_overlap(pattern, 2, 2, 499,500) +map = b.scale(map, 1.9,1.9) --Final map scaler######### +-- this sets the tile outside the bounds of the map to water, remove this and it will be void. +map = b.change_tile(map, false, "water") --"deepwater" shows borders (for debugging purposes) +map = b.fish(map, 0.0025) --So long + +local centre =b.circle(18) +--local centre = b.rectangle(5,5) +--local centre = b.scale(chamfer, 0.08,0.08) +map = b.if_else(centre, map) +centre = b.change_map_gen_collision_tile(centre, 'ground-tile', 'stone-path') +-- the coordinates at which the standard market and spawn will be created +local startx = 0 +local starty = 0 + --market +global.config.market.standard_market_location = {x = startx, y = starty} + --player +--local function on_init() +local surface = RS.get_surface()local spawn_position = {x = startx, y = starty-3} +RS.set_spawn_position(spawn_position, surface) +--end + --Ore generation -- Copy for "void gears' - altered seeds to create nice starting area - reduced amount of ore patches + local seed1 = 1410 -- random seeds (ore gears) --6666 + local seed2 = 12900 --9999 +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) -- luacheck: ignore 431 + 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) -- luacheck: ignore 43 + 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) -- luacheck: ignore 431 + local stone_r_sq = radius * 0.3025 -- radius * 0.55 + local coal_r_sq = radius * 0.4225 -- radius * 0.65 + local copper_r_sq = radius * 0.64 -- radius * 0.8 + return function(x, y, world) + if not shape(x, y) then + return nil + end + local d_sq = x * x + y * y + + local ore + if d_sq < stone_r_sq then + ore = ores[4] + elseif d_sq < coal_r_sq then + ore = ores[3] + elseif d_sq < copper_r_sq 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 = 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] -- luacheck: ignore 431 + 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, 192) --96 increased numbers to reduce generated patches +big_patches = b.grid_pattern_full_overlap(big_patches, p_cols, p_rows, 192, 192) +medium_patches = do_patches(medium_patches, 128) --64 +medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 128, 128) +small_patches = do_patches(small_patches, 128) --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) +start_gear = b.change_tile(start_gear, true, "grass-3") +map = b.if_else(start_gear, map) +map = b.if_else(centre, map) + --Starting equipment +local player_create = global.config.player_create +player_create.starting_items = { + -- {name = 'power-armor', count = 1}, --Small biters cant bite this + -- {name = 'fusion-reactor-equipment', count = 1}, --and modular wont with this combined with legs + {name = 'modular-armor', count = 1}, + {name = 'solar-panel-equipment', count = 7}, + {name = 'battery-mk2-equipment', count = 1}, + {name = 'personal-roboport-equipment', count = 1}, + {name = 'construction-robot', count = 10}, + {name = 'exoskeleton-equipment', count = 1}, + {name = 'iron-gear-wheel', count = 8}, + {name = 'iron-plate', count = 40}, + {name = 'copper-plate', count = 20}, + {name = 'car', count = 1}, + {name = 'coal', count = 5} +} +player_create.join_messages = { + 'Welcome to this map created by the RedMew community. You can join the discord at: redmew.com/discord', + 'Click the question mark in the top left corner for server information and map details.' +} + --Starting Techs + + +Event.on_init( + function() +local force = game.forces.player + force.technologies['automation'].researched = true + force.technologies['logistics'].researched = true + force.technologies['landfill'].enabled = false -- disable landfill + end +) + + +return map From 9bc3f3a678a6f8fd56a59ffb5eae531d2d122ec5 Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 24 Nov 2019 20:53:51 +0100 Subject: [PATCH 07/22] Delete terra.lua --- map_gen/maps/terra.lua | 358 ----------------------------------------- 1 file changed, 358 deletions(-) delete mode 100644 map_gen/maps/terra.lua diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua deleted file mode 100644 index 8847601ee..000000000 --- a/map_gen/maps/terra.lua +++ /dev/null @@ -1,358 +0,0 @@ -local b = require "map_gen.shared.builders" -local Event = require 'utils.event' -local ScenarioInfo = require 'features.gui.info' -local table = require 'utils.table' -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' - --Map info -ScenarioInfo.set_map_name('Terra') -ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') -ScenarioInfo.add_map_extra_info( - [[ -Tar's additional info about gears: - -You start off on familiar grounds, but you must obtain robot technology -in order to explore beyond the grid. - - [item=rocket-silo] Regular rocket launch - [item=personal-roboport-equipment] Lazy starter equipment - [entity=small-biter] Biter activity high - [item=landfill] Landfill disabled - -Coded with love, but without lua experience: Blame Tar[technology=optics] for bugs. - ]]) -ScenarioInfo.set_new_info([[ -This map! This map is new! - -T-A-R will be thankful for any feedback on discord or as PM at the Factorio-Forums]]) ---Map generation settings -RS.set_map_gen_settings( - { - MGSP.ore_oil_none, - MGSP.cliff_none, - MGSP.water_none, - --MGSP.enemy_none, - } - ) ---[[RS.set_difficulty_settings({{technology_price_multiplier = 1}}) --Set these on launch -RS.set_map_settings({map_settings}) - ---Biter settings -local map_settings = { - pollution = { - enabled = true - }, - enemy_evolution = { - enabled = true, - time_factor = (0.0000001), - destroy_factor = (0.0002), - pollution_factor = (0.0000015) - }, - enemy_expansion = { - enabled = true, - max_expansion_distance = 7, - friendly_base_influence_radius = 2, - enemy_building_influence_radius = 2, - building_coefficient = 0.1, - other_base_coefficient = 2.0, - neighbouring_chunk_coefficient = 0.5, - neighbouring_base_chunk_coefficient = 0.4, - max_colliding_tiles_coefficient = 0.9, - settler_group_min_size = 5, - settler_group_max_size = 20, - min_expansion_cooldown = 60 * 3600, - max_expansion_cooldown = 180 * 3600 - } -}]] ---Terraforming -local pic1 = require "map_gen.data.presets.factorio_logo2" --921x153 -pic1 = b.decompress(pic1) -local map1file = b.picture(pic1) --Logo2 -local fillerblock = b.translate(b.rectangle(14,12), 248,2) --land bridge to connect the logo gear island ---map = b.change_tile(fillerblock, true, "grass-4") -fillerblock = b.change_tile(fillerblock, true, "grass-4") -- same color as picture shade= 'grass-4' -local map1 = b.add(fillerblock, map1file) -map1 = b.scale(map1, 1, 1) --- Rotated logo's -local map2 = b.rotate (map1, math.pi/2) ---Square minus corner pieces -local shap1 = b.translate(b.rectangle_diamond(26, 24), pic1.height/2,pic1.height/2) -local shap2 = b.rotate((shap1), math.pi/2) -local shap3 = b.rotate((shap2), math.pi/2) -local shap4 = b.rotate((shap3), math.pi/2) -local shap5 = b.invert(b.rectangle(pic1.height+1, pic1.height+1)) --size is related to ''factorio_logo2" ---Combining using all -local chamfer = b.invert(b.any({shap1, shap2, shap3, shap4, shap5})) --starter tile is a chamfered square -local corner = chamfer -corner = b.change_tile(corner, true, "grass-4") ---Botland (robo islands) --- creating shapes -local shape1 = b.translate(b.rectangle(250, 40), 74, 0) --bridge land -local shape2 = b.rotate((shape1), math.pi/2) -local shape3 = b.rotate((shape2), math.pi/2) -local shape4 = b.rotate((shape3), math.pi/2) -local shape5 = b.scale((chamfer), 1.4,1.4) --scaled up starter tile ---Combining using all -local botland = b.any({shape5, shape1, shape2, shape3, shape4}) ---pave the shape -botland = b.scale(botland, 2.2,2.2) -botland = b.change_tile(botland, true, 'lab-dark-2') --replace to 'landfill' to absorb pollution -local pattern = { - {corner, map1}, - {map2,botland} -} -local map = b.grid_pattern_overlap(pattern, 2, 2, 499,500) -map = b.scale(map, 1.9,1.9) --Final map scaler######### --- this sets the tile outside the bounds of the map to water, remove this and it will be void. -map = b.change_tile(map, false, "water") --"deepwater" shows borders (for debugging purposes) -map = b.fish(map, 0.0025) --So long - -local centre =b.circle(18) ---local centre = b.rectangle(5,5) ---local centre = b.scale(chamfer, 0.08,0.08) -map = b.if_else(centre, map) -centre = b.change_map_gen_collision_tile(centre, 'ground-tile', 'stone-path') --- the coordinates at which the standard market and spawn will be created -local startx = 0 -local starty = 0 - --market -global.config.market.standard_market_location = {x = startx, y = starty} - --player ---local function on_init() -local surface = RS.get_surface()local spawn_position = {x = startx, y = starty-3} -RS.set_spawn_position(spawn_position, surface) ---end - --Ore generation -- Copy for "void gears' - altered seeds to create nice starting area - reduced amount of ore patches - local seed1 = 1410 -- random seeds (ore gears) --6666 - local seed2 = 12900 --9999 -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) -- luacheck: ignore 431 - 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) -- luacheck: ignore 43 - 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) -- luacheck: ignore 431 - local stone_r_sq = radius * 0.3025 -- radius * 0.55 - local coal_r_sq = radius * 0.4225 -- radius * 0.65 - local copper_r_sq = radius * 0.64 -- radius * 0.8 - return function(x, y, world) - if not shape(x, y) then - return nil - end - local d_sq = x * x + y * y - - local ore - if d_sq < stone_r_sq then - ore = ores[4] - elseif d_sq < coal_r_sq then - ore = ores[3] - elseif d_sq < copper_r_sq 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 = 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] -- luacheck: ignore 431 - 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, 192) --96 increased numbers to reduce generated patches -big_patches = b.grid_pattern_full_overlap(big_patches, p_cols, p_rows, 192, 192) -medium_patches = do_patches(medium_patches, 128) --64 -medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 128, 128) -small_patches = do_patches(small_patches, 128) --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) -start_gear = b.change_tile(start_gear, true, "grass-3") -map = b.if_else(start_gear, map) -map = b.if_else(centre, map) - --Starting equipment -local player_create = global.config.player_create -player_create.starting_items = { - -- {name = 'power-armor', count = 1}, --Small biters cant bite this - -- {name = 'fusion-reactor-equipment', count = 1}, --and modular wont with this combined with legs - {name = 'modular-armor', count = 1}, - {name = 'solar-panel-equipment', count = 7}, - {name = 'battery-mk2-equipment', count = 1}, - {name = 'personal-roboport-equipment', count = 1}, - {name = 'construction-robot', count = 10}, - {name = 'exoskeleton-equipment', count = 1}, - {name = 'iron-gear-wheel', count = 8}, - {name = 'iron-plate', count = 40}, - {name = 'copper-plate', count = 20}, - {name = 'car', count = 1}, - {name = 'coal', count = 5} -} -player_create.join_messages = { - 'Welcome to this map created by the RedMew community. You can join the discord at: redmew.com/discord', - 'Click the question mark in the top left corner for server information and map details.' -} - --Starting Techs - - -Event.on_init( - function() -local force = game.forces.player - force.technologies['automation'].researched = true - force.technologies['logistics'].researched = true - force.technologies['landfill'].enabled = false -- disable landfill - end -) - - -return map From 4d6ed4b4eae40a5ce6de7d450205d03266264da8 Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 24 Nov 2019 21:09:51 +0100 Subject: [PATCH 08/22] Terra map file You start off on familiar grounds, but you must obtain robot technology in order to explore beyond the grid. Renamed orepattern to avoid shadowing pattern value. --- map_gen/maps/terra.lua | 357 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 357 insertions(+) create mode 100644 map_gen/maps/terra.lua diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua new file mode 100644 index 000000000..21137c77c --- /dev/null +++ b/map_gen/maps/terra.lua @@ -0,0 +1,357 @@ +local b = require "map_gen.shared.builders" +local Event = require 'utils.event' +local ScenarioInfo = require 'features.gui.info' +local table = require 'utils.table' +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' + --Map info +ScenarioInfo.set_map_name('Terra') +ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') +ScenarioInfo.add_map_extra_info( + [[ +Tar's additional info about gears: + +You start off on familiar grounds, but you must obtain robot technology +in order to explore beyond the grid. + + [item=rocket-silo] Regular rocket launch + [item=personal-roboport-equipment] Lazy starter equipment + [entity=small-biter] Biter activity high + [item=landfill] Landfill disabled + +Coded with love, but without lua experience: Blame Tar[technology=optics] for bugs. + ]]) +ScenarioInfo.set_new_info([[ +This map! This map is new! + +T-A-R will be thankful for any feedback on discord or as PM at the Factorio-Forums]]) +--Map generation settings +RS.set_map_gen_settings( + { + MGSP.ore_oil_none, + MGSP.cliff_none, + MGSP.water_none, + --MGSP.enemy_none, + } + ) +--[[RS.set_difficulty_settings({{technology_price_multiplier = 1}}) --Set these on launch +RS.set_map_settings({map_settings}) + +--Biter settings +local map_settings = { + pollution = { + enabled = true + }, + enemy_evolution = { + enabled = true, + time_factor = (0.0000001), + destroy_factor = (0.0002), + pollution_factor = (0.0000015) + }, + enemy_expansion = { + enabled = true, + max_expansion_distance = 7, + friendly_base_influence_radius = 2, + enemy_building_influence_radius = 2, + building_coefficient = 0.1, + other_base_coefficient = 2.0, + neighbouring_chunk_coefficient = 0.5, + neighbouring_base_chunk_coefficient = 0.4, + max_colliding_tiles_coefficient = 0.9, + settler_group_min_size = 5, + settler_group_max_size = 20, + min_expansion_cooldown = 60 * 3600, + max_expansion_cooldown = 180 * 3600 + } +}]] +--Terraforming +local pic1 = require "map_gen.data.presets.factorio_logo2" --921x153 +pic1 = b.decompress(pic1) +local map1file = b.picture(pic1) --Logo2 +local fillerblock = b.translate(b.rectangle(14,12), 248,2) --land bridge to connect the logo gear island +fillerblock = b.change_tile(fillerblock, true, "grass-4") -- same color as picture shade= 'grass-4' +local map1 = b.add(fillerblock, map1file) +map1 = b.scale(map1, 1, 1) +-- Rotated logo's +local map2 = b.rotate (map1, math.pi/2) +--Square minus corner pieces +local shap1 = b.translate(b.rectangle_diamond(26, 24), pic1.height/2,pic1.height/2) +local shap2 = b.rotate((shap1), math.pi/2) +local shap3 = b.rotate((shap2), math.pi/2) +local shap4 = b.rotate((shap3), math.pi/2) +local shap5 = b.invert(b.rectangle(pic1.height+1, pic1.height+1)) --size is related to ''factorio_logo2" +--Combining using all +local chamfer = b.invert(b.any({shap1, shap2, shap3, shap4, shap5})) --starter tile is a chamfered square +local corner = chamfer +corner = b.change_tile(corner, true, "grass-4") +--Botland (robo islands) +-- creating shapes +local shape1 = b.translate(b.rectangle(250, 40), 74, 0) --bridge land +local shape2 = b.rotate((shape1), math.pi/2) +local shape3 = b.rotate((shape2), math.pi/2) +local shape4 = b.rotate((shape3), math.pi/2) +local shape5 = b.scale((chamfer), 1.4,1.4) --scaled up starter tile +--Combining using all +local botland = b.any({shape5, shape1, shape2, shape3, shape4}) +--pave the shape +botland = b.scale(botland, 2.2,2.2) +botland = b.change_tile(botland, true, 'lab-dark-2') --replace to 'landfill' to absorb pollution +local pattern = { + {corner, map1}, + {map2,botland} +} +local map = b.grid_pattern_overlap(pattern, 2, 2, 499,500) +map = b.scale(map, 1.9,1.9) --Final map scaler######### +-- this sets the tile outside the bounds of the map to water, remove this and it will be void. +map = b.change_tile(map, false, "water") --"deepwater" shows borders (for debugging purposes) +map = b.fish(map, 0.0025) --So long + +local centre =b.circle(18) +--local centre = b.rectangle(5,5) +--local centre = b.scale(chamfer, 0.08,0.08) +map = b.if_else(centre, map) +centre = b.change_map_gen_collision_tile(centre, 'ground-tile', 'stone-path') +-- the coordinates at which the standard market and spawn will be created +local startx = 0 +local starty = 0 + --market +global.config.market.standard_market_location = {x = startx, y = starty} + --player + +local surface = RS.get_surface()local spawn_position = {x = startx, y = starty-3} +RS.set_spawn_position(spawn_position, surface) + + --Ore generation -- Copy for "void gears' - altered seeds to create nice starting area - reduced amount of ore patches + local seed1 = 1410 -- random seeds (ore gears) --6666 + local seed2 = 12900 --9999 +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) -- luacheck: ignore 431 + 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) -- luacheck: ignore 43 + 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) -- luacheck: ignore 431 + local stone_r_sq = radius * 0.3025 -- radius * 0.55 + local coal_r_sq = radius * 0.4225 -- radius * 0.65 + local copper_r_sq = radius * 0.64 -- radius * 0.8 + return function(x, y, world) + if not shape(x, y) then + return nil + end + local d_sq = x * x + y * y + + local ore + if d_sq < stone_r_sq then + ore = ores[4] + elseif d_sq < coal_r_sq then + ore = ores[3] + elseif d_sq < copper_r_sq 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 = 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 orepattern = {} + for _ = 1, p_cols do + local row = {} + table.insert(orepattern, 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] -- luacheck: ignore 431 + 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 orepattern +end +big_patches = do_patches(big_patches, 192) --96 increased numbers to reduce generated patches +big_patches = b.grid_pattern_full_overlap(big_patches, p_cols, p_rows, 192, 192) +medium_patches = do_patches(medium_patches, 128) --64 +medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 128, 128) +small_patches = do_patches(small_patches, 128) --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) +start_gear = b.change_tile(start_gear, true, "grass-3") +map = b.if_else(start_gear, map) +map = b.if_else(centre, map) + --Starting equipment +local player_create = global.config.player_create +player_create.starting_items = { + -- {name = 'power-armor', count = 1}, --Small biters cant bite this + -- {name = 'fusion-reactor-equipment', count = 1}, --and modular wont with this combined with legs + {name = 'modular-armor', count = 1}, + {name = 'solar-panel-equipment', count = 7}, + {name = 'battery-mk2-equipment', count = 1}, + {name = 'personal-roboport-equipment', count = 1}, + {name = 'construction-robot', count = 10}, + {name = 'exoskeleton-equipment', count = 1}, + {name = 'iron-gear-wheel', count = 8}, + {name = 'iron-plate', count = 40}, + {name = 'copper-plate', count = 20}, + {name = 'car', count = 1}, + {name = 'coal', count = 5} +} +player_create.join_messages = { + 'Welcome to this map created by the RedMew community. You can join the discord at: redmew.com/discord', + 'Click the question mark in the top left corner for server information and map details.' +} + --Starting Techs + + +Event.on_init( + function() +local force = game.forces.player + force.technologies['automation'].researched = true + force.technologies['logistics'].researched = true + force.technologies['landfill'].enabled = false -- disable landfill + end +) + + +return map From 8767fa02df28b8053c0f168f93266debbecf5d01 Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 24 Nov 2019 21:58:36 +0100 Subject: [PATCH 09/22] Terra map file You start off on familiar grounds, but you must obtain robot technology in order to explore beyond the grid. renamed both patterns on line 101 and 257. Travis hints to line 102 and 258, which confuses me. --- map_gen/maps/terra.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index 21137c77c..36f6c9350 100644 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -98,11 +98,11 @@ local botland = b.any({shape5, shape1, shape2, shape3, shape4}) --pave the shape botland = b.scale(botland, 2.2,2.2) botland = b.change_tile(botland, true, 'lab-dark-2') --replace to 'landfill' to absorb pollution -local pattern = { +local mappattern = { {corner, map1}, {map2,botland} } -local map = b.grid_pattern_overlap(pattern, 2, 2, 499,500) +local map = b.grid_pattern_overlap(mappattern, 2, 2, 499,500) map = b.scale(map, 1.9,1.9) --Final map scaler######### -- this sets the tile outside the bounds of the map to water, remove this and it will be void. map = b.change_tile(map, false, "water") --"deepwater" shows borders (for debugging purposes) From 230d49a5427775a4de4f13b0803811d22adf9bc6 Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 24 Nov 2019 22:57:59 +0100 Subject: [PATCH 10/22] Terra map file You start off on familiar grounds, but you must obtain robot technology in order to explore beyond the grid. Renamed variable p_col on line 258. --- map_gen/maps/terra.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index 36f6c9350..ba79eab4c 100644 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -245,7 +245,7 @@ small_patches[#small_patches + 1] = { 1 } local random = Random.new(seed1, seed2) -local p_cols = 50 +local q_cols = 50 local p_rows = 50 local function do_patches(patches, offset) local total_weights = {} @@ -255,7 +255,7 @@ local function do_patches(patches, offset) table.insert(total_weights, t) end local orepattern = {} - for _ = 1, p_cols do + for _ = 1, q_cols do local row = {} table.insert(orepattern, row) for _ = 1, p_rows do @@ -274,11 +274,11 @@ local function do_patches(patches, offset) return orepattern end big_patches = do_patches(big_patches, 192) --96 increased numbers to reduce generated patches -big_patches = b.grid_pattern_full_overlap(big_patches, p_cols, p_rows, 192, 192) +big_patches = b.grid_pattern_full_overlap(big_patches, q_cols, p_rows, 192, 192) medium_patches = do_patches(medium_patches, 128) --64 -medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 128, 128) +medium_patches = b.grid_pattern_full_overlap(medium_patches, q_cols, p_rows, 128, 128) small_patches = do_patches(small_patches, 128) --32 -small_patches = b.grid_pattern_full_overlap(small_patches, p_cols, p_rows, 64, 64) +small_patches = b.grid_pattern_full_overlap(small_patches, q_cols, p_rows, 64, 64) --map = b.apply_entity(map, small_patches) map = b.apply_entities(map, {big_patches, medium_patches, small_patches}) From ad79ae891b867a29d676b84d938271707ac00cce Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 24 Nov 2019 23:35:38 +0100 Subject: [PATCH 11/22] Delete terra.lua Not solving warning about upvalue --- map_gen/maps/terra.lua | 357 ----------------------------------------- 1 file changed, 357 deletions(-) delete mode 100644 map_gen/maps/terra.lua diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua deleted file mode 100644 index ba79eab4c..000000000 --- a/map_gen/maps/terra.lua +++ /dev/null @@ -1,357 +0,0 @@ -local b = require "map_gen.shared.builders" -local Event = require 'utils.event' -local ScenarioInfo = require 'features.gui.info' -local table = require 'utils.table' -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' - --Map info -ScenarioInfo.set_map_name('Terra') -ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') -ScenarioInfo.add_map_extra_info( - [[ -Tar's additional info about gears: - -You start off on familiar grounds, but you must obtain robot technology -in order to explore beyond the grid. - - [item=rocket-silo] Regular rocket launch - [item=personal-roboport-equipment] Lazy starter equipment - [entity=small-biter] Biter activity high - [item=landfill] Landfill disabled - -Coded with love, but without lua experience: Blame Tar[technology=optics] for bugs. - ]]) -ScenarioInfo.set_new_info([[ -This map! This map is new! - -T-A-R will be thankful for any feedback on discord or as PM at the Factorio-Forums]]) ---Map generation settings -RS.set_map_gen_settings( - { - MGSP.ore_oil_none, - MGSP.cliff_none, - MGSP.water_none, - --MGSP.enemy_none, - } - ) ---[[RS.set_difficulty_settings({{technology_price_multiplier = 1}}) --Set these on launch -RS.set_map_settings({map_settings}) - ---Biter settings -local map_settings = { - pollution = { - enabled = true - }, - enemy_evolution = { - enabled = true, - time_factor = (0.0000001), - destroy_factor = (0.0002), - pollution_factor = (0.0000015) - }, - enemy_expansion = { - enabled = true, - max_expansion_distance = 7, - friendly_base_influence_radius = 2, - enemy_building_influence_radius = 2, - building_coefficient = 0.1, - other_base_coefficient = 2.0, - neighbouring_chunk_coefficient = 0.5, - neighbouring_base_chunk_coefficient = 0.4, - max_colliding_tiles_coefficient = 0.9, - settler_group_min_size = 5, - settler_group_max_size = 20, - min_expansion_cooldown = 60 * 3600, - max_expansion_cooldown = 180 * 3600 - } -}]] ---Terraforming -local pic1 = require "map_gen.data.presets.factorio_logo2" --921x153 -pic1 = b.decompress(pic1) -local map1file = b.picture(pic1) --Logo2 -local fillerblock = b.translate(b.rectangle(14,12), 248,2) --land bridge to connect the logo gear island -fillerblock = b.change_tile(fillerblock, true, "grass-4") -- same color as picture shade= 'grass-4' -local map1 = b.add(fillerblock, map1file) -map1 = b.scale(map1, 1, 1) --- Rotated logo's -local map2 = b.rotate (map1, math.pi/2) ---Square minus corner pieces -local shap1 = b.translate(b.rectangle_diamond(26, 24), pic1.height/2,pic1.height/2) -local shap2 = b.rotate((shap1), math.pi/2) -local shap3 = b.rotate((shap2), math.pi/2) -local shap4 = b.rotate((shap3), math.pi/2) -local shap5 = b.invert(b.rectangle(pic1.height+1, pic1.height+1)) --size is related to ''factorio_logo2" ---Combining using all -local chamfer = b.invert(b.any({shap1, shap2, shap3, shap4, shap5})) --starter tile is a chamfered square -local corner = chamfer -corner = b.change_tile(corner, true, "grass-4") ---Botland (robo islands) --- creating shapes -local shape1 = b.translate(b.rectangle(250, 40), 74, 0) --bridge land -local shape2 = b.rotate((shape1), math.pi/2) -local shape3 = b.rotate((shape2), math.pi/2) -local shape4 = b.rotate((shape3), math.pi/2) -local shape5 = b.scale((chamfer), 1.4,1.4) --scaled up starter tile ---Combining using all -local botland = b.any({shape5, shape1, shape2, shape3, shape4}) ---pave the shape -botland = b.scale(botland, 2.2,2.2) -botland = b.change_tile(botland, true, 'lab-dark-2') --replace to 'landfill' to absorb pollution -local mappattern = { - {corner, map1}, - {map2,botland} -} -local map = b.grid_pattern_overlap(mappattern, 2, 2, 499,500) -map = b.scale(map, 1.9,1.9) --Final map scaler######### --- this sets the tile outside the bounds of the map to water, remove this and it will be void. -map = b.change_tile(map, false, "water") --"deepwater" shows borders (for debugging purposes) -map = b.fish(map, 0.0025) --So long - -local centre =b.circle(18) ---local centre = b.rectangle(5,5) ---local centre = b.scale(chamfer, 0.08,0.08) -map = b.if_else(centre, map) -centre = b.change_map_gen_collision_tile(centre, 'ground-tile', 'stone-path') --- the coordinates at which the standard market and spawn will be created -local startx = 0 -local starty = 0 - --market -global.config.market.standard_market_location = {x = startx, y = starty} - --player - -local surface = RS.get_surface()local spawn_position = {x = startx, y = starty-3} -RS.set_spawn_position(spawn_position, surface) - - --Ore generation -- Copy for "void gears' - altered seeds to create nice starting area - reduced amount of ore patches - local seed1 = 1410 -- random seeds (ore gears) --6666 - local seed2 = 12900 --9999 -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) -- luacheck: ignore 431 - 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) -- luacheck: ignore 43 - 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) -- luacheck: ignore 431 - local stone_r_sq = radius * 0.3025 -- radius * 0.55 - local coal_r_sq = radius * 0.4225 -- radius * 0.65 - local copper_r_sq = radius * 0.64 -- radius * 0.8 - return function(x, y, world) - if not shape(x, y) then - return nil - end - local d_sq = x * x + y * y - - local ore - if d_sq < stone_r_sq then - ore = ores[4] - elseif d_sq < coal_r_sq then - ore = ores[3] - elseif d_sq < copper_r_sq 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 = Random.new(seed1, seed2) -local q_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 orepattern = {} - for _ = 1, q_cols do - local row = {} - table.insert(orepattern, 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] -- luacheck: ignore 431 - 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 orepattern -end -big_patches = do_patches(big_patches, 192) --96 increased numbers to reduce generated patches -big_patches = b.grid_pattern_full_overlap(big_patches, q_cols, p_rows, 192, 192) -medium_patches = do_patches(medium_patches, 128) --64 -medium_patches = b.grid_pattern_full_overlap(medium_patches, q_cols, p_rows, 128, 128) -small_patches = do_patches(small_patches, 128) --32 -small_patches = b.grid_pattern_full_overlap(small_patches, q_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) -start_gear = b.change_tile(start_gear, true, "grass-3") -map = b.if_else(start_gear, map) -map = b.if_else(centre, map) - --Starting equipment -local player_create = global.config.player_create -player_create.starting_items = { - -- {name = 'power-armor', count = 1}, --Small biters cant bite this - -- {name = 'fusion-reactor-equipment', count = 1}, --and modular wont with this combined with legs - {name = 'modular-armor', count = 1}, - {name = 'solar-panel-equipment', count = 7}, - {name = 'battery-mk2-equipment', count = 1}, - {name = 'personal-roboport-equipment', count = 1}, - {name = 'construction-robot', count = 10}, - {name = 'exoskeleton-equipment', count = 1}, - {name = 'iron-gear-wheel', count = 8}, - {name = 'iron-plate', count = 40}, - {name = 'copper-plate', count = 20}, - {name = 'car', count = 1}, - {name = 'coal', count = 5} -} -player_create.join_messages = { - 'Welcome to this map created by the RedMew community. You can join the discord at: redmew.com/discord', - 'Click the question mark in the top left corner for server information and map details.' -} - --Starting Techs - - -Event.on_init( - function() -local force = game.forces.player - force.technologies['automation'].researched = true - force.technologies['logistics'].researched = true - force.technologies['landfill'].enabled = false -- disable landfill - end -) - - -return map From 15ffe37a2bfe6db05ad179adc54f5ec4911d4e92 Mon Sep 17 00:00:00 2001 From: Tarsassum Date: Fri, 21 Feb 2020 23:03:31 +0100 Subject: [PATCH 12/22] Changed lab-tiles2 to landfill --- map_gen/maps/terra.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index cd45bde4e..0ca25b388 100755 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -67,7 +67,7 @@ local shape5 = b.scale((chamfer), 1.4,1.4) local botland = b.any({shape5, shape1, shape2, shape3, shape4}) --pave the shape botland = b.scale(botland, 2.2,2.2) -botland = b.change_tile(botland, true, 'lab-dark-2') +botland = b.change_tile(botland, true, 'landfill') --replace to 'landfill' to absorb pollution local mappattern = { {corner, map1}, From f16f47130751881e4aaa1779a20074c16baeee24 Mon Sep 17 00:00:00 2001 From: Tarsassum Date: Fri, 21 Feb 2020 23:30:13 +0100 Subject: [PATCH 13/22] Reduced map scale (wip), re-arranged starting ores, removed "new" message, removed car. --- map_gen/maps/terra.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index 0ca25b388..400e9ac70 100755 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -21,12 +21,9 @@ in order to explore beyond the grid. [entity=small-biter] Biter activity high [item=landfill] Landfill disabled -Coded with love, but without lua experience: Blame Tar[technology=optics] for bugs. +Coded with love, but without much lua experience: Blame Tar[technology=optics] for bugs. ]]) -ScenarioInfo.set_new_info([[ -This map! This map is new! -T-A-R will be thankful for any feedback on discord or as PM at the Factorio-Forums]]) --Map generation settings RS.set_map_gen_settings( { @@ -75,7 +72,7 @@ local mappattern = { } local map = b.grid_pattern_overlap(mappattern, 2, 2, 499,500) --Final map scaler -map = b.scale(map, 1.9,1.9) +map = b.scale(map, 1,1) -- this sets the tile outside the bounds of the map to water, remove this and it will be void. map = b.change_tile(map, false, "water") map = b.fish(map, 0.0025) @@ -285,7 +282,7 @@ local start_iron = return 1600 end ) -local start_segmented = b.segment_pattern({start_stone, start_coal, start_copper, start_iron}) +local start_segmented = b.segment_pattern({start_stone, start_coal, start_iron, start_copper}) local start_gear = b.apply_entity(gear_big, start_segmented) start_gear = b.change_tile(start_gear, true, "grass-3") map = b.if_else(start_gear, map) @@ -301,9 +298,7 @@ player_create.starting_items = { {name = 'exoskeleton-equipment', count = 1}, {name = 'iron-gear-wheel', count = 8}, {name = 'iron-plate', count = 40}, - {name = 'copper-plate', count = 20}, - {name = 'car', count = 1}, - {name = 'coal', count = 5} + {name = 'copper-plate', count = 20} } player_create.join_messages = { 'Welcome to this map created by the RedMew community. You can join the discord at: redmew.com/discord', From 7dc1eb37e6674f67917c072b7ce03f9c3ad50486 Mon Sep 17 00:00:00 2001 From: Tarsassum Date: Sat, 22 Feb 2020 02:08:41 +0100 Subject: [PATCH 14/22] Reduced starting ore. --- map_gen/maps/terra.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index 400e9ac70..7a6213a92 100755 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -65,7 +65,6 @@ local botland = b.any({shape5, shape1, shape2, shape3, shape4}) --pave the shape botland = b.scale(botland, 2.2,2.2) botland = b.change_tile(botland, true, 'landfill') ---replace to 'landfill' to absorb pollution local mappattern = { {corner, map1}, {map2,botland} @@ -77,7 +76,7 @@ map = b.scale(map, 1,1) map = b.change_tile(map, false, "water") map = b.fish(map, 0.0025) -local centre =b.circle(18) +local centre =b.circle(12) --local centre = b.rectangle(5,5) --local centre = b.scale(chamfer, 0.08,0.08) map = b.if_else(centre, map) @@ -252,7 +251,7 @@ map = b.apply_entities(map, {big_patches, medium_patches, small_patches}) local start_stone = b.resource( - gear_big, + gear_medium, 'stone', function() return 400 @@ -260,7 +259,7 @@ local start_stone = ) local start_coal = b.resource( - gear_big, + gear_medium, 'coal', function() return 800 @@ -268,7 +267,7 @@ local start_coal = ) local start_copper = b.resource( - gear_big, + gear_medium, 'copper-ore', function() return 800 @@ -276,14 +275,14 @@ local start_copper = ) local start_iron = b.resource( - gear_big, + gear_medium, 'iron-ore', function() return 1600 end ) local start_segmented = b.segment_pattern({start_stone, start_coal, start_iron, start_copper}) -local start_gear = b.apply_entity(gear_big, start_segmented) +local start_gear = b.apply_entity(gear_medium, start_segmented) start_gear = b.change_tile(start_gear, true, "grass-3") map = b.if_else(start_gear, map) map = b.if_else(centre, map) From 0195962975178769d028320817dfc49e77370c89 Mon Sep 17 00:00:00 2001 From: Tarsassum Date: Sat, 22 Feb 2020 03:42:41 +0100 Subject: [PATCH 15/22] Locally disabled active_turret_delay for better remote deployment. --- map_gen/maps/terra.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index 7a6213a92..e4626a888 100755 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -6,6 +6,7 @@ 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 TerraConfig = require 'config' --Map info ScenarioInfo.set_map_name('Terra') ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') @@ -32,6 +33,8 @@ RS.set_map_gen_settings( MGSP.water_none, } ) +TerraConfig.turret_active_delay.enabled = false + --Terraforming local pic1 = require "map_gen.data.presets.factorio_logo2" --picture size 921x153 From 952e69e1425539b792225fa27ea3486ec1cbf9fa Mon Sep 17 00:00:00 2001 From: Tarsassum Date: Tue, 25 Feb 2020 23:38:27 +0100 Subject: [PATCH 16/22] Banished biters from bot islands, re-enabled turret active delay --- map_gen/maps/terra.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index e4626a888..fe3641e89 100755 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -6,8 +6,8 @@ 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 TerraConfig = require 'config' - --Map info + +--Map info ScenarioInfo.set_map_name('Terra') ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') ScenarioInfo.add_map_extra_info( @@ -33,7 +33,6 @@ RS.set_map_gen_settings( MGSP.water_none, } ) -TerraConfig.turret_active_delay.enabled = false --Terraforming local pic1 = require "map_gen.data.presets.factorio_logo2" @@ -68,6 +67,7 @@ local botland = b.any({shape5, shape1, shape2, shape3, shape4}) --pave the shape botland = b.scale(botland, 2.2,2.2) botland = b.change_tile(botland, true, 'landfill') +botland = b.remove_map_gen_enemies(botland) local mappattern = { {corner, map1}, {map2,botland} From 7a899fb0774dc0f7a95e3cde2d994618fa7b5ec5 Mon Sep 17 00:00:00 2001 From: Tarsassum Date: Wed, 26 Feb 2020 22:59:29 +0100 Subject: [PATCH 17/22] Reduced ore frequency. Slightly increased copper- and reduced uranium ratios . --- map_gen/maps/terra.lua | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index fe3641e89..f968dc88b 100755 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -74,7 +74,7 @@ local mappattern = { } local map = b.grid_pattern_overlap(mappattern, 2, 2, 499,500) --Final map scaler -map = b.scale(map, 1,1) +map = b.scale(map, 1.2,1.2) -- this sets the tile outside the bounds of the map to water, remove this and it will be void. map = b.change_tile(map, false, "water") map = b.fish(map, 0.0025) @@ -95,7 +95,8 @@ RS.set_spawn_position(spawn_position, surface) --Ore generation: Copy for "void gears' - altered seeds to create nice starting area local seed1 = 1410 - local seed2 = 12900 + local seed2 = 11880 + --11900 --11830 gear = b.decompress(gear) local gear_big = b.picture(gear) local gear_medium = b.scale(gear_big, 2 / 3) @@ -103,10 +104,10 @@ 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 = 'copper-ore', value = value(250, 1.6)}, {resource_type = 'stone', value = value(250, 1)}, {resource_type = 'coal', value = value(250, 1)}, - {resource_type = 'uranium-ore', value = value(125, 1)}, + {resource_type = 'uranium-ore', value = value(125, 0.8)}, {resource_type = 'crude-oil', value = value(50000, 250)} } local function striped(shape) -- luacheck: ignore 431 @@ -243,12 +244,12 @@ local function do_patches(patches, offset) end return orepattern end -big_patches = do_patches(big_patches, 192) -big_patches = b.grid_pattern_full_overlap(big_patches, p_cols, p_rows, 192, 192) -medium_patches = do_patches(medium_patches, 128) -medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 128, 128) +big_patches = do_patches(big_patches, 256) +big_patches = b.grid_pattern_full_overlap(big_patches, p_cols, p_rows, 256, 256) +medium_patches = do_patches(medium_patches, 192) +medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 192, 192) small_patches = do_patches(small_patches, 128) -small_patches = b.grid_pattern_full_overlap(small_patches, p_cols, p_rows, 64, 64) +small_patches = b.grid_pattern_full_overlap(small_patches, p_cols, p_rows, 128, 128) map = b.apply_entities(map, {big_patches, medium_patches, small_patches}) From b645486548656d0cfe689ef236abedb695fc55b9 Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 31 Jul 2022 18:55:58 +0200 Subject: [PATCH 18/22] Patch 2022 Latest version per 2022 --- map_gen/maps/terra.lua | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index f968dc88b..1c6331f06 100755 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -1,3 +1,5 @@ +--Werkbestand + local b = require "map_gen.shared.builders" local Event = require 'utils.event' local ScenarioInfo = require 'features.gui.info' @@ -6,7 +8,7 @@ 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 ScenarioInfo = require 'features.gui.info' --Map info ScenarioInfo.set_map_name('Terra') ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') @@ -18,7 +20,6 @@ You start off on familiar grounds, but you must obtain robot technology in order to explore beyond the grid. [item=rocket-silo] Regular rocket launch - [item=personal-roboport-equipment] Lazy starter equipment [entity=small-biter] Biter activity high [item=landfill] Landfill disabled @@ -68,6 +69,7 @@ local botland = b.any({shape5, shape1, shape2, shape3, shape4}) botland = b.scale(botland, 2.2,2.2) botland = b.change_tile(botland, true, 'landfill') botland = b.remove_map_gen_enemies(botland) + local mappattern = { {corner, map1}, {map2,botland} @@ -252,7 +254,6 @@ small_patches = do_patches(small_patches, 128) small_patches = b.grid_pattern_full_overlap(small_patches, p_cols, p_rows, 128, 128) map = b.apply_entities(map, {big_patches, medium_patches, small_patches}) - local start_stone = b.resource( gear_medium, @@ -293,15 +294,9 @@ map = b.if_else(centre, map) --Starting equipment local player_create = global.config.player_create player_create.starting_items = { - {name = 'modular-armor', count = 1}, - {name = 'solar-panel-equipment', count = 7}, - {name = 'battery-mk2-equipment', count = 1}, - {name = 'personal-roboport-equipment', count = 1}, - {name = 'construction-robot', count = 10}, - {name = 'exoskeleton-equipment', count = 1}, - {name = 'iron-gear-wheel', count = 8}, {name = 'iron-plate', count = 40}, - {name = 'copper-plate', count = 20} + {name = 'copper-plate', count = 20}, + {name = 'coal', count = 5} } player_create.join_messages = { 'Welcome to this map created by the RedMew community. You can join the discord at: redmew.com/discord', From 01372f22ad9f7e175443b799a48c81722fdb33bb Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Sun, 31 Jul 2022 19:01:46 +0200 Subject: [PATCH 19/22] Delete terra.lua Bad location, mistaken upload. --- terra.lua | 358 ------------------------------------------------------ 1 file changed, 358 deletions(-) delete mode 100644 terra.lua diff --git a/terra.lua b/terra.lua deleted file mode 100644 index d7e1114a8..000000000 --- a/terra.lua +++ /dev/null @@ -1,358 +0,0 @@ -local b = require "map_gen.shared.builders" -local Event = require 'utils.event' -local ScenarioInfo = require 'features.gui.info' -local table = require 'utils.table' -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' - --Map info -ScenarioInfo.set_map_name('Terra') -ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') -ScenarioInfo.add_map_extra_info( - [[ -Tar's additional info about gears: - -You start off on familiar grounds, but you must obtain robot technology -in order to explore beyond the grid. - - [item=rocket-silo] Regular rocket launch - [item=personal-roboport-equipment] Lazy starter equipment - [entity=small-biter] Biter activity high - [item=landfill] Landfill disabled - -Coded with love, but without lua experience: Blame Tar[technology=optics] for bugs. - ]]) -ScenarioInfo.set_new_info([[ -This map! This map is new! - -T-A-R will be thankful for any feedback on discord or as PM at the Factorio-Forums]]) ---Map generation settings -RS.set_map_gen_settings( - { - MGSP.ore_oil_none, - MGSP.cliff_none, - MGSP.water_none, - --MGSP.enemy_none, - } - ) ---[[RS.set_difficulty_settings({{technology_price_multiplier = 1}}) --Set these on launch -RS.set_map_settings({map_settings}) - ---Biter settings -local map_settings = { - pollution = { - enabled = true - }, - enemy_evolution = { - enabled = true, - time_factor = (0.0000001), - destroy_factor = (0.0002), - pollution_factor = (0.0000015) - }, - enemy_expansion = { - enabled = true, - max_expansion_distance = 7, - friendly_base_influence_radius = 2, - enemy_building_influence_radius = 2, - building_coefficient = 0.1, - other_base_coefficient = 2.0, - neighbouring_chunk_coefficient = 0.5, - neighbouring_base_chunk_coefficient = 0.4, - max_colliding_tiles_coefficient = 0.9, - settler_group_min_size = 5, - settler_group_max_size = 20, - min_expansion_cooldown = 60 * 3600, - max_expansion_cooldown = 180 * 3600 - } -}]] ---Terraforming -local pic1 = require "map_gen.data.presets.factorio_logo2" --921x153 -pic1 = b.decompress(pic1) -local map1file = b.picture(pic1) --Logo2 -local fillerblock = b.translate(b.rectangle(14,12), 248,2) --land bridge to connect the logo gear island ---map = b.change_tile(fillerblock, true, "grass-4") -fillerblock = b.change_tile(fillerblock, true, "grass-4") -- same color as picture shade= 'grass-4' -local map1 = b.add(fillerblock, map1file) -map1 = b.scale(map1, 1, 1) --- Rotated logo's -local map2 = b.rotate (map1, math.pi/2) ---Square minus corner pieces -local shap1 = b.translate(b.rectangle_diamond(26, 24), pic1.height/2,pic1.height/2) -local shap2 = b.rotate((shap1), math.pi/2) -local shap3 = b.rotate((shap2), math.pi/2) -local shap4 = b.rotate((shap3), math.pi/2) -local shap5 = b.invert(b.rectangle(pic1.height+1, pic1.height+1)) --size is related to ''factorio_logo2" ---Combining using all -local chamfer = b.invert(b.any({shap1, shap2, shap3, shap4, shap5})) --starter tile is a chamfered square -local corner = chamfer -corner = b.change_tile(corner, true, "grass-4") ---Botland (robo islands) --- creating shapes -local shape1 = b.translate(b.rectangle(250, 40), 74, 0) --bridge land -local shape2 = b.rotate((shape1), math.pi/2) -local shape3 = b.rotate((shape2), math.pi/2) -local shape4 = b.rotate((shape3), math.pi/2) -local shape5 = b.scale((chamfer), 1.4,1.4) --scaled up starter tile ---Combining using all -local botland = b.any({shape5, shape1, shape2, shape3, shape4}) ---pave the shape -botland = b.scale(botland, 2.2,2.2) -botland = b.change_tile(botland, true, 'lab-dark-2') --replace to 'landfill' to absorb pollution -local pattern = { - {corner, map1}, - {map2,botland} -} -local map = b.grid_pattern_overlap(pattern, 2, 2, 499,500) -map = b.scale(map, 1.9,1.9) --Final map scaler######### --- this sets the tile outside the bounds of the map to water, remove this and it will be void. -map = b.change_tile(map, false, "water") --"deepwater" shows borders (for debugging purposes) -map = b.fish(map, 0.0025) --So long - -local centre =b.circle(18) ---local centre = b.rectangle(5,5) ---local centre = b.scale(chamfer, 0.08,0.08) -map = b.if_else(centre, map) -centre = b.change_map_gen_collision_tile(centre, 'ground-tile', 'stone-path') --- the coordinates at which the standard market and spawn will be created -local startx = 0 -local starty = 0 - --market -global.config.market.standard_market_location = {x = startx, y = starty} - --player ---local function on_init() -local surface = RS.get_surface()local spawn_position = {x = startx, y = starty-3} -RS.set_spawn_position(spawn_position, surface) ---end - --Ore generation -- Copy for "void gears' - altered seeds to create nice starting area - reduced amount of ore patches - local seed1 = 1410 -- random seeds (ore gears) --6666 - local seed2 = 12900 --9999 -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) -- luacheck: ignore 431 - 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) -- luacheck: ignore 43 - 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) -- luacheck: ignore 431 - local stone_r_sq = radius * 0.3025 -- radius * 0.55 - local coal_r_sq = radius * 0.4225 -- radius * 0.65 - local copper_r_sq = radius * 0.64 -- radius * 0.8 - return function(x, y, world) - if not shape(x, y) then - return nil - end - local d_sq = x * x + y * y - - local ore - if d_sq < stone_r_sq then - ore = ores[4] - elseif d_sq < coal_r_sq then - ore = ores[3] - elseif d_sq < copper_r_sq 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 = 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] -- luacheck: ignore 431 - 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, 192) --96 increased numbers to reduce generated patches -big_patches = b.grid_pattern_full_overlap(big_patches, p_cols, p_rows, 192, 192) -medium_patches = do_patches(medium_patches, 128) --64 -medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 128, 128) -small_patches = do_patches(small_patches, 128) --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) -start_gear = b.change_tile(start_gear, true, "grass-3") -map = b.if_else(start_gear, map) -map = b.if_else(centre, map) - --Starting equipment -local player_create = global.config.player_create -player_create.starting_items = { - -- {name = 'power-armor', count = 1}, --Small biters cant bite this - -- {name = 'fusion-reactor-equipment', count = 1}, --and modular wont with this combined with legs - {name = 'modular-armor', count = 1}, - {name = 'solar-panel-equipment', count = 7}, - {name = 'battery-mk2-equipment', count = 1}, - {name = 'personal-roboport-equipment', count = 1}, - {name = 'construction-robot', count = 10}, - {name = 'exoskeleton-equipment', count = 1}, - {name = 'iron-gear-wheel', count = 8}, - {name = 'iron-plate', count = 40}, - {name = 'copper-plate', count = 20}, - {name = 'car', count = 1}, - {name = 'coal', count = 5} -} -player_create.join_messages = { - 'Welcome to this map created by the RedMew community. You can join the discord at: redmew.com/discord', - 'Click the question mark in the top left corner for server information and map details.' -} - --Starting Techs - - -Event.on_init( - function() -local force = game.forces.player - force.technologies['automation'].researched = true - force.technologies['logistics'].researched = true - force.technologies['landfill'].enabled = false -- disable landfill - end -) - - -return map From 738bf1299e4fa642a94a80e0d111f47fe24e441c Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Mon, 1 Aug 2022 21:58:54 +0200 Subject: [PATCH 20/22] Add files via upload Removed unused variable. --- map_gen/maps/terra.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index 1c6331f06..941884958 100755 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -2,7 +2,7 @@ local b = require "map_gen.shared.builders" local Event = require 'utils.event' -local ScenarioInfo = require 'features.gui.info' +--local ScenarioInfo = require 'features.gui.info' local table = require 'utils.table' local gear = require 'map_gen.data.presets.gear_96by96' local Random = require 'map_gen.shared.random' From 82d37c04dea86e9ed89461a057aa88c2e4901f03 Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Tue, 9 Aug 2022 23:24:33 +0200 Subject: [PATCH 21/22] Terra, the resource update Players are now forced to explore islands early on to find oil and ores: -resources are now only generated on islands -set a new resource seed -starting ore is increased -logistics items are sold at the market -map information is updated -trees do not spawn on islands -re-enabled starting gear to boost early game -biters still escape the remove function on map generation (bug) --- map_gen/maps/terra.lua | 233 ++++++++++++++++++++++++++--------------- 1 file changed, 150 insertions(+), 83 deletions(-) diff --git a/map_gen/maps/terra.lua b/map_gen/maps/terra.lua index 941884958..940c00e8c 100755 --- a/map_gen/maps/terra.lua +++ b/map_gen/maps/terra.lua @@ -1,28 +1,32 @@ ---Werkbestand - +--Terra by T-A-R 2022 local b = require "map_gen.shared.builders" local Event = require 'utils.event' ---local ScenarioInfo = require 'features.gui.info' local table = require 'utils.table' 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 ScenarioInfo = require 'features.gui.info' + + +local Retailer = require 'features.retailer' +local config = global.config +config.market.create_standard_market = false + + --Map info ScenarioInfo.set_map_name('Terra') ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') ScenarioInfo.add_map_extra_info( [[ -Tar's additional info about gears: - -You start off on familiar grounds, but you must obtain robot technology +You start off on familiar grounds, but you must use robot technology in order to explore beyond the grid. - [item=rocket-silo] Regular rocket launch + [item=personal-roboport-equipment] Lazy starter equipment and market + [entity=biter-spawner] Pollution spreads fast [entity=small-biter] Biter activity high [item=landfill] Landfill disabled - + Coded with love, but without much lua experience: Blame Tar[technology=optics] for bugs. ]]) @@ -34,70 +38,9 @@ RS.set_map_gen_settings( MGSP.water_none, } ) - ---Terraforming -local pic1 = require "map_gen.data.presets.factorio_logo2" ---picture size 921x153 -pic1 = b.decompress(pic1) -local map1file = b.picture(pic1) ---land to connect the logo gear island -local fillerblock = b.translate(b.rectangle(14,12), 248,2) -fillerblock = b.change_tile(fillerblock, true, "grass-4") -local map1 = b.add(fillerblock, map1file) -map1 = b.scale(map1, 1, 1) --- Rotated logo's -local map2 = b.rotate (map1, math.pi/2) ---Square minus corner pieces, size is related to ''factorio_logo2" -local shap1 = b.translate(b.rectangle_diamond(26, 24), pic1.height/2,pic1.height/2) -local shap2 = b.rotate((shap1), math.pi/2) -local shap3 = b.rotate((shap2), math.pi/2) -local shap4 = b.rotate((shap3), math.pi/2) -local shap5 = b.invert(b.rectangle(pic1.height+1, pic1.height+1)) ---Combining using all -local chamfer = b.invert(b.any({shap1, shap2, shap3, shap4, shap5})) -local corner = chamfer -corner = b.change_tile(corner, true, "grass-4") ---Botland (robo islands) -local shape1 = b.translate(b.rectangle(250, 40), 74, 0) -local shape2 = b.rotate((shape1), math.pi/2) -local shape3 = b.rotate((shape2), math.pi/2) -local shape4 = b.rotate((shape3), math.pi/2) -local shape5 = b.scale((chamfer), 1.4,1.4) ---Combining using all -local botland = b.any({shape5, shape1, shape2, shape3, shape4}) ---pave the shape -botland = b.scale(botland, 2.2,2.2) -botland = b.change_tile(botland, true, 'landfill') -botland = b.remove_map_gen_enemies(botland) - -local mappattern = { - {corner, map1}, - {map2,botland} -} -local map = b.grid_pattern_overlap(mappattern, 2, 2, 499,500) ---Final map scaler -map = b.scale(map, 1.2,1.2) --- this sets the tile outside the bounds of the map to water, remove this and it will be void. -map = b.change_tile(map, false, "water") -map = b.fish(map, 0.0025) - -local centre =b.circle(12) ---local centre = b.rectangle(5,5) ---local centre = b.scale(chamfer, 0.08,0.08) -map = b.if_else(centre, map) -centre = b.change_map_gen_collision_tile(centre, 'ground-tile', 'stone-path') --- the coordinates at which the standard market and spawn will be created -local startx = 0 -local starty = 0 - --market -global.config.market.standard_market_location = {x = startx, y = starty} - --player -local surface = RS.get_surface()local spawn_position = {x = startx, y = starty-3} -RS.set_spawn_position(spawn_position, surface) - - --Ore generation: Copy for "void gears' - altered seeds to create nice starting area - local seed1 = 1410 - local seed2 = 11880 +--Ore generation: Copy for "void gears' - altered seeds + local seed1 = 42900 + local seed2 = 57500 --11900 --11830 gear = b.decompress(gear) local gear_big = b.picture(gear) @@ -253,18 +196,82 @@ medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 192 small_patches = do_patches(small_patches, 128) small_patches = b.grid_pattern_full_overlap(small_patches, p_cols, p_rows, 128, 128) -map = b.apply_entities(map, {big_patches, medium_patches, small_patches}) +--Terraforming +local pic1 = require "map_gen.data.presets.factorio_logo2" +--picture size 921x153 +pic1 = b.decompress(pic1) +local map1file = b.picture(pic1) +--connect the gear island to the rest of the logo +local fillerblock = b.translate(b.rectangle(14,12), 248,2) +fillerblock = b.change_tile(fillerblock, true, "grass-4") +local map1 = b.add(fillerblock, map1file) +-- Rotated logo's +local map2 = b.rotate (map1, math.pi/2) +--The shape chamfer is the square with chamfer corners +local shap1 = b.translate(b.rectangle_diamond(26, 24), pic1.height/2,pic1.height/2) +local shap2 = b.rotate((shap1), math.pi/2) +local shap3 = b.rotate((shap2), math.pi/2) +local shap4 = b.rotate((shap3), math.pi/2) +local shap5 = b.invert(b.rectangle(pic1.height+1, pic1.height+1)) +--Corner is the shape where players start +local chamfer = b.invert(b.any({shap1, shap2, shap3, shap4, shap5})) +local corner = chamfer +corner = b.change_tile(corner, true, "grass-4") +--Botland adds accespoints to the islands +local shape1 = b.translate(b.rectangle(250, 40), 74, 0) +local shape2 = b.rotate((shape1), math.pi/2) +local shape3 = b.rotate((shape2), math.pi/2) +local shape4 = b.rotate((shape3), math.pi/2) +local shape5 = b.scale((chamfer), 1.4,1.4) +local botland = b.any({shape5, shape1, shape2, shape3, shape4}) +botland = b.remove_map_gen_enemies(botland) +botland = b.scale(botland, 2.2,2.2) +botland = b.change_tile(botland, true, 'landfill') +botland = b.remove_map_gen_trees(botland) +botland = b.remove_map_gen_resources(botland) +--Patternize shapes infinitly +local mappattern = { + {corner, map1}, + {map2,botland} +} +local terra = b.grid_pattern_overlap(mappattern, 2, 2, 499,499) +--creating a shape with the ore pattern, to make ore only appear out of player reach. +local orezone = b.scale((chamfer), 3,3) +orezone = b.remove_map_gen_enemies(orezone) +orezone = b.remove_map_gen_trees(orezone) +orezone = b.change_tile(orezone, true, 'landfill') +local oremask = b.single_pattern(orezone, 998, 998) +oremask = b.translate(oremask, 497, 497) +oremask = b.apply_entities(oremask, {big_patches, medium_patches, small_patches}) +local map =b.add(oremask, terra) +--Final map, scale defines gap between islands and the grid land. Test gaps with large poles, roboports and spidertron. +map = b.scale(map, 1.2,1.2) +map = b.change_tile(map, false, "water") +map = b.fish(map, 0.0025) + +local centre =b.circle(17) +map = b.if_else(centre, map) +centre = b.change_map_gen_collision_tile(centre, 'ground-tile', 'stone-path') +-- the coordinates at which the standard market and spawn will be created +local startx = 0 +local starty = 0 + --player +local surface = RS.get_surface()local spawn_position = {x = startx, y = starty-3} +RS.set_spawn_position(spawn_position, surface) + + +--Starting ores local start_stone = b.resource( - gear_medium, + gear_big, 'stone', function() - return 400 + return 800 end ) local start_coal = b.resource( - gear_medium, + gear_big, 'coal', function() return 800 @@ -272,28 +279,36 @@ local start_coal = ) local start_copper = b.resource( - gear_medium, + gear_big, 'copper-ore', function() - return 800 + return 1200 end ) local start_iron = b.resource( - gear_medium, + gear_big, 'iron-ore', function() - return 1600 + return 1800 end ) local start_segmented = b.segment_pattern({start_stone, start_coal, start_iron, start_copper}) -local start_gear = b.apply_entity(gear_medium, start_segmented) +local start_gear = b.apply_entity(gear_big, start_segmented) start_gear = b.change_tile(start_gear, true, "grass-3") map = b.if_else(start_gear, map) map = b.if_else(centre, map) - --Starting equipment + + --Starting equipment local player_create = global.config.player_create player_create.starting_items = { + {name = 'modular-armor', count = 1}, + {name = 'solar-panel-equipment', count = 7}, + {name = 'battery-mk2-equipment', count = 1}, + {name = 'personal-roboport-equipment', count = 1}, + {name = 'construction-robot', count = 10}, + {name = 'exoskeleton-equipment', count = 1}, + {name = 'iron-gear-wheel', count = 8}, {name = 'iron-plate', count = 40}, {name = 'copper-plate', count = 20}, {name = 'coal', count = 5} @@ -305,11 +320,63 @@ player_create.join_messages = { --Starting Techs Event.on_init( function() -local force = game.forces.player + surface = RS.get_surface() + local force = game.forces.player force.technologies['automation'].researched = true force.technologies['logistics'].researched = true force.technologies['landfill'].enabled = false -- disable landfill + + -- Set up non-standard market so we can add logistics network things without editing a different file + global.config.market.create_standard_market = false + Retailer.set_item('items', {price = 100, name = 'player-port'}) + Retailer.set_item('items', {price = 15, name = 'submachine-gun'}) + Retailer.set_item('items', {price = 250, name = 'combat-shotgun'}) + Retailer.set_item('items', {price = 250, name = 'flamethrower'}) + Retailer.set_item('items', {price = 175, name = 'rocket-launcher'}) + Retailer.set_item('items', {price = 250, name = 'tank-cannon'}) + Retailer.set_item('items', {price = 2500, name = 'artillery-wagon-cannon'}) + Retailer.set_item('items', {price = 1, name = 'firearm-magazine'}) + Retailer.set_item('items', {price = 5, name = 'piercing-rounds-magazine'}) + Retailer.set_item('items', {price = 20, name = 'uranium-rounds-magazine'}) + Retailer.set_item('items', {price = 2, name = 'shotgun-shell'}) + Retailer.set_item('items', {price = 10, name = 'piercing-shotgun-shell'}) + Retailer.set_item('items', {price = 25, name = 'flamethrower-ammo'}) + Retailer.set_item('items', {price = 15, name = 'rocket'}) + Retailer.set_item('items', {price = 25, name = 'explosive-rocket'}) + Retailer.set_item('items', {price = 30, name = 'explosive-cannon-shell'}) + Retailer.set_item('items', {price = 75, name = 'explosive-uranium-cannon-shell'}) + Retailer.set_item('items', {price = 35, name = 'cluster-grenade'}) + Retailer.set_item('items', {price = 35, name = 'poison-capsule'}) + Retailer.set_item('items', {price = 875, name = 'power-armor'}) + Retailer.set_item('items', {price = 2500, name = 'power-armor-mk2'}) + Retailer.set_item('items', {price = 40, name = 'solar-panel-equipment'}) + Retailer.set_item('items', {price = 875, name = 'fusion-reactor-equipment'}) + Retailer.set_item('items', {price = 100, name = 'battery-equipment'}) + Retailer.set_item('items', {price = 625, name = 'battery-mk2-equipment'}) + Retailer.set_item('items', {price = 150, name = 'exoskeleton-equipment'}) + Retailer.set_item('items', {price = 250, name = 'energy-shield-equipment'}) + Retailer.set_item('items', {price = 750, name = 'energy-shield-mk2-equipment'}) + Retailer.set_item('items', {price = 750, name = 'personal-laser-defense-equipment'}) + Retailer.set_item('items', {price = 250, name = 'personal-roboport-equipment'}) + Retailer.set_item('items', {price = 6, name = 'big-electric-pole'}) + Retailer.set_item('items', {price = 25, name = 'substation'}) + Retailer.set_item('items', {price = 10, name = 'construction-robot'}) + Retailer.set_item('items', {price = 2, name = 'logistic-robot'}) + Retailer.set_item('items', {price = 50, name = 'roboport'}) + Retailer.set_item('items', {price = 25, name = 'logistic-chest-active-provider'}) + Retailer.set_item('items', {price = 25, name = 'logistic-chest-passive-provider'}) + Retailer.set_item('items', {price = 25, name = 'logistic-chest-requester'}) + Retailer.set_item('items', {price = 25, name = 'logistic-chest-storage'}) + Retailer.set_item('items', {price = 25, name = 'logistic-chest-buffer'}) + + Retailer.set_market_group_label('items', 'Items Market') + local item_market_1 = surface.create_entity({name = 'market', position = {0, 0}}) + item_market_1.destructible = false + Retailer.add_market('items', item_market_1) + + Retailer.add_market('items', item_market) end ) +Event.on_init(on_init) return map From daf5343b97e9909e939d3cd3a2224029d7685c49 Mon Sep 17 00:00:00 2001 From: Tarsassum <51099608+Tarsassum@users.noreply.github.com> Date: Tue, 9 Aug 2022 23:56:36 +0200 Subject: [PATCH 22/22] removed trailing whitespaces. --- map_gen/terra.lua | 382 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 382 insertions(+) create mode 100644 map_gen/terra.lua diff --git a/map_gen/terra.lua b/map_gen/terra.lua new file mode 100644 index 000000000..5e179d079 --- /dev/null +++ b/map_gen/terra.lua @@ -0,0 +1,382 @@ +--Terra by T-A-R 2022 +local b = require "map_gen.shared.builders" +local Event = require 'utils.event' +local table = require 'utils.table' +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 ScenarioInfo = require 'features.gui.info' + + +local Retailer = require 'features.retailer' +local config = global.config +config.market.create_standard_market = false + + +--Map info +ScenarioInfo.set_map_name('Terra') +ScenarioInfo.set_map_description('The latest experiments has resulted in infinite gears for infinite factory expansion.') +ScenarioInfo.add_map_extra_info( + [[ +You start off on familiar grounds, but you must use robot technology +in order to explore beyond the grid. + [item=rocket-silo] Regular rocket launch + [item=personal-roboport-equipment] Lazy starter equipment and market + [entity=biter-spawner] Pollution spreads fast + [entity=small-biter] Biter activity high + [item=landfill] Landfill disabled + +Coded with love, but without much lua experience: Blame Tar[technology=optics] for bugs. + ]]) + +--Map generation settings +RS.set_map_gen_settings( + { + MGSP.ore_oil_none, + MGSP.cliff_none, + MGSP.water_none, + } + ) +--Ore generation: Copy for "void gears' - altered seeds + local seed1 = 42900 + local seed2 = 57500 + --11900 --11830 +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.6)}, + {resource_type = 'stone', value = value(250, 1)}, + {resource_type = 'coal', value = value(250, 1)}, + {resource_type = 'uranium-ore', value = value(125, 0.8)}, + {resource_type = 'crude-oil', value = value(50000, 250)} +} +local function striped(shape) -- luacheck: ignore 431 + 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) -- luacheck: ignore 431 + 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) -- luacheck: ignore 431 + local stone_r_sq = radius * 0.3025 -- radius * 0.55 + local coal_r_sq = radius * 0.4225 -- radius * 0.65 + local copper_r_sq = radius * 0.64 -- radius * 0.8 + return function(x, y, world) + if not shape(x, y) then + return nil + end + local d_sq = x * x + y * y + + local ore + if d_sq < stone_r_sq then + ore = ores[4] + elseif d_sq < coal_r_sq then + ore = ores[3] + elseif d_sq < copper_r_sq 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 = 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 orepattern = {} + for _ = 1, p_cols do + local row = {} + table.insert(orepattern, 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] -- luacheck: ignore 431 + 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 orepattern +end +big_patches = do_patches(big_patches, 256) +big_patches = b.grid_pattern_full_overlap(big_patches, p_cols, p_rows, 256, 256) +medium_patches = do_patches(medium_patches, 192) +medium_patches = b.grid_pattern_full_overlap(medium_patches, p_cols, p_rows, 192, 192) +small_patches = do_patches(small_patches, 128) +small_patches = b.grid_pattern_full_overlap(small_patches, p_cols, p_rows, 128, 128) + +--Terraforming +local pic1 = require "map_gen.data.presets.factorio_logo2" +--picture size 921x153 +pic1 = b.decompress(pic1) +local map1file = b.picture(pic1) +--connect the gear island to the rest of the logo +local fillerblock = b.translate(b.rectangle(14,12), 248,2) +fillerblock = b.change_tile(fillerblock, true, "grass-4") +local map1 = b.add(fillerblock, map1file) +-- Rotated logo's +local map2 = b.rotate (map1, math.pi/2) +--The shape chamfer is the square with chamfer corners +local shap1 = b.translate(b.rectangle_diamond(26, 24), pic1.height/2,pic1.height/2) +local shap2 = b.rotate((shap1), math.pi/2) +local shap3 = b.rotate((shap2), math.pi/2) +local shap4 = b.rotate((shap3), math.pi/2) +local shap5 = b.invert(b.rectangle(pic1.height+1, pic1.height+1)) +--Corner is the shape where players start +local chamfer = b.invert(b.any({shap1, shap2, shap3, shap4, shap5})) +local corner = chamfer +corner = b.change_tile(corner, true, "grass-4") +--Botland adds accespoints to the islands +local shape1 = b.translate(b.rectangle(250, 40), 74, 0) +local shape2 = b.rotate((shape1), math.pi/2) +local shape3 = b.rotate((shape2), math.pi/2) +local shape4 = b.rotate((shape3), math.pi/2) +local shape5 = b.scale((chamfer), 1.4,1.4) +local botland = b.any({shape5, shape1, shape2, shape3, shape4}) +botland = b.remove_map_gen_enemies(botland) +botland = b.scale(botland, 2.2,2.2) +botland = b.change_tile(botland, true, 'landfill') +botland = b.remove_map_gen_trees(botland) +botland = b.remove_map_gen_resources(botland) +--Patternize shapes infinitly +local mappattern = { + {corner, map1}, + {map2,botland} +} +local terra = b.grid_pattern_overlap(mappattern, 2, 2, 499,499) +--creating a shape with the ore pattern, to make ore only appear out of player reach. +local orezone = b.scale((chamfer), 3,3) +orezone = b.remove_map_gen_enemies(orezone) +orezone = b.remove_map_gen_trees(orezone) +orezone = b.change_tile(orezone, true, 'landfill') +local oremask = b.single_pattern(orezone, 998, 998) +oremask = b.translate(oremask, 497, 497) +oremask = b.apply_entities(oremask, {big_patches, medium_patches, small_patches}) +local map =b.add(oremask, terra) +--Final map, scale defines gap between islands and the grid land. Test gaps with large poles, roboports and spidertron. +map = b.scale(map, 1.2,1.2) +map = b.change_tile(map, false, "water") +map = b.fish(map, 0.0025) + +local centre =b.circle(17) +map = b.if_else(centre, map) +centre = b.change_map_gen_collision_tile(centre, 'ground-tile', 'stone-path') +-- the coordinates at which the standard market and spawn will be created +local startx = 0 +local starty = 0 + --player +local surface = RS.get_surface()local spawn_position = {x = startx, y = starty-3} +RS.set_spawn_position(spawn_position, surface) + + +--Starting ores +local start_stone = + b.resource( + gear_big, + 'stone', + function() + return 800 + end +) +local start_coal = + b.resource( + gear_big, + 'coal', + function() + return 800 + end +) +local start_copper = + b.resource( + gear_big, + 'copper-ore', + function() + return 1200 + end +) +local start_iron = + b.resource( + gear_big, + 'iron-ore', + function() + return 1800 + end +) +local start_segmented = b.segment_pattern({start_stone, start_coal, start_iron, start_copper}) +local start_gear = b.apply_entity(gear_big, start_segmented) +start_gear = b.change_tile(start_gear, true, "grass-3") +map = b.if_else(start_gear, map) +map = b.if_else(centre, map) + + --Starting equipment +local player_create = global.config.player_create +player_create.starting_items = { + {name = 'modular-armor', count = 1}, + {name = 'solar-panel-equipment', count = 7}, + {name = 'battery-mk2-equipment', count = 1}, + {name = 'personal-roboport-equipment', count = 1}, + {name = 'construction-robot', count = 10}, + {name = 'exoskeleton-equipment', count = 1}, + {name = 'iron-gear-wheel', count = 8}, + {name = 'iron-plate', count = 40}, + {name = 'copper-plate', count = 20}, + {name = 'coal', count = 5} +} +player_create.join_messages = { + 'Welcome to this map created by the RedMew community. You can join the discord at: redmew.com/discord', + 'Click the question mark in the top left corner for server information and map details.' +} + --Starting Techs +Event.on_init( + function() + surface = RS.get_surface() + local force = game.forces.player + force.technologies['automation'].researched = true + force.technologies['logistics'].researched = true + force.technologies['landfill'].enabled = false -- disable landfill + + -- Set up non-standard market so we can add logistics network things without editing a different file + global.config.market.create_standard_market = false + Retailer.set_item('items', {price = 100, name = 'player-port'}) + Retailer.set_item('items', {price = 15, name = 'submachine-gun'}) + Retailer.set_item('items', {price = 250, name = 'combat-shotgun'}) + Retailer.set_item('items', {price = 250, name = 'flamethrower'}) + Retailer.set_item('items', {price = 175, name = 'rocket-launcher'}) + Retailer.set_item('items', {price = 250, name = 'tank-cannon'}) + Retailer.set_item('items', {price = 2500, name = 'artillery-wagon-cannon'}) + Retailer.set_item('items', {price = 1, name = 'firearm-magazine'}) + Retailer.set_item('items', {price = 5, name = 'piercing-rounds-magazine'}) + Retailer.set_item('items', {price = 20, name = 'uranium-rounds-magazine'}) + Retailer.set_item('items', {price = 2, name = 'shotgun-shell'}) + Retailer.set_item('items', {price = 10, name = 'piercing-shotgun-shell'}) + Retailer.set_item('items', {price = 25, name = 'flamethrower-ammo'}) + Retailer.set_item('items', {price = 15, name = 'rocket'}) + Retailer.set_item('items', {price = 25, name = 'explosive-rocket'}) + Retailer.set_item('items', {price = 30, name = 'explosive-cannon-shell'}) + Retailer.set_item('items', {price = 75, name = 'explosive-uranium-cannon-shell'}) + Retailer.set_item('items', {price = 35, name = 'cluster-grenade'}) + Retailer.set_item('items', {price = 35, name = 'poison-capsule'}) + Retailer.set_item('items', {price = 875, name = 'power-armor'}) + Retailer.set_item('items', {price = 2500, name = 'power-armor-mk2'}) + Retailer.set_item('items', {price = 40, name = 'solar-panel-equipment'}) + Retailer.set_item('items', {price = 875, name = 'fusion-reactor-equipment'}) + Retailer.set_item('items', {price = 100, name = 'battery-equipment'}) + Retailer.set_item('items', {price = 625, name = 'battery-mk2-equipment'}) + Retailer.set_item('items', {price = 150, name = 'exoskeleton-equipment'}) + Retailer.set_item('items', {price = 250, name = 'energy-shield-equipment'}) + Retailer.set_item('items', {price = 750, name = 'energy-shield-mk2-equipment'}) + Retailer.set_item('items', {price = 750, name = 'personal-laser-defense-equipment'}) + Retailer.set_item('items', {price = 250, name = 'personal-roboport-equipment'}) + Retailer.set_item('items', {price = 6, name = 'big-electric-pole'}) + Retailer.set_item('items', {price = 25, name = 'substation'}) + Retailer.set_item('items', {price = 10, name = 'construction-robot'}) + Retailer.set_item('items', {price = 2, name = 'logistic-robot'}) + Retailer.set_item('items', {price = 50, name = 'roboport'}) + Retailer.set_item('items', {price = 25, name = 'logistic-chest-active-provider'}) + Retailer.set_item('items', {price = 25, name = 'logistic-chest-passive-provider'}) + Retailer.set_item('items', {price = 25, name = 'logistic-chest-requester'}) + Retailer.set_item('items', {price = 25, name = 'logistic-chest-storage'}) + Retailer.set_item('items', {price = 25, name = 'logistic-chest-buffer'}) + + Retailer.set_market_group_label('items', 'Items Market') + local item_market_1 = surface.create_entity({name = 'market', position = {0, 0}}) + item_market_1.destructible = false + Retailer.add_market('items', item_market_1) + + Retailer.add_market('items', item_market) + end +) +Event.on_init(on_init) + +return map