1
0
Fork 0
mirror of https://github.com/Reuh/ubiquitousse.git synced 2025-10-27 17:19:31 +00:00

ecs: add callbackFiltered and emitFiltered

This commit is contained in:
Étienne Fildadut 2022-10-13 00:24:47 +09:00
parent bd28610ff4
commit aa332a0adf
20 changed files with 697 additions and 568 deletions

View file

@ -0,0 +1,35 @@
--- Timer system
-- Handles ubiquitousse timers.
let timer = require((...):match("^(.-)ecs%.timer").."scene")
return {
name = "timer",
filter = "timer",
default = {
-- timer object
},
process = :(e, t, dt)
t:update(dt)
if t:dead() then
@world:remove(t.entity)
end
end,
--- System methods ---
--- Add a new timer
run = :(func)
local t = timer.run(func)
@world:add {
timer = t
}
return t
end,
--- Add a new tween
tween = :(duration, tbl, to, method)
local t = timer.tween(duration, tbl, to, method)
@world:add {
timer = t
}
return t
end
}