CME Crash while drawing rectangles with AR goggles
jig487 opened this issue ยท 5 comments
Descripe
Crashed with an exit code: 0
Made a function to draw lines from 2 given coordinates, a brush size, and color.
Then proceeded to spam the program until my game crashed.
Steps to reproduce
Have a computer with an AR controller next, and wearing goggles connected to the AR controller. Then paste in this code:
Then spam the program a bunch of times until your game crashes :)
local ar = peripheral.find("arController")
local resolution = {480,270}
local function drawLine(x1,y1,x2,y2,size,color)
local m = 0
if x1 ~= x2 then
m = (y2-y1)/(x2-x1)
end
if x1 ~= x2 and math.abs(m) <= 1 then
local b = y1-(m*x1)
if x2 < x1 then
x1,y1,x2,y2 = x2,y2,x1,y1
end
for x = x1, x2 do -- Y = mx + b, draw centered pix
if x < resolution[1] and x > 0 then-- conditional for not drawing off screen
local y = m*x+b
if y < resolution[2] and y > 0 then
ar.fill(x-(0.5*size),y-(0.5*size),x+(0.5*size),y+(0.5*size),color)
end
end
end
else
if y2 < y1 then
x1,y1,x2,y2 = x2,y2,x1,y1
end
local w = (x2-x1)/(y2-y1)
local p = x1-(w*y1)
for y = y1, y2 do -- Y = mx + b, draw centered pix
if y < resolution[2] and y > 0 then-- conditional for not drawing off screen
local x = (p-y)/w
if x < resolution[1] and x > 0 then
ar.fill(x-(0.5*size),y-(0.5*size),x+(0.5*size),y+(0.5*size),color)
end
end
end
end
end
drawLine(0,0,480,270,2,0xF33E3E)
drawLine(0,270,480,0,2,0xA6F33E)
drawLine(50,50,200,50,4,0x8E3EF3)
drawLine(200,50,160,235,6,0xFFF000)
Version
0.6.7b (Latest)
Minecraft, Forge and maybe other related mods versions
Forge 36.1.32, Minecraft 1.16.5, CC tweaked 1.97
Screenshots or Videos
No response
Crashlog/log
Same problem here.
Also I noticed that the crash happens even if the player with the goggles is NOT online (playing on a server) and sometimes you could stop the computer entirely and it will still crash after ~30 seconds.
Is the test build based on the 0.6.x branch or the 0.7? Because if the fix is the only change I will update the modpack I'm playing with it...
Thanks!
This is a build with every feature from 0.7r. You can play with this build if you want.
Could you try it with this build
https://cloud.srendi.de/index.php/s/mBRYYt9DNJQjyz8