@quenty/humanoidutils 2.4.0-canary.aeeb98a.0 → 2.4.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 +10 -2
- package/package.json +5 -5
- package/src/Shared/RxHumanoidUtils.lua +28 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,17 @@
|
|
|
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.4.0
|
|
6
|
+
# [2.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/humanoidutils@2.3.0...@quenty/humanoidutils@2.4.0) (2025-10-08)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Fix formatting ([97cfa97](https://github.com/Quenty/NevermoreEngine/commit/97cfa9787cc2d93e90e6d9a9f1a3c3c57b87a8a5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* Add RxHumanoidUtils.observeHumanoidStateType(humanoid) ([96f9fc9](https://github.com/Quenty/NevermoreEngine/commit/96f9fc946090b597eaebd0011f04b90f7cbb690c))
|
|
9
17
|
|
|
10
18
|
|
|
11
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/humanoidutils",
|
|
3
|
-
"version": "2.4.0
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "General humanoid utility code.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@quenty/loader": "10.9.0",
|
|
32
|
-
"@quenty/maid": "3.5.0",
|
|
33
|
-
"@quenty/rx": "13.20.0"
|
|
31
|
+
"@quenty/loader": "^10.9.0",
|
|
32
|
+
"@quenty/maid": "^3.5.0",
|
|
33
|
+
"@quenty/rx": "^13.20.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "d396d6f77d25ba25f1f45bbc252216131f88eeed"
|
|
36
36
|
}
|
|
@@ -61,4 +61,32 @@ function RxHumanoidUtils.observeRunningSpeed(humanoid: Humanoid): Observable.Obs
|
|
|
61
61
|
end)
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
+
--[=[
|
|
65
|
+
Observes a humanoid's HumanoidStateType
|
|
66
|
+
]=]
|
|
67
|
+
function RxHumanoidUtils.observeHumanoidStateType(humanoid: Humanoid): Observable.Observable<Enum.HumanoidStateType>
|
|
68
|
+
return Observable.new(function(sub)
|
|
69
|
+
local maid = Maid.new()
|
|
70
|
+
|
|
71
|
+
local lastStateType = nil
|
|
72
|
+
|
|
73
|
+
local function emitStateType(stateType: Enum.HumanoidStateType)
|
|
74
|
+
if lastStateType ~= stateType then
|
|
75
|
+
lastStateType = stateType
|
|
76
|
+
sub:Fire(stateType)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
maid:GiveTask(humanoid.StateChanged:Connect(function(_oldState, stateType)
|
|
81
|
+
emitStateType(stateType)
|
|
82
|
+
end))
|
|
83
|
+
|
|
84
|
+
if not lastStateType then
|
|
85
|
+
emitStateType(humanoid:GetState())
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
return maid
|
|
89
|
+
end)
|
|
90
|
+
end
|
|
91
|
+
|
|
64
92
|
return RxHumanoidUtils
|