Add color checking to tick
This commit is contained in:
parent
10a09c51a5
commit
31aada06b8
14
script.lua
14
script.lua
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user