1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

Merge pull request #1049 from Zahir-Khan/In_progress

Artillery kills cause bots to spawn and shoot across the map.
This commit is contained in:
grilledham 2020-04-28 08:27:28 +01:00 committed by GitHub
commit 7c70d36b41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -283,7 +283,14 @@ end
local bot_spawn_whitelist = {
['gun-turret'] = true,
['laser-turret'] = true,
['flamethrower-turret'] = true
['flamethrower-turret'] = true,
['artillery-turret'] = true
}
local bot_cause_whitelist = {
['character'] = true,
['artillery-turret'] = true,
['artillery-wagon'] = true,
}
local function do_bot_spawn(entity_name, entity, event)
@ -292,8 +299,7 @@ local function do_bot_spawn(entity_name, entity, event)
local entity_force = entity.force
local ef = entity_force.evolution_factor
-- Remove 'character' condition so that attack form any entity such as artillery will cause the bots to spawn.
if not bot_spawn_whitelist[entity_name] or (cause.name ~= 'character') or ef <= 0.2 then
if not bot_spawn_whitelist[entity_name] or not bot_cause_whitelist[cause.name] or ef <= 0.2 then
return
end
@ -308,8 +314,23 @@ local function do_bot_spawn(entity_name, entity, event)
target = cause,
force = entity_force
}
if cause.name ~= 'character' then
if entity_name == 'artillery-turret' then
repeat_cycle = 15
else
repeat_cycle = 4
end
for i = 1, repeat_cycle do
spawn_entity.name = 'defender'
create_entity(spawn_entity)
create_entity(spawn_entity)
if entity_name == 'gun-turret' then
spawn_entity.name = 'destroyer'
create_entity(spawn_entity)
create_entity(spawn_entity)
end
elseif entity_name == 'gun-turret' then
for i = 1, repeat_cycle do
spawn_entity.name = 'defender'
create_entity(spawn_entity)