Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
mtn fortress and wave defense - fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerkiz committed Feb 10, 2021
1 parent 739b99c commit 48a62d4
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 6 deletions.
4 changes: 2 additions & 2 deletions maps/mountain_fortress_v3/locomotive.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1650,8 +1650,8 @@ local function place_market()
end

local function on_research_finished()
local chunk_load_tick = WPT.get('chunk_load_tick')
if chunk_load_tick > game.tick then
local market_announce = WPT.get('market_announce')
if market_announce > game.tick then
return
end

Expand Down
1 change: 1 addition & 0 deletions maps/mountain_fortress_v3/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ function Public.reset_map()
HS.get_scores()

this.chunk_load_tick = game.tick + 1200
this.market_announce = game.tick + 1200
this.game_lost = false
end

Expand Down
1 change: 1 addition & 0 deletions maps/mountain_fortress_v3/table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ function Public.reset_table()
multiply = 0.25,
highest = 10
}
this.market_announce = game.tick + 1200

--!reset player tables
for _, player in pairs(this.players) do
Expand Down
27 changes: 27 additions & 0 deletions modules/biter_health_booster_v2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,25 @@ local function on_entity_damaged(event)
biter.die(biter.force)
end

local function on_entity_died(event)
local biter = event.entity
if not (biter and biter.valid) then
return
end
if not entity_types[biter.type] then
return
end

local biter_health_boost_units = this.biter_health_boost_units

local unit_number = biter.unit_number

local health_pool = biter_health_boost_units[unit_number]
if health_pool then
biter_health_boost_units[unit_number] = nil
end
end

function Public.get(key)
if key then
return this[key]
Expand All @@ -199,11 +218,19 @@ function Public.set(key, value)
end
end

function Public.set_active_surface(str)
if str and type(str) == 'string' then
this.active_surface = str
end
return this.active_surface
end

local on_init = function()
Public.reset_table()
end

Event.on_init(on_init)
Event.add(defines.events.on_entity_damaged, on_entity_damaged)
Event.add(defines.events.on_entity_died, on_entity_died)

return Public
6 changes: 3 additions & 3 deletions modules/wave_defense/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ local function increase_biters_health()

-- this sets normal units health
local modified_unit_health = WD.get('modified_unit_health')
if modified_unit_health > 10 then
modified_unit_health = 10
if modified_unit_health > 30 then
modified_unit_health = 30
end
debug_print('[HEALTHBOOSTER] > Normal Units Health Boosted: ' .. modified_unit_health)
WD.set('modified_unit_health', modified_unit_health + 0.02)
Expand All @@ -533,7 +533,7 @@ local function increase_biters_health()
boosted_health = 1.20
end
boosted_health = boosted_health * (wave_number * 0.03)
local sum = boosted_health * 5
local sum = boosted_health * 4
debug_print('[HEALTHBOOSTER] > Boss Health Boosted: ' .. sum)
if sum >= 100 then
sum = 100
Expand Down
2 changes: 1 addition & 1 deletion modules/wave_defense/table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function Public.reset_wave_defense()
this.increase_boss_health_per_wave = true
this.increase_health_per_wave = false
this.fill_tiles_so_biter_can_path = true
this.modified_unit_health = 0.02
this.modified_unit_health = 1.02
end

function Public.get(key)
Expand Down

0 comments on commit 48a62d4

Please sign in to comment.