mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-01-18 03:21:47 +02:00
Merge pull request #1199 from grilledham/danger_ore_landfill
Danger ore landfill
This commit is contained in:
commit
0f2674ee3c
@ -14,6 +14,9 @@ local Public = {}
|
||||
local rank_too_low_message = {'landfill_remover.rank_too_low'}
|
||||
Public.rank_too_low_message =rank_too_low_message
|
||||
|
||||
local missing_research_message = {'landfill_remover.missing_research'}
|
||||
Public.missing_research_message = missing_research_message
|
||||
|
||||
local floor = math.floor
|
||||
local ceil = math.ceil
|
||||
local fast_remove = table.fast_remove
|
||||
@ -160,6 +163,11 @@ Event.add(
|
||||
return
|
||||
end
|
||||
|
||||
if not player.force.technologies['landfill'].researched then
|
||||
player.print(missing_research_message)
|
||||
return
|
||||
end
|
||||
|
||||
if Rank.less_than(player.name, Ranks.auto_trusted) then
|
||||
player.print(rank_too_low_message)
|
||||
return
|
||||
|
@ -21,16 +21,20 @@ Declare.module(
|
||||
{'features', 'landfill remover'},
|
||||
function()
|
||||
local teardown
|
||||
local old_landfill_researched
|
||||
|
||||
Declare.module_startup(
|
||||
function(context)
|
||||
teardown = Helper.startup_test_surface(context)
|
||||
old_landfill_researched = context.player.force.technologies['landfill'].researched
|
||||
context.player.force.technologies['landfill'].researched = true
|
||||
end
|
||||
)
|
||||
|
||||
Declare.module_teardown(
|
||||
function()
|
||||
function(context)
|
||||
teardown()
|
||||
context.player.force.technologies['landfill'].researched = old_landfill_researched
|
||||
end
|
||||
)
|
||||
|
||||
@ -741,5 +745,43 @@ Declare.module(
|
||||
Assert.array_contains(messages, LandfillRemover.rank_too_low_message)
|
||||
end
|
||||
)
|
||||
|
||||
Declare.test(
|
||||
'can not remove landfill when landfill tech not researched',
|
||||
function(context)
|
||||
-- Arrange
|
||||
local player = context.player
|
||||
local surface = player.surface
|
||||
local cursor = setup_player_with_valid_deconstruction_planner(player)
|
||||
local position = {2, 2}
|
||||
local area = {{2.1, 2.1}, {2.9, 2.9}}
|
||||
surface.set_tiles({{name = 'landfill', position = position}})
|
||||
|
||||
player.force.technologies['landfill'].researched = false
|
||||
|
||||
context:add_teardown(function()
|
||||
player.force.technologies['landfill'].researched = true
|
||||
end)
|
||||
|
||||
local messages = {}
|
||||
|
||||
Helper.modify_lua_object(context, player, 'print', function(text)
|
||||
messages[#messages+1] = text
|
||||
end)
|
||||
|
||||
Helper.modify_lua_object(context, game, 'get_player', function()
|
||||
return player
|
||||
end)
|
||||
|
||||
-- Act
|
||||
EventFactory.do_player_deconstruct_area(cursor, player, area)
|
||||
|
||||
-- Assert
|
||||
local tile = surface.get_tile(position[1], position[2])
|
||||
Assert.equal('landfill', tile.name)
|
||||
|
||||
Assert.array_contains(messages, LandfillRemover.missing_research_message)
|
||||
end
|
||||
)
|
||||
end
|
||||
)
|
||||
|
@ -189,3 +189,4 @@ inventory_location=[color=blue][Corpse][/color] __1__ has been offline __2__ min
|
||||
|
||||
[landfill_remover]
|
||||
rank_too_low=You must be auto trusted or above to use the deconstruction planner on landfill.
|
||||
missing_research=[technology=landfill] required before landfill can be removed with the deconstruction planner.
|
44
map_gen/maps/danger_ores/config/vanilla_ore_landfill.lua
Normal file
44
map_gen/maps/danger_ores/config/vanilla_ore_landfill.lua
Normal file
@ -0,0 +1,44 @@
|
||||
local b = require 'map_gen.shared.builders'
|
||||
local value = b.euclidean_value
|
||||
|
||||
return {
|
||||
['copper-ore'] = {
|
||||
['tiles'] = {
|
||||
[1] = 'landfill'
|
||||
},
|
||||
['start'] = value(50, 0),
|
||||
['weight'] = 1,
|
||||
['ratios'] = {
|
||||
{resource = b.resource(b.full_shape, 'iron-ore', value(0, 0.75)), weight = 15},
|
||||
{resource = b.resource(b.full_shape, 'copper-ore', value(0, 0.75)), weight = 70},
|
||||
{resource = b.resource(b.full_shape, 'stone', value(0, 0.75)), weight = 7},
|
||||
{resource = b.resource(b.full_shape, 'coal', value(0, 0.75)), weight = 8}
|
||||
}
|
||||
},
|
||||
['coal'] = {
|
||||
['tiles'] = {
|
||||
[1] = 'landfill'
|
||||
},
|
||||
['start'] = value(50, 0),
|
||||
['weight'] = 1,
|
||||
['ratios'] = {
|
||||
{resource = b.resource(b.full_shape, 'iron-ore', value(0, 0.75)), weight = 25},
|
||||
{resource = b.resource(b.full_shape, 'copper-ore', value(0, 0.75)), weight = 10},
|
||||
{resource = b.resource(b.full_shape, 'stone', value(0, 0.75)), weight = 7},
|
||||
{resource = b.resource(b.full_shape, 'coal', value(0, 0.75)), weight = 58}
|
||||
}
|
||||
},
|
||||
['iron-ore'] = {
|
||||
['tiles'] = {
|
||||
[1] = 'landfill'
|
||||
},
|
||||
['start'] = value(50, 0),
|
||||
['weight'] = 1,
|
||||
['ratios'] = {
|
||||
{resource = b.resource(b.full_shape, 'iron-ore', value(0, 0.75)), weight = 70},
|
||||
{resource = b.resource(b.full_shape, 'copper-ore', value(0, 0.75)), weight = 15},
|
||||
{resource = b.resource(b.full_shape, 'stone', value(0, 0.75)), weight = 7},
|
||||
{resource = b.resource(b.full_shape, 'coal', value(0, 0.75)), weight = 8}
|
||||
}
|
||||
}
|
||||
}
|
@ -16,13 +16,15 @@ local bnot = bit32.bnot
|
||||
|
||||
local function spawn_builder(config)
|
||||
local spawn_circle = config.spawn_shape or b.circle(64)
|
||||
local spawn_tile = config.spawn_tile or 'grass-1'
|
||||
|
||||
local water = b.circle(16)
|
||||
water = b.change_tile(water, true, 'water')
|
||||
water = b.any {b.rectangle(32, 4), b.rectangle(4, 32), water}
|
||||
|
||||
local start = b.if_else(water, spawn_circle)
|
||||
return b.change_map_gen_collision_tile(start, 'water-tile', 'grass-1')
|
||||
start = b.change_tile(start, true, spawn_tile)
|
||||
return b.change_map_gen_collision_tile(start, 'water-tile', spawn_tile)
|
||||
end
|
||||
|
||||
local function tile_builder_factory(config)
|
||||
|
@ -2,6 +2,7 @@ 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 Bobs & Angels Ore Quadrants')
|
||||
@ -84,6 +85,10 @@ RS.set_map_gen_settings(
|
||||
}
|
||||
)
|
||||
|
||||
Config.market.enabled = false
|
||||
Config.player_rewards.enabled = false
|
||||
Config.player_create.starting_items = {}
|
||||
|
||||
Event.on_init(
|
||||
function()
|
||||
game.draw_resource_selection = false
|
||||
|
@ -2,6 +2,7 @@ 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('Terraforming Danger Ore')
|
||||
@ -95,6 +96,10 @@ RS.set_map_gen_settings(
|
||||
}
|
||||
)
|
||||
|
||||
Config.market.enabled = false
|
||||
Config.player_rewards.enabled = false
|
||||
Config.player_create.starting_items = {}
|
||||
|
||||
Event.on_init(
|
||||
function()
|
||||
game.draw_resource_selection = false
|
||||
|
@ -2,6 +2,7 @@ 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('Terraforming Danger Ore')
|
||||
@ -88,6 +89,10 @@ RS.set_map_gen_settings(
|
||||
}
|
||||
)
|
||||
|
||||
Config.market.enabled = false
|
||||
Config.player_rewards.enabled = false
|
||||
Config.player_create.starting_items = {}
|
||||
|
||||
Event.on_init(
|
||||
function()
|
||||
--game.draw_resource_selection = false
|
||||
|
@ -2,6 +2,7 @@ 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('Terraforming Danger Ore')
|
||||
@ -86,6 +87,10 @@ RS.set_map_gen_settings(
|
||||
}
|
||||
)
|
||||
|
||||
Config.market.enabled = false
|
||||
Config.player_rewards.enabled = false
|
||||
Config.player_create.starting_items = {}
|
||||
|
||||
Event.on_init(
|
||||
function()
|
||||
game.draw_resource_selection = false
|
||||
|
137
map_gen/maps/danger_ores/presets/danger_ore_landfill.lua
Normal file
137
map_gen/maps/danger_ores/presets/danger_ore_landfill.lua
Normal file
@ -0,0 +1,137 @@
|
||||
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('Terraforming Danger Ore')
|
||||
ScenarioInfo.set_map_description([[
|
||||
Clear the ore to expand the base,
|
||||
focus mining efforts on specific quadrants to ensure
|
||||
proper material ratios, expand the map with pollution!
|
||||
]])
|
||||
ScenarioInfo.add_map_extra_info([[
|
||||
This map is split in four quadrants. Each quadrant has a main resource.
|
||||
[item=iron-ore] north, [item=copper-ore] south, [item=coal] east, [item=stone] west
|
||||
|
||||
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=transport-belt] [item=fast-transport-belt] [item=express-transport-belt] [item=underground-belt] [item=fast-underground-belt] [item=express-underground-belt] [item=rail]
|
||||
|
||||
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_map_description([[
|
||||
Clear the ore to expand the base,
|
||||
focus mining efforts on specific quadrants to ensure
|
||||
proper material ratios, expand the map with pollution!
|
||||
]])
|
||||
ScenarioInfo.set_new_info([[
|
||||
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 1000 to win the map.
|
||||
]])
|
||||
|
||||
local map = require 'map_gen.maps.danger_ores.modules.map'
|
||||
local main_ores_config = require 'map_gen.maps.danger_ores.config.vanilla_ore_landfill'
|
||||
local resource_patches = require 'map_gen.maps.danger_ores.modules.resource_patches'
|
||||
local resource_patches_config = require 'map_gen.maps.danger_ores.config.vanilla_resource_patches'
|
||||
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.vanilla_allowed_entities'
|
||||
banned_entities(allowed_entities)
|
||||
|
||||
RS.set_map_gen_settings({
|
||||
MGSP.grass_only,
|
||||
MGSP.enable_water,
|
||||
{terrain_segmentation = 'normal', water = 'normal'},
|
||||
MGSP.starting_area_very_low,
|
||||
MGSP.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 = {}
|
||||
|
||||
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.difficulty_settings.technology_price_multiplier = 25
|
||||
game.forces.player.technologies.logistics.researched = true
|
||||
game.forces.player.technologies.automation.researched = true
|
||||
|
||||
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
|
||||
end)
|
||||
|
||||
local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming'
|
||||
terraforming({start_size = 8 * 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 = 500})
|
||||
|
||||
local restart_command = require 'map_gen.maps.danger_ores.modules.restart_command'
|
||||
restart_command({scenario_name = 'terraforming-danger-ore'})
|
||||
|
||||
local container_dump = require 'map_gen.maps.danger_ores.modules.container_dump'
|
||||
container_dump({entity_name = 'coal'})
|
||||
|
||||
local config = {
|
||||
spawn_shape = b.circle(64),
|
||||
start_ore_shape = b.circle(68),
|
||||
spawn_tile = 'landfill',
|
||||
main_ores = main_ores_config,
|
||||
main_ores_shuffle_order = true,
|
||||
main_ores_rotate = 30,
|
||||
resource_patches = resource_patches,
|
||||
resource_patches_config = resource_patches_config,
|
||||
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 = dense_patches,
|
||||
dense_patches_scale = 1 / 48,
|
||||
dense_patches_threshold = 0.55,
|
||||
dense_patches_multiplier = 25
|
||||
}
|
||||
|
||||
return map(config)
|
@ -2,6 +2,7 @@ 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('Terraforming Danger Ore')
|
||||
@ -76,6 +77,10 @@ RS.set_map_gen_settings({
|
||||
MGSP.tree_none
|
||||
})
|
||||
|
||||
Config.market.enabled = false
|
||||
Config.player_rewards.enabled = false
|
||||
Config.player_create.starting_items = {}
|
||||
|
||||
Event.on_init(function()
|
||||
game.draw_resource_selection = false
|
||||
game.forces.player.technologies['mining-productivity-1'].enabled = false
|
||||
@ -95,7 +100,7 @@ Event.on_init(function()
|
||||
end)
|
||||
|
||||
local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming'
|
||||
terraforming({start_size = 8 * 32, min_pollution = 300, max_pollution = 12000, pollution_increment = 3})
|
||||
terraforming({start_size = 8 * 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 = 500})
|
||||
@ -116,8 +121,8 @@ local config = {
|
||||
resource_patches_config = resource_patches_config,
|
||||
water = water,
|
||||
water_scale = 1 / 96,
|
||||
water_threshold = 0.45,
|
||||
deepwater_threshold = 0.5,
|
||||
water_threshold = 0.4,
|
||||
deepwater_threshold = 0.45,
|
||||
trees = trees,
|
||||
trees_scale = 1 / 64,
|
||||
trees_threshold = 0.4,
|
||||
|
@ -2,6 +2,7 @@ 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')
|
||||
@ -35,6 +36,10 @@ RS.set_map_gen_settings(
|
||||
}
|
||||
)
|
||||
|
||||
Config.market.enabled = false
|
||||
Config.player_rewards.enabled = false
|
||||
Config.player_create.starting_items = {}
|
||||
|
||||
Event.on_init(
|
||||
function()
|
||||
game.draw_resource_selection = false
|
||||
|
@ -2,6 +2,7 @@ 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('Gradient Danger Ore')
|
||||
@ -76,6 +77,10 @@ RS.set_map_gen_settings({
|
||||
MGSP.tree_none
|
||||
})
|
||||
|
||||
Config.market.enabled = false
|
||||
Config.player_rewards.enabled = false
|
||||
Config.player_create.starting_items = {}
|
||||
|
||||
Event.on_init(function()
|
||||
game.draw_resource_selection = false
|
||||
game.forces.player.technologies['mining-productivity-1'].enabled = false
|
||||
@ -95,7 +100,7 @@ Event.on_init(function()
|
||||
end)
|
||||
|
||||
local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming'
|
||||
terraforming({start_size = 8 * 32, min_pollution = 300, max_pollution = 12000, pollution_increment = 3})
|
||||
terraforming({start_size = 8 * 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 = 500})
|
||||
|
@ -2,6 +2,7 @@ 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('Terraforming Danger Ore')
|
||||
@ -76,6 +77,10 @@ RS.set_map_gen_settings({
|
||||
MGSP.tree_none
|
||||
})
|
||||
|
||||
Config.market.enabled = false
|
||||
Config.player_rewards.enabled = false
|
||||
Config.player_create.starting_items = {}
|
||||
|
||||
Event.on_init(function()
|
||||
game.draw_resource_selection = false
|
||||
game.forces.player.technologies['mining-productivity-1'].enabled = false
|
||||
@ -95,7 +100,7 @@ Event.on_init(function()
|
||||
end)
|
||||
|
||||
local terraforming = require 'map_gen.maps.danger_ores.modules.terraforming'
|
||||
terraforming({start_size = 8 * 32, min_pollution = 300, max_pollution = 12000, pollution_increment = 3})
|
||||
terraforming({start_size = 8 * 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 = 500})
|
||||
|
Loading…
x
Reference in New Issue
Block a user