@quenty/humanoidutils 2.2.3 → 2.3.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 CHANGED
@@ -3,6 +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.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/humanoidutils@2.2.3...@quenty/humanoidutils@2.3.0) (2025-10-01)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add RxHumanoidUtils ([#593](https://github.com/Quenty/NevermoreEngine/issues/593)) ([23580a9](https://github.com/Quenty/NevermoreEngine/commit/23580a979936eb13dd850b097b7c050e54373d37))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [2.2.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/humanoidutils@2.2.1...@quenty/humanoidutils@2.2.3) (2025-04-07)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/humanoidutils",
3
- "version": "2.2.3",
3
+ "version": "2.3.0",
4
4
  "description": "General humanoid utility code.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,5 +27,10 @@
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "gitHead": "64def70499ec067077ee39f279936b620b217847"
30
+ "dependencies": {
31
+ "@quenty/loader": "^10.9.0",
32
+ "@quenty/maid": "^3.5.0",
33
+ "@quenty/rx": "^13.20.0"
34
+ },
35
+ "gitHead": "a5d81d29cf2bc0176b36ae27694c76c9246c583a"
31
36
  }
@@ -0,0 +1,64 @@
1
+ --[=[
2
+ @class RxHumanoidUtils
3
+ ]=]
4
+
5
+ local require = require(script.Parent.loader).load(script)
6
+
7
+ local Maid = require("Maid")
8
+ local Observable = require("Observable")
9
+
10
+ local RxHumanoidUtils = {}
11
+
12
+ --[=[
13
+ Observes the running speed of a humanoid
14
+
15
+ :::tip
16
+ When using :MoveTo this is the only way to know if the humanoid is walking at any speed
17
+ :::
18
+
19
+ @return Observable<number>
20
+ ]=]
21
+ function RxHumanoidUtils.observeRunningSpeed(humanoid: Humanoid): Observable.Observable<number>
22
+ assert(typeof(humanoid) == "Instance" and humanoid:IsA("Humanoid"), "No humanoid")
23
+
24
+ return Observable.new(function(sub)
25
+ local maid = Maid.new()
26
+
27
+ local lastRunningSpeed = nil
28
+
29
+ local function emitRunningSpeed(speed: number)
30
+ if lastRunningSpeed ~= speed then
31
+ lastRunningSpeed = speed
32
+ sub:Fire(speed)
33
+ end
34
+ end
35
+
36
+ maid:GiveTask(humanoid.Running:Connect(function(speed)
37
+ emitRunningSpeed(speed)
38
+ end))
39
+
40
+ maid:GiveTask(humanoid.Swimming:Connect(function()
41
+ emitRunningSpeed(0)
42
+ end))
43
+
44
+ maid:GiveTask(humanoid.Jumping:Connect(function()
45
+ emitRunningSpeed(0)
46
+ end))
47
+
48
+ maid:GiveTask(humanoid.FreeFalling:Connect(function()
49
+ emitRunningSpeed(0)
50
+ end))
51
+
52
+ maid:GiveTask(humanoid.Seated:Connect(function()
53
+ emitRunningSpeed(0)
54
+ end))
55
+
56
+ if not lastRunningSpeed then
57
+ emitRunningSpeed(0)
58
+ end
59
+
60
+ return maid
61
+ end)
62
+ end
63
+
64
+ return RxHumanoidUtils
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "node_modules",
3
+ "globIgnorePaths": [ "**/.package-lock.json" ],
4
+ "tree": {
5
+ "$path": { "optional": "../node_modules" }
6
+ }
7
+ }