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

Update events.lua

This commit is contained in:
Jayefuu 2020-12-08 08:18:31 +00:00
parent f42367bb7c
commit 052c6f17cc

View File

@ -301,6 +301,12 @@ local function do_bot_spawn(entity_name, entity, event)
local ef = entity_force.evolution_factor
local create_entity = entity.surface.create_entity
if not bot_spawn_whitelist[entity_name] then
if cause then
return
end
end
if ef <= 0.2 then
return
end
@ -311,12 +317,6 @@ local function do_bot_spawn(entity_name, entity, event)
force = entity_force
}
if not bot_spawn_whitelist[entity_name] then
if cause then
return
end
end
if not cause then
-- If we reach here then the player might have picked up the artillery turret before the projectile hit the entity and killed it.
-- We therefore won't know the location of the artillery turret/wagon that killed the turret, so let's punish them and send even more bots, straight at spawn?
@ -348,7 +348,7 @@ local function do_bot_spawn(entity_name, entity, event)
if (cause.name == 'artillery-turret') or (cause.name == 'artillery-wagon') then
spawn_entity.target = cause.position -- Overwrite target. Artillery turrets/wagons don't move so send them to entity position. Stops players from picking up the arty and the bots stopping dead.
spawn_entity.speed = 0.2
-- This is particularly risky for players to do because defender-capsule quantities are not limited by the player force's follower robot count.
spawn_entity.name = 'defender-capsule' -- use 'defender-capsule' (projectile) not 'defender' (entity) since a projectile can target a position but a capsule entity must have another entity as target
create_entity(spawn_entity)
create_entity(spawn_entity)