mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-09-16 09:16:22 +02:00
Add DO:SpaceAge (#1495)
* Add DO:SpaceAge * Redmew surface refactor * Add style guide
This commit is contained in:
10
.stylua.toml
Normal file
10
.stylua.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
column_width = 200
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 4
|
||||
quote_style = "ForceSingle"
|
||||
call_parentheses = "Input"
|
||||
collapse_simple_statement = "Never"
|
||||
|
||||
[sort_requires]
|
||||
enabled = false
|
@@ -35,6 +35,7 @@ storage.config = {
|
||||
-- the entire module can be toggled or just individual parts
|
||||
redmew_surface = {
|
||||
enabled = true,
|
||||
use_default = false,
|
||||
map_gen_settings = true,
|
||||
map_settings = true,
|
||||
difficulty = true
|
||||
|
@@ -98,4 +98,12 @@ return [[
|
||||
|
||||
2025-05-09:
|
||||
- [DO:Krastorio2] Updated to 2.0
|
||||
|
||||
2025-08-04:
|
||||
- [DO] Fixed error when displaying total ore mined to discord
|
||||
- [DO] Fixed an error with allowed_entities module
|
||||
- [DO] Updated "trees" and "enemy" modules
|
||||
- [DO] Removed ore breakdown, only total amount is displayed instead
|
||||
- [DO] Removed custom surface from base scenario
|
||||
- [DO:SpaceAge] Added DO/SpaceAge
|
||||
]]
|
||||
|
117
map_gen/maps/danger_ores/compatibility/space-age/coal.lua
Normal file
117
map_gen/maps/danger_ores/compatibility/space-age/coal.lua
Normal file
@@ -0,0 +1,117 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local start_value = b.euclidean_value(50, 0)
|
||||
local value = b.exponential_value(0, 0.035, 1.45)
|
||||
|
||||
return {
|
||||
{
|
||||
name = 'coal',
|
||||
['tiles'] = {
|
||||
[1] = 'volcanic-soil-dark',
|
||||
[2] = 'volcanic-soil-light',
|
||||
[3] = 'volcanic-ash-cracks',
|
||||
[4] = 'volcanic-ash-dark',
|
||||
[5] = 'volcanic-ash-flats',
|
||||
[6] = 'volcanic-ash-light',
|
||||
[7] = 'volcanic-ash-soil',
|
||||
[8] = 'volcanic-cracks',
|
||||
[9] = 'volcanic-cracks-hot',
|
||||
[10] = 'volcanic-cracks-warm',
|
||||
[11] = 'volcanic-folds',
|
||||
[12] = 'volcanic-folds-flat',
|
||||
[13] = 'volcanic-folds-warm',
|
||||
[14] = 'volcanic-jagged-ground',
|
||||
[15] = 'volcanic-pumice-stones',
|
||||
[16] = 'volcanic-smooth-stone',
|
||||
[17] = 'volcanic-smooth-stone-warm',
|
||||
--[18] = 'lava',
|
||||
--[19] = 'lava-hot',
|
||||
},
|
||||
['start'] = start_value,
|
||||
['weight'] = 1,
|
||||
['ratios'] = {{resource = b.resource(b.full_shape, 'coal', value), weight = 1}}
|
||||
},
|
||||
{
|
||||
name = 'copper-ore',
|
||||
['tiles'] = {
|
||||
[1] = 'fulgoran-conduit',
|
||||
[2] = 'fulgoran-dunes',
|
||||
[3] = 'fulgoran-dust',
|
||||
[4] = 'fulgoran-machinery',
|
||||
[5] = 'fulgoran-paving',
|
||||
[6] = 'fulgoran-rock',
|
||||
[7] = 'fulgoran-sand',
|
||||
[8] = 'fulgoran-walls',
|
||||
[9] = 'oil-ocean-deep',
|
||||
[10] = 'oil-ocean-shallow',
|
||||
},
|
||||
['start'] = start_value,
|
||||
['weight'] = 1,
|
||||
['ratios'] = {{resource = b.resource(b.full_shape, 'coal', value), weight = 1}}
|
||||
},
|
||||
{
|
||||
name = 'iron-ore',
|
||||
['tiles'] = {
|
||||
[1] = 'ammoniacal-ocean',
|
||||
[2] = 'ammoniacal-ocean-2',
|
||||
[3] = 'brash-ice',
|
||||
[4] = 'ice-rough',
|
||||
[5] = 'ice-smooth',
|
||||
[6] = 'snow-crests',
|
||||
[7] = 'snow-flat',
|
||||
[8] = 'snow-lumpy',
|
||||
[9] = 'snow-patchy',
|
||||
},
|
||||
['start'] = start_value,
|
||||
['weight'] = 1,
|
||||
['ratios'] = {{resource = b.resource(b.full_shape, 'coal', value), weight = 1}}
|
||||
},
|
||||
{
|
||||
name = 'stone',
|
||||
['tiles'] = {
|
||||
[1] = 'gleba-deep-lake',
|
||||
[2] = 'highland-dark-rock',
|
||||
[3] = 'highland-dark-rock-2',
|
||||
[4] = 'highland-yellow-rock',
|
||||
[5] = 'lowland-brown-blubber',
|
||||
[6] = 'lowland-cream-cauliflower',
|
||||
[7] = 'lowland-cream-cauliflower-2',
|
||||
[8] = 'lowland-cream-red',
|
||||
[9] = 'lowland-dead-skin',
|
||||
[10] = 'lowland-dead-skin-2',
|
||||
[11] = 'lowland-olive-blubber',
|
||||
[12] = 'lowland-olive-blubber-2',
|
||||
[13] = 'lowland-olive-blubber-3',
|
||||
[14] = 'lowland-pale-green',
|
||||
[15] = 'lowland-red-infection',
|
||||
[16] = 'lowland-red-vein',
|
||||
[17] = 'lowland-red-vein-2',
|
||||
[18] = 'lowland-red-vein-3',
|
||||
[19] = 'lowland-red-vein-4',
|
||||
[20] = 'lowland-red-vein-dead',
|
||||
[21] = 'midland-cracked-lichen',
|
||||
[22] = 'midland-cracked-lichen-dark',
|
||||
[23] = 'midland-cracked-lichen-dull',
|
||||
[24] = 'midland-turquoise-bark',
|
||||
[25] = 'midland-turquoise-bark-2',
|
||||
[26] = 'midland-yellow-crust',
|
||||
[27] = 'midland-yellow-crust-2',
|
||||
[28] = 'midland-yellow-crust-3',
|
||||
[29] = 'midland-yellow-crust-4',
|
||||
[30] = 'natural-jellynut-soil',
|
||||
[31] = 'natural-yumako-soil',
|
||||
[32] = 'pit-rock',
|
||||
[33] = 'wetland-blue-slime',
|
||||
[34] = 'wetland-dead-skin',
|
||||
[35] = 'wetland-green-slime',
|
||||
[36] = 'wetland-jellynut',
|
||||
[37] = 'wetland-light-dead-skin',
|
||||
[38] = 'wetland-light-green-slime',
|
||||
[39] = 'wetland-pink-tentacle',
|
||||
[40] = 'wetland-red-tentacle',
|
||||
[41] = 'wetland-yumako',
|
||||
},
|
||||
['start'] = start_value,
|
||||
['weight'] = 1,
|
||||
['ratios'] = {{resource = b.resource(b.full_shape, 'coal', value), weight = 1}}
|
||||
}
|
||||
}
|
67
map_gen/maps/danger_ores/compatibility/space-age/ores.lua
Normal file
67
map_gen/maps/danger_ores/compatibility/space-age/ores.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local math = require 'utils.math'
|
||||
local table = require 'utils.table'
|
||||
|
||||
local random = math.random
|
||||
local bnot = bit32.bnot
|
||||
local binary_search = table.binary_search
|
||||
local value = b.euclidean_value
|
||||
|
||||
--- Solid patches
|
||||
local ratio_value = b.exponential_value(0, 1.4, 1.45)
|
||||
|
||||
local iron_ratios = {
|
||||
{ resource = b.resource(b.full_shape, 'iron-ore', ratio_value), weight = 80 },
|
||||
{ resource = b.resource(b.full_shape, 'copper-ore', ratio_value), weight = 13 },
|
||||
{ resource = b.resource(b.full_shape, 'stone', ratio_value), weight = 7 },
|
||||
}
|
||||
|
||||
local copper_ratios = {
|
||||
{ resource = b.resource(b.full_shape, 'iron-ore', ratio_value), weight = 15 },
|
||||
{ resource = b.resource(b.full_shape, 'copper-ore', ratio_value), weight = 75 },
|
||||
{ resource = b.resource(b.full_shape, 'stone', ratio_value), weight = 10 },
|
||||
}
|
||||
|
||||
local function build_solid_patches(ratios)
|
||||
return function(x, y, world)
|
||||
local weighted = b.prepare_weighted_array(ratios)
|
||||
local total = weighted.total
|
||||
|
||||
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)
|
||||
|
||||
entity.enable_tree_removal = false
|
||||
|
||||
return entity
|
||||
end
|
||||
end
|
||||
|
||||
--- Liquid patches
|
||||
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 build_liquid_patches(name, data)
|
||||
return {
|
||||
scale = data.scale,
|
||||
threshold = data.t,
|
||||
resource = b.any{ b.resource(oil_shape, name, value(data.base, data.mult)), full_oil_shape }
|
||||
}
|
||||
end
|
||||
|
||||
return {
|
||||
{ scale = 1 / 24, threshold = 0.50, resource = build_solid_patches(iron_ratios) },
|
||||
{ scale = 1 / 24, threshold = 0.50, resource = build_solid_patches(copper_ratios) },
|
||||
{ scale = 1 / 48, threshold = 0.66, resource = b.resource(b.full_shape, 'tungsten-ore', value(100, 1.5)) },
|
||||
{ scale = 1 / 24, threshold = 0.66, resource = b.resource(b.full_shape, 'calcite', value(100, 1.5)) },
|
||||
{ scale = 1 / 48, threshold = 0.66, resource = b.resource(b.full_shape, prototypes.entity['holmium-ore'] and 'holmium-ore' or 'scrap', value(100, 1.5)) },
|
||||
build_liquid_patches('sulfuric-acid-geyser', { scale = 1/64, t = 0.70, base = 100000, mult = 2500 }),
|
||||
build_liquid_patches('lithium-brine', { scale = 1/32, t = 0.70, base = 100000, mult = 2500 }),
|
||||
build_liquid_patches('fluorine-vent', { scale = 1/32, t = 0.70, base = 100000, mult = 2500 }),
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
return {
|
||||
'tree-01',
|
||||
'tree-02',
|
||||
'tree-02-red',
|
||||
'tree-03',
|
||||
'tree-04',
|
||||
'tree-05',
|
||||
'tree-06',
|
||||
'tree-06-brown',
|
||||
'tree-07',
|
||||
'tree-08',
|
||||
'tree-08-brown',
|
||||
'tree-08-red',
|
||||
'tree-09',
|
||||
'tree-09-brown',
|
||||
'tree-09-red',
|
||||
'ashland-lichen-tree',
|
||||
'ashland-lichen-tree-flaming',
|
||||
'iron-stromatolite',
|
||||
'copper-stromatolite',
|
||||
'slipstack',
|
||||
'funneltrunk',
|
||||
'hairyclubnub',
|
||||
'teflilly',
|
||||
'lickmaw',
|
||||
'stingfrond',
|
||||
'boompuff',
|
||||
'sunnycomb',
|
||||
'cuttlepop',
|
||||
'fulgurite',
|
||||
'fulgurite-small',
|
||||
}
|
49
map_gen/maps/danger_ores/compatibility/space-age/victory.lua
Normal file
49
map_gen/maps/danger_ores/compatibility/space-age/victory.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
local Event = require 'utils.event'
|
||||
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.goal_notice = false
|
||||
|
||||
local function rocket_launched()
|
||||
if ShareGlobals.data.map_won then
|
||||
return
|
||||
end
|
||||
|
||||
if ShareGlobals.goal_notice then
|
||||
return
|
||||
end
|
||||
|
||||
ShareGlobals.goal_notice = true
|
||||
local message = 'Craft a legendary Mech Armor to win the map.'
|
||||
game.print(message)
|
||||
Server.to_discord_bold(message)
|
||||
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
|
||||
|
||||
Event.add(defines.events.on_rocket_launched, rocket_launched)
|
||||
Event.on_nth_tick(301, function()
|
||||
local player = game.forces.player
|
||||
for _, surface in pairs(game.surfaces) do
|
||||
local surface_stats = player.get_item_production_statistics(surface)
|
||||
if surface_stats then
|
||||
if surface_stats.get_input_count({ name = 'mech-armor', quality = 'legendary' }) > 0 then
|
||||
win()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
@@ -136,5 +136,7 @@ return {
|
||||
main_ores_split_count = nil,
|
||||
main_ores_start_ore_offset = nil,
|
||||
main_ore_resource_patches_config = nil,
|
||||
spawner_names = nil,
|
||||
tree_names = nil,
|
||||
},
|
||||
}
|
||||
|
@@ -103,7 +103,11 @@ local function handle_entity_refund(entity, event)
|
||||
end
|
||||
|
||||
-- refund item to robot/player
|
||||
local stack = entity.prototype.items_to_place_this[1]
|
||||
local items_to_place_this = entity.prototype.items_to_place_this
|
||||
if not items_to_place_this or #items_to_place_this == 0 then
|
||||
return
|
||||
end
|
||||
local stack = items_to_place_this[1]
|
||||
if stack then
|
||||
stack.quality = entity.quality
|
||||
local actor = event.robot or (event.player_index and game.get_player(event.player_index))
|
||||
|
@@ -11,9 +11,8 @@ local perlin_noise = Perlin.noise
|
||||
local random = math.random
|
||||
|
||||
return function(config)
|
||||
local worm_names =
|
||||
config.worm_names or {'small-worm-turret', 'medium-worm-turret', 'big-worm-turret', 'behemoth-worm-turret'}
|
||||
local spawner_names = config.spawner_names or {'biter-spawner', 'spitter-spawner'}
|
||||
local worm_names = config.worm_names or { 'small-worm-turret', 'medium-worm-turret', 'big-worm-turret', 'behemoth-worm-turret' }
|
||||
local spawner_names = config.spawner_names or { 'biter-spawner', 'spitter-spawner' }
|
||||
local factor = config.enemy_factor or 10 / (768 * 32)
|
||||
local max_chance = config.enemy_max_chance or 1 / 6
|
||||
local scale_factor = config.enemy_scale_factor or 32
|
||||
@@ -63,13 +62,13 @@ return function(config)
|
||||
else
|
||||
worm_id = random(lvl)
|
||||
end
|
||||
return {name = worm_names[worm_id]}
|
||||
return { name = worm_names[worm_id] }
|
||||
end
|
||||
else
|
||||
local chance = min(max_chance, d * factor)
|
||||
if random() < chance then
|
||||
local spawner_id = random(2)
|
||||
return {name = spawner_names[spawner_id]}
|
||||
local spawner_id = random(#spawner_names)
|
||||
return { name = spawner_names[spawner_id] }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -18,7 +18,9 @@ function Public.ore_oil_none(resource_list)
|
||||
end
|
||||
local ore_oil_none = {}
|
||||
for _, v in pairs(resource_list) do
|
||||
ore_oil_none[v] = { frequency = 1, richness = 1, size = 0 }
|
||||
if prototypes.autoplace_control[v] then
|
||||
ore_oil_none[v] = { frequency = 1, richness = 1, size = 0 }
|
||||
end
|
||||
end
|
||||
return { autoplace_controls = ore_oil_none }
|
||||
end
|
||||
|
@@ -26,6 +26,7 @@ local mod_packs = {
|
||||
danger_ore_omnimatter = 'danger_ore_omnimatter',
|
||||
danger_ore_py_short = 'danger_ore_py_short',
|
||||
danger_ore_scrap = 'danger_ore_scrap',
|
||||
danger_ore_space_age = 'danger_ore_space_age',
|
||||
}
|
||||
|
||||
local maps = {
|
||||
@@ -58,6 +59,7 @@ local maps = {
|
||||
--{ name = 'danger-ore-poor-mans-coal-fields', display_name = 'Poor Man\'s Coal Fields (Alex Gaming\'s map)', mod_pack = mod_packs.danger_ore_normal },
|
||||
{ name = 'danger-ore-pyfe', display_name = 'Pyanodon Short (PyFe)', mod_pack = mod_packs.danger_ore_py_short },
|
||||
{ name = 'danger-ore-scrap', display_name = 'Scrapworld (no ores, all scraps)', mod_pack = mod_packs.danger_ore_scrap },
|
||||
{ name = 'danger-ore-space-age', display_name = 'Space Age (everything on Nauvis)', mod_pack = mod_packs.danger_ore_space_age },
|
||||
{ name = 'danger-ore-spiral', display_name = 'Spiral (without void)', mod_pack = mod_packs.danger_ore_normal },
|
||||
{ name = 'danger-ore-split', display_name = 'Split (4x sectors)', mod_pack = mod_packs.danger_ore_normal },
|
||||
{ name = 'danger-ore-square', display_name = 'Square (corner start)', mod_pack = mod_packs.danger_ore_normal },
|
||||
|
@@ -77,16 +77,16 @@ return function(config)
|
||||
}
|
||||
|
||||
local awards = {
|
||||
['total_kills'] = {value = 0, player = ""},
|
||||
['units_killed'] = {value = 0, player = ""},
|
||||
['spawners_killed'] = {value = 0, player = ""},
|
||||
['worms_killed'] = {value = 0, player = ""},
|
||||
['player_deaths'] = {value = 0, player = ""},
|
||||
['time_played'] = {value = 0, player = ""},
|
||||
['entities_built'] = {value = 0, player = ""},
|
||||
['entities_crafted'] = {value = 0, player = ""},
|
||||
['distance_walked'] = {value = 0, player = ""},
|
||||
['resources_hand_mined'] = {value = 0, player = ""}
|
||||
['total_kills'] = {value = 0, player = ''},
|
||||
['units_killed'] = {value = 0, player = ''},
|
||||
['spawners_killed'] = {value = 0, player = ''},
|
||||
['worms_killed'] = {value = 0, player = ''},
|
||||
['player_deaths'] = {value = 0, player = ''},
|
||||
['time_played'] = {value = 0, player = ''},
|
||||
['entities_built'] = {value = 0, player = ''},
|
||||
['entities_crafted'] = {value = 0, player = ''},
|
||||
['distance_walked'] = {value = 0, player = ''},
|
||||
['resources_hand_mined'] = {value = 0, player = ''}
|
||||
}
|
||||
|
||||
for _, v in pairs(statistics.player_data) do
|
||||
@@ -132,7 +132,7 @@ return function(config)
|
||||
end
|
||||
end
|
||||
|
||||
local resource_prototypes = prototypes.get_entity_filtered({{filter = "type", type = "resource"}})
|
||||
local resource_prototypes = prototypes.get_entity_filtered({{filter = 'type', type = 'resource'}})
|
||||
local ore_products = {}
|
||||
for _, ore_prototype in pairs(resource_prototypes) do
|
||||
local mineable_properties = ore_prototype.mineable_properties
|
||||
@@ -144,35 +144,31 @@ return function(config)
|
||||
end
|
||||
|
||||
local total_ore = 0
|
||||
local ore_totals_message = '('
|
||||
local surface_stats = game.forces.player.get_item_production_statistics(RS.get_surface_name())
|
||||
for ore_name in pairs(ore_products) do
|
||||
local count = game.forces["player"].get_item_production_statistics(RS.get_surface_name()).get_input_count(ore_name)
|
||||
total_ore = total_ore + count
|
||||
ore_totals_message = ore_totals_message..ore_name:gsub( "-ore", "")..": "..format_number(count, true)..", "
|
||||
total_ore = total_ore + (surface_stats.get_input_count(ore_name) or 0)
|
||||
end
|
||||
ore_totals_message = ore_totals_message:sub(1, -3)..')' -- remove the last ", " and add a bracket
|
||||
ore_totals_message = format_number(total_ore, true).. "\\n"..ore_totals_message
|
||||
|
||||
local statistics_message = statistics.scenario..' completed!\\n\\n'..
|
||||
'Statistics:\\n'..
|
||||
'Map time: '..time_string..'\\n'..
|
||||
'Total entities built: '..statistics.entities_built..'\\n'..
|
||||
'Total ore mined:'..ore_totals_message..'\\n'..
|
||||
'Total ore resources exhausted: '..statistics.resources_exhausted..'\\n'..
|
||||
'Total ore hand mined: '..statistics.resources_hand_mined..'\\n'..
|
||||
'Players: '..statistics.total_players..'\\n'..
|
||||
'Enemies killed: '..statistics.biters_killed..'\\n\\n'..
|
||||
'Awards:\\n'..
|
||||
'Most ore hand mined:'..awards.resources_hand_mined.player..' ('..awards.resources_hand_mined.value..')\\n'..
|
||||
'Most items crafted: '..awards.entities_crafted.player..' ('..awards.entities_crafted.value..')\\n'..
|
||||
'Most entities built: '..awards.entities_built.player..' ('..awards.entities_built.value..')\\n'..
|
||||
'Most time played: '..awards.time_played.player..' ('..Core.format_time(awards.time_played.value)..')\\n'..
|
||||
'Furthest walked: '..awards.distance_walked.player..' ('..math.floor(awards.distance_walked.value)..')\\n'..
|
||||
'Most deaths: '..awards.player_deaths.player..' ('..awards.player_deaths.value..')\\n'..
|
||||
'Most kills overall: '..awards.total_kills.player..' ('..awards.total_kills.value..')\\n'..
|
||||
'Most biters/spitters killed: '..awards.units_killed.player..' ('..awards.units_killed.value..')\\n'..
|
||||
'Most spawners killed: '..awards.spawners_killed.player..' ('..awards.spawners_killed.value..')\\n'..
|
||||
'Most worms killed: '..awards.worms_killed.player..' ('..awards.worms_killed.value..')\\n'
|
||||
local statistics_message = statistics.scenario..' completed!\\n\\n'..
|
||||
'**Statistics:**\\n'..
|
||||
'_Map time:_ '..time_string..'\\n'..
|
||||
'_Total entities built:_ '..statistics.entities_built..'\\n'..
|
||||
'_Total ore mined:_ '..format_number(total_ore, true)..'\\n'..
|
||||
'_Total ore resources exhausted:_ '..statistics.resources_exhausted..'\\n'..
|
||||
'_Total ore hand mined:_ '..statistics.resources_hand_mined..'\\n'..
|
||||
'_Players:_ '..statistics.total_players..'\\n'..
|
||||
'_Enemies killed:_ '..statistics.biters_killed..'\\n\\n'..
|
||||
'**Awards:**\\n'..
|
||||
'_Most ore hand mined:_ '..awards.resources_hand_mined.player..' ('..awards.resources_hand_mined.value..')\\n'..
|
||||
'_Most items crafted:_ '..awards.entities_crafted.player..' ('..awards.entities_crafted.value..')\\n'..
|
||||
'_Most entities built:_ '..awards.entities_built.player..' ('..awards.entities_built.value..')\\n'..
|
||||
'_Most time played:_ '..awards.time_played.player..' ('..Core.format_time(awards.time_played.value)..')\\n'..
|
||||
'_Furthest walked:_ '..awards.distance_walked.player..' ('..math.floor(awards.distance_walked.value)..')\\n'..
|
||||
'_Most deaths:_ '..awards.player_deaths.player..' ('..awards.player_deaths.value..')\\n'..
|
||||
'_Most kills overall:_ '..awards.total_kills.player..' ('..awards.total_kills.value..')\\n'..
|
||||
'_Most biters/spitters killed:_ '..awards.units_killed.player..' ('..awards.units_killed.value..')\\n'..
|
||||
'_Most spawners killed:_ '..awards.spawners_killed.player..' ('..awards.spawners_killed.value..')\\n'..
|
||||
'_Most worms killed:_ '..awards.worms_killed.player..' ('..awards.worms_killed.value..')\\n'
|
||||
|
||||
Server.to_discord_named_embed(map_promotion_channel, statistics_message)
|
||||
Server.to_discord_named_embed(danger_ores_channel, statistics_message)
|
||||
|
@@ -5,7 +5,7 @@ local seed_provider = require 'map_gen.maps.danger_ores.modules.seed_provider'
|
||||
local perlin_noise = Perlin.noise
|
||||
local random = math.random
|
||||
|
||||
local trees = {
|
||||
local default_trees_config = {
|
||||
'tree-01',
|
||||
'tree-02',
|
||||
'tree-02-red',
|
||||
@@ -23,13 +23,13 @@ local trees = {
|
||||
'tree-09-red'
|
||||
}
|
||||
|
||||
local trees_count = #trees
|
||||
|
||||
return function(config)
|
||||
local trees = config.tree_names or default_trees_config
|
||||
local scale = config.trees_scale or 1 / 64
|
||||
local threshold = config.trees_threshold or -0.25
|
||||
local chance = config.trees_chance or 0.125
|
||||
local seed = config.trees_seed or seed_provider()
|
||||
local trees_count = #trees
|
||||
|
||||
return function(x, y)
|
||||
local tree_noise = perlin_noise(x * scale, y * scale, seed)
|
||||
|
40
map_gen/maps/danger_ores/presets/danger_ore_space_age.lua
Normal file
40
map_gen/maps/danger_ores/presets/danger_ore_space_age.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
local H = require 'map_gen.maps.danger_ores.modules.helper'
|
||||
local DOC = require 'map_gen.maps.danger_ores.configuration'
|
||||
local Scenario = require 'map_gen.maps.danger_ores.scenario'
|
||||
local ScenarioInfo = require 'features.gui.info'
|
||||
|
||||
ScenarioInfo.set_map_name('Danger Ores - Space Age')
|
||||
ScenarioInfo.add_map_extra_info([[
|
||||
This map is covered in [item=coal] with mixed dense patches containing [item=iron-ore] [item=copper-ore] [item=stone] [item=calcite] [item=tungsten-ore] [item=holmium-ore].
|
||||
The patches alternate between [item=iron-ore] and [item=copper-ore] as the main resource.
|
||||
]])
|
||||
|
||||
DOC.scenario_name = 'danger-ore-space-age'
|
||||
DOC.map_config.main_ore_resource_patches_config = require 'map_gen.maps.danger_ores.compatibility.space-age.ores'
|
||||
DOC.map_config.main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_patches'
|
||||
DOC.map_config.main_ores = require 'map_gen.maps.danger_ores.compatibility.space-age.coal'
|
||||
DOC.map_config.main_ores_rotate = nil
|
||||
DOC.map_config.trees = require 'map_gen.maps.danger_ores.modules.trees'
|
||||
DOC.map_config.tree_names = require 'map_gen.maps.danger_ores.compatibility.space-age.tree_names'
|
||||
DOC.map_config.spawner_names = { 'biter-spawner', 'spitter-spawner', 'gleba-spawner-small', 'gleba-spawner' }
|
||||
DOC.rocket_launched.enabled = false
|
||||
DOC.map_gen_settings.settings = H.empty_map_settings{
|
||||
'calcite',
|
||||
'coal',
|
||||
'copper-ore',
|
||||
'crude-oil',
|
||||
'fluorine_vent',
|
||||
'holmium-ore',
|
||||
'iron-ore',
|
||||
'lithium_brine',
|
||||
'scrap',
|
||||
'stone',
|
||||
'sulfuric_acid_geyser',
|
||||
'tungsten_ore',
|
||||
'uranium-ore',
|
||||
}
|
||||
|
||||
require 'map_gen.maps.danger_ores.compatibility.space-age.victory'()
|
||||
|
||||
return Scenario.register(DOC)
|
@@ -39,6 +39,7 @@ Config.player_rewards.enabled = false
|
||||
Config.player_shortcuts.enabled = true
|
||||
Config.player_shortcuts.shortcuts.battery_charge = false
|
||||
Config.reactor_meltdown.enabled = false
|
||||
Config.redmew_surface.use_default = true
|
||||
|
||||
local allowed_entities = require 'map_gen.maps.danger_ores.modules.allowed_entities'.register
|
||||
local concrete_on_landfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill'
|
||||
|
@@ -165,43 +165,79 @@ local function set_map_settings()
|
||||
end
|
||||
end
|
||||
|
||||
local function create_surface_with_settings()
|
||||
-- Combine default map gen settings with user components
|
||||
local combined_map_gen = { game.surfaces.nauvis.map_gen_settings }
|
||||
local nauvis_as = combined_map_gen[1].autoplace_settings
|
||||
|
||||
for _, v in pairs(data.map_gen_settings_components) do
|
||||
table.insert(combined_map_gen, v)
|
||||
-- Check for autoplace setting blacklisting
|
||||
local as = v.autoplace_settings
|
||||
if nauvis_as and as then
|
||||
for _, name in pairs({ 'entity', 'tile', 'decorative' }) do
|
||||
if nauvis_as[name] and as[name] and as[name].treat_missing_as_default == false then
|
||||
nauvis_as[name].settings = {}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local surface
|
||||
if config.use_default then
|
||||
surface = game.surfaces[vanilla_surface_name]
|
||||
surface.map_gen_settings = merge(combined_map_gen)
|
||||
else
|
||||
surface = game.create_surface(redmew_surface_name, merge(combined_map_gen))
|
||||
end
|
||||
return surface
|
||||
end
|
||||
|
||||
local function get_or_create_surface()
|
||||
if config.map_gen_settings then
|
||||
return create_surface_with_settings()
|
||||
else
|
||||
if config.use_default then
|
||||
return game.surfaces[vanilla_surface_name]
|
||||
else
|
||||
return game.create_surface(redmew_surface_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function initialize_surface()
|
||||
local surface = global_data.surface
|
||||
if not surface then
|
||||
return
|
||||
end
|
||||
|
||||
if config.use_default then
|
||||
surface.clear(true)
|
||||
else
|
||||
-- Hide the vanilla surface to all forces
|
||||
for _, force in pairs(game.forces) do
|
||||
force.set_surface_hidden(vanilla_surface_name, true)
|
||||
end
|
||||
end
|
||||
|
||||
surface.request_to_generate_chunks({0, 0}, 4)
|
||||
surface.force_generate_chunk_requests()
|
||||
|
||||
local spawn_position = global_data.spawn_position
|
||||
if spawn_position then
|
||||
game.forces.player.set_spawn_position(spawn_position, surface)
|
||||
end
|
||||
end
|
||||
|
||||
--- Creates a new surface with the settings provided by the map file and the player.
|
||||
local function create_redmew_surface()
|
||||
local function create_scenario_surface()
|
||||
if not config.enabled then
|
||||
-- we still need to set the surface so Public.get_surface() will work.
|
||||
-- Still need to set the surface for Public.get_surface() to work
|
||||
global_data.surface = game.surfaces[vanilla_surface_name]
|
||||
return
|
||||
end
|
||||
|
||||
local surface
|
||||
|
||||
if config.map_gen_settings then
|
||||
-- Add the user's map gen settings as the first entry in the table
|
||||
local combined_map_gen = {game.surfaces.nauvis.map_gen_settings}
|
||||
local nauvis_as = combined_map_gen[1].autoplace_settings
|
||||
-- Take the map's settings and add them into the table
|
||||
for _, v in pairs(data.map_gen_settings_components) do
|
||||
insert(combined_map_gen, v)
|
||||
-- Check if any preset is blacklisting other autoplace settings, and void the default one if so
|
||||
local as = v.autoplace_settings
|
||||
if nauvis_as and as then
|
||||
for _, name in pairs({ 'entity', 'tile', 'decorative' }) do
|
||||
if nauvis_as[name] and as[name] and as[name].treat_missing_as_default == false then
|
||||
nauvis_as[name].settings = {}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
surface = game.create_surface(redmew_surface_name, merge(combined_map_gen))
|
||||
else
|
||||
surface = game.create_surface(redmew_surface_name)
|
||||
end
|
||||
|
||||
for _, force in pairs(game.forces) do
|
||||
force.set_surface_hidden(vanilla_surface_name, true)
|
||||
end
|
||||
|
||||
global_data.surface = surface
|
||||
global_data.surface = get_or_create_surface()
|
||||
|
||||
if config.difficulty then
|
||||
set_difficulty_settings()
|
||||
@@ -210,12 +246,7 @@ local function create_redmew_surface()
|
||||
set_map_settings()
|
||||
end
|
||||
|
||||
surface.request_to_generate_chunks({0, 0}, 4)
|
||||
surface.force_generate_chunk_requests()
|
||||
local spawn_position = global_data.spawn_position
|
||||
if spawn_position then
|
||||
game.forces.player.set_spawn_position(spawn_position, surface)
|
||||
end
|
||||
initialize_surface()
|
||||
end
|
||||
|
||||
--- Teleport the player to the redmew surface and if there is no suitable location, create an island
|
||||
@@ -289,7 +320,7 @@ end
|
||||
--- Returns the string name of the surface that the map is created on.
|
||||
-- This can safely be called at any time.
|
||||
function Public.get_surface_name()
|
||||
if config.enabled then
|
||||
if config.enabled and not config.use_default then
|
||||
return redmew_surface_name
|
||||
else
|
||||
return vanilla_surface_name
|
||||
@@ -315,7 +346,7 @@ function Public.set_spawn_island_tile(tile_name)
|
||||
global_data.island_tile = tile_name
|
||||
end
|
||||
|
||||
Event.on_init(create_redmew_surface)
|
||||
Event.on_init(create_scenario_surface)
|
||||
|
||||
if config.enabled then
|
||||
Event.add(defines.events.on_player_created, player_created)
|
||||
|
@@ -0,0 +1 @@
|
||||
return require 'map_gen.maps.danger_ores.presets.danger_ore_space_age'
|
Reference in New Issue
Block a user