You've already forked ComfyFactorio
mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2026-06-20 16:32:28 +02:00
tweaks and fixes
This commit is contained in:
@@ -34,8 +34,8 @@ market.caspules = {
|
||||
["poison-capsule"] = {value = 32, rarity = 6},
|
||||
["slowdown-capsule"] = {value = 8, rarity = 1},
|
||||
["defender-capsule"] = {value = 8, rarity = 1},
|
||||
["distractor-capsule"] = {value = 16, rarity = 5},
|
||||
["destroyer-capsule"] = {value = 24, rarity = 7},
|
||||
["distractor-capsule"] = {value = 20, rarity = 5},
|
||||
["destroyer-capsule"] = {value = 32, rarity = 7},
|
||||
["discharge-defense-remote"] = {value = 64, rarity = 6},
|
||||
["artillery-targeting-remote"] = {value = 32, rarity = 7},
|
||||
["raw-fish"] = {value = 6, rarity = 1},
|
||||
@@ -127,8 +127,8 @@ market.vehicles = {
|
||||
["cargo-wagon"] = {value = 320, rarity = 4},
|
||||
["fluid-wagon"] = {value = 480, rarity = 5},
|
||||
["artillery-wagon"] = {value = 8192, rarity = 8},
|
||||
["car"] = {value = 96, rarity = 1},
|
||||
["tank"] = {value = 2048, rarity = 5},
|
||||
["car"] = {value = 80, rarity = 1},
|
||||
["tank"] = {value = 1800, rarity = 5},
|
||||
}
|
||||
|
||||
market.wire = {
|
||||
@@ -172,7 +172,7 @@ local function get_resource_market_buys()
|
||||
{price = {{'stone', math.random(10,12)}}, offer = {type = 'give-item', item = "coin"}},
|
||||
{price = {{'coal', math.random(10,12)}}, offer = {type = 'give-item', item = "coin"}},
|
||||
{price = {{'uranium-ore', math.random(8,10)}}, offer = {type = 'give-item', item = "coin"}},
|
||||
{price = {{'water-barrel', 1}}, offer = {type = 'give-item', item = "coin", count = math.random(1,3)}},
|
||||
{price = {{'water-barrel', 1}}, offer = {type = 'give-item', item = "coin", count = math.random(1,2)}},
|
||||
{price = {{'lubricant-barrel', 1}}, offer = {type = 'give-item', item = "coin", count = math.random(3,6)}},
|
||||
{price = {{'sulfuric-acid-barrel', 1}}, offer = {type = 'give-item', item = "coin", count = math.random(4,8)}},
|
||||
{price = {{'light-oil-barrel', 1}}, offer = {type = 'give-item', item = "coin", count = math.random(2,4)}},
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
-- Mountain digger fortress, protect the cargo wagon! -- by MewMew
|
||||
|
||||
--require "modules.flashlight_toggle_button"
|
||||
--require "modules.biter_noms_you"
|
||||
require "modules.rpg"
|
||||
require "modules.wave_defense.main"
|
||||
require "functions.soft_reset"
|
||||
@@ -94,7 +92,7 @@ function reset_map()
|
||||
game.map_settings.enemy_expansion.min_expansion_cooldown = 3600
|
||||
game.map_settings.enemy_expansion.settler_group_max_size = 8
|
||||
game.map_settings.enemy_expansion.settler_group_min_size = 16
|
||||
game.map_settings.pollution.enabled = false
|
||||
game.map_settings.pollution.enabled = true
|
||||
|
||||
game.forces.player.technologies["landfill"].enabled = false
|
||||
game.forces.player.technologies["railway"].researched = true
|
||||
@@ -105,9 +103,9 @@ function reset_map()
|
||||
reset_wave_defense()
|
||||
global.wave_defense.surface_index = global.active_surface_index
|
||||
global.wave_defense.target = global.locomotive_cargo
|
||||
global.wave_defense.side_target_search_radius = 768
|
||||
global.wave_defense.unit_group_command_step_length = 32
|
||||
global.wave_defense.nest_building_density = 32
|
||||
global.wave_defense.side_target_search_radius = 512
|
||||
global.wave_defense.unit_group_command_step_length = 64
|
||||
global.wave_defense.nest_building_density = 48
|
||||
global.wave_defense.threat_gain_multiplier = 3
|
||||
global.wave_defense.game_lost = false
|
||||
|
||||
@@ -279,7 +277,7 @@ end
|
||||
local function on_init(surface)
|
||||
global.rocks_yield_ore_maximum_amount = 999
|
||||
global.rocks_yield_ore_base_amount = 50
|
||||
global.rocks_yield_ore_distance_modifier = 0.03
|
||||
global.rocks_yield_ore_distance_modifier = 0.025
|
||||
|
||||
global.explosion_cells_destructible_tiles = {
|
||||
["out-of-map"] = 1500,
|
||||
|
||||
@@ -69,7 +69,7 @@ local function process_level_5_position(p, seed, tiles, entities, markets, treas
|
||||
|
||||
if small_caves > -0.10 and small_caves < 0.10 then
|
||||
tiles[#tiles + 1] = {name = "dirt-7", position = p}
|
||||
if math_random(1,512) == 1 then treasure[#treasure + 1] = p end
|
||||
if math_random(1,768) == 1 then treasure[#treasure + 1] = p end
|
||||
if math_random(1,2) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
|
||||
return
|
||||
end
|
||||
@@ -87,7 +87,7 @@ local function process_level_5_position(p, seed, tiles, entities, markets, treas
|
||||
if small_caves > -0.30 and small_caves < 0.30 then
|
||||
if noise_cave_ponds > 0.35 then
|
||||
tiles[#tiles + 1] = {name = "dirt-" .. math.random(1, 4), position = p}
|
||||
if math_random(1,128) == 1 then treasure[#treasure + 1] = p end
|
||||
if math_random(1,256) == 1 then treasure[#treasure + 1] = p end
|
||||
if math_random(1,256) == 1 then entities[#entities + 1] = {name = "crude-oil", position = p, amount = math.abs(p.y) * 500} end
|
||||
return
|
||||
end
|
||||
@@ -275,12 +275,12 @@ local function process_level_2_position(p, seed, tiles, entities, markets, treas
|
||||
local noise_cave_ponds = get_noise("cave_ponds", p, seed)
|
||||
|
||||
--Chasms
|
||||
if noise_cave_ponds < 0.13 and noise_cave_ponds > -0.13 then
|
||||
if small_caves > 0.35 then
|
||||
if noise_cave_ponds < 0.15 and noise_cave_ponds > -0.15 then
|
||||
if small_caves > 0.32 then
|
||||
tiles[#tiles + 1] = {name = "out-of-map", position = p}
|
||||
return
|
||||
end
|
||||
if small_caves < -0.35 then
|
||||
if small_caves < -0.32 then
|
||||
tiles[#tiles + 1] = {name = "out-of-map", position = p}
|
||||
return
|
||||
end
|
||||
|
||||
@@ -34,23 +34,23 @@ function treasure_chest(surface, position)
|
||||
{{name = "atomic-bomb", count = 1}, weight = 1, evo_min = 0.8, evo_max = 1},
|
||||
{{name = "light-armor", count = 1}, weight = 3, evo_min = 0, evo_max = 0.1},
|
||||
{{name = "heavy-armor", count = 1}, weight = 3, evo_min = 0.1, evo_max = 0.3},
|
||||
{{name = "modular-armor", count = 1}, weight = 3, evo_min = 0.2, evo_max = 0.6},
|
||||
{{name = "power-armor", count = 1}, weight = 2, evo_min = 0.4, evo_max = 1},
|
||||
{{name = "power-armor-mk2", count = 1}, weight = 1, evo_min = 0.9, evo_max = 1},
|
||||
{{name = "modular-armor", count = 1}, weight = 2, evo_min = 0.2, evo_max = 0.6},
|
||||
{{name = "power-armor", count = 1}, weight = 1, evo_min = 0.4, evo_max = 1},
|
||||
--{{name = "power-armor-mk2", count = 1}, weight = 1, evo_min = 0.9, evo_max = 1},
|
||||
{{name = "battery-equipment", count = 1}, weight = 2, evo_min = 0.3, evo_max = 0.7},
|
||||
{{name = "battery-mk2-equipment", count = 1}, weight = 2, evo_min = 0.7, evo_max = 1},
|
||||
--{{name = "battery-mk2-equipment", count = 1}, weight = 2, evo_min = 0.7, evo_max = 1},
|
||||
{{name = "belt-immunity-equipment", count = 1}, weight = 1, evo_min = 0.5, evo_max = 1},
|
||||
{{name = "solar-panel-equipment", count = math_random(1,4)}, weight = 5, evo_min = 0.4, evo_max = 0.8},
|
||||
{{name = "discharge-defense-equipment", count = 1}, weight = 1, evo_min = 0.5, evo_max = 1},
|
||||
{{name = "energy-shield-equipment", count = math_random(1,2)}, weight = 2, evo_min = 0.3, evo_max = 0.8},
|
||||
{{name = "energy-shield-mk2-equipment", count = 1}, weight = 2, evo_min = 0.8, evo_max = 1},
|
||||
--{{name = "energy-shield-mk2-equipment", count = 1}, weight = 2, evo_min = 0.8, evo_max = 1},
|
||||
{{name = "exoskeleton-equipment", count = 1}, weight = 1, evo_min = 0.3, evo_max = 1},
|
||||
{{name = "fusion-reactor-equipment", count = 1}, weight = 1, evo_min = 0.8, evo_max = 1},
|
||||
--{{name = "fusion-reactor-equipment", count = 1}, weight = 1, evo_min = 0.8, evo_max = 1},
|
||||
{{name = "night-vision-equipment", count = 1}, weight = 1, evo_min = 0.3, evo_max = 0.8},
|
||||
{{name = "personal-laser-defense-equipment", count = 1}, weight = 1, evo_min = 0.7, evo_max = 1},
|
||||
|
||||
{{name = "personal-roboport-equipment", count = math_random(1,2)}, weight = 3, evo_min = 0.4, evo_max = 1},
|
||||
{{name = "personal-roboport-mk2-equipment", count = 1}, weight = 1, evo_min = 0.9, evo_max = 1},
|
||||
--{{name = "personal-roboport-mk2-equipment", count = 1}, weight = 1, evo_min = 0.9, evo_max = 1},
|
||||
{{name = "logistic-robot", count = math_random(5,25)}, weight = 2, evo_min = 0.5, evo_max = 1},
|
||||
{{name = "construction-robot", count = math_random(5,25)}, weight = 5, evo_min = 0.4, evo_max = 1},
|
||||
|
||||
@@ -155,8 +155,9 @@ function treasure_chest(surface, position)
|
||||
end
|
||||
|
||||
local name = "wooden-chest"
|
||||
if distance_to_center > 0.5 then name = "iron-chest" end
|
||||
if distance_to_center > 0.75 then name = "steel-chest" end
|
||||
if math_random(1, 6) == 1 then name = "iron-chest" end
|
||||
--if distance_to_center > 0.75 then name = "steel-chest" end
|
||||
|
||||
local e = surface.create_entity({name = name, position=position, force="neutral"})
|
||||
e.minable = false
|
||||
local i = e.get_inventory(defines.inventory.chest)
|
||||
|
||||
@@ -164,6 +164,7 @@ local function tick(event)
|
||||
global.explosion_cells[key] = nil
|
||||
end
|
||||
end
|
||||
if game.tick % 216000 == 0 then global.explosion_cells_tiles = {} end
|
||||
end
|
||||
|
||||
local function on_entity_died(event)
|
||||
@@ -182,7 +183,7 @@ local function on_entity_died(event)
|
||||
cell_birth(entity.surface.index, {x = entity.position.x, y = entity.position.y}, game.tick, {x = entity.position.x, y = entity.position.y}, amount * damage_per_explosive)
|
||||
end
|
||||
|
||||
local function on_init(surface)
|
||||
local function on_init()
|
||||
global.explosion_cells = {}
|
||||
global.explosion_cells_vectors = {{density, 0}, {density * -1, 0}, {0, density}, {0, density * -1}}
|
||||
--global.explosion_cells_damage_dealt = 0
|
||||
|
||||
@@ -2,6 +2,7 @@ local event = require 'utils.event'
|
||||
|
||||
local function on_marked_for_deconstruction(event)
|
||||
if event.entity.force.name ~= "neutral" then return end
|
||||
if event.entity.name == "item-on-ground" then return end
|
||||
event.entity.cancel_deconstruction(game.players[event.player_index].force.name)
|
||||
end
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ function wave_defense_roll_biter_name()
|
||||
for k, v in pairs(global.wave_defense.biter_raffle) do
|
||||
max_chance = max_chance + v
|
||||
end
|
||||
local r = math.random(1, max_chance)
|
||||
local r = math.random(0, math.floor(max_chance))
|
||||
local current_chance = 0
|
||||
for k, v in pairs(global.wave_defense.biter_raffle) do
|
||||
current_chance = current_chance + v
|
||||
@@ -16,7 +16,7 @@ function wave_defense_roll_spitter_name()
|
||||
for k, v in pairs(global.wave_defense.spitter_raffle) do
|
||||
max_chance = max_chance + v
|
||||
end
|
||||
local r = math.random(1, max_chance)
|
||||
local r = math.random(0, math.floor(max_chance))
|
||||
local current_chance = 0
|
||||
for k, v in pairs(global.wave_defense.spitter_raffle) do
|
||||
current_chance = current_chance + v
|
||||
@@ -60,7 +60,7 @@ function wave_defense_roll_worm_name()
|
||||
for k, v in pairs(global.wave_defense.worm_raffle) do
|
||||
max_chance = max_chance + v
|
||||
end
|
||||
local r = math.random(1, max_chance)
|
||||
local r = math.random(0, math.floor(max_chance))
|
||||
local current_chance = 0
|
||||
for k, v in pairs(global.wave_defense.worm_raffle) do
|
||||
current_chance = current_chance + v
|
||||
|
||||
@@ -95,6 +95,15 @@ local function set_side_target_list()
|
||||
end
|
||||
|
||||
local function get_side_target()
|
||||
if math.random(1, 2) == 1 then
|
||||
local surface = game.surfaces[global.wave_defense.surface_index]
|
||||
local characters = surface.find_entities_filtered({name = "character"})
|
||||
if not characters[1] then return false end
|
||||
local character = characters[math.random(1, #characters)]
|
||||
if not character.valid then return false end
|
||||
return character
|
||||
end
|
||||
|
||||
if not global.wave_defense.side_targets then return false end
|
||||
if #global.wave_defense.side_targets < 2 then return false end
|
||||
local side_target = global.wave_defense.side_targets[math_random(1,#global.wave_defense.side_targets)]
|
||||
@@ -236,33 +245,6 @@ local function spawn_biter(surface)
|
||||
return biter
|
||||
end
|
||||
|
||||
local function spawn_unit_group()
|
||||
if not can_units_spawn() then return end
|
||||
if not global.wave_defense.target then return end
|
||||
if not global.wave_defense.target.valid then return end
|
||||
if get_active_unit_groups_count() >= global.wave_defense.max_active_unit_groups then return end
|
||||
|
||||
wave_defense_set_unit_raffle(global.wave_defense.wave_number)
|
||||
|
||||
local surface = game.surfaces[global.wave_defense.surface_index]
|
||||
set_group_spawn_position(surface)
|
||||
debug_print("Spawning unit group at x" .. global.wave_defense.spawn_position.x .." y" .. global.wave_defense.spawn_position.y)
|
||||
local unit_group = surface.create_unit_group({position = global.wave_defense.spawn_position, force = "enemy"})
|
||||
for a = 1, global.wave_defense.group_size, 1 do
|
||||
local biter = spawn_biter(surface)
|
||||
if not biter then break end
|
||||
unit_group.add_member(biter)
|
||||
end
|
||||
for i = 1, #global.wave_defense.unit_groups, 1 do
|
||||
if not global.wave_defense.unit_groups[i] then
|
||||
global.wave_defense.unit_groups[i] = unit_group
|
||||
return true
|
||||
end
|
||||
end
|
||||
global.wave_defense.unit_groups[#global.wave_defense.unit_groups + 1] = unit_group
|
||||
return true
|
||||
end
|
||||
|
||||
local function set_next_wave()
|
||||
global.wave_defense.wave_number = global.wave_defense.wave_number + 1
|
||||
global.wave_defense.group_size = global.wave_defense.wave_number * 2
|
||||
@@ -359,17 +341,17 @@ local function get_commmands(group)
|
||||
end
|
||||
|
||||
local function command_unit_group(group)
|
||||
if not global.wave_defense.unit_group_last_command[group.group_number] then
|
||||
global.wave_defense.unit_group_last_command[group.group_number] = game.tick - (global.wave_defense.unit_group_command_delay + 1)
|
||||
if global.wave_defense.unit_group_last_command[group.group_number] then
|
||||
if global.wave_defense.unit_group_last_command[group.group_number] + global.wave_defense.unit_group_command_delay > game.tick then return end
|
||||
end
|
||||
if global.wave_defense.unit_group_last_command[group.group_number] + global.wave_defense.unit_group_command_delay > game.tick then return end
|
||||
global.wave_defense.unit_group_last_command[group.group_number] = game.tick
|
||||
|
||||
group.set_command({
|
||||
type = defines.command.compound,
|
||||
structure_type = defines.compound_command.return_last,
|
||||
commands = get_commmands(group)
|
||||
})
|
||||
|
||||
global.wave_defense.unit_group_last_command[group.group_number] = game.tick
|
||||
end
|
||||
|
||||
local function give_commands_to_unit_groups()
|
||||
@@ -380,11 +362,44 @@ local function give_commands_to_unit_groups()
|
||||
if group.valid then
|
||||
command_unit_group(group)
|
||||
else
|
||||
global.wave_defense.unit_groups[k] = nil
|
||||
table.remove(global.wave_defense.unit_groups, k)
|
||||
--global.wave_defense.unit_groups[k] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function spawn_unit_group()
|
||||
if not can_units_spawn() then return end
|
||||
if not global.wave_defense.target then return end
|
||||
if not global.wave_defense.target.valid then return end
|
||||
if get_active_unit_groups_count() >= global.wave_defense.max_active_unit_groups then return end
|
||||
|
||||
wave_defense_set_unit_raffle(global.wave_defense.wave_number)
|
||||
|
||||
local surface = game.surfaces[global.wave_defense.surface_index]
|
||||
set_group_spawn_position(surface)
|
||||
debug_print("Spawning unit group at x" .. global.wave_defense.spawn_position.x .." y" .. global.wave_defense.spawn_position.y)
|
||||
local unit_group = surface.create_unit_group({position = global.wave_defense.spawn_position, force = "enemy"})
|
||||
for a = 1, global.wave_defense.group_size, 1 do
|
||||
local biter = spawn_biter(surface)
|
||||
if not biter then break end
|
||||
unit_group.add_member(biter)
|
||||
end
|
||||
--command_unit_group(unit_group)
|
||||
|
||||
table.insert(global.wave_defense.unit_groups, unit_group)
|
||||
--[[
|
||||
for i = 1, #global.wave_defense.unit_groups, 1 do
|
||||
if not global.wave_defense.unit_groups[i] then
|
||||
global.wave_defense.unit_groups[i] = unit_group
|
||||
return true
|
||||
end
|
||||
end
|
||||
global.wave_defense.unit_groups[#global.wave_defense.unit_groups + 1] = unit_group
|
||||
]]
|
||||
return true
|
||||
end
|
||||
|
||||
local tick_tasks = {
|
||||
[30] = set_main_target,
|
||||
[60] = set_enemy_evolution,
|
||||
@@ -435,7 +450,7 @@ function reset_wave_defense()
|
||||
threat = 0,
|
||||
threat_gain_multiplier = 2,
|
||||
unit_group_command_delay = 3600 * 15,
|
||||
unit_group_command_step_length = 32,
|
||||
unit_group_command_step_length = 64,
|
||||
unit_group_last_command = {},
|
||||
unit_groups = {},
|
||||
wave_interval = 3600,
|
||||
|
||||
@@ -77,8 +77,8 @@ local acid_nova_entities = {
|
||||
|
||||
local function acid_nova(entity)
|
||||
if not acid_nova_entities[entity.name] then return end
|
||||
if global.wave_defense.threat < 100000 then return end
|
||||
if math_random(1, 16) ~= 1 then return end
|
||||
if global.wave_defense.threat < 1000000 then return end
|
||||
if math_random(1, 32) ~= 1 then return end
|
||||
for _ = 1, acid_nova_entities[entity.name].amount, 1 do
|
||||
local i = math_random(1, #acid_nova_entities[entity.name].vectors)
|
||||
entity.surface.create_entity({
|
||||
|
||||
Reference in New Issue
Block a user