Add sync state function, fix tick optimization
This commit is contained in:
parent
042405cb63
commit
81d66720fe
11
script.lua
11
script.lua
@ -149,6 +149,10 @@ function ping.setArmor(state)
|
||||
end
|
||||
-- }}}
|
||||
|
||||
function syncState()
|
||||
ping.setArmor(armor_enabled)
|
||||
end
|
||||
|
||||
--- Toggle Vanilla ---
|
||||
function ping.setVanilla(state)
|
||||
if state == nil then
|
||||
@ -199,11 +203,16 @@ end
|
||||
-- Tick function --
|
||||
function tick()
|
||||
-- optimization, only execute these once a second --
|
||||
if world.getTimeOfDay() % 20 then
|
||||
if world.getTimeOfDay() % 20 == 0 then
|
||||
-- if face is cracked
|
||||
if expr_current.damage==1 and player.getHealth() > 5 then
|
||||
ping.healed()
|
||||
end
|
||||
|
||||
-- Sync state every 10 seconds
|
||||
if world.getTimeOfDay() % (20*10) == 0 then
|
||||
syncState()
|
||||
end
|
||||
end
|
||||
|
||||
-- Damage ping (onDamage doesn't work in multiplayer) --
|
||||
|
Loading…
x
Reference in New Issue
Block a user