1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-04 09:42:30 +02:00

Danger ores quality (#1439)

* Init Factorio 2.0 update

* add credits

* fix test module

* I know luackeck, I know

* Fixes

* Fix bad event.player_index handling

* Hotfixes

* Remove all filter inserters

* Migrate removed items

* Deprecating spidertron control and landfill features

* Small updates and DO preset
This commit is contained in:
RedRafe 2024-10-26 16:41:39 +02:00 committed by GitHub
parent 26e1c28dc0
commit 96860dc782
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 365 additions and 36 deletions

View File

@ -127,9 +127,10 @@ function Public.get_main_frame(player)
type = 'frame',
name = main_frame_name,
direction = 'horizontal',
style = 'quick_bar_window_frame',
style = 'quick_bar_slot_window_frame',
}
main_frame.auto_center = true
Gui.set_style(main_frame, { minimal_width = 20 })
do -- shortcuts
local left_flow = main_frame.add { type = 'flow', direction = 'vertical' }
@ -174,7 +175,7 @@ function Public.get_main_frame(player)
for button_name, s in pairs(enabled_shortcuts()) do
button = table.add {
type = 'sprite-button',
style = 'quick_bar_slot_button',
style = 'slot_button', --quick_bar_page_button
sprite = s.sprite,
hovered_sprite = s.hovered_sprite,
tooltip = s.tooltip,
@ -200,9 +201,7 @@ function Public.get_main_frame(player)
type = 'sprite-button',
name = settings_button_name,
style = 'shortcut_bar_expand_button',
sprite = 'utility/expand_dots_white',
hovered_sprite = 'utility/expand_dots',
clicked_sprite = 'utility/expand_dots',
sprite = 'utility/expand_dots',
tooltip = {'player_shortcuts.settings_tooltip'},
mouse_button_filter = { 'left' },
auto_toggle = true,

View File

@ -308,12 +308,23 @@ local function rocket_launched(event)
change_for_global(rockets_launched_name, 1)
local inventory = entity.get_inventory(defines.inventory.rocket_silo_rocket)
if not inventory or not inventory.valid then
local pod = entity.cargo_pod
if not pod or not pod.valid then
return
end
local count = inventory.get_item_count('satellite')
local count = 0
local qualities = prototypes.quality
for k = 1, pod.get_max_inventory_index() do
local inventory = pod.get_inventory(k)
if inventory then
local add = inventory.get_item_count
for tier, _ in pairs(qualities) do
count = count + add({ name = 'satellite', quality = tier })
end
end
end
if count == 0 then
return
end

View File

@ -577,16 +577,16 @@ if config.loaders then
local direction_to_offset_back = {
[0] = {x = 0, y = 1.5},
[2] = {x = -1.5, y = 0},
[4] = {x = 0, y = -1.5},
[6] = {x = 1.5, y = 0}
[4] = {x = -1.5, y = 0},
[8] = {x = 0, y = -1.5},
[12] = {x = 1.5, y = 0}
}
local direction_to_offset_front = {
[0] = {x = 0, y = -1.5},
[2] = {x = 1.5, y = 0},
[4] = {x = 0, y = 1.5},
[6] = {x = -1.5, y = 0}
[4] = {x = 1.5, y = 0},
[8] = {x = 0, y = 1.5},
[12] = {x = -1.5, y = 0}
}
local loaders = {['loader'] = true, ['fast-loader'] = true, ['express-loader'] = true}

View File

@ -192,7 +192,7 @@ instructions=Select a brush tile to replace [item=refined-concrete] and [item=re
no_place_landfill=Coloured concrete can not be placed on landfill tiles.
[death_corpse_tags]
empty_corpse=[color=red][Corpse][/color]Your corpse was empty and has been removed.
empty_corpse=[color=red][Corpse][/color] Your corpse was empty and has been removed.
[dump_offline_inventories]
inventory_location=[color=blue][Corpse][/color] __1__ has been offline __2__ minutes. Their inventory is now available at [gps=__3__,__4__,__5__]

View File

@ -1,27 +1,43 @@
return {
-- pipes
'pipe',
'pipe-to-ground',
-- belts
'transport-belt',
'fast-transport-belt',
'express-transport-belt',
-- undergrounds
'underground-belt',
'fast-underground-belt',
'express-underground-belt',
-- poles
'small-electric-pole',
'medium-electric-pole',
'big-electric-pole',
'substation',
-- drills
'electric-mining-drill',
'electric-mining-drill-2',
'electric-mining-drill-3',
'burner-mining-drill',
'pumpjack',
-- vehicles
'car',
'tank',
'spidertron',
-- rails
'straight-rail',
'curved-rail',
'curved-rail-a',
'curved-rail-b',
'half-diagonal-rail',
'legacy-straight-rail',
'legacy-curved-rail',
'rail-signal',
'rail-chain-signal',
'train-stop',
'locomotive',
'cargo-wagon',
'fluid-wagon',
'artillery-wagon'
}
'artillery-wagon',
}

View File

@ -0,0 +1,30 @@
-- This module prevents all but the normal quality drills from being built on top of resources
local Event = require 'utils.event'
local function on_built(event)
local entity = event.entity
if not (entity and entity.valid) then
return
end
local e_type = entity.type
if entity.name == 'entity-ghost' then
e_type = entity.ghost_type
end
if e_type ~= 'mining-drill' then
return
end
if entity.quality.level < 1 then
return
end
local index = event.player_index
local player = index and game.get_player(index)
if player and player.valid then
player.print('Only [quality=normal] drills can be built on top of resources!')
end
entity.destroy()
end
Event.add(defines.events.on_built_entity, on_built)
Event.add(defines.events.on_robot_built_entity, on_built)

View File

@ -36,12 +36,14 @@ return function(allowed_entities, message)
local items = {}
local len = 0
local entities = RestrictEntities.get_allowed()
for k in pairs(entities) do
for k, _ in pairs(entities) do
local entity = prototypes.entity[k]
for _, v in pairs(entity.items_to_place_this) do
if not items[v.name] then --- Avoid duplication for straight-rail and curved-rail, which both use rail
items[v.name] = v
len = len + 1
if entity then
for _, v in pairs(entity.items_to_place_this or {}) do
if not items[v.name] then --- Avoid duplication for straight-rail and curved-rail, which both use rail
items[v.name] = v
len = len + 1
end
end
end
end

View File

@ -0,0 +1,29 @@
-- This module replaces mining productivity research effects with robot cargo capacity effects
local Event = require 'utils.event'
local function starts_with(str, pattern)
return str:sub(1, #pattern) == pattern
end
Event.add(defines.events.on_research_finished, function(event)
local tech = event.research
if not (tech and tech.valid) then
return
end
if not starts_with(tech.name, 'mining-productivity') then
return
end
local force = tech.force
force.mining_drill_productivity_bonus = 0
force.worker_robots_storage_bonus = force.worker_robots_storage_bonus + 1
game.print(table.concat({
'[color=orange][Mining productivity][/color]',
'',
'[color=blue][Worker robots cargo size][/color]',
'\nReplacing technology effects. New robots cargo capacity:',
'[color=green][font=var]+'..force.worker_robots_storage_bonus..'[/font][/color]'
}, '\t\t'))
end)

View File

@ -162,8 +162,24 @@ return function(config)
return
end
local inventory = entity.get_inventory(defines.inventory.rocket_silo_rocket)
if not inventory or not inventory.valid then
local pod = entity.cargo_pod
if not pod or not pod.valid then
return
end
local count = 0
local qualities = prototypes.quality
for k = 1, pod.get_max_inventory_index() do
local inventory = pod.get_inventory(k)
if inventory then
local add = inventory.get_item_count
for tier, _ in pairs(qualities) do
count = count + add({ name = 'satellite', quality = tier })
end
end
end
if count == 0 then
return
end

View File

@ -36,8 +36,24 @@ return function()
return
end
local inventory = entity.get_inventory(defines.inventory.rocket_silo_rocket)
if not inventory or not inventory.valid then
local pod = entity.cargo_pod
if not pod or not pod.valid then
return
end
local count = 0
local qualities = prototypes.quality
for k = 1, pod.get_max_inventory_index() do
local inventory = pod.get_inventory(k)
if inventory then
local add = inventory.get_item_count
for tier, _ in pairs(qualities) do
count = count + add({ name = 'satellite', quality = tier })
end
end
end
if count == 0 then
return
end
@ -45,7 +61,6 @@ return function()
if satellite_count == 0 then
return
end
if satellite_count == 1 then
disable_biters()
end

View File

@ -36,8 +36,24 @@ return function()
return
end
local inventory = entity.get_inventory(defines.inventory.rocket_silo_rocket)
if not inventory or not inventory.valid then
local pod = entity.cargo_pod
if not pod or not pod.valid then
return
end
local count = 0
local qualities = prototypes.quality
for k = 1, pod.get_max_inventory_index() do
local inventory = pod.get_inventory(k)
if inventory then
local add = inventory.get_item_count
for tier, _ in pairs(qualities) do
count = count + add({ name = 'satellite', quality = tier })
end
end
end
if count == 0 then
return
end
@ -45,7 +61,6 @@ return function()
if satellite_count == 0 then
return
end
if satellite_count == 1 then
disable_biters()
end

View File

@ -36,8 +36,24 @@ return function()
return
end
local inventory = entity.get_inventory(defines.inventory.rocket_silo_rocket)
if not inventory or not inventory.valid then
local pod = entity.cargo_pod
if not pod or not pod.valid then
return
end
local count = 0
local qualities = prototypes.quality
for k = 1, pod.get_max_inventory_index() do
local inventory = pod.get_inventory(k)
if inventory then
local add = inventory.get_item_count
for tier, _ in pairs(qualities) do
count = count + add({ name = 'satellite', quality = tier })
end
end
end
if count == 0 then
return
end
@ -45,7 +61,6 @@ return function()
if satellite_count == 0 then
return
end
if satellite_count == 1 then
disable_biters()
end

View File

@ -62,8 +62,24 @@ return function(config)
return
end
local inventory = entity.get_inventory(defines.inventory.rocket_silo_rocket)
if not inventory or not inventory.valid then
local pod = entity.cargo_pod
if not pod or not pod.valid then
return
end
local count = 0
local qualities = prototypes.quality
for k = 1, pod.get_max_inventory_index() do
local inventory = pod.get_inventory(k)
if inventory then
local add = inventory.get_item_count
for tier, _ in pairs(qualities) do
count = count + add({ name = 'satellite', quality = tier })
end
end
end
if count == 0 then
return
end
@ -71,7 +87,6 @@ return function(config)
if satellite_count == 0 then
return
end
if satellite_count == 1 then
disable_biters()
end

View File

@ -0,0 +1,165 @@
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 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 three sectors [item=iron-ore] [item=copper-ore] [item=coal].
Each sector has a main resource and the other resources at a lower ratio.
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([[
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.
2024-04-23_
- Updated for 2.0 Quality
- Tech multiplier changed to 5x
- Added SA: Quality compatibility
- Added Ban Quality Mining module
- Added Robot Cargo Capacity module
]])
ScenarioInfo.add_extra_rule({ 'info.rules_text_danger_ore' })
local map = require 'map_gen.maps.danger_ores.modules.map'
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 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.paint.enabled = false
Config.reactor_meltdown.enabled = false
Config.apocalypse.enabled = false
Config.player_shortcuts.enabled = true
Config.player_shortcuts.shortcuts.battery_charge = false
Config.dump_offline_inventories = {
enabled = true,
offline_timeout_mins = 30, -- time after which a player logs off that their inventory is provided to the team
startup_gear_drop_hours = 24, -- time after which players will keep at least their armor when disconnecting
}
Config.player_create.starting_items = {
{ name = 'iron-gear-wheel', count = 8 },
{ name = 'iron-plate', count = 16 },
{ name = 'stone-furnace', count = 4 },
{ name = 'burner-mining-drill', count = 4 },
}
Config.permissions.presets.no_blueprints = true
Event.on_init(function()
game.draw_resource_selection = false
game.difficulty_settings.technology_price_multiplier = 5
game.forces.player.manual_mining_speed_modifier = 1
RS.get_surface().always_day = true
RS.get_surface().peaceful_mode = true
game.forces.player.set_surface_hidden('nauvis', true)
end)
require 'map_gen.maps.danger_ores.modules.robot_cargo_capacity'
require 'map_gen.maps.danger_ores.modules.ban_quality_mining'
--local Terraform = require 'map_gen.maps.danger_ores.modules.terraforming'
--Terraform({ start_size = 8 * 32, min_pollution = 350, max_pollution = 14000, pollution_increment = 3.5 })
local RocketLaunched = require 'map_gen.maps.danger_ores.modules.rocket_launched_simple'
RocketLaunched({ win_satellite_count = 500 })
--local RestartCommand = require 'map_gen.maps.danger_ores.modules.restart_command'
--RestartCommand({ scenario_name = 'danger-ore-spiral' })
local ContainerDump = require 'map_gen.maps.danger_ores.modules.container_dump'
ContainerDump({ entity_name = 'coal' })
local ConcreteOnLandfill = require 'map_gen.maps.danger_ores.modules.concrete_on_landfill'
ConcreteOnLandfill({ tile = 'blue-refined-concrete' })
-- Circles
--local main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_spiral'
--local main_ores_config = require 'map_gen.maps.danger_ores.config.vanilla_ores'
-- Gradient
local main_ores_config = require 'map_gen.maps.danger_ores.config.vanilla_gradient_ores'
local main_ores_builder = require 'map_gen.maps.danger_ores.modules.main_ores_gradient'
local config = {
spawn_shape = b.circle(64),
start_ore_shape = b.circle(68),
main_ores_builder = main_ores_builder,
main_ores = main_ores_config,
main_ores_shuffle_order = true,
resource_patches = resource_patches,
resource_patches_config = resource_patches_config,
trees = trees,
trees_scale = 1 / 64,
trees_threshold = 0.35,
trees_chance = 0.875,
enemy = enemy,
enemy_factor = 10 / (768 * 32),
enemy_max_chance = 1 / 5,
enemy_scale_factor = 32,
fish_spawn_rate = 0.025,
dense_patches_scale = 1 / 48,
dense_patches_threshold = 0.55,
dense_patches_multiplier = 50,
}
return map(config)

View File

@ -0,0 +1 @@
return require 'map_gen.maps.danger_ores.presets.danger_ore_quality'