1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-04 00:15:45 +02:00

Towny small fix

This commit is contained in:
Gerkiz 2023-07-17 00:33:59 +02:00
parent 3cd408b65e
commit efa59990f3
4 changed files with 7681 additions and 4 deletions

View File

@ -143,6 +143,10 @@ function Public.unit_groups_start_moving()
end
local function new_town(town_center)
if not town_center then
return false
end
-- cooldown for swarms on new towns is 15 minutes
local cooldown_ticks = 15 * 3600
local elapsed_ticks = game.tick - town_center.creation_tick
@ -167,7 +171,7 @@ function Public.swarm(town_center, radius)
return
end
-- cancel if relatively new town
if new_town(tc) then
if tc and new_town(tc) then
return
end
-- skip if we have to many swarms already
@ -177,6 +181,10 @@ function Public.swarm(town_center, radius)
return
end
if not tc then
return
end
local market = tc.market
local surface = market.surface
@ -269,6 +277,9 @@ local function on_unit_group_finished_gathering(event)
local this = ScenarioTable.get_table()
local town_centers = this.town_centers
local town_center = town_centers[force.name]
if not town_center then
return
end
-- cancel if relatively new town
if new_town(town_center) then
return

View File

@ -58,6 +58,9 @@ local function do_soft_reset()
end
this.game_reset_tick = nil
this.game_won = false
game.reset_time_played()
game.reset_game_state()
game.remove_offline_players()
ScenarioTable.reset_table()
local surface = game.get_surface(this.active_surface_index)
if not surface or not surface.valid then
@ -68,8 +71,7 @@ local function do_soft_reset()
else
surface.play_sound({path = 'utility/game_lost', volume_modifier = 1})
end
game.reset_time_played()
game.reset_game_state()
for _, player in pairs(game.players) do
player.teleport({0, 0}, game.surfaces['limbo'])
end

View File

@ -465,7 +465,7 @@ end
--- Use this function to add a new boss unit (with healthbar)
---@param unit userdata
---@param health_multiplier number
---@param health_bar_size number
---@param health_bar_size number|nil
function Public.add_boss_unit(unit, health_multiplier, health_bar_size)
if not health_multiplier then
health_multiplier = this.biter_health_boost

7664
tmp.lua Normal file

File diff suppressed because it is too large Load Diff