tiny-ecs-love-template/systems/decay.lua

15 lines
454 B
Lua

filteredSystem("decay", { decayAfterSeconds = T.number }, function(e, dt, system)
e.decayAfterSeconds = e.decayAfterSeconds - dt
if e.decayAfterSeconds <= 0 then
system.world:removeEntity(e)
end
end)
LiveForNFrames = filteredSystem("liveForNFrames", { liveForNFrames = T.number }, function(e, _, system)
e.liveForNFrames = e.liveForNFrames - 1
if e.liveForNFrames <= 0 then
system.world:removeEntity(e)
end
end)