Skip to content

Commit

Permalink
Fix crash - don't deduplicate search in blocking mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tburrows13 committed Oct 19, 2024
1 parent 37ffbe2 commit 509bbd7
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions scripts/search.lua
Original file line number Diff line number Diff line change
Expand Up @@ -627,20 +627,18 @@ function Search.blocking_search(force, state, target_item, surface_list, type_li
force = { force, "neutral" },
}
for _, entity in pairs(entities) do
if math2d.bounding_box.contains_point(chunk_area, entity.position) then
if entity.type == "resource" then
local amount
if entity.initial_amount then
amount = entity.amount / 3000 -- Calculate yield from amount
else
amount = entity.amount
end
SearchResults.add_entity_resource(entity, surface_data.entities, amount)
SearchResults.add_surface_info("resource_count", amount, surface_data.surface_info)
if entity.type == "resource" then
local amount
if entity.initial_amount then
amount = entity.amount / 3000 -- Calculate yield from amount
else
SearchResults.add_entity(entity, surface_data.entities)
SearchResults.add_surface_info("entity_count", 1, surface_data.surface_info)
amount = entity.amount
end
SearchResults.add_entity_resource(entity, surface_data.entities, amount)
SearchResults.add_surface_info("resource_count", amount, surface_data.surface_info)
else
SearchResults.add_entity(entity, surface_data.entities)
SearchResults.add_surface_info("entity_count", 1, surface_data.surface_info)
end
end
end
Expand Down

0 comments on commit 509bbd7

Please sign in to comment.