Guest User

SE surface deletion crash

a guest
Feb 13th, 2026
43
0
11 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | Gaming | 0 0
  1. diff --git a/control.lua b/control.lua
  2. index a479120..cfb7573 100755
  3. --- a/control.lua
  4. +++ b/control.lua
  5. @@ -130,7 +130,7 @@ local function delete_random_decal()
  6.  
  7. local d = secondary_range
  8.  
  9. - if decal.decorative.valid and surface.valid then
  10. + if decal.decorative.valid and surface ~= nil and surface.valid then
  11. local anchors = surface.find_entities_filtered{name = biter_decal_anchors, position = decal.position, radius = primary_range}
  12.  
  13. if #anchors==0 then
  14. @@ -172,17 +172,19 @@ script.on_event(defines.events.on_chunk_deleted, function(event)
  15. local hitlist = {}
  16.  
  17. for i,table_entry in ipairs(storage.biter_decal_table) do
  18. - for _,chunk in pairs(event.positions) do
  19. - local surface = table_entry.surface
  20. - local x = table_entry.position.x
  21. - local y = table_entry.position.y
  22. - local xmin = chunk.x*32
  23. - local xmax = xmin+32
  24. - local ymin = chunk.y*32
  25. - local ymax = ymin+32
  26. -
  27. - if (surface == event.surface_index) and (x>=xmin) and (x<xmax) and (y>=ymin) and (y<ymax) then
  28. - hitlist[#hitlist+1] = i
  29. + if table_entry ~= nil then
  30. + for _,chunk in pairs(event.positions) do
  31. + local surface = table_entry.surface
  32. + local x = table_entry.position.x
  33. + local y = table_entry.position.y
  34. + local xmin = chunk.x*32
  35. + local xmax = xmin+32
  36. + local ymin = chunk.y*32
  37. + local ymax = ymin+32
  38. +
  39. + if (surface == event.surface_index) and (x>=xmin) and (x<xmax) and (y>=ymin) and (y<ymax) then
  40. + hitlist[#hitlist+1] = i
  41. + end
  42. end
  43. end
  44. end
  45.  
Tags: factorio
Advertisement
Add Comment
Please, Sign In to add comment