1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-28 23:06:38 +02:00

Fix broken things

This commit is contained in:
Gerkiz 2024-06-02 17:33:54 +02:00
parent 3225cf3f23
commit a413bae9f2
4 changed files with 42 additions and 4 deletions

View File

@ -1642,13 +1642,17 @@ function Public.on_research_finished(event)
local research_name = research.name
local force = research.force
if event.tick > 1000 then
if event.tick > 100 then
if Public.get('print_tech_to_discord') and force.name == 'player' then
Server.to_discord_embed_raw('<a:Modded:835932131036364810> ' .. research_name:gsub('^%l', string.upper) .. ' has been researched!')
end
end
research.force.character_inventory_slots_bonus = player.mining_drill_productivity_bonus * 50 -- +5 Slots /
if research.name == 'toolbelt' then
Public.set('toobelt_researched_count', 10)
end
research.force.character_inventory_slots_bonus = (player.mining_drill_productivity_bonus * 50) + Public.get('toobelt_researched_count')
if bonus_drill then
bonus_drill.mining_drill_productivity_bonus = bonus_drill.mining_drill_productivity_bonus + 0.03
if bonus_drill.mining_drill_productivity_bonus >= 3 then

View File

@ -1698,13 +1698,18 @@ function Public.move_all_players()
return
end
local locomotive = Public.get('locomotive')
if not locomotive or not locomotive.valid then
return
end
ICWF.disable_auto_minimap()
local message = ({'stateful.final_boss_message_start'})
Alert.alert_all_players(50, message, nil, nil, 1)
Core.iter_connected_players(
function(player)
local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0)
local pos = surface.find_non_colliding_position('character', locomotive.position, 10, 0)
Public.stateful_gui.boss_frame(player, true)
@ -1712,11 +1717,28 @@ function Public.move_all_players()
player.teleport(pos)
else
pos = game.forces.player.get_spawn_position(surface)
player.teleport(pos)
player.teleport(locomotive.position)
Public.unstuck_player(player.index)
end
end
)
if _DEBUG then
Core.iter_fake_connected_players(
global.characters,
function(player)
local pos = surface.find_non_colliding_position('character', locomotive.position, 10, 0)
if pos then
player.teleport(pos)
else
pos = game.forces.player.get_spawn_position(surface)
player.teleport(locomotive.position)
Public.unstuck_player(player.index)
end
end
)
end
end
function Public.set_final_battle()

View File

@ -137,6 +137,7 @@ function Public.reset_main_table()
this.locomotive_health = 10000
this.locomotive_max_health = 10000
this.extra_wagons = 0
this.toobelt_researched_count = 0
this.all_the_fish = false
this.reverse_collapse_warning = false
this.gap_between_zones = {

View File

@ -115,6 +115,17 @@ function Public.iter_connected_players(callback)
end
end
--- Iterates over all connected players
---@param callback function
function Public.iter_fake_connected_players(players, callback)
for i = 1, #players do
local player = players[i]
if player and player.valid then
callback(player, i)
end
end
end
--- Iterates over all players
---@param callback function
function Public.iter_players(callback)