1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-13 13:49:33 +02:00

mtn fortress - minor changes

This commit is contained in:
Gerkiz 2021-03-01 22:04:55 +01:00
parent 9c97d54f6a
commit b7ccdf5a1d
3 changed files with 16 additions and 7 deletions
maps/mountain_fortress_v3
modules

@ -1082,7 +1082,13 @@ function Public.set_spawn_position()
local spawn_near_collapse = WPT.get('spawn_near_collapse')
if spawn_near_collapse.active then
local collapse_position = surface.find_non_colliding_position('small-biter', collapse_pos, 32, 2)
local collapse_position = surface.find_non_colliding_position('rocket-silo', collapse_pos, 64, 2)
if not collapse_position then
collapse_position = surface.find_non_colliding_position('solar-panel', collapse_pos, 32, 2)
end
if not collapse_position then
collapse_position = surface.find_non_colliding_position('small-biter', collapse_pos, 32, 2)
end
local sizeof = locomotive_positions.tbl[total_pos - total_pos + 1]
if not sizeof then
goto continue

@ -212,7 +212,7 @@ function Public.reset_map()
wave_defense_table.target = this.locomotive
wave_defense_table.nest_building_density = 32
wave_defense_table.game_lost = false
wave_defense_table.spawn_position = {x = 0, y = 100}
wave_defense_table.spawn_position = {x = 0, y = 84}
WD.alert_boss_wave(true)
WD.clear_corpses(false)
WD.remove_entities(true)

@ -16,6 +16,7 @@ local insert = table.insert
local random = math.random
local sqrt = math.sqrt
local ceil = math.ceil
local round = math.round
local Public = {}
local this = {
@ -279,9 +280,9 @@ local function on_entity_damaged(event)
return
end
if event.cause then
if event.cause.valid then
event.entity.die(event.cause.force, event.cause)
if cause then
if cause.valid then
event.entity.die(cause.force, cause)
return
end
end
@ -377,9 +378,10 @@ function Public.add_unit(unit, health_multiplier)
if not health_multiplier then
health_multiplier = this.biter_health_boost
end
local xp_modifier = round(1 / health_multiplier, 5)
this.biter_health_boost_units[unit.unit_number] = {
floor(unit.prototype.max_health * health_multiplier),
ceil(sqrt(health_multiplier))
xp_modifier
}
end
@ -394,10 +396,11 @@ function Public.add_boss_unit(unit, health_multiplier, health_bar_size)
if not health_bar_size then
health_bar_size = 0.5
end
local xp_modifier = round(1 / health_multiplier, 5)
local health = floor(unit.prototype.max_health * health_multiplier)
this.biter_health_boost_units[unit.unit_number] = {
health,
ceil(sqrt(health_multiplier)),
xp_modifier,
{max_health = health, healthbar_id = create_boss_healthbar(unit, health_bar_size), last_update = game.tick}
}
end