-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinteractable.lua
74 lines (64 loc) · 2.95 KB
/
interactable.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
---@meta _
--- An `Interactable` represents an object randomly spawned in a [Stage](https://saturnyoshi.gitlab.io/RoRML-Docs/class/stage.html) such as chests, broken drones, or shrines.
---
---@class Interactable
---@field spawnCost number This number of spawn points the object costs to spawn. *Defaults to 75*, the same amount as item shops. For reference, small chests take 50, large chests 110, golden chests 250, small barrels 7, and chance shrines 65.
---
---@overload fun(obj: GMObject, name: string): Interactable
Interactable = {}
--[[
---- static functions
--]]
--- Creates a new interactable from an existing object, with the specified name.
---
--- # Example
--- Create a new interactable called `Toast_Interactable`.
--- ```lua
--- local toastObject = Object.new("Toast_Object")
--- local toastInteractable = Interactable.new(toastObject, "Toast_Interactable")
--- ```
---
---@param obj GMObject The object represented by this interactable
---@param name? string The name to give the interactable within the current namespace
---@return Interactable
function Interactable.new(obj, name) 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) for more information.
---
---@param name string
---@param namespace? Namespace
---@return Interactable
function Interactable.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 Interactable[]
function Interactable.findAll(namespace) end
--- Finds an existing interactable given its object.
---
--- # Example
--- Get the existing interactable for the `Chest` object.
--- ```lua
--- local chestObject = Object.find("Chest", "vanilla")
--- local chestInteractable = Interactable.fromObject(chestObject)
--- ```
---
---@param object GMObject The object represented by this interactable
---@return Interactable '' An `Interactable` if one exists for the given object, otherwise nil
function Interactable.fromObject(object) end
--[[
---- methods
--]]
---@return GMObject '' The object represented by this interactable.
function Interactable:getObject() end
--- See the page on [namespace searching](https://saturnyoshi.gitlab.io/RoRML-Docs/misc/contextSearch.html#context-origin) for more information.
---
---@return Namespace '' The namespace containing the interactable
function Interactable:getOrigin() end
--- See the page on [namespace searching](https://saturnyoshi.gitlab.io/RoRML-Docs/misc/contextSearch.html#context-name) for more information.
---
---@return string '' The name of the interactable
function Interactable:getName() end