mirror of
https://github.com/LDDestroier/CC/
synced 2025-02-08 07:00:03 +00:00
Fixed quitting while paused, added fade to dark
This commit is contained in:
parent
eecfe5ec0c
commit
0e225b21f5
58
ldris.lua
58
ldris.lua
@ -775,12 +775,17 @@ local normalPalettes = {}
|
|||||||
local darkerPalettes = {}
|
local darkerPalettes = {}
|
||||||
for i = 1, 16 do
|
for i = 1, 16 do
|
||||||
normalPalettes[("0123456789abcdef"):sub(i,i)] = {term.getPaletteColor(2 ^ (i - 1))}
|
normalPalettes[("0123456789abcdef"):sub(i,i)] = {term.getPaletteColor(2 ^ (i - 1))}
|
||||||
darkerPalettes[("0123456789abcdef"):sub(i,i)] = {
|
|
||||||
normalPalettes[("0123456789abcdef"):sub(i,i)][1] * 0.6,
|
|
||||||
normalPalettes[("0123456789abcdef"):sub(i,i)][2] * 0.6,
|
|
||||||
normalPalettes[("0123456789abcdef"):sub(i,i)][3] * 0.6,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
local genDarkerPalettes = function(mult)
|
||||||
|
for i = 1, 16 do
|
||||||
|
darkerPalettes[("0123456789abcdef"):sub(i,i)] = {
|
||||||
|
normalPalettes[("0123456789abcdef"):sub(i,i)][1] * (mult or 0.6),
|
||||||
|
normalPalettes[("0123456789abcdef"):sub(i,i)][2] * (mult or 0.6),
|
||||||
|
normalPalettes[("0123456789abcdef"):sub(i,i)][3] * (mult or 0.6),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
genDarkerPalettes()
|
||||||
|
|
||||||
-- calculates the amount of garbage to send
|
-- calculates the amount of garbage to send
|
||||||
local calculateGarbage = function(lines, combo, backToBack, didTspin)
|
local calculateGarbage = function(lines, combo, backToBack, didTspin)
|
||||||
@ -832,6 +837,31 @@ local doleOutGarbage = function(player, cPlayer, amount)
|
|||||||
cPlayer.garbage = 0
|
cPlayer.garbage = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local ldPalettes = function(light)
|
||||||
|
if light then
|
||||||
|
for k,v in pairs(normalPalettes) do
|
||||||
|
if k == "c" then
|
||||||
|
--term.setPaletteColor(to_colors[k], 0xf0f0f0)
|
||||||
|
else
|
||||||
|
term.setPaletteColor(to_colors[k], table.unpack(v))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i = 1, 0.3, -0.1 do
|
||||||
|
genDarkerPalettes(i)
|
||||||
|
for k,v in pairs(darkerPalettes) do
|
||||||
|
if k == "c" then
|
||||||
|
--term.setPaletteColor(to_colors[k], 0xf0f0f0)
|
||||||
|
else
|
||||||
|
term.setPaletteColor(to_colors[k], table.unpack(v))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
sleep(0.05)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
genDarkerPalettes()
|
||||||
|
end
|
||||||
|
|
||||||
-- initiates a game as a specific player (takes a number)
|
-- initiates a game as a specific player (takes a number)
|
||||||
local startGame = function(playerNumber)
|
local startGame = function(playerNumber)
|
||||||
|
|
||||||
@ -881,30 +911,20 @@ local startGame = function(playerNumber)
|
|||||||
if control.quit == 1 then
|
if control.quit == 1 then
|
||||||
finished = true
|
finished = true
|
||||||
game.running = false
|
game.running = false
|
||||||
|
game.paused = false
|
||||||
|
ldPalettes(true)
|
||||||
sendInfo("quit_game", false)
|
sendInfo("quit_game", false)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if game.paused then
|
if game.paused then
|
||||||
if control.pause == 1 then
|
if control.pause == 1 then
|
||||||
for k,v in pairs(normalPalettes) do
|
ldPalettes(true)
|
||||||
if k == "c" then
|
|
||||||
term.setPaletteColor(to_colors[k], 0x0f0f0f)
|
|
||||||
else
|
|
||||||
term.setPaletteColor(to_colors[k], table.unpack(v))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
game.paused = false
|
game.paused = false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if control.pause == 1 then
|
if control.pause == 1 then
|
||||||
for k,v in pairs(darkerPalettes) do
|
ldPalettes(false)
|
||||||
if k == "c" then
|
|
||||||
term.setPaletteColor(to_colors[k], 0.1, 0.1, 0.1)
|
|
||||||
else
|
|
||||||
term.setPaletteColor(to_colors[k], table.unpack(v))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
game.paused = true
|
game.paused = true
|
||||||
end
|
end
|
||||||
if not cPlayer.frozen then
|
if not cPlayer.frozen then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user