You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---Functions for controlling collection factory components which are
3
+
---used to dynamically spawn collections into the runtime.
4
+
---@classcollectionfactory
5
+
collectionfactory= {}
6
+
---loaded
7
+
collectionfactory.STATUS_LOADED=nil
8
+
---loading
9
+
collectionfactory.STATUS_LOADING=nil
10
+
---unloaded
11
+
collectionfactory.STATUS_UNLOADED=nil
12
+
---The URL identifies the collectionfactory component that should do the spawning.
13
+
---Spawning is instant, but spawned game objects get their first update calls the following frame. The supplied parameters for position, rotation and scale
14
+
---will be applied to the whole collection when spawned.
15
+
---Script properties in the created game objects can be overridden through
16
+
---a properties-parameter table. The table should contain game object ids
17
+
---(hash) as keys and property tables as values to be used when initiating each
18
+
---spawned game object.
19
+
---See go.property for more information on script properties.
20
+
---The function returns a table that contains a key for each game object
21
+
---id (hash), as addressed if the collection file was top level, and the
22
+
---corresponding spawned instance id (hash) as value with a unique path
23
+
---prefix added to each instance.
24
+
--- Calling collectionfactory.create <> create on a collection factory that is marked as dynamic without having loaded resources
25
+
---using collectionfactory.load <> will synchronously load and create resources which may affect application performance.
26
+
---@paramurlstring|hash|url # the collection factory component to be used
27
+
---@parampositionvector3? # position to assign to the newly spawned collection
28
+
---@paramrotationquaternion? # rotation to assign to the newly spawned collection
29
+
---@parampropertiestable? # table of script properties to propagate to any new game object instances
30
+
---@paramscalenumber? # uniform scaling to apply to the newly spawned collection (must be greater than 0).
31
+
---@returntable # a table mapping the id:s from the collection to the new instance id:s
32
+
functioncollectionfactory.create(url, position, rotation, properties, scale) end
33
+
34
+
---This returns status of the collection factory.
35
+
---Calling this function when the factory is not marked as dynamic loading always returns COMP_COLLECTION_FACTORY_STATUS_LOADED.
36
+
---@paramurlstring|hash|url? # the collection factory component to get status from
37
+
---@returnconstant # status of the collection factory component
38
+
functioncollectionfactory.get_status(url) end
39
+
40
+
---Resources loaded are referenced by the collection factory component until the existing (parent) collection is destroyed or collectionfactory.unload is called.
41
+
---Calling this function when the factory is not marked as dynamic loading does nothing.
42
+
---@paramurlstring|hash|url? # the collection factory component to load
43
+
---@paramcomplete_function (fun(self: object, url: url, result: boolean))? # function to call when resources are loaded.
44
+
functioncollectionfactory.load(url, complete_function) end
45
+
46
+
---This decreases the reference count for each resource loaded with collectionfactory.load. If reference is zero, the resource is destroyed.
47
+
---Calling this function when the factory is not marked as dynamic loading does nothing.
48
+
---@paramurlstring|hash|url? # the collection factory component to unload
0 commit comments