1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-07 13:31:40 +02:00

e.force.name ~= "player"

This commit is contained in:
Gerkiz 2019-05-03 09:32:15 +02:00
parent dbfaac6a25
commit c83f39c171
3 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ local function bounce(surface, position, ammo)
local valid_entities = {}
for _, e in pairs(surface.find_entities_filtered({area = {{position.x - radius, position.y - radius},{position.x + radius, position.y + radius}}})) do
if e.health then
if e.force.name ~= "character" then
if e.force.name ~= "player" then
local distance_from_center = math_sqrt((e.position.x - position.x) ^ 2 + (e.position.y - position.y) ^ 2)
if distance_from_center <= radius then
valid_entities[#valid_entities + 1] = e

View File

@ -4,7 +4,7 @@ local radius = 8
local function damage_entities_around_target(entity, damage)
for _, e in pairs(entity.surface.find_entities_filtered({area = {{entity.position.x - radius, entity.position.y - radius},{entity.position.x + radius, entity.position.y + radius}}})) do
if e.health then
if e.force.name ~= "character" then
if e.force.name ~= "player" then
local distance_from_center = math.sqrt((e.position.x - entity.position.x) ^ 2 + (e.position.y - entity.position.y) ^ 2)
if distance_from_center <= radius then
e.damage(damage, "player", "explosion")

View File

@ -414,7 +414,7 @@ local function on_chunk_generated(event)
if left_top.y ~= 0 then return end
if left_top.x ~= 96 then return end
for _, e in pairs(surface.find_entities_filtered({area = {{spawn_point.x - 0.5, spawn_point.y - 0.5},{spawn_point.x + 0.5, spawn_point.y + 0.5}}})) do
if e.force.name ~= "character" then
if e.force.name ~= "player" then
e.destroy()
end
end