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

Logic change and lua check fixes

This commit is contained in:
Jayefuu 2020-11-29 21:52:41 +00:00
parent ecff8f86eb
commit fcca5de12a

View File

@ -304,13 +304,19 @@ local function do_bot_spawn(entity_name, entity, event)
if ef <= 0.2 then
return
end
local spawn_entity = {
position = entity.position,
target = cause,
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?
@ -323,10 +329,6 @@ local function do_bot_spawn(entity_name, entity, event)
return
end
if not bot_spawn_whitelist[entity_name] then
return
end
if not bot_cause_whitelist[cause.name] then
return
end
@ -336,8 +338,6 @@ local function do_bot_spawn(entity_name, entity, event)
repeat_cycle = 2
end
if cause.name ~= 'character' then
if (entity_name == 'artillery-turret') or (entity_name == 'artillery-wagon') then
repeat_cycle = 15
@ -347,15 +347,15 @@ local function do_bot_spawn(entity_name, entity, event)
for i = 1, repeat_cycle do
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
spawn_entity.speed = 0.2
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)
spawn_entity.name = 'destroyer-capsule'
create_entity(spawn_entity)
create_entity(spawn_entity)
create_entity(spawn_entity)
else
-- projectiles don't have AI so won't track/follow a player
-- if the cause wasn't artillery turret/wagon then spawn a capsule entity not projectile
@ -365,8 +365,8 @@ local function do_bot_spawn(entity_name, entity, event)
spawn_entity.name = 'destroyer'
create_entity(spawn_entity)
create_entity(spawn_entity)
end
create_entity(spawn_entity)
end
end
elseif entity_name == 'gun-turret' then
for i = 1, repeat_cycle do