Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions features/autofill_compatibility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ 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,
['kr-rifle-magazine'] = true,
['kr-armor-piercing-rifle-magazine'] = true,
['kr-uranium-rifle-magazine'] = true,
['kr-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'},
['kr-rifle-magazine'] = {'item-name.kr-rifle-magazine'},
['kr-armor-piercing-rifle-magazine'] = {'item-name.kr-armor-piercing-rifle-magazine'},
['kr-uranium-rifle-magazine'] = {'item-name.kr-uranium-rifle-magazine'},
['kr-imersite-rifle-magazine'] = {'item-name.kr-imersite-rifle-magazine'},
}
}
end
Expand Down
14 changes: 7 additions & 7 deletions features/redmew_qol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ local function draw_loader_frame_for_player(parent, player)
}
end

if recipes['loader'].enabled then
if recipes['loader'] and recipes['loader'].enabled then
local button = frame.add {
type = 'choose-elem-button',
name = player_craft_loader_1,
Expand All @@ -394,7 +394,7 @@ local function draw_loader_frame_for_player(parent, player)
button.locked = true
end

if recipes['fast-loader'].enabled then
if recipes['fast-loader'] and recipes['fast-loader'].enabled then
local button = frame.add {
type = 'choose-elem-button',
name = player_craft_loader_2,
Expand All @@ -404,7 +404,7 @@ local function draw_loader_frame_for_player(parent, player)
button.locked = true
end

if recipes['express-loader'].enabled then
if recipes['express-loader'] and recipes['express-loader'].enabled then
local button = frame.add {
type = 'choose-elem-button',
name = player_craft_loader_3,
Expand Down Expand Up @@ -451,7 +451,7 @@ local function draw_loader_frame_for_assembly_machine(parent, entity, player)
}
end

if recipes['loader'].enabled then
if recipes['loader'] and recipes['loader'].enabled then
local button = frame.add {
type = 'choose-elem-button',
name = machine_craft_loader_1,
Expand All @@ -462,7 +462,7 @@ local function draw_loader_frame_for_assembly_machine(parent, entity, player)
Gui.set_data(button, entity)
end

if recipes['fast-loader'].enabled then
if recipes['fast-loader'] and recipes['fast-loader'].enabled then
local button = frame.add {
type = 'choose-elem-button',
name = machine_craft_loader_2,
Expand All @@ -473,7 +473,7 @@ local function draw_loader_frame_for_assembly_machine(parent, entity, player)
Gui.set_data(button, entity)
end

if recipes['express-loader'].enabled then
if recipes['express-loader'] and recipes['express-loader'].enabled then
local button = frame.add {
type = 'choose-elem-button',
name = machine_craft_loader_3,
Expand All @@ -484,7 +484,7 @@ local function draw_loader_frame_for_assembly_machine(parent, entity, player)
Gui.set_data(button, entity)
end

if recipes['turbo-loader'].enabled then
if recipes['turbo-loader'] and recipes['turbo-loader'].enabled then
local button = frame.add {
type = 'choose-elem-button',
name = machine_craft_loader_4,
Expand Down
3 changes: 3 additions & 0 deletions map_gen/maps/danger_ores/changelog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,7 @@ return [[
2025-02-19:
- [DO:OneDirection] Fixed terraforming bounds
- [DO:OneDirectionWide] Fixed terraforming bounds

2025-05-09:
- [DO:Krastorio2] Updated to 2.0
]]
34 changes: 17 additions & 17 deletions map_gen/maps/danger_ores/compatibility/krastorio2/allowed_items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,38 @@ local items = {
'compact-raw-rare-metals',
'copper-ore',
'iron-ore',
'raw-imersite',
'raw-rare-metals',
'kr-imersite',
'kr-rare-metal-ore',
'stone',
'uranium-ore',
'wood',
-- processed
'coke',
'enriched-copper',
'enriched-iron',
'enriched-rare-metals',
'kr-coke',
'kr-enriched-copper',
'kr-enriched-iron',
'kr-enriched-rare-metals',
'fluoride',
'imersite-crystal',
'imersite-powder',
'lithium-chloride',
'lithium',
'quartz',
'sand',
'silicon',
'kr-imersite-crystal',
'kr-imersite-powder',
'kr-lithium-chloride',
'kr-lithium',
'kr-quartz',
'kr-sand',
'kr-silicon',
'solid-fuel',
'sulfur',
'yellowcake',
-- plates
'copper-plate',
'glass',
'imersium-plate',
'kr-glass',
'kr-imersium-plate',
'iron-plate',
'plastic-bar',
'rare-metals',
'kr-rare-metals',
'steel-plate',
'stone-brick',
-- intermediates
'electronic-components',
'kr-electronic-components',
'electronic-circuit',
'advanced-circuit',
'processing-unit',
Expand Down
8 changes: 4 additions & 4 deletions map_gen/maps/danger_ores/compatibility/krastorio2/ores.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ return {
{resource = b.resource(b.full_shape, 'copper-ore', value), weight = 64},
{resource = b.resource(b.full_shape, 'stone', value), weight = 9},
{resource = b.resource(b.full_shape, 'coal', value), weight = 4},
{resource = b.resource(b.invert(b.circle(special_resources_radius)), 'rare-metals', value), weight = 4},
{resource = b.resource(b.invert(b.circle(special_resources_radius)), 'kr-rare-metal-ore', value), weight = 4},
{resource = b.resource(b.invert(b.circle(special_resources_radius)), 'uranium-ore', value), weight = 2},
}
},
Expand All @@ -32,7 +32,7 @@ return {
{resource = b.resource(b.full_shape, 'copper-ore', value), weight = 9},
{resource = b.resource(b.full_shape, 'stone', value), weight = 7},
{resource = b.resource(b.full_shape, 'coal', value), weight = 60},
{resource = b.resource(b.invert(b.circle(special_resources_radius)), 'rare-metals', value), weight = 4},
{resource = b.resource(b.invert(b.circle(special_resources_radius)), 'kr-rare-metal-ore', value), weight = 4},
{resource = b.resource(b.invert(b.circle(special_resources_radius)), 'uranium-ore', value), weight = 2},
}
},
Expand All @@ -48,7 +48,7 @@ return {
{resource = b.resource(b.full_shape, 'copper-ore', value), weight = 15},
{resource = b.resource(b.full_shape, 'stone', value), weight = 6},
{resource = b.resource(b.full_shape, 'coal', value), weight = 2},
{resource = b.resource(b.invert(b.circle(special_resources_radius)), 'rare-metals', value), weight = 4},
{resource = b.resource(b.invert(b.circle(special_resources_radius)), 'kr-rare-metal-ore', value), weight = 4},
{resource = b.resource(b.invert(b.circle(special_resources_radius)), 'uranium-ore', value), weight = 2},
}
},
Expand All @@ -64,7 +64,7 @@ return {
{resource = b.resource(b.full_shape, 'copper-ore', value), weight = 9},
{resource = b.resource(b.full_shape, 'stone', value), weight = 54},
{resource = b.resource(b.full_shape, 'coal', value), weight = 4},
{resource = b.resource(b.invert(b.circle(special_resources_radius)), 'rare-metals', value), weight = 4},
{resource = b.resource(b.invert(b.circle(special_resources_radius)), 'kr-rare-metal-ore', value), weight = 4},
{resource = b.resource(b.invert(b.circle(special_resources_radius)), 'uranium-ore', value), weight = 2},
}
},
Expand Down
2 changes: 1 addition & 1 deletion map_gen/maps/danger_ores/modules/map_poll.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ local maps = {
{ name = 'danger-ore-hub-spiral', display_name = 'Hub-spiral (with void)', mod_pack = mod_packs.danger_ore_normal },
--{ name = 'danger-ore-industrial-revolution-3', display_name = 'Industrial Revolution 3 (default)', mod_pack = mod_packs.danger_ore_ir3 },
--{ name = 'danger-ore-industrial-revolution-3-grid-factory', display_name = 'Industrial Revolution 3 Grid Factory (squares)', mod_pack = mod_packs.danger_ore_ir3 },
--{ name = 'danger-ore-krastorio2', display_name = 'Krastorio2 (landfill)', mod_pack = mod_packs.danger_ore_krastorio2 },
{ name = 'danger-ore-krastorio2', display_name = 'Krastorio2 (landfill)', mod_pack = mod_packs.danger_ore_krastorio2 },
{ name = 'danger-ore-landfill', display_name = 'Landfill (all tiles)', mod_pack = mod_packs.danger_ore_normal },
{ name = 'danger-ore-lazy-one', display_name = 'Lazy One (no handcraft)', mod_pack = mod_packs.danger_ore_normal },
{ name = 'danger-ore-normal-science', display_name = 'Normal science (+ biters)', mod_pack = mod_packs.danger_ore_normal },
Expand Down
7 changes: 3 additions & 4 deletions map_gen/maps/danger_ores/presets/danger_ore_krastorio2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ DOC.compatibility.deadlock.items = require 'map_gen.maps.danger_ores.compatibili
DOC.game.technology_price_multiplier = 5
DOC.map_config.spawn_tile = 'landfill'
DOC.map_config.main_ores = require 'map_gen.maps.danger_ores.compatibility.krastorio2.ores'
DOC.map_config.resource_patches_config = require 'map_gen.maps.danger_ores.compatibility.krastorio2.resource_patches'
DOC.map_gen_settings.settings = H.empty_map_settings{
'coal',
'copper-ore',
'crude-oil',
'imersite',
'kr-imersite',
'iron-ore',
'mineral-water',
'rare-metals',
'kr-mineral-water',
'kr-rare-metal-ore',
'stone',
'uranium-ore',
}
Expand Down
12 changes: 6 additions & 6 deletions map_gen/maps/frontier/modules/terrain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ local noises = {
local mixed_ores = { 'iron-ore', 'copper-ore', 'iron-ore', 'stone', 'copper-ore', 'iron-ore', 'copper-ore', 'iron-ore', 'coal', 'iron-ore', 'copper-ore', 'iron-ore', 'stone', 'copper-ore', 'coal'}

if script.active_mods['Krastorio2'] then
autoplace_controls['imersite'] = { frequency = 2, richness = 0.6, size = 0.75 }
autoplace_controls['mineral-water'] = { frequency = 2, richness = 0.6, size = 0.75 }
autoplace_controls['rare-metals'] = { frequency = 2, richness = 0.6, size = 0.85 }
blacklisted_resources['imersite'] = true
blacklisted_resources['mineral-water'] = true
blacklisted_resources['rare-metals'] = true
autoplace_controls['kr-imersite'] = { frequency = 2, richness = 0.6, size = 0.75 }
autoplace_controls['kr-mineral-water'] = { frequency = 2, richness = 0.6, size = 0.75 }
autoplace_controls['kr-rare-metal-ore'] = { frequency = 2, richness = 0.6, size = 0.85 }
blacklisted_resources['kr-imersite'] = true
blacklisted_resources['kr-mineral-water'] = true
blacklisted_resources['kr-rare-metal-ore'] = true
end
if script.active_mods['zombiesextended-core'] then
autoplace_controls['gold-ore'] = { frequency = 0.5, richness = 0.5, size = 0.5 }
Expand Down
6 changes: 0 additions & 6 deletions map_gen/maps/frontier/shared/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ function Public.reset()
ScoreTracker.reset()
ScoreTracker.set_for_global(Public.scores.rocket_launches.name, this.rockets_to_win)
ScoreTracker.set_for_global(Public.scores.shop_funds.name, this.spawn_shop_funds)

if script.active_mods['Krastorio2'] then
if remote.interfaces['redmew-data'] and remote.interfaces['redmew-data']['set_spawn_x'] then
remote.call( 'redmew-data', 'set_spawn_x', this.right_boundary * 32 + 96 )
end
end
end

return Public
64 changes: 53 additions & 11 deletions map_gen/maps/maze_krastorio2.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local Config = require 'config'
local Event = require 'utils.event'
local Global = require 'utils.global'
local Retailer = require 'features.retailer'
Expand Down Expand Up @@ -30,6 +31,8 @@ ScenarioInfo.set_map_extra_info([[
ScenarioInfo.set_new_info([[
2024-07-31:
- Added Krastorio2 maze scenario: Daedalus' Domain
2025-05-09:
- Updated to Factorio 2.0
]])

local insert = table.insert
Expand Down Expand Up @@ -65,6 +68,15 @@ Global.register(
end
)

Config.player_create.starting_items = {
{ name = 'iron-gear-wheel', count = 8 },
{ name = 'iron-plate', count = 16 },
{ name = 'kr-shelter', count = 1 },
{ name = 'burner-mining-drill', count = 1 },
{ name = 'stone-furnace', count = 1 },
{ name = 'wood', count = 10 },
}

local k2_items = {
{
name = 'temporary-running-speed-bonus',
Expand Down Expand Up @@ -99,23 +111,24 @@ local k2_items = {
{ price = 30, name = 'cargo-wagon' },
{ price = 2800, name = 'artillery-wagon' },

{ price = 1, name = 'firearm-magazine' },
{ price = 15, name = 'submachine-gun' },
{ price = 15, name = 'shotgun' },
{ price = 250, name = 'combat-shotgun' },
{ price = 250, name = 'flamethrower' },
{ price = 175, name = 'rocket-launcher' },
{ price = 375, name = 'heavy-rocket-launcher' },
{ price = 375, name = 'kr-heavy-rocket-launcher' },

{ price = 2, name = 'shotgun-shell' },
{ price = 10, name = 'piercing-shotgun-shell' },

{ price = 2, name = 'rifle-magazine' },
{ price = 8, name = 'armor-piercing-rifle-magazine' },
{ price = 25, name = 'uranium-rifle-magazine' },
{ price = 2, name = 'kr-rifle-magazine' },
{ price = 8, name = 'kr-armor-piercing-rifle-magazine' },
{ price = 25, name = 'kr-uranium-rifle-magazine' },

{ price = 5, name = 'anti-material-rifle-magazine' },
{ price = 12, name = 'armor-piercing-anti-material-rifle-magazine' },
{ price = 35, name = 'uranium-anti-material-rifle-magazine' },
{ price = 5, name = 'kr-anti-materiel-rifle-magazine' },
{ price = 12, name = 'kr-armor-piercing-anti-materiel-rifle-magazine' },
{ price = 35, name = 'kr-uranium-anti-materiel-rifle-magazine' },

{ price = 30, name = 'flamethrower-ammo' },

Expand All @@ -124,12 +137,12 @@ local k2_items = {
{ price = 85, name = 'explosive-uranium-cannon-shell' },

{ price = 120, name = 'artillery-shell' },
{ price = 1200, name = 'nuclear-artillery-shell' },
{ price = 1200, name = 'kr-nuclear-artillery-shell' },

{ price = 18, name = 'rocket' },
{ price = 30, name = 'explosive-rocket' },

{ price = 250, name = 'heavy-rocket' },
{ price = 250, name = 'kr-heavy-rocket' },
{ price = 2500, name = 'atomic-bomb' },

{ price = 5, name = 'land-mine' },
Expand Down Expand Up @@ -158,7 +171,7 @@ local k2_items = {
{ price = 550, name = 'energy-shield-equipment' },
{ price = 950, name = 'personal-laser-defense-equipment' },

{ price = 800, name = 'dt-fuel' },
{ price = 800, name = 'kr-dt-fuel-cell' },
}

local function add_tile(x, y, width, height, add_cell)
Expand Down Expand Up @@ -266,7 +279,8 @@ local function remove_chunk(event)
end

Event.on_init(function()
if Retailer.get_market_group_label('fish_market') ~= 'Market' then
-- Setup market
if Retailer.get_market_group_label('fish_market') == 'Market' then
local fish_items = Retailer.get_items('fish_market')

for _, prototype in pairs(fish_items) do
Expand All @@ -278,11 +292,39 @@ Event.on_init(function()
end
end

-- Setup maze
primitives.walk_seed_w = math_random(1, MAZE_SIZE) * 2
primitives.walk_seed_h = math_random(1, MAZE_SIZE) * 2
make_maze(MAZE_SIZE, MAZE_SIZE)
reduce_walls()
render()

-- Setup starting area
local surface = RS.get_surface()
local find = surface.find_non_colliding_position
local create = surface.create_entity

surface.request_to_generate_chunks({ 0, 0 }, 1)
surface.force_generate_chunk_requests()

local wreck = { force = 'player', snap_to_grid = true, move_stuck_players = true }
for _, name in pairs({
'kr-spaceship-material-fabricator-1',
'kr-spaceship-material-fabricator-1',
'kr-spaceship-material-fabricator-2',
'kr-spaceship-material-fabricator-2',
'kr-spaceship-reactor',
'kr-spaceship-research-computer',
}) do
wreck.name = name
wreck.position = find(wreck.name, {
x = -16 + math_random(32),
y = -16 + math_random(32),
}, 32, 0.5, true)
if wreck.position then
create(wreck)
end
end
end)

Event.add(defines.events.on_chunk_generated, function(event)
Expand Down