Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/control.lua b/control.lua
- index a479120..cfb7573 100755
- --- a/control.lua
- +++ b/control.lua
- @@ -130,7 +130,7 @@ local function delete_random_decal()
- local d = secondary_range
- - if decal.decorative.valid and surface.valid then
- + if decal.decorative.valid and surface ~= nil and surface.valid then
- local anchors = surface.find_entities_filtered{name = biter_decal_anchors, position = decal.position, radius = primary_range}
- if #anchors==0 then
- @@ -172,17 +172,19 @@ script.on_event(defines.events.on_chunk_deleted, function(event)
- local hitlist = {}
- for i,table_entry in ipairs(storage.biter_decal_table) do
- - for _,chunk in pairs(event.positions) do
- - local surface = table_entry.surface
- - local x = table_entry.position.x
- - local y = table_entry.position.y
- - local xmin = chunk.x*32
- - local xmax = xmin+32
- - local ymin = chunk.y*32
- - local ymax = ymin+32
- -
- - if (surface == event.surface_index) and (x>=xmin) and (x<xmax) and (y>=ymin) and (y<ymax) then
- - hitlist[#hitlist+1] = i
- + if table_entry ~= nil then
- + for _,chunk in pairs(event.positions) do
- + local surface = table_entry.surface
- + local x = table_entry.position.x
- + local y = table_entry.position.y
- + local xmin = chunk.x*32
- + local xmax = xmin+32
- + local ymin = chunk.y*32
- + local ymax = ymin+32
- +
- + if (surface == event.surface_index) and (x>=xmin) and (x<xmax) and (y>=ymin) and (y<ymax) then
- + hitlist[#hitlist+1] = i
- + end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment