In my mod Natural Evolution Enemies, I have the worms launch units at the player.
The problem I have is that the created units are being damaged by the worms own attack.
As can be seen from below image, the 4 units around me is damaged by the worms attack.
On low evolution factor the created units are instantly killed.
I thought that the same force would not hurt itself, is that not the case?
Not sure what code to give here. Mod it attached.
This is the unit creation code:
Code: Select all
---------------------------------------------
-- Spawn Launched Units
function SpawnLaunchedUnits(enemy)
local subEnemyName = subEnemyNameTable[enemy.name]
if not subEnemyName then
return
end
if subEnemyNameTable[enemy.name][global.evoFactorFloor] then
subEnemyName = subEnemyNameTable[enemy.name][global.evoFactorFloor]
end
local number = subEnemyNumberTable[enemy.name][global.evoFactorFloor]
for i = 1, number do
local subEnemyPosition = enemy.surface.find_non_colliding_position(subEnemyName, enemy.position, 2, 0.5)
if subEnemyPosition then
local create_unit = enemy.surface.create_entity({name = subEnemyName, position = subEnemyPosition, force = game.forces.enemy})
end
end
end
Code: Select all
--- Mutated WORM Projectile
{
type = "projectile",
name = "Mutated-Projectile-Worm",
flags = {"not-on-map"},
acceleration = 0.005,
action =
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "play-sound",
sound =
{
{
filename = "__base__/sound/creatures/projectile-acid-burn-1.ogg",
volume = 0.8
},
{
filename = "__base__/sound/creatures/projectile-acid-burn-2.ogg",
volume = 0.8
},
{
filename = "__base__/sound/creatures/projectile-acid-burn-long-1.ogg",
volume = 0.8
},
{
filename = "__base__/sound/creatures/projectile-acid-burn-long-2.ogg",
volume = 0.8
}
}
},
{
type = "create-entity",
entity_name = "unit-cluster",
trigger_created_entity = "true"
},
{
type = "create-sticker",
sticker = "slowdown-sticker"
},
{
type = "create-entity",
entity_name = "acid-splash-purple"
},
{
type = "nested-result",
action =
{
type = "area",
radius = 2,
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "damage",
damage = {amount = 10*NE_Enemies.Settings.NE_Difficulty, type = "explosion", force = "enemy" }
},
{
type = "damage",
damage = {amount = 20*NE_Enemies.Settings.NE_Difficulty, type = "acid", force = "enemy"}
},
}
}
}
}
}
}
},
animation =
{
filename = "__Natural_Evolution_Enemies__/graphics/entity/acid-projectile-red.png",
line_length = 5,
width = 16,
height = 18,
frame_count = 33,
priority = "high"
},
shadow =
{
filename = "__base__/graphics/entity/acid-projectile-purple/acid-projectile-purple-shadow.png",
line_length = 5,
width = 28,
height = 16,
frame_count = 33,
priority = "high",
shift = {-0.09, 0.395}
},
rotatable = false
},
Thanks.