change expression modifier to use timer function
This commit is contained in:
parent
2c3dae2156
commit
5694ab896f
11
script.lua
11
script.lua
@ -14,7 +14,6 @@ armor_enabled=true
|
|||||||
function player_init()
|
function player_init()
|
||||||
old_health=player.getHealth()
|
old_health=player.getHealth()
|
||||||
end
|
end
|
||||||
expr_cooldown=0
|
|
||||||
|
|
||||||
-- Parts --
|
-- Parts --
|
||||||
HEAD=model.Head.Head
|
HEAD=model.Head.Head
|
||||||
@ -43,7 +42,7 @@ function changeExpression(_damage, _expression, ticks)
|
|||||||
end
|
end
|
||||||
|
|
||||||
HEAD.setUV(getExprUV(damage,expression))
|
HEAD.setUV(getExprUV(damage,expression))
|
||||||
expr_cooldown=ticks
|
wait(ticks, resetExpression())
|
||||||
end
|
end
|
||||||
function setExpression(damage, expression)
|
function setExpression(damage, expression)
|
||||||
face_damage=damage
|
face_damage=damage
|
||||||
@ -115,14 +114,6 @@ end
|
|||||||
|
|
||||||
-- Tick function --
|
-- Tick function --
|
||||||
function tick()
|
function tick()
|
||||||
-- expression reset spaghetti code --
|
|
||||||
if expr_cooldown > 0 then
|
|
||||||
expr_cooldown = expr_cooldown-1
|
|
||||||
if expr_cooldown <= 0 then
|
|
||||||
resetExpression()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- optimization, only execute these once a second --
|
-- optimization, only execute these once a second --
|
||||||
if world.getTimeOfDay() % 20 then
|
if world.getTimeOfDay() % 20 then
|
||||||
-- if face is cracked
|
-- if face is cracked
|
||||||
|
Loading…
x
Reference in New Issue
Block a user