Optimize a division

This commit is contained in:
John Bauer 2021-03-08 13:41:18 -08:00
parent 798ed388cf
commit 35e1c523af
1 changed files with 3 additions and 2 deletions

View File

@ -191,11 +191,12 @@ function suctionUpdateChunk(chunkTo, dx, dy)
--game.print("From: " .. position[1] .. ", " .. position[2] .. " (" .. toPollute .. ")")
local steps = stepsToOrigin(dx, dy)
toPollute = toPollute / #steps
for _, step in pairs(steps) do
position[1] = (chunkTo.x + step[1]) * 32
position[2] = (chunkTo.y + step[2]) * 32
surface.pollute(position, toPollute / #steps)
--game.print("To: " .. position[1] .. ", " .. position[2] .. " (" .. (toPollute / #steps) .. ")")
surface.pollute(position, toPollute)
--game.print("To: " .. position[1] .. ", " .. position[2] .. " (" .. toPollute .. ")")
end
end
end