mirror of
https://github.com/LDDestroier/CC/
synced 2025-07-04 11:02:56 +00:00
Update pain.lua
This commit is contained in:
parent
b78fb56131
commit
4c921fb8c8
39
pain.lua
39
pain.lua
@ -647,34 +647,61 @@ end
|
|||||||
local fillTool = function(frame,cx,cy,dot) -- takes a frame, not the whole paintEncoded
|
local fillTool = function(frame,cx,cy,dot) -- takes a frame, not the whole paintEncoded
|
||||||
local maxX, maxY = 0, 0
|
local maxX, maxY = 0, 0
|
||||||
local minX, minY = 0, 0
|
local minX, minY = 0, 0
|
||||||
|
local scx, scy = cx+paint.scrollX, cy+paint.scrollY
|
||||||
local output = {}
|
local output = {}
|
||||||
|
local initDot
|
||||||
for a = 1, #frame do
|
for a = 1, #frame do
|
||||||
maxX = math.max(maxX, frame[a].x)
|
maxX = math.max(maxX, frame[a].x)
|
||||||
maxY = math.max(maxY, frame[a].y)
|
maxY = math.max(maxY, frame[a].y)
|
||||||
mixX = math.min(maxX, frame[a].x)
|
minX = math.min(minX, frame[a].x)
|
||||||
minY = math.min(maxY, frame[a].y)
|
minY = math.min(minY, frame[a].y)
|
||||||
|
end
|
||||||
|
local doop = {}
|
||||||
|
for y = minY, maxY do
|
||||||
|
doop[y] = {}
|
||||||
|
for x = minX, maxX do
|
||||||
|
doop[y][x] = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for a = 1, #frame do
|
||||||
|
doop[frame[a].y][frame[a].x] = frame[a]
|
||||||
|
if frame[a].x == scx and frame[a].y == scy then
|
||||||
|
initDot = frame[a]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local touched = {}
|
local touched = {}
|
||||||
local check = {{cx+paint.scrollX, cy+paint.scrollY}}
|
local check = {{scx, scy}}
|
||||||
local chkpos = function(x, y)
|
local chkpos = function(x, y)
|
||||||
if (x < minX or x > maxX) or (y < minY or y > maxY) then
|
if (x < minX or x > maxX) or (y < minY or y > maxY) then
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
|
if initDot then
|
||||||
|
if (doop[y][x].b ~= initDot.b) or (doop[y][x].t ~= initDot.t) or (doop[y][x].c ~= initDot.c) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
elseif doop[y][x] then
|
||||||
|
return false
|
||||||
|
end
|
||||||
for a = 1, #touched do
|
for a = 1, #touched do
|
||||||
if (touched[1] == x and touched[2] == y) then
|
if (touched[1] == x and touched[2] == y) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
for a = 1, #check do
|
||||||
|
if (check[1] == x and check[2] == y) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local a = 0
|
local a = 0
|
||||||
while true do
|
while true do
|
||||||
a = a + 1
|
a = a + 1
|
||||||
chX, chY = check[a].x, check[a].y
|
chX, chY = check[a][1], check[a][2]
|
||||||
frame[#frame+1] = {
|
frame[#frame+1] = {
|
||||||
x = check[a].x,
|
x = chX,
|
||||||
y = check[a].y,
|
y = chY,
|
||||||
c = dot.c,
|
c = dot.c,
|
||||||
t = dot.t,
|
t = dot.t,
|
||||||
b = dot.b
|
b = dot.b
|
||||||
|
Loading…
x
Reference in New Issue
Block a user