I agree. PLNT should remove green colour from photons. <--- Don't look at this, I'm stupid...
I agree. PLNT should "eat" all photon's colours instead of green.
can we have this script
local xPos, yPos = 100, 100
local xPos2, yPos2 = 300, 100
local rgb = {}
local function makebits(color, num, offset)
local bits = bit.lshift(2^num-1, offset)
return bit.bor(color, bits)
end
local function makephot(x, y, color)
local i = sim.partCreate(-1, x, y, tpt.el.phot.id)
if i ~= -1 then
sim.partProperty(i, sim.FIELD_CTYPE, color)
end
end
local function seenColor(r, g, b)
if not rgb[r] then
rgb[r] = {}
end
if not rgb[r][g] then
rgb[r][g] = {}
end
if not rgb[r][g][b] then
rgb[r][g][b] = true
return false
end
return true
end
local function getRGB(color)
local colr, colg, colb = 0, 0, 0
for i = 0,11 do
colr = colr + bit.band(bit.rshift(color, i+18), 0x1)
colg = colg + bit.band(bit.rshift(color, i+9), 0x1)
colb = colb + bit.band(bit.rshift(color, i), 0x1)
end
local multiplier = math.floor(624 / ( colr + colg + colb + 1))
colr = colr * multiplier
colg = colg * multiplier
colb = colb * multiplier
if colr > 255 then colr = 255 end
if colg > 255 then colg = 255 end
if colb > 255 then colb = 255 end
-- PHOT colors are so screwed up
colr = bit.rshift(255*colr + 255*colr, 8)
cobg = bit.rshift(255*colg + 255*colb, 8)
colb = bit.rshift(255*colb + 255*colb, 8)
if colr > 255 then colr = 255 end
if colg > 255 then colg = 255 end
if colb > 255 then colb = 255 end
return colr, colg, colb
end
for r = 0,9 do
for b = 0,9 do
for g = 0,6 do
for y = 0,3 do
for c = 0,3 do
local color = 0
color = makebits(color, r, 0)
color = makebits(color, y, 9)
color = makebits(color, g, 12)
color = makebits(color, c, 18)
color = makebits(color, b, 21)
local rgbR, rgbG, rgbB = getRGB(color)
if not seenColor(rgbR, rgbG, rgbB) then
makephot(xPos2, yPos2, color)
if xPos2 > 400 then
xPos2 = 300
yPos2 = yPos2 + 1
end
xPos2 = xPos2 + 1
end
makephot(xPos, yPos, color)
if xPos > 200 then
xPos = 100
yPos = yPos + 1
end
xPos = xPos + 1
end
end
end
end
end
Thanks!