@quenty/r15utils 13.16.0 → 13.16.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 +8 -0
- package/package.json +4 -4
- package/src/Shared/R15Utils.lua +58 -32
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [13.16.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/r15utils@13.16.0...@quenty/r15utils@13.16.1) (2025-03-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/r15utils
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [13.16.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/r15utils@13.15.0...@quenty/r15utils@13.16.0) (2025-02-18)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @quenty/r15utils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/r15utils",
|
|
3
|
-
"version": "13.16.
|
|
3
|
+
"version": "13.16.1",
|
|
4
4
|
"description": "Utility methods for R15 Characters",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/brio": "^14.16.
|
|
29
|
-
"@quenty/instanceutils": "^13.16.
|
|
28
|
+
"@quenty/brio": "^14.16.1",
|
|
29
|
+
"@quenty/instanceutils": "^13.16.1",
|
|
30
30
|
"@quenty/loader": "^10.8.0"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "6b7c3e15e60cdb185986207b574e2b5591261e7a"
|
|
36
36
|
}
|
package/src/Shared/R15Utils.lua
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Utility methods for R15 Characters
|
|
2
|
+
Utility methods for R15 Characters. R15 is a specific Roblox character specification.
|
|
3
|
+
|
|
3
4
|
@class R15Utils
|
|
4
5
|
]=]
|
|
5
6
|
|
|
6
7
|
local R15Utils = {}
|
|
7
8
|
|
|
9
|
+
export type R15Side = "Left" | "Right"
|
|
10
|
+
|
|
8
11
|
--[=[
|
|
9
12
|
Searches the rig for an attachment
|
|
10
13
|
@param character Model
|
|
@@ -12,8 +15,8 @@ local R15Utils = {}
|
|
|
12
15
|
@param attachmentName string
|
|
13
16
|
@return Attachment?
|
|
14
17
|
]=]
|
|
15
|
-
function R15Utils.searchForRigAttachment(character, partName, attachmentName)
|
|
16
|
-
local part = character
|
|
18
|
+
function R15Utils.searchForRigAttachment(character: Model, partName: string, attachmentName: string): Attachment?
|
|
19
|
+
local part = R15Utils.getBodyPart(character, partName)
|
|
17
20
|
if not part then
|
|
18
21
|
return nil
|
|
19
22
|
end
|
|
@@ -28,12 +31,12 @@ end
|
|
|
28
31
|
@param motorName string
|
|
29
32
|
@return Motor6D?
|
|
30
33
|
]=]
|
|
31
|
-
function R15Utils.getRigMotor(character, partName, motorName)
|
|
34
|
+
function R15Utils.getRigMotor(character: Model, partName: string, motorName: string): Motor6D?
|
|
32
35
|
assert(typeof(character) == "Instance", "Bad character")
|
|
33
36
|
assert(type(partName) == "string", "Bad partName")
|
|
34
37
|
assert(type(motorName) == "string", "Bad motorName")
|
|
35
38
|
|
|
36
|
-
local basePart = character
|
|
39
|
+
local basePart = R15Utils.getBodyPart(character, partName)
|
|
37
40
|
if not basePart then
|
|
38
41
|
return nil
|
|
39
42
|
end
|
|
@@ -46,14 +49,13 @@ function R15Utils.getRigMotor(character, partName, motorName)
|
|
|
46
49
|
return motor
|
|
47
50
|
end
|
|
48
51
|
|
|
49
|
-
|
|
50
52
|
--[=[
|
|
51
53
|
Retrieves the upper torso
|
|
52
54
|
@param character Model
|
|
53
55
|
@return BasePart?
|
|
54
56
|
]=]
|
|
55
|
-
function R15Utils.getUpperTorso(character)
|
|
56
|
-
return character
|
|
57
|
+
function R15Utils.getUpperTorso(character: Model): BasePart?
|
|
58
|
+
return R15Utils.getBodyPart(character, "UpperTorso")
|
|
57
59
|
end
|
|
58
60
|
|
|
59
61
|
--[=[
|
|
@@ -61,8 +63,21 @@ end
|
|
|
61
63
|
@param character Model
|
|
62
64
|
@return BasePart?
|
|
63
65
|
]=]
|
|
64
|
-
function R15Utils.getLowerTorso(character)
|
|
65
|
-
return character
|
|
66
|
+
function R15Utils.getLowerTorso(character: Model): BasePart?
|
|
67
|
+
return R15Utils.getBodyPart(character, "LowerTorso")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
function R15Utils.getBodyPart(character: Model, partName: string): BasePart?
|
|
71
|
+
local found = character:FindFirstChild(partName)
|
|
72
|
+
if found == nil then
|
|
73
|
+
return nil
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if not found:IsA("BasePart") then
|
|
77
|
+
return nil
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
return found
|
|
66
81
|
end
|
|
67
82
|
|
|
68
83
|
--[=[
|
|
@@ -70,7 +85,7 @@ end
|
|
|
70
85
|
@param character Model
|
|
71
86
|
@return Motor6D?
|
|
72
87
|
]=]
|
|
73
|
-
function R15Utils.getWaistJoint(character)
|
|
88
|
+
function R15Utils.getWaistJoint(character: Model): Motor6D?
|
|
74
89
|
local upperTorso = R15Utils.getUpperTorso(character)
|
|
75
90
|
if not upperTorso then
|
|
76
91
|
return nil
|
|
@@ -84,7 +99,7 @@ end
|
|
|
84
99
|
@param character Model
|
|
85
100
|
@return Motor6D?
|
|
86
101
|
]=]
|
|
87
|
-
function R15Utils.getNeckJoint(character)
|
|
102
|
+
function R15Utils.getNeckJoint(character: Model)
|
|
88
103
|
local head = character:FindFirstChild("Head")
|
|
89
104
|
if not head then
|
|
90
105
|
return nil
|
|
@@ -99,7 +114,7 @@ end
|
|
|
99
114
|
@param side "Left" | "Right"
|
|
100
115
|
@return Attachment?
|
|
101
116
|
]=]
|
|
102
|
-
function R15Utils.getHand(character, side)
|
|
117
|
+
function R15Utils.getHand(character: Model, side: R15Side)
|
|
103
118
|
return character:FindFirstChild(R15Utils.getHandName(side))
|
|
104
119
|
end
|
|
105
120
|
|
|
@@ -109,7 +124,7 @@ end
|
|
|
109
124
|
@param side "Left" | "Right"
|
|
110
125
|
@return Motor6D?
|
|
111
126
|
]=]
|
|
112
|
-
function R15Utils.getGripWeld(character, side)
|
|
127
|
+
function R15Utils.getGripWeld(character: Model, side: R15Side): Motor6D?
|
|
113
128
|
local rightHand = R15Utils.getHand(character, side)
|
|
114
129
|
if rightHand then
|
|
115
130
|
return rightHand:FindFirstChild(R15Utils.getGripWeldName(side))
|
|
@@ -123,7 +138,7 @@ end
|
|
|
123
138
|
@param side "Left" | "Right"
|
|
124
139
|
@return "LeftGrip" | "RightGrip"
|
|
125
140
|
]=]
|
|
126
|
-
function R15Utils.getGripWeldName(side)
|
|
141
|
+
function R15Utils.getGripWeldName(side: R15Side)
|
|
127
142
|
if side == "Left" then
|
|
128
143
|
return "LeftGrip"
|
|
129
144
|
elseif side == "Right" then
|
|
@@ -153,7 +168,7 @@ end
|
|
|
153
168
|
@param side "Left" | "Right"
|
|
154
169
|
@return "LeftGripAttachment" | "RightGripAttachment"
|
|
155
170
|
]=]
|
|
156
|
-
function R15Utils.getGripAttachmentName(side)
|
|
171
|
+
function R15Utils.getGripAttachmentName(side: R15Side): "LeftGripAttachment" | "RightGripAttachment"
|
|
157
172
|
if side == "Left" then
|
|
158
173
|
return "LeftGripAttachment"
|
|
159
174
|
elseif side == "Right" then
|
|
@@ -169,8 +184,8 @@ end
|
|
|
169
184
|
@param side "Left" | "Right"
|
|
170
185
|
@return Attachment?
|
|
171
186
|
]=]
|
|
172
|
-
function R15Utils.getShoulderRigAttachment(character, side)
|
|
173
|
-
if side == "Left"
|
|
187
|
+
function R15Utils.getShoulderRigAttachment(character: Model, side: R15Side): Attachment?
|
|
188
|
+
if side == "Left" then
|
|
174
189
|
return R15Utils.searchForRigAttachment(character, "UpperTorso", "LeftShoulderRigAttachment")
|
|
175
190
|
elseif side == "Right" then
|
|
176
191
|
return R15Utils.searchForRigAttachment(character, "UpperTorso", "RightShoulderRigAttachment")
|
|
@@ -185,8 +200,8 @@ end
|
|
|
185
200
|
@param side "Left" | "Right"
|
|
186
201
|
@return Attachment?
|
|
187
202
|
]=]
|
|
188
|
-
function R15Utils.getGripAttachment(character, side)
|
|
189
|
-
if side == "Left"
|
|
203
|
+
function R15Utils.getGripAttachment(character: Model, side: R15Side): Attachment?
|
|
204
|
+
if side == "Left" then
|
|
190
205
|
return R15Utils.searchForRigAttachment(character, "LeftHand", "LeftGripAttachment")
|
|
191
206
|
elseif side == "Right" then
|
|
192
207
|
return R15Utils.searchForRigAttachment(character, "RightHand", "RightGripAttachment")
|
|
@@ -200,13 +215,13 @@ end
|
|
|
200
215
|
@param humanoid Humanoid
|
|
201
216
|
@return number?
|
|
202
217
|
]=]
|
|
203
|
-
function R15Utils.getExpectedRootPartYOffset(humanoid)
|
|
218
|
+
function R15Utils.getExpectedRootPartYOffset(humanoid: Humanoid): number?
|
|
204
219
|
local rootPart = humanoid.RootPart
|
|
205
220
|
if not rootPart then
|
|
206
221
|
return nil
|
|
207
222
|
end
|
|
208
223
|
|
|
209
|
-
return humanoid.HipHeight + rootPart.Size.Y/2
|
|
224
|
+
return humanoid.HipHeight + rootPart.Size.Y / 2
|
|
210
225
|
end
|
|
211
226
|
|
|
212
227
|
--[=[
|
|
@@ -217,7 +232,7 @@ end
|
|
|
217
232
|
@param rigAttachment1 string
|
|
218
233
|
@return number?
|
|
219
234
|
]=]
|
|
220
|
-
function R15Utils.getRigLength(character, partName, rigAttachment0, rigAttachment1)
|
|
235
|
+
function R15Utils.getRigLength(character: Model, partName: string, rigAttachment0: string, rigAttachment1: string)
|
|
221
236
|
local attachment0 = R15Utils.searchForRigAttachment(character, partName, rigAttachment0)
|
|
222
237
|
if not attachment0 then
|
|
223
238
|
return nil
|
|
@@ -236,7 +251,7 @@ end
|
|
|
236
251
|
@param lengths { number? }
|
|
237
252
|
@return number?
|
|
238
253
|
]=]
|
|
239
|
-
function R15Utils.addLengthsOrNil(lengths)
|
|
254
|
+
function R15Utils.addLengthsOrNil(lengths: { number? }): number?
|
|
240
255
|
local total = 0
|
|
241
256
|
for _, length in pairs(lengths) do
|
|
242
257
|
if not length then
|
|
@@ -255,11 +270,16 @@ end
|
|
|
255
270
|
@param side "Left" | "Right"
|
|
256
271
|
@return number?
|
|
257
272
|
]=]
|
|
258
|
-
function R15Utils.getUpperArmRigLength(character, side)
|
|
273
|
+
function R15Utils.getUpperArmRigLength(character: Model, side: R15Side)
|
|
259
274
|
if side == "Left" then
|
|
260
275
|
return R15Utils.getRigLength(character, "LeftUpperArm", "LeftShoulderRigAttachment", "LeftElbowRigAttachment")
|
|
261
276
|
elseif side == "Right" then
|
|
262
|
-
return R15Utils.getRigLength(
|
|
277
|
+
return R15Utils.getRigLength(
|
|
278
|
+
character,
|
|
279
|
+
"RightUpperArm",
|
|
280
|
+
"RightShoulderRigAttachment",
|
|
281
|
+
"RightElbowRigAttachment"
|
|
282
|
+
)
|
|
263
283
|
else
|
|
264
284
|
error("Bad side")
|
|
265
285
|
end
|
|
@@ -271,7 +291,7 @@ end
|
|
|
271
291
|
@param side "Left" | "Right"
|
|
272
292
|
@return number?
|
|
273
293
|
]=]
|
|
274
|
-
function R15Utils.getLowerArmRigLength(character, side)
|
|
294
|
+
function R15Utils.getLowerArmRigLength(character: Model, side: R15Side): number?
|
|
275
295
|
if side == "Left" then
|
|
276
296
|
return R15Utils.getRigLength(character, "LeftLowerArm", "LeftElbowRigAttachment", "LeftWristRigAttachment")
|
|
277
297
|
elseif side == "Right" then
|
|
@@ -287,7 +307,7 @@ end
|
|
|
287
307
|
@param side "Left" | "Right"
|
|
288
308
|
@return number?
|
|
289
309
|
]=]
|
|
290
|
-
function R15Utils.getWristToGripLength(character, side)
|
|
310
|
+
function R15Utils.getWristToGripLength(character: Model, side: R15Side): number?
|
|
291
311
|
if side == "Left" then
|
|
292
312
|
return R15Utils.getRigLength(character, "LeftHand", "LeftWristRigAttachment", "LeftGripAttachment")
|
|
293
313
|
elseif side == "Right" then
|
|
@@ -297,7 +317,13 @@ function R15Utils.getWristToGripLength(character, side)
|
|
|
297
317
|
end
|
|
298
318
|
end
|
|
299
319
|
|
|
300
|
-
|
|
320
|
+
--[=[
|
|
321
|
+
Retrieves the humanoid scale property
|
|
322
|
+
@param humanoid Humanoid
|
|
323
|
+
@param scaleValueName string
|
|
324
|
+
@return number?
|
|
325
|
+
]=]
|
|
326
|
+
function R15Utils.getHumanoidScaleProperty(humanoid: Humanoid, scaleValueName: string): number?
|
|
301
327
|
assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
|
|
302
328
|
|
|
303
329
|
local scaleValue = humanoid:FindFirstChild(scaleValueName)
|
|
@@ -314,12 +340,12 @@ end
|
|
|
314
340
|
@param side "Left" | "Right"
|
|
315
341
|
@return number?
|
|
316
342
|
]=]
|
|
317
|
-
function R15Utils.getArmRigToGripLength(character, side)
|
|
343
|
+
function R15Utils.getArmRigToGripLength(character: Model, side: R15Side)
|
|
318
344
|
return R15Utils.addLengthsOrNil({
|
|
319
345
|
R15Utils.getUpperArmRigLength(character, side),
|
|
320
346
|
R15Utils.getLowerArmRigLength(character, side),
|
|
321
|
-
R15Utils.getWristToGripLength(character, side)
|
|
347
|
+
R15Utils.getWristToGripLength(character, side),
|
|
322
348
|
})
|
|
323
349
|
end
|
|
324
350
|
|
|
325
|
-
return R15Utils
|
|
351
|
+
return R15Utils
|