1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-26 03:52:22 +02:00

mtn v3 - minor changes

Chemical plants now produce explosives out in the wild.
Fixed stack error of wave defense.
Modified so worms and spawners that are spawned when threat is high, to also be included in the scalement of health.
This commit is contained in:
Gerkiz 2021-11-12 18:09:06 +01:00
parent 233ac15be2
commit b4becfd882
6 changed files with 48 additions and 25 deletions

View File

@ -271,7 +271,7 @@ local function do_place_buildings(data)
} == 0
then
entity = surface.create_entity(e)
if entity then
if entity and entity.valid then
if e.direction then
entity.direction = e.direction
end
@ -280,17 +280,16 @@ local function do_place_buildings(data)
end
if e.callback then
local c = e.callback.callback
if not c then
return
if c then
local d = {callback_data = e.callback.data}
if not d then
callback = Token.get(c)
callback(entity)
else
callback = Token.get(c)
callback(entity, d)
end
end
local d = {callback_data = e.callback.data}
if not d then
callback = Token.get(c)
callback(entity)
return
end
callback = Token.get(c)
callback(entity, d)
end
end
end

View File

@ -203,7 +203,7 @@ function Public.reset_map()
BiterHealthBooster.check_on_entity_died(true)
BiterHealthBooster.boss_spawns_projectiles(true)
BiterHealthBooster.enable_boss_loot(false)
BiterHealthBooster.enable_randomize_discharge_stun(true)
BiterHealthBooster.enable_randomize_stun_and_slowdown_sticker(true)
Balance.init_enemy_weapon_damage()

View File

@ -161,6 +161,18 @@ local oil_prod_loot = {
}
},
weight = 0.25
},
{
stack = {
recipe = 'explosives',
tech = 'explosives',
output = {
item = 'explosives',
min_rate = 0.8 / 60,
distance_factor = 1 / 25 / 60 / 512
}
},
weight = 0.20
}
}

View File

@ -31,7 +31,7 @@ local this = {
acid_nova = false,
boss_spawns_projectiles = false,
enable_boss_loot = false,
randomize_discharge_stun = false
randomize_stun_and_slowdown_sticker = false
}
local radius = 6
@ -286,18 +286,24 @@ local function on_entity_damaged(event)
return
end
if this.randomize_discharge_stun then
if this.randomize_stun_and_slowdown_sticker then
local damage_type = event.damage_type
if damage_type and damage_type.name == 'electric' then
local stickers = biter.stickers
if stickers and #stickers > 0 then
for i = 1, #stickers, 1 do
if random(1, 4) == 1 then -- there's a % that biters can recover from stun and get slowed instead.
if stickers[i].sticked_to == biter and stickers[i].name == 'stun-sticker' then
stickers[i].destroy()
local slow = surface.create_entity {name = 'slowdown-sticker', position = biter.position, target = biter}
slow.time_to_live = 200
break
if stickers[i].sticked_to == biter then
if stickers[i].name == 'stun-sticker' then
stickers[i].destroy()
if random(1, 2) == 1 then
local slow = surface.create_entity {name = 'slowdown-sticker', position = biter.position, target = biter}
slow.time_to_live = 200
end
break
elseif stickers[i].name == 'slowdown-sticker' then
stickers[i].destroy()
end
end
end
end
@ -538,10 +544,10 @@ end
--- Enables that enemies can recover from stun randomly.
---@param boolean
function Public.enable_randomize_discharge_stun(boolean)
this.randomize_discharge_stun = boolean or false
function Public.enable_randomize_stun_and_slowdown_sticker(boolean)
this.randomize_stun_and_slowdown_sticker = boolean or false
return this.randomize_discharge_stun
return this.randomize_stun_and_slowdown_sticker
end
Event.on_init(

View File

@ -324,9 +324,11 @@ local function get_random_close_spawner()
end
if not spawner or (center.x - spawner_2.position.x) ^ 2 + (center.y - spawner_2.position.y) ^ 2 < (center.x - spawner.position.x) ^ 2 + (center.y - spawner.position.y) ^ 2 then
spawner = spawner_2
if spawner and spawner.position then
debug_print('get_random_close_spawner - Found at x' .. spawner.position.x .. ' y' .. spawner.position.y)
end
end
end
debug_print('get_random_close_spawner - Found at x' .. spawner.position.x .. ' y' .. spawner.position.y)
return spawner
end

View File

@ -76,8 +76,10 @@ local function place_nest_near_unit_group()
then
return
end
local modified_boss_unit_health = WD.get('modified_boss_unit_health')
local spawner = unit.surface.create_entity({name = name, position = position, force = unit.force})
BiterHealthBooster.add_boss_unit(spawner, 4)
BiterHealthBooster.add_boss_unit(spawner, modified_boss_unit_health)
local nests = WD.get('nests')
nests[#nests + 1] = spawner
unit.surface.create_entity({name = 'blood-explosion-huge', position = position})
@ -164,8 +166,10 @@ function Public.build_worm()
then
return
end
local modified_boss_unit_health = WD.get('modified_boss_unit_health')
local u = unit.surface.create_entity({name = worm, position = position, force = unit.force})
BiterHealthBooster.add_boss_unit(u, 4)
BiterHealthBooster.add_boss_unit(u, modified_boss_unit_health)
unit.surface.create_entity({name = 'blood-explosion-huge', position = position})
unit.surface.create_entity({name = 'blood-explosion-huge', position = unit.position})
remove_unit(unit)