diff --git a/.luacheckrc b/.luacheckrc index 2236b8b0..905c68f5 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -431,7 +431,8 @@ stds.factorio_control = { ticks_played = {read_only = true, other_fields = true}, ticks_to_run = {read_only = false, other_fields = false}, tile_prototypes = {read_only = true, other_fields = true}, - virtual_signal_prototypes = {read_only = true, other_fields = true} + virtual_signal_prototypes = {read_only = true, other_fields = true}, + finished_but_continuing = {read_only = true, other_fields = false} }, }, }, diff --git a/features/autofill.lua b/features/autofill.lua index fd134a8e..5ac67f23 100644 --- a/features/autofill.lua +++ b/features/autofill.lua @@ -13,20 +13,9 @@ Settings.register(enable_autofill_name, Settings.types.boolean, true, 'autofill. Settings.register(ammo_count_name, Settings.types.positive_integer, 10, 'autofill.ammo_count') local Public = {} - -local ammo_locales = { - ['uranium-rounds-magazine'] = {'item-name.uranium-rounds-magazine'}, - ['piercing-rounds-magazine'] = {'item-name.piercing-rounds-magazine'}, - ['firearm-magazine'] = {'item-name.firearm-magazine'} -} -local k2_ammo_locales = { - ['rifle-magazine'] = {'item-name.rifle-magazine'}, - ['armor-piercing-rifle-magazine'] = {'item-name.armor-piercing-rifle-magazine'}, - ['uranium-rifle-magazine'] = {'item-name.uranium-rifle-magazine'}, - ['imersite-rifle-magazine'] = {'item-name.imersite-rifle-magazine'} -} -if script.active_mods["Krastorio2"] then ammo_locales = k2_ammo_locales end -Public.ammo_locales = ammo_locales +local Ammos = require 'features.autofill_compatibility' +local default_ammos = Ammos.ammo +Public.ammo_locales = Ammos.locale local player_ammos = {} -- player_index -> dict of name -> bool @@ -37,20 +26,6 @@ Global.register( end ) -local default_ammos = { - ['uranium-rounds-magazine'] = true, - ['piercing-rounds-magazine'] = true, - ['firearm-magazine'] = true -} - -local k2_default_ammos = { - ['rifle-magazine'] = true, - ['armor-piercing-rifle-magazine'] = true, - ['uranium-rifle-magazine'] = true, - ['imersite-rifle-magazine'] = true -} -if script.active_mods["Krastorio2"] then default_ammos = k2_default_ammos end - local function copy(tbl) local result = {} @@ -127,7 +102,7 @@ local function entity_built(event) { name = 'flying-text', position = entity.position, - text = {'autofill.insert_item', inserted, ammo_locales[name], remaining_count} + text = {'autofill.insert_item', inserted, Ammos.locale[name], remaining_count} } ) diff --git a/features/autofill_compatibility.lua b/features/autofill_compatibility.lua new file mode 100644 index 00000000..75fba4cb --- /dev/null +++ b/features/autofill_compatibility.lua @@ -0,0 +1,114 @@ +local default = function() + return { + ammo = { + ['firearm-magazine'] = true, + ['piercing-rounds-magazine'] = true, + ['uranium-rounds-magazine'] = true, + }, + locale = { + ['firearm-magazine'] = {'item-name.firearm-magazine'}, + ['piercing-rounds-magazine'] = {'item-name.piercing-rounds-magazine'}, + ['uranium-rounds-magazine'] = {'item-name.uranium-rounds-magazine'}, + } + } +end + +if script.active_mods['Krastorio2'] then + return { + ammo = { + ['rifle-magazine'] = true, + ['armor-piercing-rifle-magazine'] = true, + ['uranium-rifle-magazine'] = true, + ['imersite-rifle-magazine'] = true, + }, + locale = { + ['rifle-magazine'] = {'item-name.rifle-magazine'}, + ['armor-piercing-rifle-magazine'] = {'item-name.armor-piercing-rifle-magazine'}, + ['uranium-rifle-magazine'] = {'item-name.uranium-rifle-magazine'}, + ['imersite-rifle-magazine'] = {'item-name.imersite-rifle-magazine'}, + } + } +end + +if script.active_mods['exotic-industries'] then + return { + ammo = { + ['firearm-magazine'] = true, + ['piercing-rounds-magazine'] = true, + ['uranium-rounds-magazine'] = true, + ['ei_compound-ammo'] = true, + }, + locale = { + ['firearm-magazine'] = {'item-name.firearm-magazine'}, + ['piercing-rounds-magazine'] = {'item-name.piercing-rounds-magazine'}, + ['uranium-rounds-magazine'] = {'item-name.uranium-rounds-magazine'}, + ['ei_compound-ammo'] = {'item-name.ei_compound-ammo'}, + } + } +end + +if script.active_mods['IndustrialRevolution3'] then + return { + ammo = { + ['firearm-magazine'] = true, + ['piercing-rounds-magazine'] = true, + ['chromium-magazine'] = true, + ['uranium-rounds-magazine'] = true, + }, + locale = { + ['firearm-magazine'] = {'item-name.firearm-magazine'}, + ['piercing-rounds-magazine'] = {'item-name.piercing-rounds-magazine'}, + ['chromium-magazine'] = {'item-name.chromium-magazine'}, + ['uranium-rounds-magazine'] = {'item-name.uranium-rounds-magazine'}, + } + } +end + +if script.active_mods['bobwarfare'] then + return { + ammo = { + ['firearm-magazine'] = true, + ['piercing-rounds-magazine'] = true, + ['uranium-rounds-magazine'] = true, + ['bullet-magazine'] = true, + ['acid-bullet-magazine'] = true, + ['ap-bullet-magazine'] = true, + ['electric-bullet-magazine'] = true, + ['flame-bullet-magazine'] = true, + ['he-bullet-magazine'] = true, + ['plasma-bullet-magazine'] = true, + ['poison-bullet-magazine'] = true, + }, + locale = { + ['firearm-magazine'] = {'item-name.firearm-magazine'}, + ['piercing-rounds-magazine'] = {'item-name.piercing-rounds-magazine'}, + ['uranium-rounds-magazine'] = {'item-name.uranium-rounds-magazine'}, + ['acid-bullet-magazine'] = {'item-name.acid-bullet-magazine'}, + ['ap-bullet-magazine'] = {'item-name.ap-bullet-magazine'}, + ['electric-bullet-magazine'] = {'item-name.electric-bullet-magazine'}, + ['flame-bullet-magazine'] = {'item-name.flame-bullet-magazine'}, + ['he-bullet-magazine'] = {'item-name.he-bullet-magazine'}, + ['plasma-bullet-magazine'] = {'item-name.plasma-bullet-magazine'}, + ['poison-bullet-magazine'] = {'item-name.poison-bullet-magazine'}, + } + } +end + +if script.active_mods['bzzirconium'] then + return { + ammo = { + ['firearm-magazine'] = true, + ['piercing-rounds-magazine'] = true, + ['explosive-rounds-magazine'] = true, + ['uranium-rounds-magazine'] = true, + }, + locale = { + ['firearm-magazine'] = {'item-name.firearm-magazine'}, + ['piercing-rounds-magazine'] = {'item-name.piercing-rounds-magazine'}, + ['explosive-rounds-magazine'] = {'item-name.explosive-rounds-magazine'}, + ['uranium-rounds-magazine'] = {'item-name.uranium-rounds-magazine'}, + } + } +end + +return default() \ No newline at end of file diff --git a/locale/en/redmew_maps.cfg b/locale/en/redmew_maps.cfg index f3fd0c7d..4a6323f8 100644 --- a/locale/en/redmew_maps.cfg +++ b/locale/en/redmew_maps.cfg @@ -176,5 +176,6 @@ anti_grief_jail_reason=You have spilled too many items on the ground, contact an biters_disabled=Launching the first [item=satellite] has killed all the biters. Launch __1__ [item=satellite] to win the map. win=Congratulations! The map has been won. Restart the map with /restart satellite_launch=Launch another __1__ [item=satellite] to win the map. -biters_disabled_k2=Launching the first [item=satellite] has killed all the biters. Build and activate the intergalactic transceiver to win the map. - +biters_disabled_k2=Launching the first [item=satellite] has killed all the biters. Build and activate the Intergalactic Transceiver to win the map. +biters_disabled_ei=Launching the first [item=satellite] has killed all the biters. Build and activate the Black Hole to win the map. +biters_disabled_py=Launching the first [item=satellite] has killed all the biters. Research [technology-name=pyrrhic] to win the game. diff --git a/map_gen/maps/danger_ores/config/alien_biomes_tile_sets.lua b/map_gen/maps/danger_ores/config/alien_biomes_tile_sets.lua new file mode 100644 index 00000000..ad77d704 --- /dev/null +++ b/map_gen/maps/danger_ores/config/alien_biomes_tile_sets.lua @@ -0,0 +1,51 @@ +local function make_variations(name, min, max) + local tiles = {} + local c = min + for i=1, max do + tiles[i] = name .. '-' .. tostring(c) + c = c + 1 + end + return tiles +end + +return { + make_variations('frozen-snow', 0, 9), + make_variations('mineral-aubergine-dirt', 1, 6), + make_variations('mineral-aubergine-sand', 1, 3), + make_variations('mineral-beige-dirt', 1, 6), + make_variations('mineral-beige-sand', 1, 3), + make_variations('mineral-black-dirt', 1, 6), + make_variations('mineral-black-sand', 1, 3), + make_variations('mineral-brown-dirt', 1, 6), + make_variations('mineral-brown-sand', 1, 3), + make_variations('mineral-cream-dirt', 1, 6), + make_variations('mineral-cream-sand', 1, 3), + make_variations('mineral-dustyrose-dirt', 1, 6), + make_variations('mineral-dustyrose-sand', 1, 3), + make_variations('mineral-grey-dirt', 1, 6), + make_variations('mineral-grey-sand', 1, 3), + make_variations('mineral-purple-dirt', 1, 6), + make_variations('mineral-purple-sand', 1, 3), + make_variations('mineral-red-dirt', 1, 6), + make_variations('mineral-red-sand', 1, 3), + make_variations('mineral-tan-dirt', 1, 6), + make_variations('mineral-tan-sand', 1, 3), + make_variations('mineral-violet-dirt', 1, 6), + make_variations('mineral-violet-sand', 1, 3), + make_variations('mineral-white-dirt', 1, 6), + make_variations('mineral-white-sand', 1, 3), + make_variations('vegetation-blue-grass', 1, 2), + make_variations('vegetation-green-grass', 1, 4), + make_variations('vegetation-mauve-grass', 1, 2), + make_variations('vegetation-olive-grass', 1, 2), + make_variations('vegetation-orange-grass', 1, 2), + make_variations('vegetation-purple-grass', 1, 2), + make_variations('vegetation-red-grass', 1, 2), + make_variations('vegetation-turquoise-grass', 1, 2), + make_variations('vegetation-violet-grass', 1, 2), + make_variations('vegetation-yellow-grass', 1, 2), + make_variations('volcanic-blue-heat', 1, 4), + make_variations('volcanic-green-heat', 1, 4), + make_variations('volcanic-orange-heat', 1, 4), + make_variations('volcanic-purple-heat', 1, 4), +} \ No newline at end of file diff --git a/map_gen/maps/danger_ores/config/bz_ores.lua b/map_gen/maps/danger_ores/config/bz_ores.lua new file mode 100644 index 00000000..07ef99a0 --- /dev/null +++ b/map_gen/maps/danger_ores/config/bz_ores.lua @@ -0,0 +1,100 @@ +local b = require 'map_gen.shared.builders' +local value = b.exponential_value(0, 0.07, 1.45) +local start_value = b.euclidean_value(0, 0.35) + +local function total_weight(tbl) + local total = 0 + for _, weight in pairs(tbl) do total = total + weight end + return total +end + +local MIN_MIXED_WEIGHT = 1 +local MIN_SECTOR_WEIGHT = 2 +local TILE_SETS = { + { + [1] = 'grass-1', + [2] = 'grass-2', + [3] = 'grass-3', + [4] = 'grass-4', + }, + { + [1] = 'red-desert-0', + [2] = 'red-desert-1', + [3] = 'red-desert-2', + [4] = 'red-desert-3', + }, + { + [1] = 'dirt-1', + [2] = 'dirt-2', + [3] = 'dirt-3', + [4] = 'dirt-4', + [5] = 'dirt-5', + [6] = 'dirt-6', + [7] = 'dirt-7', + }, + { + [1] = 'sand-1', + [2] = 'sand-2', + [3] = 'sand-3', + }, +} + +if script.active_mods['alien-biomes'] then + TILE_SETS = require 'map_gen.maps.danger_ores.config.alien_biomes_tile_sets' +end + +--[[ + (Estimated resource consumption (in M) to craft 1 Million science of each pack + obtained by using Factory Planner mod + source: https://mods.factorio.com/mod/factoryplanner +]] +local estimated_consumption = { +--['crude-oil'] = 300, +--['gas'] = 3, + ['aluminum-ore'] = 16, + ['coal'] = 80, + ['copper-ore'] = 12, + ['gold-ore'] = 1, + ['graphite'] = 37, + ['iron-ore'] = 47, -- 37 + 10 + ['lead-ore'] = 25, + ['rich-copper-ore'] = 20, + ['salt'] = 35, + ['stone'] = 48, -- 51 - 3 + ['tin-ore'] = 19, + ['titanium-ore'] = 16, + ['tungsten-ore'] = 10, + ['uranium-ore'] = 2, + ['zircon'] = 8, +} + +--[[ + Build set of resource. Each sector has weight equal to its estimated consumption. + Then each sector has 60% of its main resource, while the remaining 40% is split among the other mixed resources, + in proportion to each resource's expected consumption again. + A mixed resource can't have less than 1 points of weight. +]] +local resources = {} +local N_SETS = #TILE_SETS +local TOTAL = total_weight(estimated_consumption) + +for resource_name, consumption in pairs(estimated_consumption) do + + local mixed_ratios = {} + for name, weight in pairs(estimated_consumption) do + local subset = table.deepcopy(estimated_consumption) + subset[resource_name] = nil + local w = (name == resource_name) and 60 or math.ceil(weight / total_weight(subset) * 100 * 0.4) + table.insert(mixed_ratios, { resource = b.resource(b.full_shape, name, value), weight = math.max(MIN_MIXED_WEIGHT, w) }) + end + + table.insert(resources, { + name = resource_name, + tiles = TILE_SETS[(consumption % N_SETS) + 1], + start = start_value, + weight = math.max(estimated_consumption[resource_name] / TOTAL * 100, MIN_SECTOR_WEIGHT), + ratios = mixed_ratios + }) +end + +return resources diff --git a/map_gen/maps/danger_ores/config/bz_resource_patches.lua b/map_gen/maps/danger_ores/config/bz_resource_patches.lua new file mode 100644 index 00000000..84c5e6c9 --- /dev/null +++ b/map_gen/maps/danger_ores/config/bz_resource_patches.lua @@ -0,0 +1,19 @@ +local b = require 'map_gen.shared.builders' +local value = b.euclidean_value + +local full_oil_shape = b.translate(b.throttle_xy(b.full_shape, 3, 6, 3, 6), -1, -1) +full_oil_shape = b.use_world_as_local(full_oil_shape) +local oil_shape = b.throttle_world_xy(b.full_shape, 1, 6, 1, 6) + +return { + { + scale = 1 / 64, + threshold = 0.6, + resource = b.any{ b.resource(oil_shape, 'crude-oil', value(100000, 2500)), full_oil_shape } + }, + { + scale = 1 / 64, + threshold = 0.6, + resource = b.any{ b.resource(oil_shape, 'gas', value(100000, 2500)), full_oil_shape } + }, +} diff --git a/map_gen/maps/danger_ores/config/exotic_industries_allowed_entities.lua b/map_gen/maps/danger_ores/config/exotic_industries_allowed_entities.lua new file mode 100644 index 00000000..335ca34f --- /dev/null +++ b/map_gen/maps/danger_ores/config/exotic_industries_allowed_entities.lua @@ -0,0 +1,50 @@ +return { + -- belts + 'transport-belt', + 'fast-transport-belt', + 'express-transport-belt', + 'ei_neo-belt', + -- undergrounds + 'underground-belt', + 'fast-underground-belt', + 'express-underground-belt', + 'ei_neo-underground-belt', + -- pipes + 'pipe', + 'pipe-to-ground', + 'ei_insulated-pipe', + 'ei_insulated-underground-pipe', + -- poles + 'small-electric-pole', + 'medium-electric-pole', + 'big-electric-pole', + 'substation', + -- drills + 'electric-mining-drill', + 'ei_advanced-electric-mining-drill', + 'ei_superior-electric-mining-drill', + 'ei_deep-drill', + 'ei_advanced-deep-drill', + 'burner-mining-drill', + 'pumpjack', + 'ei_steam-oil-pumpjack', + -- vehicles + 'car', + 'tank', + 'spidertron', + -- rails + 'straight-rail', + 'curved-rail', + 'rail-signal', + 'rail-chain-signal', + 'train-stop', + 'locomotive', + 'cargo-wagon', + 'fluid-wagon', + 'artillery-wagon', + 'ei_steam-basic-locomotive', + 'ei_steam-basic-wagon', + 'ei_steam-advanced-locomotive', + 'ei_steam-advanced-wagon', + 'ei_steam-advanced-fluid-wagon', +} diff --git a/map_gen/maps/danger_ores/config/exotic_industries_resource_patches.lua b/map_gen/maps/danger_ores/config/exotic_industries_resource_patches.lua new file mode 100644 index 00000000..16d1e56e --- /dev/null +++ b/map_gen/maps/danger_ores/config/exotic_industries_resource_patches.lua @@ -0,0 +1,34 @@ +local b = require 'map_gen.shared.builders' +local value = b.euclidean_value + +local full_oil_shape = b.translate(b.throttle_xy(b.full_shape, 3, 6, 3, 6), -1, -1) +full_oil_shape = b.use_world_as_local(full_oil_shape) +local oil_shape = b.throttle_world_xy(b.full_shape, 1, 6, 1, 6) + +local full_patch_shape = b.throttle_xy(b.full_shape, 5, 10, 5, 10) +full_patch_shape = b.use_world_as_local(full_patch_shape) +local patch_shape = b.throttle_world_xy(b.full_shape, 4, 10, 4, 10) + +local function generate_patch(name, data) + return { + scale = data.scale, + threshold = data.t, + resource = b.any{ b.resource(data.shape, name, value(data.base, data.mult)), data.full_shape } + } +end + +return { + generate_patch('crude-oil', { scale = 1 / 64, base = 100000, mult = 2500, t = 0.60, shape = oil_shape, full_shape = full_oil_shape, rarity = 'common' }), + generate_patch('ei_coal-patch', { scale = 1 / 56, base = 25000, mult = 100, t = 0.60, shape = patch_shape, full_shape = full_patch_shape, rarity = 'common' }), + generate_patch('ei_copper-patch', { scale = 1 / 56, base = 25000, mult = 100, t = 0.60, shape = patch_shape, full_shape = full_patch_shape, rarity = 'common' }), + generate_patch('ei_gold-patch', { scale = 1 / 64, base = 60000, mult = 750, t = 0.65, shape = patch_shape, full_shape = full_patch_shape, rarity = 'rare' }), + generate_patch('ei_iron-patch', { scale = 1 / 56, base = 25000, mult = 100, t = 0.60, shape = patch_shape, full_shape = full_patch_shape, rarity = 'common' }), + generate_patch('ei_lead-patch', { scale = 1 / 56, base = 25000, mult = 100, t = 0.60, shape = patch_shape, full_shape = full_patch_shape, rarity = 'common' }), + generate_patch('ei_neodym-patch', { scale = 1 / 64, base = 80000, mult = 1500, t = 0.67, shape = patch_shape, full_shape = full_patch_shape, rarity = 'very-rare' }), + generate_patch('ei_sulfur-patch', { scale = 1 / 56, base = 25000, mult = 100, t = 0.60, shape = patch_shape, full_shape = full_patch_shape, rarity = 'common' }), + generate_patch('ei_uranium-patch', { scale = 1 / 64, base = 60000, mult = 750, t = 0.65, shape = patch_shape, full_shape = full_patch_shape, rarity = 'rare' }), + -- Gaia surface + -- ['ei_core-patch'] = { rarity = 'gaia', }, + -- ['ei_cryoflux-patch'] = { rarity = 'gaia', }, + -- ['ei_phytogas-patch'] = { rarity = 'gaia', }, +} diff --git a/map_gen/maps/danger_ores/config/ir3_allowed_entities.lua b/map_gen/maps/danger_ores/config/ir3_allowed_entities.lua new file mode 100644 index 00000000..940f84a4 --- /dev/null +++ b/map_gen/maps/danger_ores/config/ir3_allowed_entities.lua @@ -0,0 +1,60 @@ +return { + -- belts + 'transport-belt', + 'fast-transport-belt', + 'express-transport-belt', + -- undergrounds + 'underground-belt', + 'fast-underground-belt', + 'express-underground-belt', + -- pipes + 'copper-pipe', + 'copper-pipe-to-ground', + 'copper-pipe-to-ground-short', + 'steam-pipe', + 'steam-pipe-to-ground', + 'steam-pipe-to-ground-short', + 'pipe', + 'pipe-to-ground', + 'pipe-to-ground-short', + 'air-pipe', + 'air-pipe-to-ground', + 'air-pipe-to-ground-short', + -- poles + 'small-electric-pole', + 'medium-electric-pole', + 'big-electric-pole', + 'substation', + 'small-bronze-pole', + 'small-iron-pole', + 'big-wooden-pole', + -- drills + 'electric-mining-drill', + 'burner-mining-drill', + 'pumpjack', + 'steam-drill', + 'chrome-drill', + 'copper-derrick', + 'steel-derrick', + -- simulation (needed?) + --'electric-mining-drill-simulation', + --'steam-drill-simulation', + --'chrome-drill-simulation', + -- vehicles + 'car', + 'tank', + 'spidertron', + 'monowheel', + 'heavy-roller', + 'heavy-picket', + -- rails + 'straight-rail', + 'curved-rail', + 'rail-signal', + 'rail-chain-signal', + 'train-stop', + 'locomotive', + 'cargo-wagon', + 'fluid-wagon', + 'artillery-wagon', +} diff --git a/map_gen/maps/danger_ores/config/ir3_ores.lua b/map_gen/maps/danger_ores/config/ir3_ores.lua new file mode 100644 index 00000000..63623461 --- /dev/null +++ b/map_gen/maps/danger_ores/config/ir3_ores.lua @@ -0,0 +1,122 @@ +local b = require 'map_gen.shared.builders' +local start_value = b.euclidean_value(0, 0.25) +local value = b.exponential_value(0, 0.07, 1.30) + +return { + { + name = 'iron-ore', + ['tiles'] = { + [1] = 'grass-1', + [2] = 'grass-2', + [3] = 'grass-3', + [4] = 'grass-4', + }, + ['start'] = start_value, + ['weight'] = 125, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 75 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 13 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 7 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 5 }, + { resource = b.resource(b.full_shape, 'gold-ore', value), weight = 2 }, + { resource = b.resource(b.full_shape, 'tin-ore', value), weight = 5 }, + } + }, + { + name = 'copper-ore', + ['tiles'] = { + [1] = 'red-desert-0', + [2] = 'red-desert-1', + [3] = 'red-desert-2', + [4] = 'red-desert-3', + }, + ['start'] = start_value, + ['weight'] = 75, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 15 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 70 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 10 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 5 }, + { resource = b.resource(b.full_shape, 'gold-ore', value), weight = 2 }, + { resource = b.resource(b.full_shape, 'tin-ore', value), weight = 5 }, + } + }, + { + name = 'coal', + ['tiles'] = { + [1] = 'dirt-1', + [2] = 'dirt-2', + [3] = 'dirt-3', + [4] = 'dirt-4', + [5] = 'dirt-5', + [6] = 'dirt-6', + [7] = 'dirt-7' + }, + ['start'] = start_value, + ['weight'] = 100, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 18 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 9 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 8 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 65 }, + { resource = b.resource(b.full_shape, 'gold-ore', value), weight = 2 }, + { resource = b.resource(b.full_shape, 'tin-ore', value), weight = 5 }, + } + }, + { + name = 'stone', + ['tiles'] = { + [1] = 'sand-1', + [2] = 'sand-2', + [3] = 'sand-3', + }, + ['start'] = start_value, + ['weight'] = 20, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 25 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 10 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 60 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 5 }, + { resource = b.resource(b.full_shape, 'gold-ore', value), weight = 2 }, + { resource = b.resource(b.full_shape, 'tin-ore', value), weight = 5 }, + } + }, + { + name = 'gold-ore', + ['tiles'] = { + [1] = 'grass-1', + [2] = 'grass-2', + [3] = 'grass-3', + [4] = 'grass-4', + }, + ['start'] = start_value, + ['weight'] = 20, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 15 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 10 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 8 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 5 }, + { resource = b.resource(b.full_shape, 'gold-ore', value), weight = 60 }, + { resource = b.resource(b.full_shape, 'tin-ore', value), weight = 5 }, + } + }, + { + name = 'tin-ore', + ['tiles'] = { + [1] = 'red-desert-0', + [2] = 'red-desert-1', + [3] = 'red-desert-2', + [4] = 'red-desert-3', + }, + ['start'] = start_value, + ['weight'] = 20, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 15 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 10 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 8 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 5 }, + { resource = b.resource(b.full_shape, 'gold-ore', value), weight = 2 }, + { resource = b.resource(b.full_shape, 'tin-ore', value), weight = 65 }, + } + }, +} diff --git a/map_gen/maps/danger_ores/config/ir3_ores_grid_factory.lua b/map_gen/maps/danger_ores/config/ir3_ores_grid_factory.lua new file mode 100644 index 00000000..75e6bf9b --- /dev/null +++ b/map_gen/maps/danger_ores/config/ir3_ores_grid_factory.lua @@ -0,0 +1,84 @@ +local b = require 'map_gen.shared.builders' +local start_value = b.euclidean_value(0, 0.25) +local value = b.exponential_value(0, 0.07, 1.30) + +return { + { + name = 'iron-ore', + ['tiles'] = { + [1] = 'grass-1', + [2] = 'grass-2', + [3] = 'grass-3', + [4] = 'grass-4', + }, + ['start'] = start_value, + ['weight'] = 1, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 75 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 13 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 7 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 5 }, + { resource = b.resource(b.full_shape, 'gold-ore', value), weight = 2 }, + { resource = b.resource(b.full_shape, 'tin-ore', value), weight = 5 }, + } + }, + { + name = 'copper-ore', + ['tiles'] = { + [1] = 'red-desert-0', + [2] = 'red-desert-1', + [3] = 'red-desert-2', + [4] = 'red-desert-3', + }, + ['start'] = start_value, + ['weight'] = 1, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 20 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 65 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 10 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 5 }, + { resource = b.resource(b.full_shape, 'gold-ore', value), weight = 2 }, + { resource = b.resource(b.full_shape, 'tin-ore', value), weight = 5 }, + } + }, + { + name = 'coal', + ['tiles'] = { + [1] = 'dirt-1', + [2] = 'dirt-2', + [3] = 'dirt-3', + [4] = 'dirt-4', + [5] = 'dirt-5', + [6] = 'dirt-6', + [7] = 'dirt-7' + }, + ['start'] = start_value, + ['weight'] = 1, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 18 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 9 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 8 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 65 }, + { resource = b.resource(b.full_shape, 'gold-ore', value), weight = 2 }, + { resource = b.resource(b.full_shape, 'tin-ore', value), weight = 5 }, + } + }, + { + name = 'stone', + ['tiles'] = { + [1] = 'sand-1', + [2] = 'sand-2', + [3] = 'sand-3', + }, + ['start'] = start_value, + ['weight'] = 1, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 8 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 6 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 24 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 5 }, + { resource = b.resource(b.full_shape, 'gold-ore', value), weight = 27 }, + { resource = b.resource(b.full_shape, 'tin-ore', value), weight = 30 }, + } + }, +} diff --git a/map_gen/maps/danger_ores/config/ir3_resource_patches.lua b/map_gen/maps/danger_ores/config/ir3_resource_patches.lua new file mode 100644 index 00000000..c7436e8d --- /dev/null +++ b/map_gen/maps/danger_ores/config/ir3_resource_patches.lua @@ -0,0 +1,22 @@ +local b = require 'map_gen.shared.builders' +local value = b.euclidean_value + +local full_oil_shape = b.translate(b.throttle_xy(b.full_shape, 3, 6, 3, 6), -1, -1) +full_oil_shape = b.use_world_as_local(full_oil_shape) +local oil_shape = b.throttle_world_xy(b.full_shape, 1, 6, 1, 6) + +local function generate_patch(name, data) + return { + scale = data.scale, + threshold = data.t, + resource = b.any{ b.resource(data.shape, name, value(data.base, data.mult)), data.full_shape } + } +end + +return { + generate_patch('crude-oil', { scale = 1/48, base = 100000, mult = 2500, t = 0.60, shape = oil_shape, full_shape = full_oil_shape }), + generate_patch('dirty-steam-fissure', { scale = 1/12, base = 25000, mult = 1, t = 0.70, shape = oil_shape, full_shape = full_oil_shape }), + generate_patch('natural-gas-fissure', { scale = 1/12, base = 25000, mult = 1, t = 0.70, shape = oil_shape, full_shape = full_oil_shape }), + generate_patch('steam-fissure', { scale = 1/12, base = 25000, mult = 1, t = 0.70, shape = oil_shape, full_shape = full_oil_shape }), + generate_patch('sulphur-gas-fissure', { scale = 1/12, base = 25000, mult = 1, t = 0.70, shape = oil_shape, full_shape = full_oil_shape }), +} diff --git a/map_gen/maps/danger_ores/config/krastorio2.lua b/map_gen/maps/danger_ores/config/krastorio2_ores.lua similarity index 98% rename from map_gen/maps/danger_ores/config/krastorio2.lua rename to map_gen/maps/danger_ores/config/krastorio2_ores.lua index 9e1a6794..960b6b68 100644 --- a/map_gen/maps/danger_ores/config/krastorio2.lua +++ b/map_gen/maps/danger_ores/config/krastorio2_ores.lua @@ -1,7 +1,7 @@ local b = require 'map_gen.shared.builders' local start_value = b.euclidean_value(0, 0.35) local value = b.exponential_value(0, 0.06, 1.55) -local special_resources_radius = 32 * 4 +local special_resources_radius = 32 * 6 return { { diff --git a/map_gen/maps/danger_ores/config/omnimatter.lua b/map_gen/maps/danger_ores/config/omnimatter.lua new file mode 100644 index 00000000..ce789aa9 --- /dev/null +++ b/map_gen/maps/danger_ores/config/omnimatter.lua @@ -0,0 +1,34 @@ +local b = require 'map_gen.shared.builders' +local start_value = b.euclidean_value(0, 0.35) +local value = b.exponential_value(0, 0.06, 1.55) + +return { + { + name = 'omnite', + ['tiles'] = { + [1] = 'red-desert-0', + [2] = 'red-desert-1', + [3] = 'red-desert-2', + [4] = 'red-desert-3', + [5] = 'dirt-1', + [6] = 'dirt-2', + [7] = 'dirt-3', + [8] = 'dirt-4', + [9] = 'dirt-5', + [10] = 'dirt-6', + [11] = 'dirt-7', + [12] = 'grass-1', + [13] = 'grass-2', + [14] = 'grass-3', + [15] = 'grass-4', + [16] = 'sand-1', + [17] = 'sand-2', + [18] = 'sand-3', + }, + ['start'] = start_value, + ['weight'] = 1, + ['ratios'] = { + {resource = b.resource(b.full_shape, 'omnite', value), weight = 100}, + } + }, +} diff --git a/map_gen/maps/danger_ores/config/omnimatter_allowed_entities.lua b/map_gen/maps/danger_ores/config/omnimatter_allowed_entities.lua new file mode 100644 index 00000000..8ebc1c4e --- /dev/null +++ b/map_gen/maps/danger_ores/config/omnimatter_allowed_entities.lua @@ -0,0 +1,50 @@ +local entities = { + -- belts + 'basic-transport-belt', + 'transport-belt', + 'fast-transport-belt', + 'express-transport-belt', + -- undergrounds + 'basic-underground-belt', + 'underground-belt', + 'fast-underground-belt', + 'express-underground-belt', + -- pipes + 'pipe', + 'pipe-to-ground', + -- poles + 'small-electric-pole', + 'small-iron-electric-pole', + 'small-omnium-electric-pole', + 'medium-electric-pole', + 'big-electric-pole', + 'substation', + -- drills + 'electric-mining-drill', + 'burner-mining-drill', + -- vehicles + 'car', + 'tank', + 'spidertron', + -- rails + 'straight-rail', + 'curved-rail', + 'rail-signal', + 'rail-chain-signal', + 'train-stop', + 'locomotive', + 'cargo-wagon', + 'fluid-wagon', + 'artillery-wagon', +} + +local list = {} +for _, e in pairs(entities) do + table.insert(list, e) + table.insert(list, e .. '-compressed-compact') + table.insert(list, e .. '-compressed-nanite') + table.insert(list, e .. '-compressed-quantum') + table.insert(list, e .. '-compressed-singularity') +end + +return list diff --git a/map_gen/maps/danger_ores/config/omnimatter_cages.lua b/map_gen/maps/danger_ores/config/omnimatter_cages.lua new file mode 100644 index 00000000..316bd74e --- /dev/null +++ b/map_gen/maps/danger_ores/config/omnimatter_cages.lua @@ -0,0 +1,40 @@ +local b = require 'map_gen.shared.builders' +local start_value = b.euclidean_value(10, 0.35) +local value = b.exponential_value(10, 0.06, 1.55) + +local function cages(void, width, start, stop, shape) + local cage_table = {} + for i = 1, stop/(void+width) +1 do + local r = i*(void+width) + table.insert(cage_table, b.subtract(shape(r), shape(r - width))) + end + local bounds = b.subtract(shape(start+stop), shape(start)) + return b.all({ b.any(cage_table), bounds }) +end + +local cage_shape = cages(80*2, 16*2, 40*2, 800*2, b.rectangle) -- "b.circle" can also be used instead of "b.rectangle" + +return { + { + name = 'omnite', + ['tiles'] = { + [1] = 'landfill' + }, + ['start'] = start_value, + ['weight'] = 1, + ['ratios'] = { + { resource = b.resource(b.invert(cage_shape), 'omnite', value), weight = 100}, + } + }, + { + name = 'infinite-omnite', + ['tiles'] = { + [1] = 'landfill' + }, + ['start'] = start_value, + ['weight'] = 1, + ['ratios'] = { + { resource = b.resource(cage_shape, 'infinite-omnite', value), weight = 100}, + } + }, +} diff --git a/map_gen/maps/danger_ores/config/pyanodon_allowed_entities.lua b/map_gen/maps/danger_ores/config/pyanodon_allowed_entities.lua new file mode 100644 index 00000000..d6db330a --- /dev/null +++ b/map_gen/maps/danger_ores/config/pyanodon_allowed_entities.lua @@ -0,0 +1,139 @@ +return { + -- belts + 'transport-belt', + 'fast-transport-belt', + 'express-transport-belt', + -- undergrounds + 'underground-belt', + 'fast-underground-belt', + 'express-underground-belt', + -- splitters + 'splitter', + 'fast-splitter', + 'express-splitter', + -- pipes + 'pipe', + 'pipe-to-ground', + -- poles + 'small-electric-pole', + 'medium-electric-pole', + 'big-electric-pole', + 'substation', + -- drills + 'electric-mining-drill', + 'burner-mining-drill', + 'pumpjack', + -- vehicles + 'car', + 'tank', + 'spidertron', + -- rails + 'straight-rail', + 'curved-rail', + 'rail-signal', + 'rail-chain-signal', + 'train-stop', + 'locomotive', + 'cargo-wagon', + 'fluid-wagon', + 'artillery-wagon', + -- inserters + 'burner-inserter', + 'inserter', + 'long-handed-inserter', + 'fast-inserter', + 'filter-inserter', + 'stack-inserter', + 'stack-filter-inserter', + -- Py drills + 'aluminium-mine', + 'antimonium-drill-mk01', + 'antimonium-drill-mk02', + 'antimonium-drill-mk03', + 'antimonium-drill-mk04', + 'bitumen-seep-mk01', + 'bitumen-seep-mk02', + 'bitumen-seep-mk03', + 'bitumen-seep-mk04', + 'borax-mine-mk02', + 'borax-mine-mk03', + 'borax-mine-mk04', + 'borax-mine', + 'chromium-mine', + 'coal-mine', + 'collector-mk02', + 'collector-mk03', + 'collector-mk04', + 'collector', + 'copper-mine', + 'diamond-mine', + 'fluid-drill-mk01', + 'fluid-drill-mk02', + 'fluid-drill-mk03', + 'fluid-drill-mk04', + 'geothermal-plant-mk01', + 'harvester', + 'iron-mine', + 'lead-mine', + 'mo-mine', + 'natural-gas-extractor-mk01', + 'natural-gas-extractor-mk02', + 'natural-gas-extractor-mk03', + 'natural-gas-extractor-mk04', + 'natural-gas-seep-mk01', + 'natural-gas-seep-mk02', + 'natural-gas-seep-mk03', + 'natural-gas-seep-mk04', + 'nexelit-mine', + 'nickel-mine', + 'niobium-mine', + 'oil-derrick-mk01', + 'oil-derrick-mk02', + 'oil-derrick-mk03', + 'oil-derrick-mk04', + 'oil-sand-extractor-mk01', + 'oil-sand-extractor-mk02', + 'oil-sand-extractor-mk03', + 'oil-sand-extractor-mk04', + 'phosphate-mine-02', + 'phosphate-mine', + 'quartz-mine', + 'rare-earth-mine', + 'ree-mining-drill-mk01', + 'ree-mining-drill-mk02', + 'ree-mining-drill-mk03', + 'ree-mining-drill-mk04', + 'regolite-mine', + 'salt-mine', + 'sulfur-mine', + 'tar-extractor-mk01', + 'tar-extractor-mk02', + 'tar-extractor-mk03', + 'tar-extractor-mk04', + 'tar-seep-mk01', + 'tar-seep-mk02', + 'tar-seep-mk03', + 'tar-seep-mk04', + 'tin-mine', + 'titanium-mine', + 'uranium-mine', + 'zinc-mine', + -- Py Industry + 'mk02-locomotive', + 'mk02-wagon', + 'mk02-fluid-wagon', + 'niobium-pipe', + 'niobium-pipe-to-ground', + -- Py High Tech + 'ht-pipes', + 'ht-pipes-to-ground', + 'ht-locomotive', + 'ht-generic-wagon', + 'ht-generic-fluid-wagon', + -- Py Alternative Energy + 'nexelit-power-pole', + 'nexelit-substation', + 'mk04-locomotive', + 'mk04-wagon', + 'mk04-fluid-wagon', +} diff --git a/map_gen/maps/danger_ores/config/pyfe_ores.lua b/map_gen/maps/danger_ores/config/pyfe_ores.lua new file mode 100644 index 00000000..c01ccfb4 --- /dev/null +++ b/map_gen/maps/danger_ores/config/pyfe_ores.lua @@ -0,0 +1,118 @@ +local b = require 'map_gen.shared.builders' +local start_value = b.euclidean_value(0, 0.20) +local value = b.exponential_value(0, 0.07, 1.18) +local before = function(radius) return b.circle(radius) end +local after = function(radius) return b.invert(b.circle(radius)) end + +--[[ + This config uses 'map_without_gaps' module to generate the ores. + Each sector has a prevalence of ore, some ores require fluid/special miners to mine it, + which won't be available until later (later) techs. To allow players to still expand and + buils without fluid-required-ores still being on the ground. the spawn of said ores has + been moved out of the way after their corrispective radius. + To still fill the gaps (default ore builder would simply leave gaps, empty tiles, if the + coordinates of drawn ore's shape didn't return any resource amount), a custom ore builder + is used in 'map_without_gaps', which pre-evaluates the yield of the drawn ore, and if nil + (zero) it draws again the previous ore among the ores listed in the 'ratios' field. The + ore which precedes the special ore which will not spawn until target radius will be the + choosen one (until better implementation comes around). Thefallback ore is usually the + main ore of that sector, or one of the designer's choice. +]] + +local R_borax = 32 * 6 +local R_molyb = 32 * 8 +local R_niobium = 32 * 8 + +return { + { + name = 'copper-ore', + ['tiles'] = { + [1] = 'landfill' + }, + ['start'] = start_value, + ['weight'] = 20, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 15 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 10 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 5 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 70 }, + { resource = b.resource(after(R_molyb), 'molybdenum-ore', value), weight = 1 }, + } + }, + { + name = 'coal', + ['tiles'] = { + [1] = 'landfill' + }, + ['start'] = start_value, + ['weight'] = 20, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 18 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 9 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 8 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 65 }, + { resource = b.resource(after(R_molyb), 'molybdenum-ore', value), weight = 1 }, + } + }, + { + name = 'iron-ore', + ['tiles'] = { + [1] = 'landfill' + }, + ['start'] = start_value, + ['weight'] = 20, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 13 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 7 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 5 }, + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 75 }, + { resource = b.resource(after(R_molyb), 'molybdenum-ore', value), weight = 1 }, + } + }, + { + name = 'stone', + ['tiles'] = { + [1] = 'landfill', + }, + ['start'] = start_value, + ['weight'] = 6, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 25 }, + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 10 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 5 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 60 }, + { resource = b.resource(after(R_molyb), 'molybdenum-ore', value), weight = 1 }, + } + }, + { + name = 'molybdenum-ore', + ['tiles'] = { + [1] = 'landfill', + }, + ['start'] = start_value, + ['weight'] = 4, + ['ratios'] = { + { resource = b.resource(b.full_shape, 'copper-ore', value), weight = 15 }, + { resource = b.resource(b.full_shape, 'stone', value), weight = 10 }, + { resource = b.resource(b.full_shape, 'iron-ore', value), weight = 20 }, + { resource = b.resource(b.full_shape, 'coal', value), weight = 5 }, + { resource = b.resource(after(R_molyb), 'molybdenum-ore', value), weight = 50 }, + } + }, + { + name = 'borax', + ['tiles'] = { + [1] = 'landfill', + }, + ['start'] = start_value, + ['weight'] = 6, + ['ratios'] = { + { resource = b.resource(before(R_borax), 'coal', value), weight = 5 }, + { resource = b.resource(before(R_borax), 'stone', value), weight = 10 }, + { resource = b.resource(before(R_borax), 'copper-ore', value), weight = 15 }, + { resource = b.resource(before(R_borax), 'iron-ore', value), weight = 20 }, + { resource = b.resource(after(R_borax), 'borax', value), weight = 50 }, + { resource = b.resource(after(R_niobium), 'niobium', value), weight = 50 }, + } + }, +} diff --git a/map_gen/maps/danger_ores/config/pyfe_resource_patches.lua b/map_gen/maps/danger_ores/config/pyfe_resource_patches.lua new file mode 100644 index 00000000..f31af693 --- /dev/null +++ b/map_gen/maps/danger_ores/config/pyfe_resource_patches.lua @@ -0,0 +1,23 @@ +local b = require 'map_gen.shared.builders' +local value = b.euclidean_value + +local full_oil_shape = b.throttle_xy(b.full_shape, 3, 6, 3, 6) +full_oil_shape = b.use_world_as_local(full_oil_shape) + +local full_patch_shape = b.throttle_xy(b.full_shape, 7, 12, 7, 12) +full_patch_shape = b.use_world_as_local(full_patch_shape) + +local function generate_patch(name, data) + return { + scale = data.scale, + threshold = data.t, + resource = b.resource(data.shape, name, value(data.base, data.mult)) + } +end + +return { + generate_patch('crude-oil', { scale = 1/32, base = 100000, mult = 2500, t = 0.60, shape = full_oil_shape }), + generate_patch('volcanic-pipe', { scale = 1/32, base = 25000, mult = 750, t = 0.60, shape = full_patch_shape }), + generate_patch('regolites', { scale = 1/32, base = 25000, mult = 750, t = 0.60, shape = full_patch_shape }), + generate_patch('uranium-ore', { scale = 1/96, base = 100, mult = 1.5, t = 0.66, shape = b.full_shape }), +} diff --git a/map_gen/maps/danger_ores/modules/biter_drops_exotic_industries.lua b/map_gen/maps/danger_ores/modules/biter_drops_exotic_industries.lua new file mode 100644 index 00000000..67b8eaeb --- /dev/null +++ b/map_gen/maps/danger_ores/modules/biter_drops_exotic_industries.lua @@ -0,0 +1,59 @@ +local Event = require 'utils.event' +local Task = require 'utils.task' +local Token = require 'utils.token' + +local weights = { + ['ei_energy-crystal'] = 10, + ['ei_gold-chunk'] = 10, + ['ei_alien-resin'] = 150, + ['ei_alien-seed'] = 4, + ['ei_alien-beacon'] = 1, +} +local weighted_table = {} + +for item, weight in pairs(weights) do + for _ = 1, weight do + weighted_table[#weighted_table + 1] = item + end +end + +local function draw_random() + return weighted_table[math.random(#weighted_table)] +end + +local spill_items = Token.register(function(data) + local surface = data.surface + if not surface or not surface.valid then + return + end + + surface.spill_item_stack(data.position, data.stack, true) +end) + +Event.add(defines.events.on_entity_died, function(event) + local entity = event.entity + if not entity or not entity.valid then + return + end + + local entity_name = entity.name + if not(entity_name == "biter-spawner" or entity_name == 'spitter-spawner') then + return + end + + local item = draw_random() + if not item then + return + end + + local stack = { + name = item, + count = 1 + } + + Task.set_timeout_in_ticks(1, spill_items, { + stack = stack, + surface = entity.surface, + position = entity.position + }) +end) diff --git a/map_gen/maps/danger_ores/modules/concrete_on_landfill.lua b/map_gen/maps/danger_ores/modules/concrete_on_landfill.lua index 65617b67..e29682de 100644 --- a/map_gen/maps/danger_ores/modules/concrete_on_landfill.lua +++ b/map_gen/maps/danger_ores/modules/concrete_on_landfill.lua @@ -1,10 +1,11 @@ local Event = require 'utils.event' return function(config) + local refund_tile = config.refund_tile or 'refined-concrete' local replace_tile = config.tile or 'blue-refined-concrete' local replace_tiles = {['landfill'] = true, [replace_tile] = true} - local brush_tools = {['refined-concrete'] = true} -- , ['refined-hazard-concrete'] = true} + local brush_tools = {[refund_tile] = true} -- , ['refined-hazard-concrete'] = true} local character_main = defines.inventory.character_main local robot_cargo = defines.inventory.robot_cargo @@ -25,7 +26,7 @@ return function(config) end if inventory and inventory.valid and refund_count > 0 then - inventory.insert {name = 'refined-concrete', count = refund_count} + inventory.insert {name = refund_tile, count = refund_count} end end @@ -49,7 +50,7 @@ return function(config) surface.set_tiles(new_tiles) if inventory and inventory.valid and refund_count > 0 then - inventory.insert {name = 'refined-concrete', count = refund_count} + inventory.insert {name = refund_tile, count = refund_count} end end diff --git a/map_gen/maps/danger_ores/modules/main_ores_cage.lua b/map_gen/maps/danger_ores/modules/main_ores_cage.lua new file mode 100644 index 00000000..7e202a71 --- /dev/null +++ b/map_gen/maps/danger_ores/modules/main_ores_cage.lua @@ -0,0 +1,43 @@ +local Helper = require 'map_gen.maps.danger_ores.modules.helper' +local b = require 'map_gen.shared.builders' +local table = require 'utils.table' + +return function(config) + local main_ores = config.main_ores + local shuffle_order = config.main_ores_shuffle_order + local main_ores_rotate = config.main_ores_rotate or 0 + local main_ores_split_count = config.main_ores_split_count or 1 + + main_ores = Helper.split_ore(main_ores, main_ores_split_count) + + return function(tile_builder, ore_builder, spawn_shape, water_shape, random_gen) + local shapes = {} + + for _, ore_data in pairs(main_ores) do + local ore_name = ore_data.name + local tiles = ore_data.tiles + local land = tile_builder(tiles) + + local ratios = ore_data.ratios + local weighted = b.prepare_weighted_array(ratios) + local amount = ore_data.start + + local ore = ore_builder(ore_name, amount, ratios, weighted) + + local shape = b.apply_entity(land, ore) + shapes[#shapes + 1] = {shape = shape, weight = ore_data.weight} + end + + if shuffle_order then + table.shuffle_table(shapes, random_gen) + end + + local ores = b.any_entity_pattern(shapes) + + if main_ores_rotate ~= 0 then + ores = b.rotate(ores, math.rad(main_ores_rotate)) + end + + return b.any {spawn_shape, water_shape, ores} + end +end diff --git a/map_gen/maps/danger_ores/modules/map.lua b/map_gen/maps/danger_ores/modules/map.lua index ad49f4e0..eb402cfe 100644 --- a/map_gen/maps/danger_ores/modules/map.lua +++ b/map_gen/maps/danger_ores/modules/map.lua @@ -1,18 +1,15 @@ local Global = require 'utils.global' local b = require 'map_gen.shared.builders' local Perlin = require 'map_gen.shared.perlin_noise' -local table = require 'utils.table' local math = require 'utils.math' local seed_provider = require 'map_gen.maps.danger_ores.modules.seed_provider' local RS = require 'map_gen.shared.redmew_surface' local deafult_main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores' +local default_ore_builder = require 'map_gen.maps.danger_ores.modules.ore_builder' -local binary_search = table.binary_search local perlin_noise = Perlin.noise local floor = math.floor -local random = math.random -local bnot = bit32.bnot local function spawn_builder(config) local spawn_circle = config.spawn_shape or b.circle(64) @@ -53,43 +50,7 @@ local function empty_builder() end return function(config) - local start_ore_shape - local resource_patches - local no_resource_patch_shape - local dense_patches - - local function ore_builder(ore_name, amount, ratios, weighted) - local start_ore = b.resource(b.full_shape, ore_name, amount) - local total = weighted.total - - return function(x, y, world) - if start_ore_shape(x, y) then - return start_ore(x, y, world) - end - - if not no_resource_patch_shape(x, y) then - local resource_patches_entity = resource_patches(x, y, world) - if resource_patches_entity then - return resource_patches_entity - end - end - - local i = random() * total - local index = binary_search(weighted, i) - if index < 0 then - index = bnot(index) - end - - local resource = ratios[index].resource - local entity = resource(x, y, world) - - dense_patches(x, y, entity) - if entity then entity.enable_tree_removal = false end - - return entity - end - end - + local ore_builder = config.ore_builder or default_ore_builder local map Global.register_init({}, function(tbl) tbl.seed = RS.get_surface().map_gen_settings.seed @@ -104,14 +65,16 @@ return function(config) local main_ores_builder = (config.main_ores_builder or deafult_main_ores_builder)(config) local post_map_func = config.post_map_func - start_ore_shape = config.start_ore_shape or b.circle(68) - resource_patches = (config.resource_patches or no_op)(config) or b.empty_shape - no_resource_patch_shape = config.no_resource_patch_shape or b.empty_shape - dense_patches = (config.dense_patches or no_op)(config) or no_op + local ore_builder_config = { + start_ore_shape = config.start_ore_shape or b.circle(68), + resource_patches = (config.resource_patches or no_op)(config) or b.empty_shape, + no_resource_patch_shape = config.no_resource_patch_shape or b.empty_shape, + dense_patches = (config.dense_patches or no_op)(config) or no_op, + } local random_gen = tbl.random random_gen.re_seed(tbl.seed) - map = main_ores_builder(tile_builder, ore_builder, spawn_shape, water_shape, random_gen) + map = main_ores_builder(tile_builder, ore_builder(ore_builder_config), spawn_shape, water_shape, random_gen) if enemy_shape then map = b.apply_entity(map, enemy_shape) diff --git a/map_gen/maps/danger_ores/modules/map_poll.lua b/map_gen/maps/danger_ores/modules/map_poll.lua index baa7ca5c..3ec9b9fb 100644 --- a/map_gen/maps/danger_ores/modules/map_poll.lua +++ b/map_gen/maps/danger_ores/modules/map_poll.lua @@ -18,11 +18,21 @@ end) local normal_mod_pack = 'normal_mod_pack' local bobs_mod_pack = 'bobs_mod_pack' local krastorio_mod_pack = 'krastorio_mod_pack' +local omnimatter_mod_pack = 'omnimatter_mod_pack' +local bz_mod_pack = 'bz_mod_pack' +local ei_mod_pack = 'ei_mod_pack' +local py_short_mod_pack = 'py_short_mod_pack' +local ir3_mod_pack = 'ir3_mod_pack' local mod_packs = { normal_mod_pack = 'danger_ore29', bobs_mod_pack = 'danger_ore_bobs3', - krastorio_mod_pack = 'danger_ore_krastorio2' + krastorio_mod_pack = 'danger_ore_krastorio3', + omnimatter_mod_pack = 'danger_ore_omnimatter', + bz_mod_pack = 'danger_ore_bz', + ei_mod_pack = 'danger_ore_ei', + py_short_mod_pack = 'danger_ore_py_short', + ir3_mod_pack = 'danger_ore_ir3', } local maps = { @@ -129,7 +139,47 @@ local maps = { { name = 'danger-ore-krastorio2', mod_pack = krastorio_mod_pack, - display_name = 'Krastorio2 mod (landfill + terraforming)' + display_name = 'Krastorio2 (landfill)' + }, + { + name = 'danger-ore-omnimatter', + mod_pack = omnimatter_mod_pack, + display_name = 'Omnimatter (default map)' + }, + { + name = 'danger-ore-omnimatter-cages', + mod_pack = omnimatter_mod_pack, + display_name = 'Omnimatter cages (landfill + frames)' + }, + { + name = 'danger-ore-bz', + mod_pack = bz_mod_pack, + display_name = 'Very BZ (default map)' + }, + { + name = 'danger-ore-exotic-industries', + mod_pack = ei_mod_pack, + display_name = 'Exotic Industries (default map)' + }, + { + name = 'danger-ore-exotic-industries-spiral', + mod_pack = ei_mod_pack, + display_name = 'Exotic Industries spiral (without void)' + }, + { + name = 'danger-ore-pyfe', + mod_pack = py_short_mod_pack, + display_name = 'Pyanodon Short (landfill)' + }, + { + name = 'danger-ore-industrial-revolution-3', + mod_pack = ir3_mod_pack, + display_name = 'Industrial Revolution 3 (default map)' + }, + { + name = 'danger-ore-industrial-revolution-3-grid-factory', + mod_pack = ir3_mod_pack, + display_name = 'Industrial Revolution 3 chessboard (fixed squares)' } } diff --git a/map_gen/maps/danger_ores/modules/ore_builder.lua b/map_gen/maps/danger_ores/modules/ore_builder.lua new file mode 100644 index 00000000..569efbf0 --- /dev/null +++ b/map_gen/maps/danger_ores/modules/ore_builder.lua @@ -0,0 +1,44 @@ +local b = require 'map_gen.shared.builders' +local table = require 'utils.table' +local random = math.random +local binary_search = table.binary_search +local bnot = bit32.bnot + +return function(ore_builder_config) + local start_ore_shape = ore_builder_config.start_ore_shape + local resource_patches = ore_builder_config.resource_patches + local no_resource_patch_shape = ore_builder_config.no_resource_patch_shape + local dense_patches = ore_builder_config.dense_patches + + return function(ore_name, amount, ratios, weighted) + local start_ore = b.resource(b.full_shape, ore_name, amount) + local total = weighted.total + + return function(x, y, world) + if start_ore_shape(x, y) then + return start_ore(x, y, world) + end + + if not no_resource_patch_shape(x, y) then + local resource_patches_entity = resource_patches(x, y, world) + if resource_patches_entity then + return resource_patches_entity + end + end + + local i = random() * total + local index = binary_search(weighted, i) + if index < 0 then + index = bnot(index) + end + + local resource = ratios[index].resource + local entity = resource(x, y, world) + + dense_patches(x, y, entity) + if entity then entity.enable_tree_removal = false end + + return entity + end + end +end \ No newline at end of file diff --git a/map_gen/maps/danger_ores/modules/ore_builder_without_gaps.lua b/map_gen/maps/danger_ores/modules/ore_builder_without_gaps.lua new file mode 100644 index 00000000..55598fac --- /dev/null +++ b/map_gen/maps/danger_ores/modules/ore_builder_without_gaps.lua @@ -0,0 +1,49 @@ +local b = require 'map_gen.shared.builders' +local table = require 'utils.table' +local random = math.random +local binary_search = table.binary_search +local bnot = bit32.bnot + +return function(ore_builder_config) + local start_ore_shape = ore_builder_config.start_ore_shape + local resource_patches = ore_builder_config.resource_patches + local no_resource_patch_shape = ore_builder_config.no_resource_patch_shape + local dense_patches = ore_builder_config.dense_patches + + return function(ore_name, amount, ratios, weighted) + local start_ore = b.resource(b.full_shape, ore_name, amount) + local total = weighted.total + + return function(x, y, world) + if start_ore_shape(x, y) then + return start_ore(x, y, world) + end + + if not no_resource_patch_shape(x, y) then + local resource_patches_entity = resource_patches(x, y, world) + if resource_patches_entity then + return resource_patches_entity + end + end + + local i = random() * total + local index = binary_search(weighted, i) + if index < 0 then + index = bnot(index) + end + + local resource = ratios[index].resource + local entity = resource(x, y, world) + local tries = #ratios + while(entity == nil and tries > 0) do + entity = ratios[tries].resource(x, y, world) + tries = tries - 1 + end + + dense_patches(x, y, entity) + if entity then entity.enable_tree_removal = false end + + return entity + end + end +end \ No newline at end of file diff --git a/map_gen/maps/danger_ores/modules/rocket_launched_exotic_industries.lua b/map_gen/maps/danger_ores/modules/rocket_launched_exotic_industries.lua new file mode 100644 index 00000000..de04ce8d --- /dev/null +++ b/map_gen/maps/danger_ores/modules/rocket_launched_exotic_industries.lua @@ -0,0 +1,75 @@ +local Event = require 'utils.event' +local RS = require 'map_gen.shared.redmew_surface' +local Server = require 'features.server' +local ShareGlobals = require 'map_gen.maps.danger_ores.modules.shared_globals' + +return function() + ShareGlobals.data.biters_disabled = false + ShareGlobals.data.map_won = false + ShareGlobals.data.show_reset_message = true + + local function disable_biters() + if ShareGlobals.data.biters_disabled then + return + end + + ShareGlobals.data.biters_disabled = true + game.forces.enemy.kill_all_units() + for _, enemy_entity in pairs(RS.get_surface().find_entities_filtered({force = 'enemy'})) do + enemy_entity.destroy() + end + + local message = table.concat { + 'Launching the first satellite has killed all the biters. ', + 'Build and activate the Black Hole to win the map.' + } + game.print({'danger_ores.biters_disabled_ei'}) + Server.to_discord_bold(message) + end + + local function rocket_launched(event) + if ShareGlobals.data.map_won then + return + end + + local entity = event.rocket + if not entity or not entity.valid or not entity.force == 'player' then + return + end + + local inventory = entity.get_inventory(defines.inventory.rocket) + if not inventory or not inventory.valid then + return + end + + local satellite_count = game.forces.player.get_item_launched('satellite') + if satellite_count == 0 then + return + end + + if satellite_count == 1 then + disable_biters() + end + end + + local function win() + if ShareGlobals.data.map_won then + return + end + + ShareGlobals.data.map_won = true + local message = 'Congratulations! The map has been won. Restart the map with /restart' + game.print({'danger_ores.win'}) + Server.to_discord_bold(message) + end + + local function on_win_condition_met() + if ShareGlobals.show_reset_message and game.finished_but_continuing then + win() + end + end + + Event.on_nth_tick(60 * 17, on_win_condition_met) + Event.add(defines.events.on_rocket_launched, rocket_launched) +end + diff --git a/map_gen/maps/danger_ores/modules/rocket_launched_krastorio2.lua b/map_gen/maps/danger_ores/modules/rocket_launched_krastorio2.lua index a58069d5..963885a6 100644 --- a/map_gen/maps/danger_ores/modules/rocket_launched_krastorio2.lua +++ b/map_gen/maps/danger_ores/modules/rocket_launched_krastorio2.lua @@ -20,7 +20,7 @@ return function() local message = table.concat { 'Launching the first satellite has killed all the biters. ', - 'Build and activate the intergalactic transceiver to win the map.' + 'Build and activate the Intergalactic Transceiver to win the map.' } game.print({'danger_ores.biters_disabled_k2'}) Server.to_discord_bold(message) diff --git a/map_gen/maps/danger_ores/modules/rocket_launched_pyanodon.lua b/map_gen/maps/danger_ores/modules/rocket_launched_pyanodon.lua new file mode 100644 index 00000000..77425c73 --- /dev/null +++ b/map_gen/maps/danger_ores/modules/rocket_launched_pyanodon.lua @@ -0,0 +1,78 @@ +local Event = require 'utils.event' +local RS = require 'map_gen.shared.redmew_surface' +local Server = require 'features.server' +local ShareGlobals = require 'map_gen.maps.danger_ores.modules.shared_globals' + +return function() + ShareGlobals.data.biters_disabled = false + ShareGlobals.data.map_won = false + + local function disable_biters() + if ShareGlobals.data.biters_disabled then + return + end + + ShareGlobals.data.biters_disabled = true + game.forces.enemy.kill_all_units() + for _, enemy_entity in pairs(RS.get_surface().find_entities_filtered({force = 'enemy'})) do + enemy_entity.destroy() + end + + local message = table.concat { + 'Launching the first satellite has killed all the biters. ', + 'Research Pyrrhic Victory to win the game.' + } + game.print({'danger_ores.biters_disabled_py'}) + Server.to_discord_bold(message) + end + + local function rocket_launched(event) + if ShareGlobals.data.map_won then + return + end + + local entity = event.rocket + if not entity or not entity.valid or not entity.force == 'player' then + return + end + + local inventory = entity.get_inventory(defines.inventory.rocket) + if not inventory or not inventory.valid then + return + end + + local satellite_count = game.forces.player.get_item_launched('satellite') + if satellite_count == 0 then + return + end + + if satellite_count == 1 then + disable_biters() + end + end + + local function win() + if ShareGlobals.data.map_won then + return + end + + ShareGlobals.data.map_won = true + local message = 'Congratulations! The map has been won. Restart the map with /restart' + game.print({'danger_ores.win'}) + Server.to_discord_bold(message) + end + + local function on_research_finished(event) + local tech = event.research + if not tech then + return + end + if tech.name and tech.name == 'pyrrhic' then + win() + end + end + + Event.add(defines.events.on_rocket_launched, rocket_launched) + Event.add(defines.events.on_research_finished, on_research_finished) +end + diff --git a/map_gen/maps/danger_ores/presets/danger_ore_bz.lua b/map_gen/maps/danger_ores/presets/danger_ore_bz.lua new file mode 100644 index 00000000..f2d71a72 --- /dev/null +++ b/map_gen/maps/danger_ores/presets/danger_ore_bz.lua @@ -0,0 +1,172 @@ +local RS = require 'map_gen.shared.redmew_surface' +local MGSP = require 'resources.map_gen_settings' +local Event = require 'utils.event' +local b = require 'map_gen.shared.builders' +local Config = require 'config' + +local ScenarioInfo = require 'features.gui.info' +ScenarioInfo.set_map_name('Danger Ores x Very BZ') +ScenarioInfo.set_map_description([[ +Clear the ore to expand the base, +focus mining efforts on specific sectors to ensure +proper material ratios, expand the map with pollution! +]]) +ScenarioInfo.add_map_extra_info([[ +This map is split in 15 sectors. Each sector has a main resource. + +You may not build the factory on ore patches. Exceptions: + [item=burner-mining-drill] [item=electric-mining-drill] [item=pumpjack] [item=small-electric-pole] [item=medium-electric-pole] [item=big-electric-pole] [item=substation] [item=car] [item=tank] [item=spidertron] [item=locomotive] [item=cargo-wagon] [item=fluid-wagon] [item=artillery-wagon] + [item=transport-belt] [item=fast-transport-belt] [item=express-transport-belt] [item=underground-belt] [item=fast-underground-belt] [item=express-underground-belt] [item=rail] [item=rail-signal] [item=rail-chain-signal] [item=train-stop] + +The map size is restricted to the pollution generated. A significant amount of +pollution must affect a section of the map before it is revealed. Pollution +does not affect biter evolution. +]]) + +ScenarioInfo.set_new_info([[ +2023-10-21: + - Added BZ preset +]]) + +ScenarioInfo.add_extra_rule({'info.rules_text_danger_ore'}) + +global.config.redmew_qol.loaders = false + +local map = require 'map_gen.maps.danger_ores.modules.map' +local main_ores_config = require 'map_gen.maps.danger_ores.config.bz_ores' +local resource_patches = require 'map_gen.maps.danger_ores.modules.resource_patches' +local resource_patches_config = require 'map_gen.maps.danger_ores.config.bz_resource_patches' +local water = require 'map_gen.maps.danger_ores.modules.water' +local trees = require 'map_gen.maps.danger_ores.modules.trees' +local enemy = require 'map_gen.maps.danger_ores.modules.enemy' +local spawn_tile = script.active_mods['alien-biomes'] and 'volcanic-green-heat-2' or 'grass-1' + +local banned_entities = require 'map_gen.maps.danger_ores.modules.banned_entities' +local allowed_entities = require 'map_gen.maps.danger_ores.config.vanilla_allowed_entities' +banned_entities(allowed_entities) + +local ores_names = { + -- fluid patches + 'crude-oil', + 'gas', + -- ore patches + 'aluminum-ore', + 'coal', + 'copper-ore', + 'gold-ore', + 'graphite', + 'iron-ore', + 'lead-ore', + 'rich-copper-ore', + 'salt', + 'stone', + 'tin-ore', + 'titanium-ore', + 'tungsten-ore', + 'uranium-ore', + 'zircon', +} +local ore_oil_none = {} +for _, v in pairs(ores_names) do + ore_oil_none[v] = {frequency = 1, richness = 1, size = 0} +end +ore_oil_none = {autoplace_controls = ore_oil_none} + +RS.set_map_gen_settings({ + MGSP.grass_only, + MGSP.enable_water, + { terrain_segmentation = 'normal', water = 'normal' }, + MGSP.starting_area_very_low, + ore_oil_none, + MGSP.enemy_none, + MGSP.cliff_none, + MGSP.tree_none +}) + +Config.market.enabled = false +Config.player_rewards.enabled = false +Config.player_create.starting_items = { + { count = 1, name = 'stone-furnace'}, + { count = 2, name = 'burner-mining-drill' }, + { count = 50, name = 'wood' }, +} +Config.dump_offline_inventories = { + enabled = true, + offline_timout_mins = 30 -- time after which a player logs off that their inventory is provided to the team +} +Config.paint.enabled = false + +if script.active_mods['early_construction'] then + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-light-armor' }) + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-equipment' }) + table.insert(Config.player_create.starting_items, { count = 100, name = 'early-construction-robot' }) +end + +Event.on_init(function() + game.draw_resource_selection = false + + game.forces.player.technologies['mining-productivity-1'].enabled = false + game.forces.player.technologies['mining-productivity-2'].enabled = false + game.forces.player.technologies['mining-productivity-3'].enabled = false + game.forces.player.technologies['mining-productivity-4'].enabled = false + + game.forces.player.manual_mining_speed_modifier = 1 + + game.difficulty_settings.technology_price_multiplier = game.difficulty_settings.technology_price_multiplier * 5 + + game.map_settings.enemy_evolution.time_factor = 0.000007 -- default 0.000004 + game.map_settings.enemy_evolution.destroy_factor = 0.000010 -- default 0.002 + game.map_settings.enemy_evolution.pollution_factor = 0.000000 -- Pollution has no affect on evolution default 0.0000009 + + RS.get_surface().always_day = true + RS.get_surface().peaceful_mode = true +end) + +local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming' +terraforming({start_size = 10 * 32, min_pollution = 400, max_pollution = 16000, pollution_increment = 4}) + +local rocket_launched = require 'map_gen.maps.danger_ores.modules.rocket_launched_simple' +rocket_launched({win_satellite_count = 1000}) + +local restart_command = require 'map_gen.maps.danger_ores.modules.restart_command' +restart_command({scenario_name = 'danger-ore-bz'}) + +local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' +container_dump({entity_name = 'coal'}) + +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + +require 'map_gen.maps.danger_ores.modules.biter_drops' + +require 'map_gen.maps.danger_ores.modules.map_poll' + +local config = { + spawn_tile = spawn_tile, + spawn_shape = b.circle(40), + start_ore_shape = b.circle(48), + no_resource_patch_shape = b.circle(80), + main_ores = main_ores_config, + main_ores_shuffle_order = true, + resource_patches = resource_patches, + resource_patches_config = resource_patches_config, + water = water, + water_scale = 1 / 96, + water_threshold = 0.5, + deepwater_threshold = 0.55, + no_water_shape = b.circle(102), + trees = trees, + trees_scale = 1 / 64, + trees_threshold = 0.4, + trees_chance = 0.875, + enemy = enemy, + enemy_factor = 10 / (768 * 32), + enemy_max_chance = 1 / 6, + enemy_scale_factor = 32, + fish_spawn_rate = 0.025, + dense_patches_scale = 1 / 48, + dense_patches_threshold = 0.5, + dense_patches_multiplier = 50 +} + +return map(config) diff --git a/map_gen/maps/danger_ores/presets/danger_ore_exotic_industries.lua b/map_gen/maps/danger_ores/presets/danger_ore_exotic_industries.lua new file mode 100644 index 00000000..bc0396be --- /dev/null +++ b/map_gen/maps/danger_ores/presets/danger_ore_exotic_industries.lua @@ -0,0 +1,166 @@ +local RS = require 'map_gen.shared.redmew_surface' +local MGSP = require 'resources.map_gen_settings' +local Event = require 'utils.event' +local b = require 'map_gen.shared.builders' +local Config = require 'config' + +local ScenarioInfo = require 'features.gui.info' +ScenarioInfo.set_map_name('Danger Ores x Exotic Industries') +ScenarioInfo.set_map_description([[ +Clear the ore to expand the base, +focus mining efforts on specific sectors to ensure +proper material ratios, expand the map with pollution! +]]) +ScenarioInfo.add_map_extra_info([[ +This map is split in 3 sectors. Each sector has a main resource. Resource veins are scattered across the map. + +You may not build the factory on ore patches. Exceptions: + [item=transport-belt] [item=fast-transport-belt] [item=express-transport-belt] [item=ei_neo-belt] [item=underground-belt] [item=fast-underground-belt] [item=express-underground-belt] [item=ei_neo-underground-belt] + [item=pipe] [item=pipe-to-ground] [item=ei_insulated-pipe] [item=ei_insulated-underground-pipe] [item=small-electric-pole] [item=medium-electric-pole] [item=big-electric-pole] [item=substation] + [item=electric-mining-drill] [item=ei_advanced-electric-mining-drill] [item=ei_superior-electric-mining-drill] [item=ei_deep-drill] [item=ei_advanced-deep-drill] [item=burner-mining-drill] [item=pumpjack] [item=ei_steam-oil-pumpjack] + [item=car] [item=tank] [item=spidertron] + [item=rail] [item=rail-signal] [item=rail-chain-signal] [item=train-stop] [item=locomotive] [item=cargo-wagon] [item=fluid-wagon] [item=artillery-wagon] [item=ei_steam-basic-locomotive] [item=ei_steam-basic-wagon] [item=ei_steam-advanced-locomotive] [item=ei_steam-advanced-wagon] [item=ei_steam-advanced-fluid-wagon] + +The map size is restricted to the pollution generated. A significant amount of +pollution must affect a section of the map before it is revealed. Pollution +does not affect biter evolution. +]]) + +ScenarioInfo.set_new_info([[ +2023-10-23: + - Added EI preset +]]) + +ScenarioInfo.add_extra_rule({'info.rules_text_danger_ore'}) + +global.config.redmew_qol.loaders = false + +local map = require 'map_gen.maps.danger_ores.modules.map' +local main_ores_config = require 'map_gen.maps.danger_ores.config.vanilla_ores' +local resource_patches = require 'map_gen.maps.danger_ores.modules.resource_patches' +local resource_patches_config = require 'map_gen.maps.danger_ores.config.exotic_industries_resource_patches' +local water = require 'map_gen.maps.danger_ores.modules.water' +local trees = require 'map_gen.maps.danger_ores.modules.trees' +local enemy = require 'map_gen.maps.danger_ores.modules.enemy' + +local banned_entities = require 'map_gen.maps.danger_ores.modules.banned_entities' +local allowed_entities = require 'map_gen.maps.danger_ores.config.exotic_industries_allowed_entities' +banned_entities(allowed_entities) + +local ores_names = { + -- point patches + 'crude-oil', + 'ei_coal-patch', + 'ei_copper-patch', + 'ei_gold-patch', + 'ei_iron-patch', + 'ei_lead-patch', + 'ei_neodym-patch', + 'ei_sulfur-patch', + 'ei_uranium-patch', + -- ore patches + 'coal', + 'copper-ore', + 'iron-ore', +} +local ore_oil_none = {} +for _, v in pairs(ores_names) do + ore_oil_none[v] = {frequency = 1, richness = 1, size = 0} +end +ore_oil_none = {autoplace_controls = ore_oil_none} + +RS.set_map_gen_settings({ + MGSP.grass_only, + MGSP.enable_water, + { terrain_segmentation = 'normal', water = 'normal' }, + MGSP.starting_area_very_low, + ore_oil_none, + MGSP.enemy_none, + MGSP.cliff_none, + MGSP.tree_none +}) + +Config.market.enabled = false +Config.player_rewards.enabled = false +Config.player_create.starting_items = { + { count = 1, name = 'stone-furnace'}, + { count = 2, name = 'burner-mining-drill' }, + { count = 50, name = 'wood' }, +} +Config.dump_offline_inventories = { + enabled = true, + offline_timout_mins = 30 -- time after which a player logs off that their inventory is provided to the team +} +Config.paint.enabled = false + +if script.active_mods['early_construction'] then + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-light-armor' }) + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-equipment' }) + table.insert(Config.player_create.starting_items, { count = 100, name = 'early-construction-robot' }) +end + +Event.on_init(function() + game.draw_resource_selection = false + + game.forces.player.technologies['mining-productivity-1'].enabled = false + game.forces.player.technologies['mining-productivity-2'].enabled = false + game.forces.player.technologies['mining-productivity-3'].enabled = false + game.forces.player.technologies['mining-productivity-4'].enabled = false + + game.forces.player.manual_mining_speed_modifier = 1 + + game.map_settings.enemy_evolution.time_factor = 0.000007 -- default 0.000004 + game.map_settings.enemy_evolution.destroy_factor = 0.000010 -- default 0.002 + game.map_settings.enemy_evolution.pollution_factor = 0.000000 -- Pollution has no affect on evolution default 0.0000009 + + RS.get_surface().always_day = true + RS.get_surface().peaceful_mode = true +end) + +local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming' +terraforming({start_size = 10 * 32, min_pollution = 400, max_pollution = 16000, pollution_increment = 4}) + +local rocket_launched = require 'map_gen.maps.danger_ores.modules.rocket_launched_exotic_industries' +rocket_launched() + +local restart_command = require 'map_gen.maps.danger_ores.modules.restart_command' +restart_command({scenario_name = 'danger-ore-exotic-industries'}) + +local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' +container_dump({entity_name = 'coal'}) + +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + +require 'map_gen.maps.danger_ores.modules.biter_drops_exotic_industries' + +require 'map_gen.maps.danger_ores.modules.map_poll' + +local config = { + spawn_shape = b.circle(40), + start_ore_shape = b.circle(48), + no_resource_patch_shape = b.circle(80), + main_ores = main_ores_config, + main_ores_shuffle_order = true, + resource_patches = resource_patches, + resource_patches_config = resource_patches_config, + water = water, + water_scale = 1 / 96, + water_threshold = 0.5, + deepwater_threshold = 0.55, + no_water_shape = b.circle(102), + trees = trees, + trees_scale = 1 / 64, + trees_threshold = 0.4, + trees_chance = 0.875, + enemy = enemy, + enemy_factor = 10 / (768 * 32), + enemy_max_chance = 1 / 6, + enemy_scale_factor = 32, + fish_spawn_rate = 0.025, + dense_patches_scale = 1 / 48, + dense_patches_threshold = 0.5, + dense_patches_multiplier = 50 +} + +return map(config) diff --git a/map_gen/maps/danger_ores/presets/danger_ore_exotic_industries_spiral.lua b/map_gen/maps/danger_ores/presets/danger_ore_exotic_industries_spiral.lua new file mode 100644 index 00000000..ae5dcfd7 --- /dev/null +++ b/map_gen/maps/danger_ores/presets/danger_ore_exotic_industries_spiral.lua @@ -0,0 +1,169 @@ +local RS = require 'map_gen.shared.redmew_surface' +local MGSP = require 'resources.map_gen_settings' +local Event = require 'utils.event' +local b = require 'map_gen.shared.builders' +local Config = require 'config' + +local ScenarioInfo = require 'features.gui.info' +ScenarioInfo.set_map_name('Danger Ores x Exotic Industries Spiral') +ScenarioInfo.set_map_description([[ +Clear the ore to expand the base, +focus mining efforts on specific sectors to ensure +proper material ratios, expand the map with pollution! +]]) +ScenarioInfo.add_map_extra_info([[ +This map is split in 3 sectors. Each sector has a main resource. Resource veins are scattered across the map. + +You may not build the factory on ore patches. Exceptions: + [item=transport-belt] [item=fast-transport-belt] [item=express-transport-belt] [item=ei_neo-belt] [item=underground-belt] [item=fast-underground-belt] [item=express-underground-belt] [item=ei_neo-underground-belt] + [item=pipe] [item=pipe-to-ground] [item=ei_insulated-pipe] [item=ei_insulated-underground-pipe] [item=small-electric-pole] [item=medium-electric-pole] [item=big-electric-pole] [item=substation] + [item=electric-mining-drill] [item=ei_advanced-electric-mining-drill] [item=ei_superior-electric-mining-drill] [item=ei_deep-drill] [item=ei_advanced-deep-drill] [item=burner-mining-drill] [item=pumpjack] [item=ei_steam-oil-pumpjack] + [item=car] [item=tank] [item=spidertron] + [item=rail] [item=rail-signal] [item=rail-chain-signal] [item=train-stop] [item=locomotive] [item=cargo-wagon] [item=fluid-wagon] [item=artillery-wagon] [item=ei_steam-basic-locomotive] [item=ei_steam-basic-wagon] [item=ei_steam-advanced-locomotive] [item=ei_steam-advanced-wagon] [item=ei_steam-advanced-fluid-wagon] + +The map size is restricted to the pollution generated. A significant amount of +pollution must affect a section of the map before it is revealed. Pollution +does not affect biter evolution. +]]) + +ScenarioInfo.set_new_info([[ +2023-10-26: + - Added EI spiral preset +]]) + +ScenarioInfo.add_extra_rule({'info.rules_text_danger_ore'}) + +global.config.redmew_qol.loaders = false + +local map = require 'map_gen.maps.danger_ores.modules.map' +local main_ores_config = require 'map_gen.maps.danger_ores.config.vanilla_ores' +local main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_spiral' +local resource_patches = require 'map_gen.maps.danger_ores.modules.resource_patches' +local resource_patches_config = require 'map_gen.maps.danger_ores.config.exotic_industries_resource_patches' +local water = require 'map_gen.maps.danger_ores.modules.water' +local trees = require 'map_gen.maps.danger_ores.modules.trees' +local enemy = require 'map_gen.maps.danger_ores.modules.enemy' + +local banned_entities = require 'map_gen.maps.danger_ores.modules.banned_entities' +local allowed_entities = require 'map_gen.maps.danger_ores.config.exotic_industries_allowed_entities' +banned_entities(allowed_entities) + +local ores_names = { + -- point patches + 'crude-oil', + 'ei_coal-patch', + 'ei_copper-patch', + 'ei_gold-patch', + 'ei_iron-patch', + 'ei_lead-patch', + 'ei_neodym-patch', + 'ei_sulfur-patch', + 'ei_uranium-patch', + -- ore patches + 'coal', + 'copper-ore', + 'iron-ore', +} +local ore_oil_none = {} +for _, v in pairs(ores_names) do + ore_oil_none[v] = {frequency = 1, richness = 1, size = 0} +end +ore_oil_none = {autoplace_controls = ore_oil_none} + +RS.set_map_gen_settings({ + MGSP.grass_only, + MGSP.enable_water, + { terrain_segmentation = 'normal', water = 'normal' }, + MGSP.starting_area_very_low, + ore_oil_none, + MGSP.enemy_none, + MGSP.cliff_none, + MGSP.tree_none +}) + +Config.market.enabled = false +Config.player_rewards.enabled = false +Config.player_create.starting_items = { + { count = 1, name = 'stone-furnace'}, + { count = 2, name = 'burner-mining-drill' }, + { count = 50, name = 'wood' }, +} +Config.dump_offline_inventories = { + enabled = true, + offline_timout_mins = 30 -- time after which a player logs off that their inventory is provided to the team +} +Config.paint.enabled = false + +if script.active_mods['early_construction'] then + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-light-armor' }) + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-equipment' }) + table.insert(Config.player_create.starting_items, { count = 100, name = 'early-construction-robot' }) +end + +Event.on_init(function() + game.draw_resource_selection = false + + game.forces.player.technologies['mining-productivity-1'].enabled = false + game.forces.player.technologies['mining-productivity-2'].enabled = false + game.forces.player.technologies['mining-productivity-3'].enabled = false + game.forces.player.technologies['mining-productivity-4'].enabled = false + + game.forces.player.manual_mining_speed_modifier = 1 + + game.map_settings.enemy_evolution.time_factor = 0.000007 -- default 0.000004 + game.map_settings.enemy_evolution.destroy_factor = 0.000010 -- default 0.002 + game.map_settings.enemy_evolution.pollution_factor = 0.000000 -- Pollution has no affect on evolution default 0.0000009 + + RS.get_surface().always_day = true + RS.get_surface().peaceful_mode = true +end) + +local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming' +terraforming({start_size = 10 * 32, min_pollution = 300, max_pollution = 15000, pollution_increment = 3}) + +local rocket_launched = require 'map_gen.maps.danger_ores.modules.rocket_launched_exotic_industries' +rocket_launched() + +local restart_command = require 'map_gen.maps.danger_ores.modules.restart_command' +restart_command({scenario_name = 'danger-ore-exotic-industries-spiral'}) + +local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' +container_dump({entity_name = 'coal'}) + +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + +require 'map_gen.maps.danger_ores.modules.biter_drops_exotic_industries' + +require 'map_gen.maps.danger_ores.modules.map_poll' + +local config = { + spawn_shape = b.circle(64), + start_ore_shape = b.circle(68), + --no_resource_patch_shape = b.circle(80), + spawn_tile = 'landfill', + main_ores = main_ores_config, + main_ores_builder = main_ores_builder, + main_ores_shuffle_order = true, + resource_patches = resource_patches, + resource_patches_config = resource_patches_config, + water = water, + water_scale = 1 / 96, + water_threshold = 0.5, + deepwater_threshold = 0.55, + no_water_shape = b.circle(102), + trees = trees, + trees_scale = 1 / 64, + trees_threshold = 0.4, + trees_chance = 0.875, + enemy = enemy, + enemy_factor = 10 / (768 * 32), + enemy_max_chance = 1 / 6, + enemy_scale_factor = 32, + fish_spawn_rate = 0.025, + dense_patches_scale = 1 / 48, + dense_patches_threshold = 0.5, + dense_patches_multiplier = 50 +} + +return map(config) diff --git a/map_gen/maps/danger_ores/presets/danger_ore_industrial_revolution_3.lua b/map_gen/maps/danger_ores/presets/danger_ore_industrial_revolution_3.lua new file mode 100644 index 00000000..ccbd6d44 --- /dev/null +++ b/map_gen/maps/danger_ores/presets/danger_ore_industrial_revolution_3.lua @@ -0,0 +1,179 @@ +local RS = require 'map_gen.shared.redmew_surface' +local MGSP = require 'resources.map_gen_settings' +local Event = require 'utils.event' +local b = require 'map_gen.shared.builders' +local Config = require 'config' + +local ScenarioInfo = require 'features.gui.info' +ScenarioInfo.set_map_name('Danger Ores x Industrial Revolution 3') +ScenarioInfo.set_map_description([[ +Clear the ore to expand the base, +focus mining efforts on specific sectors to ensure +proper material ratios, expand the map with pollution! +]]) +ScenarioInfo.add_map_extra_info([[ +This map is split in 6 sectors. Each sector has a main resource. Gas fissures are scattered across the map. + + [item=transport-belt] [item=fast-transport-belt] [item=express-transport-belt] [item=underground-belt] [item=fast-underground-belt] [item=express-underground-belt] + [item=small-electric-pole] [item=medium-electric-pole] [item=big-electric-pole] [item=substation] [item=small-bronze-pole] [item=small-iron-pole] [item=big-wooden-pole] + [item=electric-mining-drill] [item=burner-mining-drill] [item=pumpjack] [item=steam-drill] [item=chrome-drill] [item=copper-derrick] [item=steel-derrick] + [item=copper-pipe] [item=copper-pipe-to-ground] [item=copper-pipe-to-ground-short] [item=steam-pipe] [item=steam-pipe-to-ground] [item=steam-pipe-to-ground-short] [item=pipe] [item=pipe-to-ground] [item=pipe-to-ground-short] [item=air-pipe] [item=air-pipe-to-ground] [item=air-pipe-to-ground-short] + [item=car] [item=tank] [item=spidertron] [item=monowheel] [item=heavy-roller] [item=heavy-picket] + [item=rail-signal] [item=rail-chain-signal] [item=rail] [item=train-stop] [item=locomotive] [item=cargo-wagon] [item=fluid-wagon] [item=artillery-wagon] + +The map size is restricted to the pollution generated. A significant amount of +pollution must affect a section of the map before it is revealed. Pollution +does not affect biter evolution. +]]) + +ScenarioInfo.set_new_info([[ +2023-10-24: + - Added IR3 preset +]]) + +ScenarioInfo.add_extra_rule({'info.rules_text_danger_ore'}) + +global.config.redmew_qol.loaders = false + +local map = require 'map_gen.maps.danger_ores.modules.map' +local main_ores_config = require 'map_gen.maps.danger_ores.config.ir3_ores' +local resource_patches = require 'map_gen.maps.danger_ores.modules.resource_patches' +local resource_patches_config = require 'map_gen.maps.danger_ores.config.ir3_resource_patches' +local water = require 'map_gen.maps.danger_ores.modules.water' +local trees = require 'map_gen.maps.danger_ores.modules.trees' +local enemy = require 'map_gen.maps.danger_ores.modules.enemy' +-- local dense_patches = require 'map_gen.maps.danger_ores.modules.dense_patches' + +local banned_entities = require 'map_gen.maps.danger_ores.modules.banned_entities' +local allowed_entities = require 'map_gen.maps.danger_ores.config.ir3_allowed_entities' +banned_entities(allowed_entities) + +local ores_names = { + -- point patches + 'crude-oil', + 'dirty-steam-fissure', + 'natural-gas-fissure', + 'steam-fissure', + 'sulphur-gas-fissure', + -- ore patches + 'coal', + 'copper-ore', + 'iron-ore', + 'stone', + 'uranium-ore', + 'gold-ore', + 'tin-ore', +} +local ore_oil_none = {} +for _, v in pairs(ores_names) do + ore_oil_none[v] = {frequency = 1, richness = 1, size = 0} +end +ore_oil_none = {autoplace_controls = ore_oil_none} + +RS.set_map_gen_settings({ + MGSP.grass_only, + MGSP.enable_water, + { terrain_segmentation = 'normal', water = 'normal' }, + MGSP.starting_area_very_low, + ore_oil_none, + MGSP.enemy_none, + MGSP.cliff_none, + MGSP.tree_none +}) + +Config.market.enabled = false +Config.player_rewards.enabled = false +Config.player_create.starting_items = { + { count = 1, name = 'shotgun' }, + { count = 4, name = 'burner-mining-drill' }, + { count = 4, name = 'stone-furnace'}, + { count = 25, name = 'copper-rivet' }, + { count = 25, name = 'copper-rod' }, + { count = 25, name = 'tin-gear-wheel' }, + { count = 25, name = 'tin-plate' }, + { count = 25, name = 'tin-rod' }, + { count = 50, name = 'copper-gear-wheel' }, + { count = 50, name = 'copper-plate' }, + { count = 50, name = 'shotgun-shell' }, + { count = 100, name = 'tin-scrap' }, + { count = 150, name = 'copper-scrap' }, +} +Config.dump_offline_inventories = { + enabled = true, + offline_timout_mins = 30 -- time after which a player logs off that their inventory is provided to the team +} +Config.paint.enabled = false + +if script.active_mods['early_construction'] then + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-light-armor' }) + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-equipment' }) + table.insert(Config.player_create.starting_items, { count = 100, name = 'early-construction-robot' }) +end + +Event.on_init(function() + game.draw_resource_selection = false + + game.forces.player.technologies['mining-productivity-1'].enabled = false + game.forces.player.technologies['mining-productivity-2'].enabled = false + game.forces.player.technologies['mining-productivity-3'].enabled = false + game.forces.player.technologies['mining-productivity-4'].enabled = false + + game.forces.player.manual_mining_speed_modifier = 1 + + game.difficulty_settings.technology_price_multiplier = game.difficulty_settings.technology_price_multiplier * 5 + + game.map_settings.enemy_evolution.time_factor = 0.000007 -- default 0.000004 + game.map_settings.enemy_evolution.destroy_factor = 0.000010 -- default 0.002 + game.map_settings.enemy_evolution.pollution_factor = 0.000000 -- Pollution has no affect on evolution default 0.0000009 + + RS.get_surface().always_day = false + RS.get_surface().peaceful_mode = true +end) + +local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming' +terraforming({start_size = 10 * 32, min_pollution = 400, max_pollution = 16000, pollution_increment = 4}) + +local rocket_launched = require 'map_gen.maps.danger_ores.modules.rocket_launched_simple' +rocket_launched({win_satellite_count = 100}) + +local restart_command = require 'map_gen.maps.danger_ores.modules.restart_command' +restart_command({scenario_name = 'danger-ore-industrial-revolution-3'}) + +local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' +container_dump({entity_name = 'coal'}) + +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + +require 'map_gen.maps.danger_ores.modules.biter_drops' + +require 'map_gen.maps.danger_ores.modules.map_poll' + +local config = { + spawn_shape = b.circle(40), + start_ore_shape = b.circle(48), + no_resource_patch_shape = b.circle(80), + main_ores = main_ores_config, + main_ores_shuffle_order = true, + resource_patches = resource_patches, + resource_patches_config = resource_patches_config, + water = water, + water_scale = 1 / 96, + water_threshold = 0.5, + deepwater_threshold = 0.55, + no_water_shape = b.circle(102), + trees = trees, + trees_scale = 1 / 64, + trees_threshold = 0.4, + trees_chance = 0.875, + enemy = enemy, + enemy_factor = 10 / (768 * 32), + enemy_max_chance = 1 / 6, + enemy_scale_factor = 32, + fish_spawn_rate = 0.025, + dense_patches_scale = 1 / 48, + dense_patches_threshold = 0.5, + dense_patches_multiplier = 50 +} + +return map(config) diff --git a/map_gen/maps/danger_ores/presets/danger_ore_industrial_revolution_3_grid_factory.lua b/map_gen/maps/danger_ores/presets/danger_ore_industrial_revolution_3_grid_factory.lua new file mode 100644 index 00000000..0deaa8fd --- /dev/null +++ b/map_gen/maps/danger_ores/presets/danger_ore_industrial_revolution_3_grid_factory.lua @@ -0,0 +1,181 @@ +local RS = require 'map_gen.shared.redmew_surface' +local MGSP = require 'resources.map_gen_settings' +local Event = require 'utils.event' +local b = require 'map_gen.shared.builders' +local Config = require 'config' + +local ScenarioInfo = require 'features.gui.info' +ScenarioInfo.set_map_name('Danger Ores x Industrial Revolution 3 Squares') +ScenarioInfo.set_map_description([[ +Clear the ore to expand the base, +focus mining efforts on specific sectors to ensure +proper material ratios, expand the map with pollution! +]]) +ScenarioInfo.add_map_extra_info([[ +This map is split in 6 sectors. Each sector has a main resource. Gas fissures are scattered across the map. + + [item=transport-belt] [item=fast-transport-belt] [item=express-transport-belt] [item=underground-belt] [item=fast-underground-belt] [item=express-underground-belt] + [item=small-electric-pole] [item=medium-electric-pole] [item=big-electric-pole] [item=substation] [item=small-bronze-pole] [item=small-iron-pole] [item=big-wooden-pole] + [item=electric-mining-drill] [item=burner-mining-drill] [item=pumpjack] [item=steam-drill] [item=chrome-drill] [item=copper-derrick] [item=steel-derrick] + [item=copper-pipe] [item=copper-pipe-to-ground] [item=copper-pipe-to-ground-short] [item=steam-pipe] [item=steam-pipe-to-ground] [item=steam-pipe-to-ground-short] [item=pipe] [item=pipe-to-ground] [item=pipe-to-ground-short] [item=air-pipe] [item=air-pipe-to-ground] [item=air-pipe-to-ground-short] + [item=car] [item=tank] [item=spidertron] [item=monowheel] [item=heavy-roller] [item=heavy-picket] + [item=rail-signal] [item=rail-chain-signal] [item=rail] [item=train-stop] [item=locomotive] [item=cargo-wagon] [item=fluid-wagon] [item=artillery-wagon] + +The map size is restricted to the pollution generated. A significant amount of +pollution must affect a section of the map before it is revealed. Pollution +does not affect biter evolution. +]]) + +ScenarioInfo.set_new_info([[ +2023-10-26: + - Added IR3 preset +]]) + +ScenarioInfo.add_extra_rule({'info.rules_text_danger_ore'}) + +global.config.redmew_qol.loaders = false + +local map = require 'map_gen.maps.danger_ores.modules.map' +local main_ores_config = require 'map_gen.maps.danger_ores.config.ir3_ores_grid_factory' +local main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_grid_factory' +local resource_patches = require 'map_gen.maps.danger_ores.modules.resource_patches' +local resource_patches_config = require 'map_gen.maps.danger_ores.config.ir3_resource_patches' +local water = require 'map_gen.maps.danger_ores.modules.water' +local trees = require 'map_gen.maps.danger_ores.modules.trees' +local enemy = require 'map_gen.maps.danger_ores.modules.enemy' + +local banned_entities = require 'map_gen.maps.danger_ores.modules.banned_entities' +local allowed_entities = require 'map_gen.maps.danger_ores.config.ir3_allowed_entities' +banned_entities(allowed_entities) + +local ores_names = { + -- point patches + 'crude-oil', + 'dirty-steam-fissure', + 'natural-gas-fissure', + 'steam-fissure', + 'sulphur-gas-fissure', + -- ore patches + 'coal', + 'copper-ore', + 'iron-ore', + 'stone', + 'uranium-ore', + 'gold-ore', + 'tin-ore', +} +local ore_oil_none = {} +for _, v in pairs(ores_names) do + ore_oil_none[v] = {frequency = 1, richness = 1, size = 0} +end +ore_oil_none = {autoplace_controls = ore_oil_none} + +RS.set_map_gen_settings({ + MGSP.grass_only, + MGSP.enable_water, + { terrain_segmentation = 'normal', water = 'normal' }, + MGSP.starting_area_very_low, + ore_oil_none, + MGSP.enemy_none, + MGSP.cliff_none, + MGSP.tree_none +}) + +Config.market.enabled = false +Config.player_rewards.enabled = false +Config.player_create.starting_items = { + { count = 1, name = 'shotgun' }, + { count = 4, name = 'burner-mining-drill' }, + { count = 4, name = 'stone-furnace'}, + { count = 25, name = 'copper-rivet' }, + { count = 25, name = 'copper-rod' }, + { count = 25, name = 'tin-gear-wheel' }, + { count = 25, name = 'tin-plate' }, + { count = 25, name = 'tin-rod' }, + { count = 50, name = 'copper-gear-wheel' }, + { count = 50, name = 'copper-plate' }, + { count = 50, name = 'shotgun-shell' }, + { count = 100, name = 'tin-scrap' }, + { count = 150, name = 'copper-scrap' }, +} +Config.dump_offline_inventories = { + enabled = true, + offline_timout_mins = 30 -- time after which a player logs off that their inventory is provided to the team +} +Config.paint.enabled = false + +if script.active_mods['early_construction'] then + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-light-armor' }) + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-equipment' }) + table.insert(Config.player_create.starting_items, { count = 100, name = 'early-construction-robot' }) +end + +Event.on_init(function() + game.draw_resource_selection = false + + game.forces.player.technologies['mining-productivity-1'].enabled = false + game.forces.player.technologies['mining-productivity-2'].enabled = false + game.forces.player.technologies['mining-productivity-3'].enabled = false + game.forces.player.technologies['mining-productivity-4'].enabled = false + + game.forces.player.manual_mining_speed_modifier = 1 + + game.difficulty_settings.technology_price_multiplier = game.difficulty_settings.technology_price_multiplier * 5 + + game.map_settings.enemy_evolution.time_factor = 0.000007 -- default 0.000004 + game.map_settings.enemy_evolution.destroy_factor = 0.000010 -- default 0.002 + game.map_settings.enemy_evolution.pollution_factor = 0.000000 -- Pollution has no affect on evolution default 0.0000009 + + RS.get_surface().always_day = false + RS.get_surface().peaceful_mode = true +end) + +local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming' +terraforming({start_size = 10 * 32, min_pollution = 400, max_pollution = 16000, pollution_increment = 4}) + +local rocket_launched = require 'map_gen.maps.danger_ores.modules.rocket_launched_simple' +rocket_launched({win_satellite_count = 100}) + +local restart_command = require 'map_gen.maps.danger_ores.modules.restart_command' +restart_command({scenario_name = 'danger-ore-industrial-revolution-3-grid-factory'}) + +local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' +container_dump({entity_name = 'coal'}) + +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete'}) + +require 'map_gen.maps.danger_ores.modules.biter_drops' + +require 'map_gen.maps.danger_ores.modules.map_poll' + +local config = { + spawn_shape = b.circle(20), + start_ore_shape = b.circle(40), + no_resource_patch_shape = b.circle(80), + spawn_tile = 'tarmac', + main_ores = main_ores_config, + main_ores_builder = main_ores_builder, + main_ores_shuffle_order = true, + resource_patches = resource_patches, + resource_patches_config = resource_patches_config, + water = water, + water_scale = 1 / 96, + water_threshold = 0.5, + deepwater_threshold = 0.55, + no_water_shape = b.circle(102), + trees = trees, + trees_scale = 1 / 64, + trees_threshold = 0.4, + trees_chance = 0.875, + enemy = enemy, + enemy_factor = 10 / (768 * 32), + enemy_max_chance = 1 / 6, + enemy_scale_factor = 32, + fish_spawn_rate = 0.025, + dense_patches_scale = 1 / 48, + dense_patches_threshold = 0.5, + dense_patches_multiplier = 50 +} + +return map(config) diff --git a/map_gen/maps/danger_ores/presets/danger_ore_krastorio2.lua b/map_gen/maps/danger_ores/presets/danger_ore_krastorio2.lua index 4a219928..b1922d93 100644 --- a/map_gen/maps/danger_ores/presets/danger_ore_krastorio2.lua +++ b/map_gen/maps/danger_ores/presets/danger_ore_krastorio2.lua @@ -7,7 +7,7 @@ local b = require 'map_gen.shared.builders' local Config = require 'config' local ScenarioInfo = require 'features.gui.info' -ScenarioInfo.set_map_name('Danger Ore Krastorio2') +ScenarioInfo.set_map_name('Danger Ore x Krastorio2') ScenarioInfo.set_map_description([[ Clear the ore to expand the base, focus mining efforts on specific sectors to ensure @@ -32,42 +32,19 @@ does not affect biter evolution. ]]) ScenarioInfo.set_new_info([[ +2023-10-26: + - Reduced tech multiplier (10 -> 5) + - Increased Uranium ore & Compact raw rare metals spawn radius (128 -> 192 tiles) + - Eased terraforming requirements (8 -> 10 chunks, 9 -> 8 pollution increase, 24k -> 16k max pollution, 600 -> 400 min pollution) + - Reduced rocket required to win (500 -> 100) + - Removed Expensive Warehousing from required mods + 2023-10-11: - Increased Uranium ore & Compact raw rare metals spawn radius to 128 tiles - Reduced Compact raw rare metals yield weight (8 -> 4) 2023-10-01: - Added K2 preset - -2023-06-27: - - disabled Crafting - - added Starting Equipment - -2019-04-24: - - Stone ore density reduced by 1/2 - - Ore quadrants randomized - - Increased time factor of biter evolution from 5 to 7 - - Added win conditions (+5% evolution every 5 rockets until 100%, +100 rockets until biters are wiped) - -2019-03-30: - - Uranium ore patch threshold increased slightly - - Bug fix: Cars and tanks can now be placed onto ore! - - Starting minimum pollution to expand map set to 650 - View current pollution via Debug Settings [F4] show-pollution-values, - then open map and turn on pollution via the red box. - - Starting water at spawn increased from radius 8 to radius 16 circle. - -2019-03-27: - - Ore arranged into quadrants to allow for more controlled resource gathering. - -2020-09-02: - - Destroyed chests dump their content as coal ore. - -2020-12-28: - - Changed win condition. First satellite kills all biters, launch 500 to win the map. - -2021-04-06: - - Rail signals and train stations now allowed on ore. ]]) ScenarioInfo.add_extra_rule({'info.rules_text_danger_ore'}) @@ -75,12 +52,9 @@ ScenarioInfo.add_extra_rule({'info.rules_text_danger_ore'}) global.config.redmew_qol.loaders = false local map = require 'map_gen.maps.danger_ores.modules.map' -local main_ores_config = require 'map_gen.maps.danger_ores.config.krastorio2' --- local resource_patches = require 'map_gen.maps.danger_ores.modules.resource_patches' --- local resource_patches_config = require 'map_gen.maps.danger_ores.config.deadlock_beltboxes_resource_patches' +local main_ores_config = require 'map_gen.maps.danger_ores.config.krastorio2_ores' local trees = require 'map_gen.maps.danger_ores.modules.trees' local enemy = require 'map_gen.maps.danger_ores.modules.enemy' --- local dense_patches = require 'map_gen.maps.danger_ores.modules.dense_patches' local banned_entities = require 'map_gen.maps.danger_ores.modules.banned_entities' local allowed_entities = require 'map_gen.maps.danger_ores.config.krastorio2_allowed_entities' @@ -130,7 +104,7 @@ Config.player_create.starting_items = { {name = 'stone-furnace', count = 1}, {name = 'wood', count = 50}, } -if script.active_mods["early_construction"] then +if script.active_mods['early_construction'] then table.insert(Config.player_create.starting_items, {name = 'early-construction-light-armor', count = 1}) table.insert(Config.player_create.starting_items, {name = 'early-construction-equipment', count = 1}) table.insert(Config.player_create.starting_items, {name = 'early-construction-robot', count = 100}) @@ -144,18 +118,17 @@ Config.paint.enabled = false local kr_remote = Token.register(function() -- enable creep on Redmew surface - if remote.interfaces["kr-creep"] and remote.interfaces["kr-creep"]["set_creep_on_surface"] then - remote.call( "kr-creep", "set_creep_on_surface", game.surfaces.redmew.index, true ) + if remote.interfaces['kr-creep'] and remote.interfaces['kr-creep']['set_creep_on_surface'] then + remote.call( 'kr-creep', 'set_creep_on_surface', game.surfaces.redmew.index, true ) end -- disable K2 radioactivity (if uranium is mixed with all the ores) - if remote.interfaces["kr-radioactivity"] and remote.interfaces["kr-radioactivity"]["set_enabled"] then - remote.call( "kr-radioactivity", "set_enabled", false ) + if remote.interfaces['kr-radioactivity'] and remote.interfaces['kr-radioactivity']['set_enabled'] then + remote.call( 'kr-radioactivity', 'set_enabled', false ) end end) Event.on_init(function() - -- game.permissions.get_group("Default").set_allows_action(defines.input_action.craft, false) - -- game.draw_resource_selection = false + game.draw_resource_selection = false local p = game.forces.player p.technologies['mining-productivity-1'].enabled = false @@ -168,7 +141,7 @@ Event.on_init(function() p.manual_mining_speed_modifier = 1 - game.difficulty_settings.technology_price_multiplier = game.difficulty_settings.technology_price_multiplier * 10 + game.difficulty_settings.technology_price_multiplier = game.difficulty_settings.technology_price_multiplier * 5 game.map_settings.enemy_evolution.time_factor = 0.000007 -- default 0.000004 game.map_settings.enemy_evolution.destroy_factor = 0.000010 -- default 0.002 @@ -181,7 +154,7 @@ Event.on_init(function() end) local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming' -terraforming({start_size = 8 * 32, min_pollution = 600, max_pollution = 24000, pollution_increment = 9}) +terraforming({start_size = 10 * 32, min_pollution = 400, max_pollution = 16000, pollution_increment = 8}) --[[ Win condition in K2: build intergalactic transceiver ]] local rocket_launched = require 'map_gen.maps.danger_ores.modules.rocket_launched_krastorio2' @@ -212,8 +185,6 @@ local config = { main_ores = main_ores_config, main_ores_shuffle_order = true, main_ores_rotate = 45, - -- resource_patches = resource_patches, - -- resource_patches_config = resource_patches_config, water_scale = 1 / 96, water_threshold = 0.4, deepwater_threshold = 0.45, @@ -226,7 +197,6 @@ local config = { enemy_max_chance = 1 / 6, enemy_scale_factor = 32, fish_spawn_rate = 0.025, - -- dense_patches = dense_patches, dense_patches_scale = 1 / 48, dense_patches_threshold = 0.55, dense_patches_multiplier = 25 diff --git a/map_gen/maps/danger_ores/presets/danger_ore_omnimatter.lua b/map_gen/maps/danger_ores/presets/danger_ore_omnimatter.lua new file mode 100644 index 00000000..e9aaa21e --- /dev/null +++ b/map_gen/maps/danger_ores/presets/danger_ore_omnimatter.lua @@ -0,0 +1,155 @@ +local RS = require 'map_gen.shared.redmew_surface' +local MGSP = require 'resources.map_gen_settings' +local Event = require 'utils.event' +local b = require 'map_gen.shared.builders' +local Config = require 'config' + +local ScenarioInfo = require 'features.gui.info' +ScenarioInfo.set_map_name('Danger Ore Omnimatter') +ScenarioInfo.set_map_description([[ +Clear the ore to expand the base, +expand the map with pollution! +]]) +ScenarioInfo.add_map_extra_info([[ +This map is covered in [item=omnite]. +Mine it to make room for your factory. + +You may not build the factory on ore patches. Exceptions: + [item=burner-mining-drill] [item=electric-mining-drill] + [item=small-electric-pole] [item=small-iron-electric-pole] [item=small-omnium-electric-pole] [item=medium-electric-pole] [item=big-electric-pole] [item=substation] + [item=car] [item=tank] [item=spidertron] + [item=locomotive] [item=cargo-wagon] [item=fluid-wagon] [item=artillery-wagon] + [item=basic-transport-belt] [item=transport-belt] [item=fast-transport-belt] [item=express-transport-belt] + [item=basic-underground-belt] [item=underground-belt] [item=fast-underground-belt] [item=express-underground-belt] + [item=rail] [item=rail-signal] [item=rail-chain-signal] [item=train-stop] + +The map size is restricted to the pollution generated. A significant amount of +pollution must affect a section of the map before it is revealed. Pollution +does not affect biter evolution. +]]) + +ScenarioInfo.set_new_info([[ +2023-10-17: + - Added Omnimatter preset +]]) + +ScenarioInfo.add_extra_rule({'info.rules_text_danger_ore'}) + +global.config.redmew_qol.loaders = false + +local map = require 'map_gen.maps.danger_ores.modules.map' +local main_ores_config = require 'map_gen.maps.danger_ores.config.omnimatter' +local water = require 'map_gen.maps.danger_ores.modules.water' +local trees = require 'map_gen.maps.danger_ores.modules.trees' +local enemy = require 'map_gen.maps.danger_ores.modules.enemy' + +local banned_entities = require 'map_gen.maps.danger_ores.modules.banned_entities' +local allowed_entities = require 'map_gen.maps.danger_ores.config.omnimatter_allowed_entities' +banned_entities(allowed_entities) + +local omni_resources_control = { + autoplace_controls = { + ['omnite'] = { frequency = 1, richness = 1, size = 0 }, + ['infinite-omnite'] = { frequency = 1, richness = 1, size = 0 }, +}} + +RS.set_map_gen_settings({ + MGSP.dirt_only, + MGSP.enable_water, + {terrain_segmentation = 'normal', water = 'normal'}, + MGSP.starting_area_very_low, + omni_resources_control, + MGSP.enemy_none, + MGSP.cliff_none, + {autoplace_controls = {trees = {frequency = 1, richness = 1, size = 1}}} +}) + +-- Config.lazy_bastard.enabled = true +Config.market.enabled = false +Config.player_rewards.enabled = false +Config.player_create.starting_items = { + { count = 1, name = 'stone-furnace'}, + { count = 2, name = 'burner-mining-drill' }, + { count = 50, name = 'wood' }, + { count = 1, name = 'burner-omnitractor' }, + { count = 1, name = 'burner-omniphlog' }, +} +if script.active_mods['early_construction'] then + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-light-armor' }) + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-equipment' }) + table.insert(Config.player_create.starting_items, { count = 100, name = 'early-construction-robot' }) +end + +Config.dump_offline_inventories = { + enabled = true, + offline_timout_mins = 30 -- time after which a player logs off that their inventory is provided to the team +} +Config.paint.enabled = false + +Event.on_init(function() + game.draw_resource_selection = false + + local p = game.forces.player + p.technologies['mining-productivity-1'].enabled = false + p.technologies['mining-productivity-2'].enabled = false + p.technologies['mining-productivity-3'].enabled = false + p.technologies['mining-productivity-4'].enabled = false + + p.manual_mining_speed_modifier = 1 + + game.difficulty_settings.technology_price_multiplier = game.difficulty_settings.technology_price_multiplier * 10 + + game.map_settings.enemy_evolution.time_factor = 0.000007 -- default 0.000004 + game.map_settings.enemy_evolution.destroy_factor = 0.000010 -- default 0.002 + game.map_settings.enemy_evolution.pollution_factor = 0.000000 -- Pollution has no affect on evolution default 0.0000009 + + RS.get_surface().always_day = true + RS.get_surface().peaceful_mode = true +end) + +local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming' +terraforming({start_size = 8 * 32, min_pollution = 600, max_pollution = 20000, pollution_increment = 5}) + +local rocket_launched = require 'map_gen.maps.danger_ores.modules.rocket_launched_simple' +rocket_launched({win_satellite_count = 100}) + +local restart_command = require 'map_gen.maps.danger_ores.modules.restart_command' +restart_command({scenario_name = 'danger-ore-omnimatter'}) + +local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' +container_dump({entity_name = 'coal'}) + +local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +concrete_on_landfill({tile = 'blue-refined-concrete', refund_tile = 'omnite-refined-concrete'}) + +require 'map_gen.maps.danger_ores.modules.biter_drops' + +require 'map_gen.maps.danger_ores.modules.map_poll' + +local config = { + spawn_shape = b.square_diamond(36*2), + start_ore_shape = b.square_diamond(44*2), + no_resource_patch_shape = b.square_diamond(80*2), + spawn_tile = 'landfill', + main_ores = main_ores_config, + main_ores_shuffle_order = true, + main_ores_rotate = 0, + water = water, + water_scale = 1 / 96, + water_threshold = 0.4, + deepwater_threshold = 0.45, + trees = trees, + trees_scale = 1 / 64, + trees_threshold = 0.4, + trees_chance = 0.875, + enemy = enemy, + enemy_factor = 10 / (768 * 32), + enemy_max_chance = 1 / 6, + enemy_scale_factor = 32, + fish_spawn_rate = 0.025, + dense_patches_scale = 1 / 48, + dense_patches_threshold = 0.55, + dense_patches_multiplier = 25 +} + +return map(config) diff --git a/map_gen/maps/danger_ores/presets/danger_ore_omnimatter_cages.lua b/map_gen/maps/danger_ores/presets/danger_ore_omnimatter_cages.lua new file mode 100644 index 00000000..971edcdb --- /dev/null +++ b/map_gen/maps/danger_ores/presets/danger_ore_omnimatter_cages.lua @@ -0,0 +1,164 @@ +local RS = require 'map_gen.shared.redmew_surface' +local MGSP = require 'resources.map_gen_settings' +local Event = require 'utils.event' +local b = require 'map_gen.shared.builders' +local Config = require 'config' + +local ScenarioInfo = require 'features.gui.info' +ScenarioInfo.set_map_name('Danger Ore x Omnimatter Cages') +ScenarioInfo.set_map_description([[ + Clear the ore to expand the base, + expand the map with pollution! +]]) +ScenarioInfo.add_map_extra_info([[ +This map is covered in [item=omnite] and [item=infinite-omnite]. +Mine it to make room for your factory. + +You may not build the factory on ore patches. Exceptions: + [item=burner-mining-drill] [item=electric-mining-drill] + [item=small-electric-pole] [item=small-iron-electric-pole] [item=small-omnium-electric-pole] [item=medium-electric-pole] [item=big-electric-pole] [item=substation] + [item=car] [item=tank] [item=spidertron] + [item=locomotive] [item=cargo-wagon] [item=fluid-wagon] [item=artillery-wagon] + [item=basic-transport-belt] [item=transport-belt] [item=fast-transport-belt] [item=express-transport-belt] + [item=basic-underground-belt] [item=underground-belt] [item=fast-underground-belt] [item=express-underground-belt] + [item=rail] [item=rail-signal] [item=rail-chain-signal] [item=train-stop] + + +The map size is restricted to the pollution generated. A significant amount of +pollution must affect a section of the map before it is revealed. Pollution +does not affect biter evolution. +]]) + +ScenarioInfo.set_new_info([[ +2023-10-17: + - Added Omnimatter Cages preset +]]) + +ScenarioInfo.add_extra_rule({'info.rules_text_danger_ore'}) + +global.config.redmew_qol.loaders = false + +local map = require 'map_gen.maps.danger_ores.modules.map' +local main_ores_config = require 'map_gen.maps.danger_ores.config.omnimatter_cages' +local main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_cage' +local trees = require 'map_gen.maps.danger_ores.modules.trees' +local enemy = require 'map_gen.maps.danger_ores.modules.enemy' + +local banned_entities = require 'map_gen.maps.danger_ores.modules.banned_entities' +local allowed_entities = require 'map_gen.maps.danger_ores.config.omnimatter_allowed_entities' +banned_entities(allowed_entities) + +local omni_resources_control = { + autoplace_controls = { + ['omnite'] = { frequency = 1, richness = 1, size = 0 }, + ['infinite-omnite'] = { frequency = 1, richness = 1, size = 0 }, +}} + +RS.set_map_gen_settings({ + MGSP.dirt_only, + MGSP.enable_water, + {terrain_segmentation = 'normal', water = 'normal'}, + MGSP.starting_area_very_low, + omni_resources_control, + MGSP.enemy_none, + MGSP.cliff_none, + {autoplace_controls = {trees = {frequency = 1, richness = 1, size = 1}}} +}) + +-- Config.lazy_bastard.enabled = true +Config.market.enabled = false +Config.player_rewards.enabled = false +Config.player_create.starting_items = { + { count = 1, name = 'stone-furnace'}, + { count = 2, name = 'burner-mining-drill' }, + { count = 50, name = 'wood' }, + { count = 1, name = 'burner-omnitractor' }, + { count = 1, name = 'burner-omniphlog' }, +} +if script.active_mods['early_construction'] then + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-light-armor' }) + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-equipment' }) + table.insert(Config.player_create.starting_items, { count = 100, name = 'early-construction-robot' }) +end + +Config.dump_offline_inventories = { + enabled = true, + offline_timout_mins = 30 -- time after which a player logs off that their inventory is provided to the team +} +Config.paint.enabled = false + +Event.on_init(function() + game.draw_resource_selection = false + + local p = game.forces.player + + local techs = { + 'mining-productivity-1', + 'mining-productivity-2', + 'mining-productivity-3', + 'mining-productivity-4', + 'omnipressed-mining-productivity-1', + 'omnipressed-mining-productivity-2', + 'omnipressed-mining-productivity-3', + 'omnipressed-mining-productivity-4', + } + for _, name in pairs(techs) do if p.technologies[name] then p.technologies[name].enabled = false end end + + p.manual_mining_speed_modifier = 1 + + game.difficulty_settings.technology_price_multiplier = game.difficulty_settings.technology_price_multiplier * 10 + + game.map_settings.enemy_evolution.time_factor = 0.000007 -- default 0.000004 + game.map_settings.enemy_evolution.destroy_factor = 0.000010 -- default 0.002 + game.map_settings.enemy_evolution.pollution_factor = 0.000000 -- Pollution has no affect on evolution default 0.0000009 + + RS.get_surface().always_day = true + RS.get_surface().peaceful_mode = true +end) + +local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming' +terraforming({start_size = 8 * 32, min_pollution = 600, max_pollution = 20000, pollution_increment = 5}) + +local rocket_launched = require 'map_gen.maps.danger_ores.modules.rocket_launched_simple' +rocket_launched({win_satellite_count = 100}) + +local restart_command = require 'map_gen.maps.danger_ores.modules.restart_command' +restart_command({scenario_name = 'danger-ore-omnimatter-cages'}) + +local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' +container_dump({entity_name = 'coal'}) + +-- local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +-- concrete_on_landfill({tile = 'blue-refined-concrete', refund_tile = 'omnite-refined-concrete'}) + +require 'map_gen.maps.danger_ores.modules.biter_drops' + +require 'map_gen.maps.danger_ores.modules.map_poll' + +local config = { + spawn_shape = b.square_diamond(36*2), + start_ore_shape = b.square_diamond(44*2), + no_resource_patch_shape = b.square_diamond(80*2), + spawn_tile = 'landfill', + main_ores = main_ores_config, + main_ores_builder = main_ores_builder, + main_ores_shuffle_order = false, + main_ores_rotate = 0, + water_scale = 1 / 96, + water_threshold = 0.4, + deepwater_threshold = 0.45, + trees = trees, + trees_scale = 1 / 64, + trees_threshold = 0.4, + trees_chance = 0.875, + enemy = enemy, + enemy_factor = 10 / (768 * 32), + enemy_max_chance = 1 / 6, + enemy_scale_factor = 32, + fish_spawn_rate = 0.025, + dense_patches_scale = 1 / 48, + dense_patches_threshold = 0.55, + dense_patches_multiplier = 25 +} + +return map(config) diff --git a/map_gen/maps/danger_ores/presets/danger_ore_pyfe.lua b/map_gen/maps/danger_ores/presets/danger_ore_pyfe.lua new file mode 100644 index 00000000..a4dd3624 --- /dev/null +++ b/map_gen/maps/danger_ores/presets/danger_ore_pyfe.lua @@ -0,0 +1,164 @@ +local RS = require 'map_gen.shared.redmew_surface' +local MGSP = require 'resources.map_gen_settings' +local Event = require 'utils.event' +local b = require 'map_gen.shared.builders' +local Config = require 'config' + +local ScenarioInfo = require 'features.gui.info' +ScenarioInfo.set_map_name('Danger Ores x Pyanodon Fusion Energy') +ScenarioInfo.set_map_description([[ +Clear the ore to expand the base, +focus mining efforts on specific sectors to ensure +proper material ratios, expand the map with pollution! +]]) +ScenarioInfo.add_map_extra_info([[ +This map is split in 6 sectors. Each sector has a main resource. + +You may not build the factory on ore patches. Exceptions: + [item=transport-belt] [item=fast-transport-belt] [item=express-transport-belt] [item=underground-belt] [item=fast-underground-belt] [item=express-underground-belt] [item=splitter] [item=fast-splitter] [item=express-splitter] + [item=pipe] [item=pipe-to-ground] [item=small-electric-pole] [item=medium-electric-pole] [item=big-electric-pole] [item=substation] + [item=electric-mining-drill] [item=burner-mining-drill] [item=pumpjack] [item=mo-mine] [item=diamond-mine] [item=regolite-mine] [item=borax-mine] [item=niobium-mine] [item=car] [item=tank] [item=spidertron] + [item=burner-inserter] [item=inserter] [item=long-handed-inserter] [item=fast-inserter] [item=filter-inserter] [item=stack-inserter] [item=stack-filter-inserter] + [item=rail] [item=rail-chain-signal] [item=train-stop] [item=locomotive] [item=cargo-wagon] [item=fluid-wagon] [item=artillery-wagon] + [item=mk02-locomotive] [item=mk02-wagon] [item=mk02-fluid-wagon] [item=niobium-pipe] [item=niobium-pipe-to-ground] [item=pipe] [item=pipe-to-ground] + +The map size is restricted to the pollution generated. A significant amount of +pollution must affect a section of the map before it is revealed. Pollution +does not affect biter evolution. +]]) + +ScenarioInfo.set_new_info([[ +2023-10-24: + - Added PyFE preset +]]) + +ScenarioInfo.add_extra_rule({'info.rules_text_danger_ore'}) + +global.config.redmew_qol.loaders = false + +local map = require 'map_gen.maps.danger_ores.modules.map' +local main_ores_config = require 'map_gen.maps.danger_ores.config.pyfe_ores' +local ore_builder = require 'map_gen.maps.danger_ores.modules.ore_builder_without_gaps' +local resource_patches = require 'map_gen.maps.danger_ores.modules.resource_patches' +local resource_patches_config = require 'map_gen.maps.danger_ores.config.pyfe_resource_patches' +local trees = require 'map_gen.maps.danger_ores.modules.trees' + +local banned_entities = require 'map_gen.maps.danger_ores.modules.banned_entities' +local allowed_entities = require 'map_gen.maps.danger_ores.config.pyanodon_allowed_entities' +banned_entities(allowed_entities) + +local ores_names = { + -- point patches + 'crude-oil', + 'regolites', + 'volcanic-pipe', + -- ore patches + 'coal', + 'stone', + 'copper-ore', + 'uranium-ore', + 'iron-ore', + 'borax', + 'molybdenum-ore', + 'niobium', +} +local ore_oil_none = {} +for _, v in pairs(ores_names) do + ore_oil_none[v] = {frequency = 1, richness = 1, size = 0} +end +ore_oil_none = {autoplace_controls = ore_oil_none} + +RS.set_map_gen_settings({ + MGSP.grass_only, + MGSP.enable_water, + { terrain_segmentation = 'normal', water = 'normal' }, + MGSP.starting_area_very_low, + ore_oil_none, + MGSP.enemy_none, + MGSP.cliff_none, + MGSP.tree_none +}) + +Config.market.enabled = false +Config.player_rewards.enabled = false +Config.player_create.starting_items = { + { count = 1, name = 'stone-furnace'}, + { count = 10, name = 'burner-mining-drill' }, + { count = 50, name = 'wood' }, +} +Config.dump_offline_inventories = { + enabled = true, + offline_timout_mins = 30 -- time after which a player logs off that their inventory is provided to the team +} +Config.paint.enabled = false + +if script.active_mods['early_construction'] then + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-light-armor' }) + table.insert(Config.player_create.starting_items, { count = 1, name = 'early-construction-equipment' }) + table.insert(Config.player_create.starting_items, { count = 100, name = 'early-construction-robot' }) +end + +Event.on_init(function() + game.draw_resource_selection = false + + game.forces.player.technologies['mining-productivity-1'].enabled = false + game.forces.player.technologies['mining-productivity-2'].enabled = false + game.forces.player.technologies['mining-productivity-3'].enabled = false + game.forces.player.technologies['mining-productivity-4'].enabled = false + + game.forces.player.manual_mining_speed_modifier = 1 + + game.map_settings.enemy_evolution.time_factor = 0.000007 -- default 0.000004 + game.map_settings.enemy_evolution.destroy_factor = 0.000010 -- default 0.002 + game.map_settings.enemy_evolution.pollution_factor = 0.000000 -- Pollution has no affect on evolution default 0.0000009 + + RS.get_surface().always_day = false + RS.get_surface().peaceful_mode = true +end) + +local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming' +terraforming({start_size = 12 * 32, min_pollution = 300, max_pollution = 16000, pollution_increment = 3}) + +local rocket_launched = require 'map_gen.maps.danger_ores.modules.rocket_launched_pyanodon' +rocket_launched() + +local restart_command = require 'map_gen.maps.danger_ores.modules.restart_command' +restart_command({scenario_name = 'danger-ore-pyfe'}) + +local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump' +container_dump({entity_name = 'coal'}) + +-- local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill' +-- concrete_on_landfill({tile = 'blue-refined-concrete'}) + +require 'map_gen.maps.danger_ores.modules.biter_drops' + +require 'map_gen.maps.danger_ores.modules.map_poll' + +local config = { + spawn_shape = b.rectangle(100), + start_ore_shape = b.empty_shape, + spawn_tile = 'landfill', + ore_builder = ore_builder, + main_ores = main_ores_config, + main_ores_shuffle_order = true, + resource_patches = resource_patches, + resource_patches_config = resource_patches_config, + water_scale = 1 / 96, + water_threshold = 0.4, + deepwater_threshold = 0.45, + trees = trees, + trees_scale = 1 / 64, + trees_threshold = 0.4, + trees_chance = 0.875, + enemy = nil, + enemy_factor = 10 / (768 * 32), + enemy_max_chance = 1 / 6, + enemy_scale_factor = 32, + fish_spawn_rate = 0.025, + dense_patches_scale = 1 / 48, + dense_patches_threshold = 0.5, + dense_patches_multiplier = 50 +} + +return map(config) diff --git a/map_gen/shared/builders.lua b/map_gen/shared/builders.lua index 9540d298..f9ff0847 100644 --- a/map_gen/shared/builders.lua +++ b/map_gen/shared/builders.lua @@ -1065,6 +1065,18 @@ end -- pattern builders +--- Loops through the shapes, if any shape is able to place any entities, +--- it'll return that tile. Otherwise, false is returned. +function Builders.any_entity_pattern(pattern) + return function(x, y, world) + for index, shape in pairs(pattern or {}) do + local tile = shape.shape(x, y, world) + if tile and tile.entities then return tile end + end + return false + end +end + --- Docs: https://github.com/Refactorio/RedMew/wiki/Using-the-Builders#builderssingle_pattern function Builders.single_pattern(shape, width, height) shape = shape or Builders.empty_shape @@ -1544,6 +1556,7 @@ function Builders.segment_weighted_pattern(pattern) end local shape = pattern[index].shape or Builders.empty_shape + return shape(x, y, world) end end diff --git a/scenario_templates/danger-ore-bz/map_selection.lua b/scenario_templates/danger-ore-bz/map_selection.lua new file mode 100644 index 00000000..a00af522 --- /dev/null +++ b/scenario_templates/danger-ore-bz/map_selection.lua @@ -0,0 +1 @@ +return require 'map_gen.maps.danger_ores.presets.danger_ore_bz' \ No newline at end of file diff --git a/scenario_templates/danger-ore-exotic-industries-spiral/map_selection.lua b/scenario_templates/danger-ore-exotic-industries-spiral/map_selection.lua new file mode 100644 index 00000000..0e53fde3 --- /dev/null +++ b/scenario_templates/danger-ore-exotic-industries-spiral/map_selection.lua @@ -0,0 +1 @@ +return require 'map_gen.maps.danger_ores.presets.danger_ore_exotic_industries_spiral' \ No newline at end of file diff --git a/scenario_templates/danger-ore-exotic-industries/map_selection.lua b/scenario_templates/danger-ore-exotic-industries/map_selection.lua new file mode 100644 index 00000000..ace12ccc --- /dev/null +++ b/scenario_templates/danger-ore-exotic-industries/map_selection.lua @@ -0,0 +1 @@ +return require 'map_gen.maps.danger_ores.presets.danger_ore_exotic_industries' \ No newline at end of file diff --git a/scenario_templates/danger-ore-industrial-revolution-3-grid-factory/map_selection.lua b/scenario_templates/danger-ore-industrial-revolution-3-grid-factory/map_selection.lua new file mode 100644 index 00000000..c18c01ff --- /dev/null +++ b/scenario_templates/danger-ore-industrial-revolution-3-grid-factory/map_selection.lua @@ -0,0 +1 @@ +return require 'map_gen.maps.danger_ores.presets.danger_ore_industrial_revolution_3_grid_factory' \ No newline at end of file diff --git a/scenario_templates/danger-ore-industrial-revolution-3/map_selection.lua b/scenario_templates/danger-ore-industrial-revolution-3/map_selection.lua new file mode 100644 index 00000000..60694745 --- /dev/null +++ b/scenario_templates/danger-ore-industrial-revolution-3/map_selection.lua @@ -0,0 +1 @@ +return require 'map_gen.maps.danger_ores.presets.danger_ore_industrial_revolution_3' \ No newline at end of file diff --git a/scenario_templates/danger-ore-omnimatter-cages/map_selection.lua b/scenario_templates/danger-ore-omnimatter-cages/map_selection.lua new file mode 100644 index 00000000..8149c8f2 --- /dev/null +++ b/scenario_templates/danger-ore-omnimatter-cages/map_selection.lua @@ -0,0 +1 @@ +return require 'map_gen.maps.danger_ores.presets.danger_ore_omnimatter_cages' \ No newline at end of file diff --git a/scenario_templates/danger-ore-omnimatter/map_selection.lua b/scenario_templates/danger-ore-omnimatter/map_selection.lua new file mode 100644 index 00000000..e2225e0e --- /dev/null +++ b/scenario_templates/danger-ore-omnimatter/map_selection.lua @@ -0,0 +1 @@ +return require 'map_gen.maps.danger_ores.presets.danger_ore_omnimatter' \ No newline at end of file diff --git a/scenario_templates/danger-ore-pyfe/map_selection.lua b/scenario_templates/danger-ore-pyfe/map_selection.lua new file mode 100644 index 00000000..9f9b512c --- /dev/null +++ b/scenario_templates/danger-ore-pyfe/map_selection.lua @@ -0,0 +1 @@ +return require 'map_gen.maps.danger_ores.presets.danger_ore_pyfe' \ No newline at end of file