@quenty/adorneeutils 2.0.1-canary.9c1fd3b.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/LICENSE.md +1 -1
- package/README.md +5 -3
- package/package.json +2 -2
- package/src/Shared/AdorneeUtils.lua +58 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [2.
|
|
6
|
+
## [2.1.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/adorneeutils@2.1.0...@quenty/adorneeutils@2.1.1) (2021-12-30)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @quenty/adorneeutils
|
|
9
9
|
|
|
@@ -11,6 +11,17 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
# [2.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/adorneeutils@2.0.0...@quenty/adorneeutils@2.1.0) (2021-09-22)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* Add attachment for bounding box in adornee utils ([e2d2f25](https://github.com/Quenty/NevermoreEngine/commit/e2d2f25027ea5acb3f9caff47e2919f9577e6318))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
14
25
|
# [2.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/adorneeutils@1.2.0...@quenty/adorneeutils@2.0.0) (2021-09-05)
|
|
15
26
|
|
|
16
27
|
|
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
## AdorneeUtils
|
|
2
2
|
<div align="center">
|
|
3
|
-
<a href="http://quenty.github.io/
|
|
4
|
-
<img src="https://
|
|
3
|
+
<a href="http://quenty.github.io/NevermoreEngine/">
|
|
4
|
+
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
|
|
5
5
|
</a>
|
|
6
6
|
<a href="https://discord.gg/mhtGUS8">
|
|
7
|
-
<img src="https://img.shields.io/
|
|
7
|
+
<img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
|
|
8
8
|
</a>
|
|
9
9
|
<a href="https://github.com/Quenty/NevermoreEngine/actions">
|
|
10
10
|
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
AdorneeUtils - Generic adornee functions to make attaching to objects in Roblox easier.
|
|
15
15
|
|
|
16
|
+
<div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/AdorneeUtils">View docs →</a></div>
|
|
17
|
+
|
|
16
18
|
## Installation
|
|
17
19
|
```
|
|
18
20
|
npm install @quenty/adorneeutils --save
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/adorneeutils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "AdorneeUtils - Generic adornee functions to make attaching to objects in Roblox easier.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "d146c77d0a8e452824de0ab0b4b03ba0370bcc1b"
|
|
31
31
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Utilities involving an "Adornee" effectively, any Roblox instance
|
|
3
|
+
@class AdorneeUtils
|
|
4
|
+
]=]
|
|
4
5
|
|
|
5
6
|
local AdorneeUtils = {}
|
|
6
7
|
|
|
8
|
+
--[=[
|
|
9
|
+
Gets the center of the adornee
|
|
10
|
+
@param adornee Instance
|
|
11
|
+
@return Vector3?
|
|
12
|
+
]=]
|
|
7
13
|
function AdorneeUtils.getCenter(adornee)
|
|
8
14
|
assert(typeof(adornee) == "Instance", "Adornee must by of type 'Instance'")
|
|
9
15
|
|
|
@@ -39,14 +45,28 @@ function AdorneeUtils.getCenter(adornee)
|
|
|
39
45
|
end
|
|
40
46
|
end
|
|
41
47
|
|
|
48
|
+
--[=[
|
|
49
|
+
Gets the bounding box of the adornee
|
|
50
|
+
@param adornee Instance
|
|
51
|
+
@return CFrame?
|
|
52
|
+
@return Vector3?
|
|
53
|
+
]=]
|
|
42
54
|
function AdorneeUtils.getBoundingBox(adornee)
|
|
43
55
|
if adornee:IsA("Model") then
|
|
44
56
|
return adornee:GetBoundingBox()
|
|
57
|
+
elseif adornee:IsA("Attachment") then
|
|
58
|
+
return adornee.WorldCFrame, Vector3.new(0, 0, 0) -- This is a point
|
|
45
59
|
else
|
|
46
60
|
return AdorneeUtils.getPartCFrame(adornee), AdorneeUtils.getAlignedSize(adornee)
|
|
47
61
|
end
|
|
48
62
|
end
|
|
49
63
|
|
|
64
|
+
--[=[
|
|
65
|
+
Returns whether a part is a part of an adornee
|
|
66
|
+
@param adornee Instance
|
|
67
|
+
@param part BasePart
|
|
68
|
+
@return boolean
|
|
69
|
+
]=]
|
|
50
70
|
function AdorneeUtils.isPartOfAdornee(adornee, part)
|
|
51
71
|
assert(part:IsA("BasePart"))
|
|
52
72
|
|
|
@@ -61,6 +81,11 @@ function AdorneeUtils.isPartOfAdornee(adornee, part)
|
|
|
61
81
|
return adornee == part or part:IsDescendantOf(adornee)
|
|
62
82
|
end
|
|
63
83
|
|
|
84
|
+
--[=[
|
|
85
|
+
Retrieves all parts of an adornee
|
|
86
|
+
@param adornee Instance
|
|
87
|
+
@return { BasePart }
|
|
88
|
+
]=]
|
|
64
89
|
function AdorneeUtils.getParts(adornee)
|
|
65
90
|
assert(typeof(adornee) == "Instance", "Adornee must by of type 'Instance'")
|
|
66
91
|
|
|
@@ -87,6 +112,11 @@ function AdorneeUtils.getParts(adornee)
|
|
|
87
112
|
return parts
|
|
88
113
|
end
|
|
89
114
|
|
|
115
|
+
--[=[
|
|
116
|
+
Retrieves a size aligned the adornee's CFrame
|
|
117
|
+
@param adornee Instance
|
|
118
|
+
@return Vector3?
|
|
119
|
+
]=]
|
|
90
120
|
function AdorneeUtils.getAlignedSize(adornee)
|
|
91
121
|
if adornee:IsA("Model") then
|
|
92
122
|
return select(2, adornee:GetBoundingBox())
|
|
@@ -106,6 +136,11 @@ function AdorneeUtils.getAlignedSize(adornee)
|
|
|
106
136
|
return nil
|
|
107
137
|
end
|
|
108
138
|
|
|
139
|
+
--[=[
|
|
140
|
+
Retrieves this adornee's "part"'s CFrame.
|
|
141
|
+
@param adornee Instance
|
|
142
|
+
@return CFrame
|
|
143
|
+
]=]
|
|
109
144
|
function AdorneeUtils.getPartCFrame(adornee)
|
|
110
145
|
assert(typeof(adornee) == "Instance", "Adornee must by of type 'Instance'")
|
|
111
146
|
|
|
@@ -117,6 +152,11 @@ function AdorneeUtils.getPartCFrame(adornee)
|
|
|
117
152
|
return part.CFrame
|
|
118
153
|
end
|
|
119
154
|
|
|
155
|
+
--[=[
|
|
156
|
+
Retrieves this adornee's "part"'s position.
|
|
157
|
+
@param adornee Instance
|
|
158
|
+
@return Position
|
|
159
|
+
]=]
|
|
120
160
|
function AdorneeUtils.getPartPosition(adornee)
|
|
121
161
|
assert(typeof(adornee) == "Instance", "Adornee must by of type 'Instance'")
|
|
122
162
|
|
|
@@ -128,6 +168,11 @@ function AdorneeUtils.getPartPosition(adornee)
|
|
|
128
168
|
return part.Position
|
|
129
169
|
end
|
|
130
170
|
|
|
171
|
+
--[=[
|
|
172
|
+
Retrieves this adornee's "part"'s Velocity.
|
|
173
|
+
@param adornee Instance
|
|
174
|
+
@return Vector3
|
|
175
|
+
]=]
|
|
131
176
|
function AdorneeUtils.getPartVelocity(adornee)
|
|
132
177
|
local part = AdorneeUtils.getPart(adornee)
|
|
133
178
|
if not part then
|
|
@@ -137,6 +182,11 @@ function AdorneeUtils.getPartVelocity(adornee)
|
|
|
137
182
|
return part.Velocity
|
|
138
183
|
end
|
|
139
184
|
|
|
185
|
+
--[=[
|
|
186
|
+
Retrieves this adornee's part
|
|
187
|
+
@param adornee Instance
|
|
188
|
+
@return BasePart
|
|
189
|
+
]=]
|
|
140
190
|
function AdorneeUtils.getPart(adornee)
|
|
141
191
|
assert(typeof(adornee) == "Instance", "Adornee must by of type 'Instance'")
|
|
142
192
|
|
|
@@ -166,6 +216,11 @@ function AdorneeUtils.getPart(adornee)
|
|
|
166
216
|
end
|
|
167
217
|
end
|
|
168
218
|
|
|
219
|
+
--[=[
|
|
220
|
+
Retrieves this adornee's part on which to attach a rendering instance to
|
|
221
|
+
@param adornee Instance
|
|
222
|
+
@return Instance
|
|
223
|
+
]=]
|
|
169
224
|
function AdorneeUtils.getRenderAdornee(adornee)
|
|
170
225
|
assert(typeof(adornee) == "Instance", "Adornee must by of type 'Instance'")
|
|
171
226
|
|