mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-17 20:58:13 +02:00
too much stuff
This commit is contained in:
parent
faac8c1905
commit
aa6386033b
20
maps/mountain_fortress_v2/flamethrower_nerf.lua
Normal file
20
maps/mountain_fortress_v2/flamethrower_nerf.lua
Normal file
@ -0,0 +1,20 @@
|
||||
--Flamethrower Turret Nerf
|
||||
local function on_research_finished(event)
|
||||
local research = event.research
|
||||
local force_name = research.force.name
|
||||
if research.name == "flamethrower" then
|
||||
if not global.flamethrower_damage then global.flamethrower_damage = {} end
|
||||
global.flamethrower_damage[force_name] = -0.6
|
||||
game.forces[force_name].set_turret_attack_modifier("flamethrower-turret", global.flamethrower_damage[force_name])
|
||||
game.forces[force_name].set_ammo_damage_modifier("flamethrower", global.flamethrower_damage[force_name])
|
||||
end
|
||||
|
||||
if string.sub(research.name, 0, 18) == "refined-flammables" then
|
||||
global.flamethrower_damage[force_name] = global.flamethrower_damage[force_name] + 0.05
|
||||
game.forces[force_name].set_turret_attack_modifier("flamethrower-turret", global.flamethrower_damage[force_name])
|
||||
game.forces[force_name].set_ammo_damage_modifier("flamethrower", global.flamethrower_damage[force_name])
|
||||
end
|
||||
end
|
||||
|
||||
local event = require 'utils.event'
|
||||
event.add(defines.events.on_research_finished, on_research_finished)
|
@ -26,12 +26,22 @@ local function remove_acceleration()
|
||||
if global.locomotive_driver then global.locomotive_driver.destroy() end
|
||||
end
|
||||
|
||||
---DESYNC?
|
||||
local function set_player_spawn()
|
||||
if not global.locomotive_cargo then return end
|
||||
if not global.locomotive_cargo.valid then return end
|
||||
local position = global.locomotive_cargo.surface.find_non_colliding_position("stone-furnace", global.locomotive_cargo.position, 16, 2)
|
||||
if not position then return end
|
||||
game.forces.player.set_spawn_position(position, global.locomotive_cargo.surface)
|
||||
game.forces.player.set_spawn_position({x = position.x, y = position.y}, global.locomotive_cargo.surface)
|
||||
end
|
||||
|
||||
local function set_player_spawn_and_refill_fish()
|
||||
if not global.locomotive_cargo then return end
|
||||
if not global.locomotive_cargo.valid then return end
|
||||
global.locomotive_cargo.get_inventory(defines.inventory.cargo_wagon).insert({name = "raw-fish", count = 4000})
|
||||
local position = global.locomotive_cargo.surface.find_non_colliding_position("stone-furnace", global.locomotive_cargo.position, 16, 2)
|
||||
if not position then return end
|
||||
game.forces.player.set_spawn_position({x = position.x, y = position.y}, global.locomotive_cargo.surface)
|
||||
end
|
||||
|
||||
local function tick()
|
||||
@ -40,7 +50,9 @@ local function tick()
|
||||
|
||||
if game.tick % 30 == 0 then
|
||||
accelerate()
|
||||
if game.tick % 1800 == 0 then set_player_spawn() end
|
||||
if game.tick % 900 == 0 then
|
||||
set_player_spawn_and_refill_fish()
|
||||
end
|
||||
else
|
||||
remove_acceleration()
|
||||
end
|
||||
|
@ -4,7 +4,9 @@ require "modules.biter_evasion_hp_increaser"
|
||||
require "modules.wave_defense"
|
||||
--require "modules.dense_rocks"
|
||||
require "functions.soft_reset"
|
||||
--require "modules.dynamic_player_spawn"
|
||||
require "modules.biters_yield_coins"
|
||||
require "modules.no_deconstruction_of_neutral_entities"
|
||||
require "modules.rocks_broken_paint_tiles"
|
||||
require "modules.rocks_heal_over_time"
|
||||
require "modules.rocks_yield_ore_veins"
|
||||
@ -15,7 +17,7 @@ require "modules.rpg"
|
||||
|
||||
global.map_info = {}
|
||||
global.map_info.main_caption = "Mountain Fortress"
|
||||
global.map_info.sub_caption = " ..diggy diggy choo.."
|
||||
global.map_info.sub_caption = " ..diggy diggy choo choo.."
|
||||
global.map_info.text = [[
|
||||
The biters have catched the scent of fish in the cargo wagon.
|
||||
Guide the choo into the mountain and protect it as long as possible!
|
||||
@ -32,6 +34,7 @@ require "maps.mountain_fortress_v2.treasure"
|
||||
require "maps.mountain_fortress_v2.terrain"
|
||||
require "maps.mountain_fortress_v2.locomotive"
|
||||
require "maps.mountain_fortress_v2.explosives"
|
||||
require "maps.mountain_fortress_v2.flamethrower_nerf"
|
||||
|
||||
local starting_items = {['pistol'] = 1, ['firearm-magazine'] = 16, ['rail'] = 16, ['wood'] = 16}
|
||||
|
||||
@ -40,7 +43,7 @@ local function get_gen_settings()
|
||||
["seed"] = math.random(1, 1000000),
|
||||
["water"] = 0.001,
|
||||
["starting_area"] = 1,
|
||||
["cliff_settings"] = {cliff_elevation_interval = 8, cliff_elevation_0 = 8},
|
||||
["cliff_settings"] = {cliff_elevation_interval = 0, cliff_elevation_0 = 0},
|
||||
["default_enable_all_autoplace_controls"] = true,
|
||||
["autoplace_settings"] = {
|
||||
["entity"] = {treat_missing_as_default = false},
|
||||
|
@ -45,6 +45,17 @@ local function process_rock_chunk_position(p, seed, tiles, entities, markets, tr
|
||||
if math_random(1,96) == 1 then entities[#entities + 1] = {name = "crude-oil", position = p, amount = math.abs(p.y) * 250} end
|
||||
return
|
||||
end
|
||||
if noise_cave_ponds < 0.08 and noise_cave_ponds > -0.08 then
|
||||
if noise > 0.45 then
|
||||
tiles[#tiles + 1] = {name = "out-of-map", position = p}
|
||||
return
|
||||
end
|
||||
if noise < -0.45 then
|
||||
tiles[#tiles + 1] = {name = "out-of-map", position = p}
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
tiles[#tiles + 1] = {name = "dirt-7", position = p}
|
||||
if math_random(1,3) > 1 then entities[#entities + 1] = {name = rock_raffle[math_random(1, #rock_raffle)], position = p} end
|
||||
if math_random(1,2048) == 1 then treasure[#treasure + 1] = p end
|
||||
@ -62,7 +73,7 @@ local function process_rock_chunk_position(p, seed, tiles, entities, markets, tr
|
||||
end
|
||||
if math.abs(noise) > m * 5 then
|
||||
tiles[#tiles + 1] = {name = "grass-2", position = p}
|
||||
if math_random(1,128) == 1 then entities[#entities + 1] = {name=spawner_raffle[math_random(1, #spawner_raffle)], position=p} end
|
||||
--if math_random(1,128) == 1 then entities[#entities + 1] = {name=spawner_raffle[math_random(1, #spawner_raffle)], position=p} end
|
||||
return
|
||||
end
|
||||
|
||||
@ -205,5 +216,5 @@ local function on_chunk_generated(event)
|
||||
end
|
||||
|
||||
local event = require 'utils.event'
|
||||
event.on_nth_tick(15, process_chunk_queue)
|
||||
event.on_nth_tick(1, process_chunk_queue)
|
||||
event.add(defines.events.on_chunk_generated, on_chunk_generated)
|
@ -47,11 +47,25 @@ local function set_biter_raffle(level)
|
||||
end
|
||||
end
|
||||
|
||||
local function is_unit_valid(biter)
|
||||
if not biter.entity then return false end
|
||||
if not biter.entity.valid then return false end
|
||||
if not biter.entity.unit_group then return false end
|
||||
if biter.spawn_tick + global.wave_defense.max_biter_age < game.tick then return false end
|
||||
return true
|
||||
end
|
||||
|
||||
local function time_out_biters()
|
||||
for k, biter in pairs(global.wave_defense.active_biters) do
|
||||
if biter.spawn_tick + global.wave_defense.max_biter_age < game.tick then
|
||||
global.wave_defense.threat = global.wave_defense.threat + threat_values[biter.entity.name]
|
||||
biter.entity.destroy()
|
||||
if not is_unit_valid(biter) then
|
||||
global.wave_defense.active_biter_count = global.wave_defense.active_biter_count - 1
|
||||
if biter.entity then
|
||||
if biter.entity.valid then
|
||||
global.wave_defense.threat = global.wave_defense.threat + threat_values[biter.entity.name]
|
||||
if global.wave_defense.debug then game.print("WaveDefense>> Unit Number " .. k .. " has timed out.") end
|
||||
biter.entity.destroy()
|
||||
end
|
||||
end
|
||||
global.wave_defense.active_biters[k] = nil
|
||||
end
|
||||
end
|
||||
@ -132,17 +146,58 @@ local function spawn_unit_group()
|
||||
return true
|
||||
end
|
||||
|
||||
local function spawn_wave()
|
||||
local function set_unit_group_count()
|
||||
c = 0
|
||||
for k, g in pairs(global.wave_defense.unit_groups) do
|
||||
if g.valid then
|
||||
c = c + 1
|
||||
else
|
||||
global.wave_defense.unit_groups[k] = nil
|
||||
end
|
||||
end
|
||||
global.wave_defense.active_unit_group_count = c
|
||||
end
|
||||
|
||||
local function spawn_attack_groups()
|
||||
if global.wave_defense.active_biter_count >= global.wave_defense.max_active_biters then return false end
|
||||
set_enemy_evolution()
|
||||
set_biter_raffle(global.wave_defense.wave_number)
|
||||
for a = 1, global.wave_defense.max_active_unit_groups - global.wave_defense.active_unit_group_count, 1 do
|
||||
if not spawn_unit_group() then break end
|
||||
end
|
||||
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
|
||||
if global.wave_defense.group_size > global.wave_defense.max_group_size then global.wave_defense.group_size = global.wave_defense.max_group_size end
|
||||
global.wave_defense.threat = global.wave_defense.threat + global.wave_defense.wave_number * 3
|
||||
set_enemy_evolution()
|
||||
set_biter_raffle(global.wave_defense.wave_number)
|
||||
for a = 1, 16, 1 do
|
||||
if not spawn_unit_group() then break end
|
||||
end
|
||||
global.wave_defense.last_wave = global.wave_defense.next_wave
|
||||
global.wave_defense.next_wave = game.tick + global.wave_defense.wave_interval
|
||||
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) 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 = {
|
||||
{
|
||||
type = defines.command.attack_area,
|
||||
destination = global.wave_defense.target.position,
|
||||
radius = 16,
|
||||
distraction = defines.distraction.by_enemy
|
||||
},
|
||||
{
|
||||
type = defines.command.attack,
|
||||
target = global.wave_defense.target,
|
||||
distraction = defines.distraction.by_enemy
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local function give_commands_to_unit_groups()
|
||||
@ -151,23 +206,7 @@ local function give_commands_to_unit_groups()
|
||||
if not global.wave_defense.target.valid then return end
|
||||
for k, group in pairs(global.wave_defense.unit_groups) do
|
||||
if group.valid then
|
||||
group.set_command({
|
||||
type = defines.command.compound,
|
||||
structure_type = defines.compound_command.return_last,
|
||||
commands = {
|
||||
{
|
||||
type = defines.command.attack_area,
|
||||
destination = global.wave_defense.target.position,
|
||||
radius = 16,
|
||||
distraction = defines.distraction.by_enemy
|
||||
},
|
||||
{
|
||||
type = defines.command.attack,
|
||||
target = global.wave_defense.target,
|
||||
distraction = defines.distraction.by_enemy
|
||||
}
|
||||
}
|
||||
})
|
||||
command_unit_group(group)
|
||||
else
|
||||
global.wave_defense.unit_groups[k] = nil
|
||||
end
|
||||
@ -180,7 +219,7 @@ local function create_gui(player)
|
||||
|
||||
local label = frame.add({ type = "label", caption = " ", name = "label"})
|
||||
label.style.font_color = {r=0.88, g=0.88, b=0.88}
|
||||
label.style.font = "default-listbox"
|
||||
label.style.font = "default-bold"
|
||||
label.style.left_padding = 4
|
||||
label.style.right_padding = 4
|
||||
label.style.minimal_width = 68
|
||||
@ -190,6 +229,18 @@ local function create_gui(player)
|
||||
progressbar.style.minimal_width = 128
|
||||
progressbar.style.maximal_width = 128
|
||||
progressbar.style.top_padding = 10
|
||||
|
||||
local line = frame.add({type = "line", direction = "vertical"})
|
||||
line.style.left_padding = 4
|
||||
line.style.right_padding = 4
|
||||
|
||||
local label = frame.add({ type = "label", caption = " ", name = "threat"})
|
||||
label.style.font_color = {r=0.88, g=0.88, b=0.88}
|
||||
label.style.font = "default-bold"
|
||||
label.style.left_padding = 4
|
||||
label.style.right_padding = 4
|
||||
label.style.minimal_width = 10
|
||||
label.style.font_color = {r=0.99, g=0.0, b=0.5}
|
||||
end
|
||||
|
||||
local function update_gui(player)
|
||||
@ -198,6 +249,7 @@ local function update_gui(player)
|
||||
if global.wave_defense.wave_number == 0 then player.gui.top.wave_defense.label.caption = "First wave in " .. math.floor((global.wave_defense.next_wave - game.tick) / 60) + 1 end
|
||||
local interval = global.wave_defense.next_wave - global.wave_defense.last_wave
|
||||
player.gui.top.wave_defense.progressbar.value = 1 - (global.wave_defense.next_wave - game.tick) / interval
|
||||
player.gui.top.wave_defense.threat.caption = "Threat: " .. global.wave_defense.threat
|
||||
end
|
||||
|
||||
local function on_entity_died(event)
|
||||
@ -213,33 +265,32 @@ local function on_tick()
|
||||
|
||||
for _, player in pairs(game.connected_players) do update_gui(player) end
|
||||
|
||||
if game.tick < global.wave_defense.next_wave then return end
|
||||
if game.tick > global.wave_defense.next_wave then set_next_wave() end
|
||||
|
||||
if global.wave_defense.active_biter_count < global.wave_defense.max_active_biters then
|
||||
global.wave_defense.last_wave = global.wave_defense.next_wave
|
||||
global.wave_defense.next_wave = game.tick + global.wave_defense.wave_interval
|
||||
time_out_biters()
|
||||
if game.tick % 180 == 0 then
|
||||
if game.tick % 1800 == 0 then
|
||||
time_out_biters()
|
||||
end
|
||||
set_target()
|
||||
spawn_wave()
|
||||
spawn_attack_groups()
|
||||
set_unit_group_count()
|
||||
give_commands_to_unit_groups()
|
||||
return
|
||||
end
|
||||
|
||||
if game.tick % 3600 == 0 then
|
||||
time_out_biters()
|
||||
set_target()
|
||||
give_commands_to_unit_groups()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function reset_wave_defense()
|
||||
global.wave_defense = {
|
||||
debug = false,
|
||||
surface = game.surfaces["nauvis"],
|
||||
active_biters = {},
|
||||
unit_groups = {},
|
||||
unit_group_last_command = {},
|
||||
unit_group_command_delay = 3600 * 5,
|
||||
max_active_unit_groups = 4,
|
||||
max_active_biters = 1024,
|
||||
max_group_size = 256,
|
||||
max_biter_age = 3600 * 30,
|
||||
active_unit_group_count = 0,
|
||||
active_biter_count = 0,
|
||||
spawn_position = {x = 0, y = 48},
|
||||
last_wave = game.tick,
|
||||
|
8
tools/base_market_items.lua
Normal file
8
tools/base_market_items.lua
Normal file
@ -0,0 +1,8 @@
|
||||
local price_list = {
|
||||
["grenade"] = 10,
|
||||
|
||||
}
|
||||
|
||||
local rarity_list = {
|
||||
["grenade"] = 2,
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user