mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-14 02:34:09 +02:00
Push fixes for Mtn and Fish
This commit is contained in:
parent
2facdbffda
commit
41a56873d2
@ -516,9 +516,9 @@ end
|
||||
local function spawn_boss_units(surface)
|
||||
local wave_count = Public.get('wave_count')
|
||||
if wave_count <= 2000 then
|
||||
game.print({ 'fish_defender_v2.boss_message', wave_count, { 'fish_defender_v2.' .. wave_count } }, { r = 0.8, g = 0.1, b = 0.1 })
|
||||
game.print({ 'fish_defender_v2.boss_message', wave_count, { 'fish_defender_v2.' .. wave_count } }, { color = { r = 0.8, g = 0.1, b = 0.1 } })
|
||||
else
|
||||
game.print({ 'fish_defender_v2.boss_message', wave_count }, { r = 0.8, g = 0.1, b = 0.1 })
|
||||
game.print({ 'fish_defender_v2.boss_message', wave_count }, { color = { r = 0.8, g = 0.1, b = 0.1 } })
|
||||
end
|
||||
|
||||
local boss_waves = Public.get('boss_waves')
|
||||
|
@ -19,20 +19,150 @@ local coin_yield = {
|
||||
['medium-spitter'] = 2,
|
||||
['medium-worm-turret'] = 4,
|
||||
['small-biter'] = 1,
|
||||
['mtn-addon-small-piercing-biter'] = 3,
|
||||
['mtn-addon-small-acid-biter'] = 3,
|
||||
['mtn-addon-small-explosive-biter'] = 3,
|
||||
['mtn-addon-small-poison-biter'] = 3,
|
||||
['mtn-addon-small-fire-biter'] = 3,
|
||||
['mtn-addon-medium-piercing-biter'] = 6,
|
||||
['mtn-addon-big-piercing-biter'] = 9,
|
||||
['mtn-addon-huge-piercing-biter'] = 13,
|
||||
['mtn-addon-giant-piercing-biter'] = 20,
|
||||
['mtn-addon-massive-piercing-biter'] = 40,
|
||||
['mtn-addon-behemoth-piercing-biter'] = 100,
|
||||
['small-spitter'] = 1,
|
||||
['small-worm-turret'] = 2,
|
||||
['spitter-spawner'] = 32
|
||||
['spitter-spawner'] = 32,
|
||||
|
||||
['mtn-addon-small-piercing-biter-t1'] = 1,
|
||||
['mtn-addon-small-piercing-biter-t2'] = 1,
|
||||
['mtn-addon-small-piercing-biter-t3'] = 1,
|
||||
['mtn-addon-small-acid-biter-t1'] = 1,
|
||||
['mtn-addon-small-acid-biter-t2'] = 1,
|
||||
['mtn-addon-small-acid-biter-t3'] = 1,
|
||||
['mtn-addon-small-explosive-biter-t1'] = 1,
|
||||
['mtn-addon-small-explosive-biter-t2'] = 1,
|
||||
['mtn-addon-small-explosive-biter-t3'] = 1,
|
||||
['mtn-addon-small-poison-biter-t1'] = 1,
|
||||
['mtn-addon-small-poison-biter-t2'] = 1,
|
||||
['mtn-addon-small-poison-biter-t3'] = 1,
|
||||
['mtn-addon-small-fire-biter-t1'] = 1,
|
||||
['mtn-addon-small-fire-biter-t2'] = 1,
|
||||
['mtn-addon-small-fire-biter-t3'] = 1,
|
||||
['mtn-addon-small-piercing-spitter-t1'] = 1,
|
||||
['mtn-addon-small-piercing-spitter-t2'] = 1,
|
||||
['mtn-addon-small-piercing-spitter-t3'] = 1,
|
||||
['mtn-addon-small-acid-spitter-t1'] = 1,
|
||||
['mtn-addon-small-acid-spitter-t2'] = 1,
|
||||
['mtn-addon-small-acid-spitter-t3'] = 1,
|
||||
['mtn-addon-small-explosive-spitter-t1'] = 1,
|
||||
['mtn-addon-small-explosive-spitter-t2'] = 1,
|
||||
['mtn-addon-small-explosive-spitter-t3'] = 1,
|
||||
['mtn-addon-small-poison-spitter-t1'] = 1,
|
||||
['mtn-addon-small-poison-spitter-t2'] = 1,
|
||||
['mtn-addon-small-poison-spitter-t3'] = 1,
|
||||
['mtn-addon-small-fire-spitter-t1'] = 1,
|
||||
['mtn-addon-small-fire-spitter-t2'] = 1,
|
||||
['mtn-addon-small-fire-spitter-t3'] = 1,
|
||||
|
||||
['mtn-addon-medium-piercing-biter-t1'] = 2,
|
||||
['mtn-addon-medium-piercing-biter-t2'] = 2,
|
||||
['mtn-addon-medium-piercing-biter-t3'] = 2,
|
||||
['mtn-addon-medium-acid-biter-t1'] = 2,
|
||||
['mtn-addon-medium-acid-biter-t2'] = 2,
|
||||
['mtn-addon-medium-acid-biter-t3'] = 2,
|
||||
['mtn-addon-medium-explosive-biter-t1'] = 2,
|
||||
['mtn-addon-medium-explosive-biter-t2'] = 2,
|
||||
['mtn-addon-medium-explosive-biter-t3'] = 2,
|
||||
['mtn-addon-medium-poison-biter-t1'] = 2,
|
||||
['mtn-addon-medium-poison-biter-t2'] = 2,
|
||||
['mtn-addon-medium-poison-biter-t3'] = 2,
|
||||
['mtn-addon-medium-fire-biter-t1'] = 2,
|
||||
['mtn-addon-medium-fire-biter-t2'] = 2,
|
||||
['mtn-addon-medium-fire-biter-t3'] = 2,
|
||||
['mtn-addon-medium-piercing-spitter-t1'] = 2,
|
||||
['mtn-addon-medium-piercing-spitter-t2'] = 2,
|
||||
['mtn-addon-medium-piercing-spitter-t3'] = 2,
|
||||
['mtn-addon-medium-acid-spitter-t1'] = 2,
|
||||
['mtn-addon-medium-acid-spitter-t2'] = 2,
|
||||
['mtn-addon-medium-acid-spitter-t3'] = 2,
|
||||
['mtn-addon-medium-explosive-spitter-t1'] = 2,
|
||||
['mtn-addon-medium-explosive-spitter-t2'] = 2,
|
||||
['mtn-addon-medium-explosive-spitter-t3'] = 2,
|
||||
['mtn-addon-medium-poison-spitter-t1'] = 2,
|
||||
['mtn-addon-medium-poison-spitter-t2'] = 2,
|
||||
['mtn-addon-medium-poison-spitter-t3'] = 2,
|
||||
['mtn-addon-medium-fire-spitter-t1'] = 2,
|
||||
['mtn-addon-medium-fire-spitter-t2'] = 2,
|
||||
['mtn-addon-medium-fire-spitter-t3'] = 2,
|
||||
|
||||
['mtn-addon-big-piercing-biter-t1'] = 3,
|
||||
['mtn-addon-big-piercing-biter-t2'] = 3,
|
||||
['mtn-addon-big-piercing-biter-t3'] = 3,
|
||||
['mtn-addon-big-acid-biter-t1'] = 3,
|
||||
['mtn-addon-big-acid-biter-t2'] = 3,
|
||||
['mtn-addon-big-acid-biter-t3'] = 3,
|
||||
['mtn-addon-big-explosive-biter-t1'] = 3,
|
||||
['mtn-addon-big-explosive-biter-t2'] = 3,
|
||||
['mtn-addon-big-explosive-biter-t3'] = 3,
|
||||
['mtn-addon-big-poison-biter-t1'] = 3,
|
||||
['mtn-addon-big-poison-biter-t2'] = 3,
|
||||
['mtn-addon-big-poison-biter-t3'] = 3,
|
||||
['mtn-addon-big-fire-biter-t1'] = 3,
|
||||
['mtn-addon-big-fire-biter-t2'] = 3,
|
||||
['mtn-addon-big-fire-biter-t3'] = 3,
|
||||
['mtn-addon-big-piercing-spitter-t1'] = 3,
|
||||
['mtn-addon-big-piercing-spitter-t2'] = 3,
|
||||
['mtn-addon-big-piercing-spitter-t3'] = 3,
|
||||
['mtn-addon-big-acid-spitter-t1'] = 3,
|
||||
['mtn-addon-big-acid-spitter-t2'] = 3,
|
||||
['mtn-addon-big-acid-spitter-t3'] = 3,
|
||||
['mtn-addon-big-explosive-spitter-t1'] = 3,
|
||||
['mtn-addon-big-explosive-spitter-t2'] = 3,
|
||||
['mtn-addon-big-explosive-spitter-t3'] = 3,
|
||||
['mtn-addon-big-poison-spitter-t1'] = 3,
|
||||
['mtn-addon-big-poison-spitter-t2'] = 3,
|
||||
['mtn-addon-big-poison-spitter-t3'] = 3,
|
||||
['mtn-addon-big-fire-spitter-t1'] = 3,
|
||||
['mtn-addon-big-fire-spitter-t2'] = 3,
|
||||
['mtn-addon-big-fire-spitter-t3'] = 3,
|
||||
|
||||
['mtn-addon-behemoth-piercing-biter-t1'] = 5,
|
||||
['mtn-addon-behemoth-piercing-biter-t2'] = 5,
|
||||
['mtn-addon-behemoth-piercing-biter-t3'] = 5,
|
||||
['mtn-addon-behemoth-acid-biter-t1'] = 5,
|
||||
['mtn-addon-behemoth-acid-biter-t2'] = 5,
|
||||
['mtn-addon-behemoth-acid-biter-t3'] = 5,
|
||||
['mtn-addon-behemoth-explosive-biter-t1'] = 5,
|
||||
['mtn-addon-behemoth-explosive-biter-t2'] = 5,
|
||||
['mtn-addon-behemoth-explosive-biter-t3'] = 5,
|
||||
['mtn-addon-behemoth-poison-biter-t1'] = 5,
|
||||
['mtn-addon-behemoth-poison-biter-t2'] = 5,
|
||||
['mtn-addon-behemoth-poison-biter-t3'] = 5,
|
||||
['mtn-addon-behemoth-fire-biter-t1'] = 5,
|
||||
['mtn-addon-behemoth-fire-biter-t2'] = 5,
|
||||
['mtn-addon-behemoth-fire-biter-t3'] = 5,
|
||||
['mtn-addon-behemoth-piercing-spitter-t1'] = 5,
|
||||
['mtn-addon-behemoth-piercing-spitter-t2'] = 5,
|
||||
['mtn-addon-behemoth-piercing-spitter-t3'] = 5,
|
||||
['mtn-addon-behemoth-acid-spitter-t1'] = 5,
|
||||
['mtn-addon-behemoth-acid-spitter-t2'] = 5,
|
||||
['mtn-addon-behemoth-acid-spitter-t3'] = 5,
|
||||
['mtn-addon-behemoth-explosive-spitter-t1'] = 5,
|
||||
['mtn-addon-behemoth-explosive-spitter-t2'] = 5,
|
||||
['mtn-addon-behemoth-explosive-spitter-t3'] = 5,
|
||||
['mtn-addon-behemoth-poison-spitter-t1'] = 5,
|
||||
['mtn-addon-behemoth-poison-spitter-t2'] = 5,
|
||||
['mtn-addon-behemoth-poison-spitter-t3'] = 5,
|
||||
['mtn-addon-behemoth-fire-spitter-t1'] = 5,
|
||||
['mtn-addon-behemoth-fire-spitter-t2'] = 5,
|
||||
['mtn-addon-behemoth-fire-spitter-t3'] = 5,
|
||||
-- worms
|
||||
['mtn-addon-small-explosive-worm-turret'] = 2,
|
||||
['mtn-addon-small-fire-worm-turret'] = 2,
|
||||
['mtn-addon-small-piercing-worm-turret'] = 2,
|
||||
['mtn-addon-small-poison-worm-turret'] = 2,
|
||||
['mtn-addon-small-electric-worm-turret'] = 2,
|
||||
['mtn-addon-medium-explosive-worm-turret'] = 4,
|
||||
['mtn-addon-medium-fire-worm-turret'] = 4,
|
||||
['mtn-addon-medium-piercing-worm-turret'] = 4,
|
||||
['mtn-addon-medium-poison-worm-turret'] = 4,
|
||||
['mtn-addon-medium-electric-worm-turret'] = 4,
|
||||
['mtn-addon-big-explosive-worm-turret'] = 16,
|
||||
['mtn-addon-big-fire-worm-turret'] = 16,
|
||||
['mtn-addon-big-piercing-worm-turret'] = 16,
|
||||
['mtn-addon-big-poison-worm-turret'] = 16,
|
||||
['mtn-addon-big-electric-worm-turret'] = 16,
|
||||
['mtn-addon-giant-worm-turret'] = 200,
|
||||
}
|
||||
|
||||
local entities_that_earn_coins = {
|
||||
|
@ -82,33 +82,6 @@ local protect_types = {
|
||||
['car'] = true
|
||||
}
|
||||
|
||||
local reset_game =
|
||||
Task.register(
|
||||
function (data)
|
||||
local this = data.this
|
||||
if this.soft_reset then
|
||||
Public.set_scores()
|
||||
this.game_reset_tick = nil
|
||||
Public.set_task('move_players', 'Init')
|
||||
return
|
||||
end
|
||||
if this.restart then
|
||||
Public.set_scores()
|
||||
local message = ({ 'entity.reset_game' })
|
||||
Server.to_discord_bold(message, true)
|
||||
Server.start_scenario('Mountain_Fortress_v3')
|
||||
return
|
||||
end
|
||||
if this.shutdown then
|
||||
Public.set_scores()
|
||||
local message = ({ 'entity.shutdown_game' })
|
||||
Server.to_discord_bold(message, true)
|
||||
Server.stop_scenario()
|
||||
return
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
local change_force_for_drills_token =
|
||||
Task.register(
|
||||
function (event)
|
||||
@ -272,7 +245,7 @@ local function set_train_final_health(final_damage_amount, repair)
|
||||
end
|
||||
|
||||
if locomotive_health <= 0 or locomotive.health <= 5 then
|
||||
locomotive.destructible = false
|
||||
Public.set('locomotive_position', locomotive.position)
|
||||
locomotive.health = 1
|
||||
Public.set('game_lost', true)
|
||||
Public.set_stateful('current_streak', 0)
|
||||
@ -510,7 +483,7 @@ local unstuck_player_token =
|
||||
end
|
||||
|
||||
local surface = player.physical_surface
|
||||
local position = surface.find_non_colliding_position('stone-furnace', player.physical_position, 32, 1)
|
||||
local position = surface.find_non_colliding_position('character', player.physical_position, 32, 1)
|
||||
if not position then
|
||||
return
|
||||
end
|
||||
@ -1349,7 +1322,7 @@ function Public.unstuck_player(index)
|
||||
player.teleport(position, surface)
|
||||
end
|
||||
|
||||
function Public.loco_died(invalid_locomotive)
|
||||
function Public.loco_died()
|
||||
local game_lost = Public.get('game_lost')
|
||||
if not game_lost then
|
||||
return
|
||||
@ -1362,103 +1335,70 @@ function Public.loco_died(invalid_locomotive)
|
||||
return
|
||||
end
|
||||
|
||||
local notified_game_over = Public.get('notified_game_over')
|
||||
if notified_game_over then
|
||||
return
|
||||
end
|
||||
|
||||
local active_surface_index = Public.get('active_surface_index')
|
||||
if not active_surface_index then
|
||||
return
|
||||
end
|
||||
|
||||
local locomotive = Public.get('locomotive')
|
||||
local surface = game.surfaces[active_surface_index]
|
||||
local wave_defense_table = WD.get_table()
|
||||
if wave_defense_table.game_lost and not invalid_locomotive then
|
||||
return
|
||||
end
|
||||
Collapse.start_now(false)
|
||||
|
||||
Collapse.start_now(false, true)
|
||||
|
||||
for _, player in pairs(game.connected_players) do
|
||||
player.play_sound { path = 'utility/game_lost', volume_modifier = 0.75 }
|
||||
show_mvps(player)
|
||||
end
|
||||
|
||||
if not locomotive or not locomotive.valid then
|
||||
local this = Public.get()
|
||||
|
||||
local data = {}
|
||||
if this.locomotive and this.locomotive.valid then
|
||||
data.position = this.locomotive.position
|
||||
else
|
||||
data.position = { x = 0, y = 0 }
|
||||
end
|
||||
|
||||
local msg = defeated_messages[random(1, #defeated_messages)]
|
||||
Alert.alert_all_players_location(data, msg, nil, 15)
|
||||
|
||||
wave_defense_table.game_lost = true
|
||||
wave_defense_table.target = nil
|
||||
|
||||
local params = {
|
||||
this = this
|
||||
}
|
||||
|
||||
if this.soft_reset then
|
||||
this.game_reset_tick = nil
|
||||
Task.set_timeout_in_ticks(600, reset_game, params)
|
||||
this.announced_message = true
|
||||
return
|
||||
end
|
||||
if this.restart then
|
||||
game.print(({ 'entity.notify_restart' }), { r = 0.22, g = 0.88, b = 0.22 })
|
||||
Task.set_timeout_in_ticks(600, reset_game, params)
|
||||
this.announced_message = true
|
||||
return
|
||||
end
|
||||
if this.shutdown then
|
||||
game.print(({ 'entity.notify_shutdown' }), { r = 0.22, g = 0.88, b = 0.22 })
|
||||
Task.set_timeout_in_ticks(600, reset_game, params)
|
||||
this.announced_message = true
|
||||
return
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
local this = Public.get()
|
||||
|
||||
this.locomotive_health = 0
|
||||
this.locomotive.color = { 0.49, 0, 255, 1 }
|
||||
if this.health_text and this.health_text.valid then
|
||||
if this.health_text and this.health_text.valid and this.locomotive and this.locomotive.valid then
|
||||
this.locomotive.color = { 0.49, 0, 255, 1 }
|
||||
this.health_text.text = 'HP: ' .. round(this.locomotive_health) .. ' / ' .. round(this.locomotive_max_health)
|
||||
end
|
||||
wave_defense_table.game_lost = true
|
||||
wave_defense_table.target = nil
|
||||
WD.set('game_lost', true)
|
||||
WD.set('target', nil)
|
||||
local msg = defeated_messages[random(1, #defeated_messages)]
|
||||
|
||||
local p = this.locomotive_position or { x = 0, y = 0 }
|
||||
|
||||
local pos = {
|
||||
position = this.locomotive.position
|
||||
position = p,
|
||||
}
|
||||
Alert.alert_all_players_location(pos, msg)
|
||||
game.forces.enemy.set_friend('player', true)
|
||||
game.forces.player.set_friend('enemy', true)
|
||||
game.forces.aggressors.set_friend('player', true)
|
||||
game.forces.aggressors_frenzy.set_friend('player', true)
|
||||
|
||||
local fake_shooter = surface.create_entity({ name = 'character', position = this.locomotive.position, force = 'enemy' })
|
||||
game.forces.player.set_friend('enemy', true)
|
||||
game.forces.player.set_friend('aggressors', true)
|
||||
game.forces.player.set_friend('aggressors_frenzy', true)
|
||||
|
||||
local fake_shooter = surface.create_entity({ name = 'character', position = p, force = 'enemy' })
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'atomic-rocket',
|
||||
position = this.locomotive.position,
|
||||
position = p,
|
||||
force = 'enemy',
|
||||
speed = 1,
|
||||
max_range = 1200,
|
||||
target = this.locomotive,
|
||||
target = p,
|
||||
source = fake_shooter
|
||||
}
|
||||
)
|
||||
|
||||
surface.spill_item_stack({ position = this.locomotive.position, stack = { name = 'coin', count = 512, quality = 'normal' } })
|
||||
surface.spill_item_stack({ position = p, stack = { name = 'coin', count = 512, quality = 'normal' } })
|
||||
this.game_reset_tick = 5400
|
||||
for _, player in pairs(game.connected_players) do
|
||||
player.play_sound { path = 'utility/game_lost', volume_modifier = 0.75 }
|
||||
show_mvps(player)
|
||||
end
|
||||
Public.set('notified_game_over', true)
|
||||
end
|
||||
|
||||
local function on_entity_spawned(event)
|
||||
|
@ -107,7 +107,7 @@ local is_locomotive_valid = function ()
|
||||
if game.ticks_played < 1000 then return end
|
||||
if not locomotive or not locomotive.valid then
|
||||
Public.set('game_lost', true)
|
||||
Public.loco_died(true)
|
||||
Public.loco_died()
|
||||
end
|
||||
end
|
||||
|
||||
@ -732,6 +732,14 @@ function Public.reset_map(current_task)
|
||||
WD.disable_spawning_biters(true)
|
||||
end
|
||||
|
||||
game.forces.enemy.set_friend('player', false)
|
||||
game.forces.aggressors.set_friend('player', false)
|
||||
game.forces.aggressors_frenzy.set_friend('player', false)
|
||||
|
||||
game.forces.player.set_friend('enemy', false)
|
||||
game.forces.player.set_friend('aggressors', false)
|
||||
game.forces.player.set_friend('aggressors_frenzy', false)
|
||||
|
||||
current_task.message = 'Reset map done!'
|
||||
current_task.delay = game.tick + 60
|
||||
current_task.state = 'post_init_task'
|
||||
|
@ -155,6 +155,7 @@ function Public.reset_main_table()
|
||||
this.restart = false
|
||||
this.shutdown = false
|
||||
this.announced_message = false
|
||||
this.notified_game_over = false
|
||||
this.game_reset_tick = nil
|
||||
-- @end
|
||||
this.breach_wall_warning = false
|
||||
@ -162,6 +163,7 @@ function Public.reset_main_table()
|
||||
this.game_lost = false
|
||||
this.death_mode = false
|
||||
this.collapse_started = false
|
||||
this.locomotive_position = nil
|
||||
this.locomotive_health = 10000
|
||||
this.locomotive_max_health = 10000
|
||||
this.extra_wagons = 0
|
||||
|
Loading…
Reference in New Issue
Block a user