Add color checking to tick

This commit is contained in:
NullBite 2022-03-28 01:26:12 -04:00
parent 10a09c51a5
commit 31aada06b8
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A

View File

@ -696,12 +696,6 @@ SNORES={"snore-1", "snore-2", "snore-3"}
-- Expression change -- {{{
do
function setColor(col)
col=(col~=nil) and col or COLORS.neutral
for _, v in pairs(EMISSIVES) do
v.setColor(col)
end
end
local expressions={}
expressions.neutral={0,0}
expressions.hurt={0,1}
@ -718,6 +712,12 @@ do
function getBestExpression()
return "neutral"
end
function setColor(col)
col=(col~=nil) and col or getBestColor()
for _, v in pairs(EMISSIVES) do
v.setColor(col)
end
end
-- Expression change code
function setExpression(expression)
@ -1025,6 +1025,8 @@ function hostTick()
end
function tick()
setColor()
-- optimization, only execute these once a second --
if world.getTimeOfDay() % 20 == 0 then