mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-11 14:49:24 +02:00
Merge branch 'develop' into develop
This commit is contained in:
commit
2814af6e4c
@ -463,7 +463,6 @@ local function secret_shop(pos)
|
||||
{price = {{'raw-fish', math_random(25, 50)}}, offer = {type = 'give-item', item = 'construction-robot'}},
|
||||
{price = {{'raw-fish', math_random(250, 450)}}, offer = {type = 'give-item', item = 'energy-shield-equipment'}},
|
||||
{price = {{'raw-fish', math_random(350, 550)}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment'}},
|
||||
{price = {{'raw-fish', math_random(125, 250)}}, offer = {type = 'give-item', item = 'railgun'}},
|
||||
{price = {{'raw-fish', math_random(100, 175)}}, offer = {type = 'give-item', item = 'loader'}},
|
||||
{price = {{'raw-fish', math_random(200, 350)}}, offer = {type = 'give-item', item = 'fast-loader'}},
|
||||
{price = {{'raw-fish', math_random(400, 600)}}, offer = {type = 'give-item', item = 'express-loader'}}
|
||||
|
@ -20,6 +20,7 @@ Public.size_of_particle_spawn_vectors = #Public.particle_spawn_vectors
|
||||
|
||||
Public.world_selector_width = 6
|
||||
Public.world_selector_height = 8
|
||||
Public.max_satellites = 3
|
||||
|
||||
local area = {
|
||||
left_top = {x = -3, y = math.floor(Public.mothership_radius * 0.5) * -1},
|
||||
|
@ -982,8 +982,9 @@ function Public.create_the_world(journey)
|
||||
if name == "ageing" then
|
||||
game.map_settings.pollution.ageing = game.map_settings.pollution.ageing * m
|
||||
end
|
||||
if name == "diffusion_ratio" then
|
||||
game.map_settings.pollution.diffusion_ratio = game.map_settings.pollution.diffusion_ratio * m
|
||||
if name == "diffusion_ratio" then
|
||||
--recommended to keep the diffusion at 0 to 50%. Going over 100% eventually gives corrupted map due to pollution value overflows so needs to be capped
|
||||
game.map_settings.pollution.diffusion_ratio = math.min(0.5, math.max(0, game.map_settings.pollution.diffusion_ratio * m))
|
||||
end
|
||||
if name == "tree_durability" then
|
||||
game.map_settings.pollution.min_pollution_to_damage_trees = game.map_settings.pollution.min_pollution_to_damage_trees * m
|
||||
@ -1002,7 +1003,11 @@ function Public.create_the_world(journey)
|
||||
journey.rocket_silos = {}
|
||||
journey.mothership_cargo["uranium-fuel-cell"] = 0
|
||||
journey.world_number = journey.world_number + 1
|
||||
journey.mothership_cargo_space["satellite"] = math_floor(journey.world_number * 0.334) + 1
|
||||
local max_satellites = math_floor(journey.world_number * 0.334) + 1
|
||||
if max_satellites > Constants.max_satellites then
|
||||
max_satellites = Constants.max_satellites
|
||||
end
|
||||
journey.mothership_cargo_space["satellite"] = max_satellites
|
||||
journey.mothership_cargo_space["uranium-fuel-cell"] = journey.mothership_cargo_space["uranium-fuel-cell"] + journey.world_selectors[journey.selected_world].fuel_requirement
|
||||
|
||||
game.forces.enemy.reset_evolution()
|
||||
@ -1031,11 +1036,41 @@ function Public.wipe_offline_players(journey)
|
||||
journey.game_state = "set_unique_modifiers"
|
||||
end
|
||||
|
||||
function Public.notify_discord(journey)
|
||||
if journey.disable_discord_notifications then
|
||||
return
|
||||
end
|
||||
local caption = 'World ' .. journey.world_number .. ' | ' .. Constants.unique_world_traits[journey.world_trait][1]
|
||||
local message = {
|
||||
title = 'World advanced',
|
||||
description = 'Arriving at target destination!',
|
||||
color = 'warning',
|
||||
field1 = {
|
||||
text1 = 'World level:',
|
||||
text2 = caption,
|
||||
inline = 'true'
|
||||
},
|
||||
field2 = {
|
||||
text1 = 'World description:',
|
||||
text2 = Constants.unique_world_traits[journey.world_trait][2],
|
||||
inline = 'true'
|
||||
},
|
||||
field3 = {
|
||||
text1 = 'Fuel cells in mothership cargo:',
|
||||
text2 = journey.mothership_cargo['uranium-fuel-cell'],
|
||||
inline = 'false'
|
||||
}
|
||||
}
|
||||
Server.to_discord_embed_parsed(message)
|
||||
end
|
||||
|
||||
|
||||
function Public.set_unique_modifiers(journey)
|
||||
local unique_modifier = Unique_modifiers[journey.world_trait]
|
||||
local on_world_start = unique_modifier.on_world_start
|
||||
if on_world_start then on_world_start(journey) end
|
||||
Public.draw_gui(journey)
|
||||
Public.notify_discord(journey)
|
||||
journey.game_state = "place_teleporter_into_world"
|
||||
end
|
||||
|
||||
|
@ -303,6 +303,8 @@ local function grow_cell(chunk_position, surface) -- luacheck: ignore
|
||||
|
||||
if #valid_chunks > 0 then
|
||||
this.settings.labyrinth_size = this.settings.labyrinth_size + 1
|
||||
else
|
||||
return
|
||||
end
|
||||
local evolution = this.settings.labyrinth_size / labyrinth_difficulty_curve
|
||||
if evolution > 1 then
|
||||
@ -726,8 +728,6 @@ local function treasure_chest(position, surface)
|
||||
{{name = 'firearm-magazine', count = math_random(32, 128)}, weight = 10, evolution_min = 0, evolution_max = 0.3},
|
||||
{{name = 'piercing-rounds-magazine', count = math_random(32, 128)}, weight = 10, evolution_min = 0.1, evolution_max = 0.8},
|
||||
{{name = 'uranium-rounds-magazine', count = math_random(32, 128)}, weight = 10, evolution_min = 0.5, evolution_max = 1},
|
||||
{{name = 'railgun', count = 1}, weight = 1, evolution_min = 0.2, evolution_max = 1},
|
||||
{{name = 'railgun-dart', count = math_random(16, 32)}, weight = 3, evolution_min = 0.2, evolution_max = 0.7},
|
||||
{{name = 'defender-capsule', count = math_random(8, 16)}, weight = 10, evolution_min = 0.0, evolution_max = 0.7},
|
||||
{{name = 'distractor-capsule', count = math_random(8, 16)}, weight = 10, evolution_min = 0.2, evolution_max = 1},
|
||||
{{name = 'destroyer-capsule', count = math_random(8, 16)}, weight = 10, evolution_min = 0.3, evolution_max = 1},
|
||||
@ -1216,65 +1216,74 @@ local function on_player_joined_game(event)
|
||||
create_labyrinth_difficulty_gui(player)
|
||||
end
|
||||
|
||||
local inserters = {'inserter', 'long-handed-inserter', 'burner-inserter', 'fast-inserter', 'filter-inserter', 'stack-filter-inserter', 'stack-inserter'}
|
||||
local loaders = {'loader', 'fast-loader', 'express-loader'}
|
||||
local inserter_list = {'inserter', 'long-handed-inserter', 'burner-inserter', 'fast-inserter', 'filter-inserter', 'stack-filter-inserter', 'stack-inserter'}
|
||||
local inserters = {
|
||||
['inserter'] = true,
|
||||
['long-handed-inserter'] = true,
|
||||
['burner-inserter'] = true,
|
||||
['fast-inserter'] = true,
|
||||
['filter-inserter'] = true,
|
||||
['stack-filter-inserter'] = true,
|
||||
['stack-inserter'] = true
|
||||
}
|
||||
local loaders = {
|
||||
['loader'] = true,
|
||||
['fast-loader'] = true,
|
||||
['express-loader'] = true
|
||||
}
|
||||
local function on_built_entity(event)
|
||||
if not event.created_entity or not event.created_entity.valid then return end
|
||||
local get_score = Score.get_table().score_table
|
||||
for _, e in pairs(inserters) do
|
||||
if e == event.created_entity.name then
|
||||
local surface = event.created_entity.surface
|
||||
local a = {
|
||||
left_top = {x = event.created_entity.position.x - 2, y = event.created_entity.position.y - 2},
|
||||
right_bottom = {x = event.created_entity.position.x + 2, y = event.created_entity.position.y + 2}
|
||||
}
|
||||
local chest = surface.find_entities_filtered {area = a, name = 'infinity-chest', limit = 1}
|
||||
if not chest[1] then
|
||||
return
|
||||
end
|
||||
local _ = {
|
||||
left_top = {x = chest[1].position.x - 2, y = chest[1].position.y - 2},
|
||||
right_bottom = {x = chest[1].position.x + 2, y = chest[1].position.y + 2}
|
||||
}
|
||||
local i = surface.find_entities_filtered {area = a, name = inserters}
|
||||
if not i[1] then
|
||||
return
|
||||
end
|
||||
if #i > 1 then
|
||||
if math.random(1, 11) == 1 then
|
||||
break
|
||||
else
|
||||
for _, x in pairs(i) do
|
||||
x.die('enemy')
|
||||
end
|
||||
if event.player_index then
|
||||
local player = game.players[event.player_index]
|
||||
player.print('The mysterious chest noticed your greed and devoured your devices.', {r = 0.75, g = 0.0, b = 0.0})
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
local name = event.created_entity.name
|
||||
if inserters[name] then
|
||||
local surface = event.created_entity.surface
|
||||
local a = {
|
||||
left_top = {x = event.created_entity.position.x - 2, y = event.created_entity.position.y - 2},
|
||||
right_bottom = {x = event.created_entity.position.x + 2, y = event.created_entity.position.y + 2}
|
||||
}
|
||||
local chest = surface.find_entities_filtered {area = a, name = 'infinity-chest', limit = 1}
|
||||
if not chest[1] then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
for _, e in pairs(loaders) do
|
||||
if e == event.created_entity.name then
|
||||
local surface = event.created_entity.surface
|
||||
local a = {
|
||||
left_top = {x = event.created_entity.position.x - 2, y = event.created_entity.position.y - 2},
|
||||
right_bottom = {x = event.created_entity.position.x + 2, y = event.created_entity.position.y + 2}
|
||||
}
|
||||
local found = surface.find_entities_filtered {area = a, name = 'infinity-chest'}
|
||||
if found[1] then
|
||||
event.created_entity.die('enemy')
|
||||
local _ = {
|
||||
left_top = {x = chest[1].position.x - 2, y = chest[1].position.y - 2},
|
||||
right_bottom = {x = chest[1].position.x + 2, y = chest[1].position.y + 2}
|
||||
}
|
||||
local i = surface.find_entities_filtered {area = a, name = inserter_list}
|
||||
if not i[1] then
|
||||
return
|
||||
end
|
||||
if #i > 1 then
|
||||
if math.random(1, 11) > 1 then
|
||||
for _, x in pairs(i) do
|
||||
x.die('enemy')
|
||||
end
|
||||
if event.player_index then
|
||||
local player = game.players[event.player_index]
|
||||
player.print('The mysterious chest noticed your greed and devoured your device.', {r = 0.75, g = 0.0, b = 0.0})
|
||||
player.print('The mysterious chest noticed your greed and devoured your devices.', {r = 0.75, g = 0.0, b = 0.0})
|
||||
end
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if loaders[name] then
|
||||
local surface = event.created_entity.surface
|
||||
local a = {
|
||||
left_top = {x = event.created_entity.position.x - 2, y = event.created_entity.position.y - 2},
|
||||
right_bottom = {x = event.created_entity.position.x + 2, y = event.created_entity.position.y + 2}
|
||||
}
|
||||
local found = surface.find_entities_filtered {area = a, name = 'infinity-chest'}
|
||||
if found[1] then
|
||||
event.created_entity.die('enemy')
|
||||
if event.player_index then
|
||||
local player = game.players[event.player_index]
|
||||
player.print('The mysterious chest noticed your greed and devoured your device.', {r = 0.75, g = 0.0, b = 0.0})
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local name = event.created_entity.name
|
||||
if name == 'flamethrower-turret' or name == 'laser-turret' then
|
||||
if event.created_entity.position.y < 0 then
|
||||
if event.player_index then
|
||||
@ -1297,6 +1306,7 @@ local function on_built_entity(event)
|
||||
end
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if name == 'gun-turret' then
|
||||
|
@ -20,6 +20,10 @@ Maybe i should inspect...
|
||||
]]
|
||||
|
||||
local function create_map_intro(player)
|
||||
if player.gui.left.map_intro_frame and player.gui.left.map_intro_frame.valid then
|
||||
return
|
||||
end
|
||||
|
||||
local frame = player.gui.left.add {type = 'frame', name = 'map_intro_frame', direction = 'vertical'}
|
||||
local t = frame.add {type = 'table', column_count = 1}
|
||||
|
||||
|
@ -1136,12 +1136,16 @@ end
|
||||
|
||||
function Public.update_minimap()
|
||||
local icw = ICW.get()
|
||||
for k, player in pairs(game.connected_players) do
|
||||
local player_data = get_player_data(icw, player)
|
||||
if player.character and player.character.valid then
|
||||
local wagon = get_wagon_for_entity(icw, player.character)
|
||||
if wagon and player_data.auto then
|
||||
Public.draw_minimap(icw, player, wagon.entity.surface, wagon.entity.position)
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if player and player.valid then
|
||||
local player_data = get_player_data(icw, player)
|
||||
if player.character and player.character.valid then
|
||||
local wagon = get_wagon_for_entity(icw, player.character)
|
||||
if wagon and player_data.auto then
|
||||
if wagon and wagon.entity and wagon.entity.valid then
|
||||
Public.draw_minimap(icw, player, wagon.entity.surface, wagon.entity.position)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -290,7 +290,7 @@ local function on_player_changed_position(event)
|
||||
return
|
||||
end
|
||||
local player = game.players[event.player_index]
|
||||
if player.character.driving == true then
|
||||
if not player.character or player.character.driving == true then
|
||||
return
|
||||
end
|
||||
--if game.tick % 2 == 1 then return end
|
||||
|
Loading…
x
Reference in New Issue
Block a user