From dcdf9cbd49ea1fe115bd1659fbd299898c344ee7 Mon Sep 17 00:00:00 2001 From: "Jill \"oatmealine\" Monoids" Date: Tue, 13 Dec 2022 21:33:45 +0300 Subject: [PATCH] getChildren util func --- main.xml | 13 +++++++++++++ typings.lua | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/main.xml b/main.xml index 2206c7e..e8a5ab7 100644 --- a/main.xml +++ b/main.xml @@ -307,6 +307,17 @@ resetOnFrameStartActors[actor.__raw or actor] = bool end + local actorAssociationTable = {} + + function getChildren(frame) + local c = actorAssociationTable[frame] + if c then + return c + else + error('uranium: actorframe doesn\'t exist (or isn\'t an actorframe)', 2) + end + end + -- actors local actorQueue = {} @@ -580,6 +591,7 @@ end }) actor.__queueRepresentation(actorQueue[#actorQueue]) + actorAssociationTable[actor] = {} return actor end @@ -705,6 +717,7 @@ error('uranium: trying to add a child to an ActorFrame that isn\'t an actor; please read the first half of \'ActorFrame\'', 2) end actorAssociationQueue[actor.__queue] = frame.__queue + table.insert(actorAssociationTable[frame], actor) end local function transformQueueToTree() diff --git a/typings.lua b/typings.lua index b0eb17a..866c7fd 100644 --- a/typings.lua +++ b/typings.lua @@ -87,6 +87,11 @@ function resetOnFrameStart(bool) end ---@param bool boolean | nil function resetActorOnFrameStart(actor, bool) end +-- Gets every child of an ActorFrame. More accurate than :GetChildren() +---@param frame ActorFrame +---@return Actor[] +function getChildren(frame) end + ---@type number --- A simple timer. Ticks upwards at a rate of 1/sec. ---