-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobject.lua
77 lines (70 loc) · 2.8 KB
/
object.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---@meta _
--- A `GMObject` is a specific type of [Instance](https://saturnyoshi.gitlab.io/RoRML-Docs/class/instance.html).
---
--- `GMObject` inherits all functionality from [GMObjectBase](https://saturnyoshi.gitlab.io/RoRML-Docs/class/gmObjectBase.html).
---
--- A list of most usable objects added by the base game can be found on [this page](https://saturnyoshi.gitlab.io/RoRML-Docs/misc/objects.html).
---
---@overload fun(name?: string): GMObject
Object = {}
--- Executes a [namespace search](https://saturnyoshi.gitlab.io/RoRML-Docs/misc/contextSearch.html) to find an existing Item.
---
--- See the page on [namespace searching](https://saturnyoshi.gitlab.io/RoRML-Docs/misc/contextSearch.html#context-find) for more information.
---
---@param name string
---@param namespace? Namespace
---@return GMObject
function Object.find(name, namespace) end
--- Executes a [namespace search](https://saturnyoshi.gitlab.io/RoRML-Docs/misc/contextSearch.html) to find an existing Item.
---
--- See the page on [namespace searching](https://saturnyoshi.gitlab.io/RoRML-Docs/misc/contextSearch.html#context-find-all) for more information.
---
---@param namespace? Namespace
---@return GMObject[]
function Object.findAll(namespace) end
--- Creates a new GMObject.
---
--- If a name is not provided then an automatically generated name will be used.
---
--- # Example
--- Create a new GMObject.
--- ```lua
--- local fireball = Object.new("fireball")
--- ```
---
---@param name string The name to give the object within the current namespace
---@return GMObject
function Object.new(name) end
--- Creates a new `GMObject`, inheriting properties from a base object type.
---
--- If a name is not provided then an automatically generated name will be used.
---
--- This method is used to generate objects for custom enemies, interactables, and other features with built-in behavior.
---
--- [See here](https://saturnyoshi.gitlab.io/RoRML-Docs/misc/baseObjects.html) for information on each base object type.
---
--- # Example
--- TODO
---
---@param kind string The base object type to inherit from
---@param name? string The name to give the object within the current namespace
---@return GMObject
function Object.base(kind, name) end
--- Finds the Instance with a certain ID.
---
--- # Example
--- Find the instance with the ID in `someID`.
--- ```lua
--- local inst = Object.findInstanceByID(someID)
--- ```
---
---@param id Id The ID of the instance to find
---@return Instance? '' An Instance when found, otherwise nil
function Object.findInstance(id) end
--- Used to fetch a GMObject from its GameMaker resource ID.
---
--- Useful for getting objects from instance variables which contain an object ID.
---
---@param id Id The GameMaker ID of the object
---@return GMObject? '' The GMObject if found, otherwise nil
function Object.fromID(id) end