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 -- {{{
|
-- Expression change -- {{{
|
||||||
do
|
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={}
|
local expressions={}
|
||||||
expressions.neutral={0,0}
|
expressions.neutral={0,0}
|
||||||
expressions.hurt={0,1}
|
expressions.hurt={0,1}
|
||||||
@ -718,6 +712,12 @@ do
|
|||||||
function getBestExpression()
|
function getBestExpression()
|
||||||
return "neutral"
|
return "neutral"
|
||||||
end
|
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
|
-- Expression change code
|
||||||
function setExpression(expression)
|
function setExpression(expression)
|
||||||
@ -1025,6 +1025,8 @@ function hostTick()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function tick()
|
function tick()
|
||||||
|
|
||||||
|
setColor()
|
||||||
-- optimization, only execute these once a second --
|
-- optimization, only execute these once a second --
|
||||||
if world.getTimeOfDay() % 20 == 0 then
|
if world.getTimeOfDay() % 20 == 0 then
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user