allow passing arguments through drawfunctions
This commit is contained in:
parent
9681b0538e
commit
99f8ab7f8b
29
main.xml
29
main.xml
|
@ -248,6 +248,7 @@
|
||||||
|
|
||||||
GAMESTATE:ApplyModifiers('clearall')
|
GAMESTATE:ApplyModifiers('clearall')
|
||||||
|
|
||||||
|
local drawfunctionArguments = {}
|
||||||
local specialActorFrames = {} -- ones defined specifically; here for drawfunction jank
|
local specialActorFrames = {} -- ones defined specifically; here for drawfunction jank
|
||||||
|
|
||||||
function setDrawFunction(frame, func)
|
function setDrawFunction(frame, func)
|
||||||
|
@ -261,7 +262,12 @@
|
||||||
a:Draw()
|
a:Draw()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
func()
|
local args = drawfunctionArguments[frame]
|
||||||
|
if args then
|
||||||
|
func(unpack(args))
|
||||||
|
else
|
||||||
|
func()
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -406,6 +412,13 @@
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local actorMethodOverrides = {
|
||||||
|
Draw = function(self, ...)
|
||||||
|
drawfunctionArguments[self] = arg
|
||||||
|
self.__raw:Draw()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
local function createProxyActor(name)
|
local function createProxyActor(name)
|
||||||
local queue = {}
|
local queue = {}
|
||||||
local initCommands = {}
|
local initCommands = {}
|
||||||
|
@ -418,11 +431,15 @@
|
||||||
return lockedActor
|
return lockedActor
|
||||||
end
|
end
|
||||||
if lockedActor then
|
if lockedActor then
|
||||||
local val = lockedActor[key]
|
if actorMethodOverrides[key] then
|
||||||
if type(val) == 'function' then
|
return actorMethodOverrides[key]
|
||||||
return patchFunction(val, lockedActor)
|
else
|
||||||
|
local val = lockedActor[key]
|
||||||
|
if type(val) == 'function' then
|
||||||
|
return patchFunction(val, lockedActor)
|
||||||
|
end
|
||||||
|
return val
|
||||||
end
|
end
|
||||||
return val
|
|
||||||
end
|
end
|
||||||
if key == '__queue' then
|
if key == '__queue' then
|
||||||
return queueRepresentation
|
return queueRepresentation
|
||||||
|
@ -732,6 +749,8 @@
|
||||||
uranium:call('ready')
|
uranium:call('ready')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
drawfunctionArguments = {}
|
||||||
|
|
||||||
for _, q in ipairs(globalQueue) do
|
for _, q in ipairs(globalQueue) do
|
||||||
local actor = q[1]
|
local actor = q[1]
|
||||||
local v = q[2]
|
local v = q[2]
|
||||||
|
|
Loading…
Reference in New Issue