-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbase.lua
31 lines (26 loc) · 911 Bytes
/
base.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
local actor_fw = lib.framework.actors
LINE_HANDLERS = {add=function(name, start, update, draw)
LINE_HANDLERS[name]={start=start,update=update, draw=draw}
end
}
DIRECTORS = {}
function loveHug(name, scene_collection, skip_lines_if_any_director_successful)
love[name] = function(...)
local should_return = false
local current_scene=AFW:get_current_scene()
for k,v in pairs(scene_collection:get_current_scene().directors)do
if DIRECTORS[k][name] then
should_return = should_return or DIRECTORS[k][name](v, dt, scene_collection:get_current_scene(), scene_collection, ...)
end
end
if should_return and skip_lines_if_any_director_successful then
return
end
for actor,_ in pairs(current_scene.objects) do
local line, _ = actor_fw.get_line(current_scene, actor)
if LINE_HANDLERS[line.name][name] then
LINE_HANDLERS[line.name][name](line,actor, ...)
end
end
end
end