@quenty/r15utils 13.17.0-canary.544.de8fcee.0 → 13.17.1-canary.545.2374fb2.0
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 +20 -1
- package/package.json +5 -5
- package/src/Shared/R15Utils.lua +39 -28
- package/src/Shared/RxR15Utils.lua +29 -29
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,26 @@
|
|
|
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
|
-
|
|
6
|
+
## [13.17.1-canary.545.2374fb2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/r15utils@13.17.0...@quenty/r15utils@13.17.1-canary.545.2374fb2.0) (2025-04-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [13.17.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/r15utils@13.16.2...@quenty/r15utils@13.17.0) (2025-04-02)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @quenty/r15utils
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [13.16.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/r15utils@13.16.1...@quenty/r15utils@13.16.2) (2025-03-31)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @quenty/r15utils
|
|
9
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/r15utils",
|
|
3
|
-
"version": "13.17.
|
|
3
|
+
"version": "13.17.1-canary.545.2374fb2.0",
|
|
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.17.
|
|
29
|
-
"@quenty/instanceutils": "13.17.
|
|
30
|
-
"@quenty/loader": "10.8.0"
|
|
28
|
+
"@quenty/brio": "14.17.1-canary.545.2374fb2.0",
|
|
29
|
+
"@quenty/instanceutils": "13.17.1-canary.545.2374fb2.0",
|
|
30
|
+
"@quenty/loader": "10.8.1-canary.545.2374fb2.0"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "2374fb2b043cfbe0e9b507b3316eec46a4e353a0"
|
|
36
36
|
}
|
package/src/Shared/R15Utils.lua
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
Utility methods for R15 Characters. R15 is a specific Roblox character specification.
|
|
3
4
|
|
|
@@ -21,7 +22,12 @@ function R15Utils.searchForRigAttachment(character: Model, partName: string, att
|
|
|
21
22
|
return nil
|
|
22
23
|
end
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
local result = part:FindFirstChild(attachmentName)
|
|
26
|
+
if result == nil or not result:IsA("Attachment") then
|
|
27
|
+
return nil
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
return result
|
|
25
31
|
end
|
|
26
32
|
|
|
27
33
|
--[=[
|
|
@@ -42,7 +48,7 @@ function R15Utils.getRigMotor(character: Model, partName: string, motorName: str
|
|
|
42
48
|
end
|
|
43
49
|
|
|
44
50
|
local motor = basePart:FindFirstChild(motorName)
|
|
45
|
-
if not motor then
|
|
51
|
+
if motor == nil or not motor:IsA("Motor6D") then
|
|
46
52
|
return nil
|
|
47
53
|
end
|
|
48
54
|
|
|
@@ -86,12 +92,7 @@ end
|
|
|
86
92
|
@return Motor6D?
|
|
87
93
|
]=]
|
|
88
94
|
function R15Utils.getWaistJoint(character: Model): Motor6D?
|
|
89
|
-
|
|
90
|
-
if not upperTorso then
|
|
91
|
-
return nil
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
return upperTorso:FindFirstChild("Waist")
|
|
95
|
+
return R15Utils.getRigMotor(character, "UpperTorso", "Waist")
|
|
95
96
|
end
|
|
96
97
|
|
|
97
98
|
--[=[
|
|
@@ -99,13 +100,8 @@ end
|
|
|
99
100
|
@param character Model
|
|
100
101
|
@return Motor6D?
|
|
101
102
|
]=]
|
|
102
|
-
function R15Utils.getNeckJoint(character: Model)
|
|
103
|
-
|
|
104
|
-
if not head then
|
|
105
|
-
return nil
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
return head:FindFirstChild("Neck")
|
|
103
|
+
function R15Utils.getNeckJoint(character: Model): Motor6D?
|
|
104
|
+
return R15Utils.getRigMotor(character, "Head", "Neck")
|
|
109
105
|
end
|
|
110
106
|
|
|
111
107
|
--[=[
|
|
@@ -114,8 +110,13 @@ end
|
|
|
114
110
|
@param side "Left" | "Right"
|
|
115
111
|
@return Attachment?
|
|
116
112
|
]=]
|
|
117
|
-
function R15Utils.getHand(character: Model, side: R15Side)
|
|
118
|
-
|
|
113
|
+
function R15Utils.getHand(character: Model, side: R15Side): BasePart?
|
|
114
|
+
local result = character:FindFirstChild(R15Utils.getHandName(side))
|
|
115
|
+
if result == nil or not result:IsA("BasePart") then
|
|
116
|
+
return nil
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
return result
|
|
119
120
|
end
|
|
120
121
|
|
|
121
122
|
--[=[
|
|
@@ -126,11 +127,16 @@ end
|
|
|
126
127
|
]=]
|
|
127
128
|
function R15Utils.getGripWeld(character: Model, side: R15Side): Motor6D?
|
|
128
129
|
local rightHand = R15Utils.getHand(character, side)
|
|
129
|
-
if rightHand then
|
|
130
|
-
return rightHand:FindFirstChild(R15Utils.getGripWeldName(side))
|
|
131
|
-
else
|
|
130
|
+
if rightHand == nil then
|
|
132
131
|
return nil
|
|
133
132
|
end
|
|
133
|
+
|
|
134
|
+
local result = rightHand:FindFirstChild(R15Utils.getGripWeldName(side))
|
|
135
|
+
if result == nil or not result:IsA("Motor6D") then
|
|
136
|
+
return nil
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
return result
|
|
134
140
|
end
|
|
135
141
|
|
|
136
142
|
--[=[
|
|
@@ -138,7 +144,7 @@ end
|
|
|
138
144
|
@param side "Left" | "Right"
|
|
139
145
|
@return "LeftGrip" | "RightGrip"
|
|
140
146
|
]=]
|
|
141
|
-
function R15Utils.getGripWeldName(side: R15Side)
|
|
147
|
+
function R15Utils.getGripWeldName(side: R15Side): "LeftGrip" | "RightGrip"
|
|
142
148
|
if side == "Left" then
|
|
143
149
|
return "LeftGrip"
|
|
144
150
|
elseif side == "Right" then
|
|
@@ -153,7 +159,7 @@ end
|
|
|
153
159
|
@param side "Left" | "Right"
|
|
154
160
|
@return "LeftHand" | "RightHand"
|
|
155
161
|
]=]
|
|
156
|
-
function R15Utils.getHandName(side)
|
|
162
|
+
function R15Utils.getHandName(side: R15Side): "LeftHand" | "RightHand"
|
|
157
163
|
if side == "Left" then
|
|
158
164
|
return "LeftHand"
|
|
159
165
|
elseif side == "Right" then
|
|
@@ -232,7 +238,12 @@ end
|
|
|
232
238
|
@param rigAttachment1 string
|
|
233
239
|
@return number?
|
|
234
240
|
]=]
|
|
235
|
-
function R15Utils.getRigLength(
|
|
241
|
+
function R15Utils.getRigLength(
|
|
242
|
+
character: Model,
|
|
243
|
+
partName: string,
|
|
244
|
+
rigAttachment0: string,
|
|
245
|
+
rigAttachment1: string
|
|
246
|
+
): number?
|
|
236
247
|
local attachment0 = R15Utils.searchForRigAttachment(character, partName, rigAttachment0)
|
|
237
248
|
if not attachment0 then
|
|
238
249
|
return nil
|
|
@@ -243,7 +254,7 @@ function R15Utils.getRigLength(character: Model, partName: string, rigAttachment
|
|
|
243
254
|
return nil
|
|
244
255
|
end
|
|
245
256
|
|
|
246
|
-
return (attachment0.Position - attachment1.Position).
|
|
257
|
+
return (attachment0.Position - attachment1.Position).Magnitude
|
|
247
258
|
end
|
|
248
259
|
|
|
249
260
|
--[=[
|
|
@@ -253,7 +264,7 @@ end
|
|
|
253
264
|
]=]
|
|
254
265
|
function R15Utils.addLengthsOrNil(lengths: { number? }): number?
|
|
255
266
|
local total = 0
|
|
256
|
-
for _, length in
|
|
267
|
+
for _, length in lengths do
|
|
257
268
|
if not length then
|
|
258
269
|
return nil
|
|
259
270
|
end
|
|
@@ -270,7 +281,7 @@ end
|
|
|
270
281
|
@param side "Left" | "Right"
|
|
271
282
|
@return number?
|
|
272
283
|
]=]
|
|
273
|
-
function R15Utils.getUpperArmRigLength(character: Model, side: R15Side)
|
|
284
|
+
function R15Utils.getUpperArmRigLength(character: Model, side: R15Side): number?
|
|
274
285
|
if side == "Left" then
|
|
275
286
|
return R15Utils.getRigLength(character, "LeftUpperArm", "LeftShoulderRigAttachment", "LeftElbowRigAttachment")
|
|
276
287
|
elseif side == "Right" then
|
|
@@ -327,7 +338,7 @@ function R15Utils.getHumanoidScaleProperty(humanoid: Humanoid, scaleValueName: s
|
|
|
327
338
|
assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
|
|
328
339
|
|
|
329
340
|
local scaleValue = humanoid:FindFirstChild(scaleValueName)
|
|
330
|
-
if scaleValue then
|
|
341
|
+
if scaleValue and scaleValue:IsA("NumberValue") then
|
|
331
342
|
return scaleValue.Value
|
|
332
343
|
else
|
|
333
344
|
return nil
|
|
@@ -340,7 +351,7 @@ end
|
|
|
340
351
|
@param side "Left" | "Right"
|
|
341
352
|
@return number?
|
|
342
353
|
]=]
|
|
343
|
-
function R15Utils.getArmRigToGripLength(character: Model, side: R15Side)
|
|
354
|
+
function R15Utils.getArmRigToGripLength(character: Model, side: R15Side): number?
|
|
344
355
|
return R15Utils.addLengthsOrNil({
|
|
345
356
|
R15Utils.getUpperArmRigLength(character, side),
|
|
346
357
|
R15Utils.getLowerArmRigLength(character, side),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
Utility methods to query components of an R15 character.
|
|
3
4
|
@class RxR15Utils
|
|
@@ -8,6 +9,8 @@ local require = require(script.Parent.loader).load(script)
|
|
|
8
9
|
local RxInstanceUtils = require("RxInstanceUtils")
|
|
9
10
|
local RxBrioUtils = require("RxBrioUtils")
|
|
10
11
|
|
|
12
|
+
export type R15Side = "Left" | "Right"
|
|
13
|
+
|
|
11
14
|
local RxR15Utils = {}
|
|
12
15
|
|
|
13
16
|
--[=[
|
|
@@ -17,17 +20,16 @@ local RxR15Utils = {}
|
|
|
17
20
|
@param attachmentName string
|
|
18
21
|
@return Observable<Brio<Attachment>>
|
|
19
22
|
]=]
|
|
20
|
-
function RxR15Utils.observeRigAttachmentBrio(character, partName, attachmentName)
|
|
23
|
+
function RxR15Utils.observeRigAttachmentBrio(character: Model, partName: string, attachmentName: string)
|
|
21
24
|
assert(typeof(character) == "Instance", "Bad character")
|
|
22
25
|
assert(type(partName) == "string", "Bad partName")
|
|
23
26
|
assert(type(attachmentName) == "string", "Bad attachmentName")
|
|
24
27
|
|
|
25
|
-
return RxR15Utils.observeCharacterPartBrio(character, partName)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
28
|
+
return RxR15Utils.observeCharacterPartBrio(character, partName):Pipe({
|
|
29
|
+
RxBrioUtils.switchMapBrio(function(part)
|
|
30
|
+
return RxInstanceUtils.observeLastNamedChildBrio(part, "Attachment", attachmentName)
|
|
31
|
+
end),
|
|
32
|
+
})
|
|
31
33
|
end
|
|
32
34
|
|
|
33
35
|
--[=[
|
|
@@ -37,18 +39,17 @@ end
|
|
|
37
39
|
@param motorName string
|
|
38
40
|
@return Observable<Brio<Motor6D>>
|
|
39
41
|
]=]
|
|
40
|
-
function RxR15Utils.observeRigMotorBrio(character, partName, motorName)
|
|
42
|
+
function RxR15Utils.observeRigMotorBrio(character: Model, partName: string, motorName: string)
|
|
41
43
|
assert(typeof(character) == "Instance", "Bad character")
|
|
42
44
|
assert(type(partName) == "string", "Bad partName")
|
|
43
45
|
assert(type(motorName) == "string", "Bad motorName")
|
|
44
46
|
|
|
45
|
-
return RxInstanceUtils.observeLastNamedChildBrio(character, "BasePart", partName)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
})
|
|
47
|
+
return RxInstanceUtils.observeLastNamedChildBrio(character, "BasePart", partName):Pipe({
|
|
48
|
+
RxBrioUtils.switchMapBrio(function(part)
|
|
49
|
+
return RxInstanceUtils.observeLastNamedChildBrio(part, "Motor6D", motorName)
|
|
50
|
+
end),
|
|
51
|
+
RxBrioUtils.onlyLastBrioSurvives(),
|
|
52
|
+
})
|
|
52
53
|
end
|
|
53
54
|
|
|
54
55
|
--[=[
|
|
@@ -58,18 +59,17 @@ end
|
|
|
58
59
|
@param weldName string
|
|
59
60
|
@return Observable<Brio<Motor6D>>
|
|
60
61
|
]=]
|
|
61
|
-
function RxR15Utils.observeRigWeldBrio(character, partName, weldName)
|
|
62
|
+
function RxR15Utils.observeRigWeldBrio(character: Model, partName: string, weldName: string)
|
|
62
63
|
assert(typeof(character) == "Instance", "Bad character")
|
|
63
64
|
assert(type(partName) == "string", "Bad partName")
|
|
64
65
|
assert(type(weldName) == "string", "Bad weldName")
|
|
65
66
|
|
|
66
|
-
return RxInstanceUtils.observeLastNamedChildBrio(character, "BasePart", partName)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
})
|
|
67
|
+
return RxInstanceUtils.observeLastNamedChildBrio(character, "BasePart", partName):Pipe({
|
|
68
|
+
RxBrioUtils.switchMapBrio(function(part)
|
|
69
|
+
return RxInstanceUtils.observeLastNamedChildBrio(part, "Weld", weldName)
|
|
70
|
+
end),
|
|
71
|
+
RxBrioUtils.onlyLastBrioSurvives(),
|
|
72
|
+
})
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
--[=[
|
|
@@ -78,7 +78,7 @@ end
|
|
|
78
78
|
@param partName string
|
|
79
79
|
@return Observable<Brio<BasePart>>
|
|
80
80
|
]=]
|
|
81
|
-
function RxR15Utils.observeCharacterPartBrio(character, partName)
|
|
81
|
+
function RxR15Utils.observeCharacterPartBrio(character: Model, partName: string)
|
|
82
82
|
assert(typeof(character) == "Instance", "Bad character")
|
|
83
83
|
assert(type(partName) == "string", "Bad partName")
|
|
84
84
|
|
|
@@ -90,29 +90,29 @@ end
|
|
|
90
90
|
@param character Model
|
|
91
91
|
@return Observable<Brio<Humanoid>>
|
|
92
92
|
]=]
|
|
93
|
-
function RxR15Utils.observeHumanoidBrio(character)
|
|
93
|
+
function RxR15Utils.observeHumanoidBrio(character: Model)
|
|
94
94
|
assert(typeof(character) == "Instance", "Bad character")
|
|
95
95
|
|
|
96
96
|
return RxInstanceUtils.observeLastNamedChildBrio(character, "Humanoid", "Humanoid")
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
-
function RxR15Utils.observeHumanoidScaleValueObject(humanoid, scaleValueName)
|
|
99
|
+
function RxR15Utils.observeHumanoidScaleValueObject(humanoid: Humanoid, scaleValueName: string)
|
|
100
100
|
assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
|
|
101
101
|
|
|
102
102
|
return RxInstanceUtils.observeLastNamedChildBrio(humanoid, "NumberValue", scaleValueName)
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
function RxR15Utils.observeHumanoidScaleProperty(humanoid, scaleValueName)
|
|
105
|
+
function RxR15Utils.observeHumanoidScaleProperty(humanoid: Humanoid, scaleValueName: string)
|
|
106
106
|
assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "Bad humanoid")
|
|
107
107
|
|
|
108
108
|
return RxR15Utils.observeHumanoidScaleValueObject(humanoid, scaleValueName):Pipe({
|
|
109
109
|
RxBrioUtils.switchMapBrio(function(scaleValue)
|
|
110
110
|
return RxInstanceUtils.observeProperty(scaleValue, "Value")
|
|
111
|
-
end)
|
|
111
|
+
end),
|
|
112
112
|
})
|
|
113
113
|
end
|
|
114
114
|
|
|
115
|
-
function RxR15Utils.observeShoulderRigAttachmentBrio(character, side)
|
|
115
|
+
function RxR15Utils.observeShoulderRigAttachmentBrio(character: Model, side: R15Side)
|
|
116
116
|
if side == "Left" then
|
|
117
117
|
return RxR15Utils.observeRigAttachmentBrio(character, "UpperTorso", "LeftShoulderRigAttachment")
|
|
118
118
|
elseif side == "Right" then
|