Register wrapper functions for ticks/render
Apparently dying breaks player entity checks, this fixes that. The function will only run the tick/render if the player is alive.
This commit is contained in:
parent
b88e98d9fb
commit
9a17550b74
11
script.lua
11
script.lua
@ -259,7 +259,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
events.TICK:register(tick, "timer")
|
events.TICK:register(function() if player:exists() then tick() end end, "timer")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- named timers (this one is mine but heavily based on the other) --
|
-- named timers (this one is mine but heavily based on the other) --
|
||||||
@ -279,7 +279,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
events.TICK:register(tick, "named_timer")
|
events.TICK:register(function() if player:exists() then tick() end end, "named_timer")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- named cooldowns
|
-- named cooldowns
|
||||||
@ -299,7 +299,7 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
events.TICK:register(tick, "cooldown")
|
events.TICK:register(function() if player:exists() then tick() end end, "cooldown")
|
||||||
end
|
end
|
||||||
|
|
||||||
function rateLimit(ticks, next, name)
|
function rateLimit(ticks, next, name)
|
||||||
@ -1192,7 +1192,7 @@ function tick()
|
|||||||
old_state.color_check=color_check
|
old_state.color_check=color_check
|
||||||
local_state.anim=player:getPose()
|
local_state.anim=player:getPose()
|
||||||
end
|
end
|
||||||
events.TICK:register(tick, "main_tick")
|
events.TICK:register(function() if player:exists() then tick() end end, "main_tick")
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Render function {{{
|
-- Render function {{{
|
||||||
@ -1207,5 +1207,6 @@ function render(delta)
|
|||||||
animateTail((lerp(old_state.anim_cycle, anim_cycle, delta)))
|
animateTail((lerp(old_state.anim_cycle, anim_cycle, delta)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
events.RENDER:register(render, "main_render")
|
-- TODO this may break animation during death
|
||||||
|
events.RENDER:register(function(delta) if player:exists() then render(delta) end end, "main_render")
|
||||||
-- }}}
|
-- }}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user