@quenty/idleservice 13.51.1 → 13.53.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 -0
- package/package.json +3 -3
- package/src/Client/IdleServiceClient.lua +45 -25
- package/src/Server/IdleService.lua +10 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.53.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/idleservice@13.52.0...@quenty/idleservice@13.53.0) (2026-07-14)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **idleservice:** convert package to --!strict ([cf9f304](https://github.com/Quenty/NevermoreEngine/commit/cf9f304a7588231c711816ddf8ef7f9c3f9bc468))
|
|
11
|
+
|
|
12
|
+
# [13.52.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/idleservice@13.51.1...@quenty/idleservice@13.52.0) (2026-07-12)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @quenty/idleservice
|
|
15
|
+
|
|
6
16
|
## [13.51.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/idleservice@13.51.0...@quenty/idleservice@13.51.1) (2026-06-05)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @quenty/idleservice
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/idleservice",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.53.0",
|
|
4
4
|
"description": "Helps track whether or not a player is idle and if so, then can show UI or other cute things.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@quenty/humanoidtracker": "13.31.1",
|
|
35
35
|
"@quenty/loader": "10.11.0",
|
|
36
36
|
"@quenty/maid": "3.9.0",
|
|
37
|
-
"@quenty/ragdoll": "15.
|
|
37
|
+
"@quenty/ragdoll": "15.53.0",
|
|
38
38
|
"@quenty/rx": "13.28.3",
|
|
39
39
|
"@quenty/servicebag": "11.18.1",
|
|
40
40
|
"@quenty/signal": "7.13.1",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "13f0162f4971a77378e55e9b7236aea94f0dd3a8"
|
|
49
49
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Helps track whether or not a player is idle and if so, then can show UI or other cute things.
|
|
4
4
|
|
|
@@ -12,6 +12,7 @@ local RunService = game:GetService("RunService")
|
|
|
12
12
|
local VRService = game:GetService("VRService")
|
|
13
13
|
|
|
14
14
|
local Maid = require("Maid")
|
|
15
|
+
local Observable = require("Observable")
|
|
15
16
|
local RagdollClient = require("RagdollClient")
|
|
16
17
|
local Rx = require("Rx")
|
|
17
18
|
local ServiceBag = require("ServiceBag")
|
|
@@ -21,6 +22,21 @@ local ValueObject = require("ValueObject")
|
|
|
21
22
|
local IdleServiceClient = {}
|
|
22
23
|
IdleServiceClient.ServiceName = "IdleServiceClient"
|
|
23
24
|
|
|
25
|
+
export type IdleServiceClient = typeof(setmetatable(
|
|
26
|
+
{} :: {
|
|
27
|
+
_maid: Maid.Maid,
|
|
28
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
29
|
+
_ragdollBinder: any,
|
|
30
|
+
_humanoidTracker: any,
|
|
31
|
+
_disableStack: StateStack.StateStack<boolean>,
|
|
32
|
+
_enabled: ValueObject.ValueObject<boolean>,
|
|
33
|
+
_showIdleUI: ValueObject.ValueObject<boolean>,
|
|
34
|
+
_humanoidIdle: ValueObject.ValueObject<boolean>,
|
|
35
|
+
_lastPosition: ValueObject.ValueObject<Vector3?>,
|
|
36
|
+
},
|
|
37
|
+
{} :: typeof({ __index = IdleServiceClient })
|
|
38
|
+
))
|
|
39
|
+
|
|
24
40
|
local STANDING_TIME_REQUIRED = 0.5
|
|
25
41
|
local MOVE_DISTANCE_REQUIRED = 2.5
|
|
26
42
|
|
|
@@ -28,8 +44,8 @@ local MOVE_DISTANCE_REQUIRED = 2.5
|
|
|
28
44
|
Initializes the idle service on the client. Should be done via [ServiceBag].
|
|
29
45
|
@param serviceBag ServiceBag
|
|
30
46
|
]=]
|
|
31
|
-
function IdleServiceClient
|
|
32
|
-
assert(not self._maid, "Already initialized")
|
|
47
|
+
function IdleServiceClient.Init(self: IdleServiceClient, serviceBag: ServiceBag.ServiceBag): ()
|
|
48
|
+
assert(not (self :: any)._maid, "Already initialized")
|
|
33
49
|
|
|
34
50
|
self._maid = Maid.new()
|
|
35
51
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
@@ -51,7 +67,7 @@ end
|
|
|
51
67
|
--[=[
|
|
52
68
|
Starts idle service on the client. Should be done via [ServiceBag].
|
|
53
69
|
]=]
|
|
54
|
-
function IdleServiceClient
|
|
70
|
+
function IdleServiceClient.Start(self: IdleServiceClient): ()
|
|
55
71
|
self._maid:GiveTask(self._humanoidIdle.Changed:Connect(function()
|
|
56
72
|
self:_updateShowIdleUI()
|
|
57
73
|
end))
|
|
@@ -59,7 +75,7 @@ function IdleServiceClient:Start()
|
|
|
59
75
|
self:_updateShowIdleUI()
|
|
60
76
|
end))
|
|
61
77
|
|
|
62
|
-
self._humanoidTracker = self._serviceBag:GetService(require("HumanoidTrackerService")):GetHumanoidTracker()
|
|
78
|
+
self._humanoidTracker = (self._serviceBag:GetService(require("HumanoidTrackerService")) :: any):GetHumanoidTracker()
|
|
63
79
|
if self._humanoidTracker then
|
|
64
80
|
self._maid:GiveTask(self._humanoidTracker.AliveHumanoid.Changed:Connect(function(...)
|
|
65
81
|
self:_handleAliveHumanoidChanged(...)
|
|
@@ -82,26 +98,30 @@ end
|
|
|
82
98
|
|
|
83
99
|
@return Observable
|
|
84
100
|
]=]
|
|
85
|
-
function IdleServiceClient
|
|
101
|
+
function IdleServiceClient.ObserveHumanoidMoveFromCurrentPosition(
|
|
102
|
+
self: IdleServiceClient,
|
|
103
|
+
minimumTimeVisible: number
|
|
104
|
+
): Observable.Observable<Vector3?>
|
|
86
105
|
assert(type(minimumTimeVisible) == "number", "Bad minimumTimeVisible")
|
|
87
106
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
107
|
+
local rx = Rx :: any
|
|
108
|
+
return rx.of(true):Pipe({
|
|
109
|
+
rx.delay(minimumTimeVisible),
|
|
110
|
+
rx.flatMap(function()
|
|
91
111
|
return self._lastPosition:Observe()
|
|
92
112
|
end),
|
|
93
|
-
|
|
113
|
+
rx.where(function(value)
|
|
94
114
|
return value ~= nil
|
|
95
115
|
end),
|
|
96
|
-
|
|
97
|
-
|
|
116
|
+
rx.first(),
|
|
117
|
+
rx.flatMap(function(initialPosition: any)
|
|
98
118
|
return self._lastPosition:Observe():Pipe({
|
|
99
|
-
|
|
119
|
+
rx.where(function(position)
|
|
100
120
|
return position == nil or (initialPosition - position).magnitude >= MOVE_DISTANCE_REQUIRED
|
|
101
121
|
end),
|
|
102
122
|
})
|
|
103
123
|
end),
|
|
104
|
-
|
|
124
|
+
rx.first(),
|
|
105
125
|
})
|
|
106
126
|
end
|
|
107
127
|
|
|
@@ -109,7 +129,7 @@ end
|
|
|
109
129
|
Returns whether the humanoid is idle.
|
|
110
130
|
@return boolean
|
|
111
131
|
]=]
|
|
112
|
-
function IdleServiceClient
|
|
132
|
+
function IdleServiceClient.IsHumanoidIdle(self: IdleServiceClient): boolean
|
|
113
133
|
return self._humanoidIdle.Value
|
|
114
134
|
end
|
|
115
135
|
|
|
@@ -117,7 +137,7 @@ end
|
|
|
117
137
|
Returns whether the humanoid is idle.
|
|
118
138
|
@return boolean
|
|
119
139
|
]=]
|
|
120
|
-
function IdleServiceClient
|
|
140
|
+
function IdleServiceClient.IsMoving(self: IdleServiceClient): boolean
|
|
121
141
|
return not self._humanoidIdle.Value
|
|
122
142
|
end
|
|
123
143
|
|
|
@@ -125,7 +145,7 @@ end
|
|
|
125
145
|
Observes if the humanoid is idle.
|
|
126
146
|
@return Observable<boolean>
|
|
127
147
|
]=]
|
|
128
|
-
function IdleServiceClient
|
|
148
|
+
function IdleServiceClient.ObserveHumanoidIdle(self: IdleServiceClient): Observable.Observable<boolean>
|
|
129
149
|
return self._humanoidIdle:Observe()
|
|
130
150
|
end
|
|
131
151
|
|
|
@@ -133,7 +153,7 @@ end
|
|
|
133
153
|
Returns whether UI should be shown (if the humanoid is idle)
|
|
134
154
|
@return boolean
|
|
135
155
|
]=]
|
|
136
|
-
function IdleServiceClient
|
|
156
|
+
function IdleServiceClient.DoShowIdleUI(self: IdleServiceClient): boolean
|
|
137
157
|
return self._showIdleUI.Value
|
|
138
158
|
end
|
|
139
159
|
|
|
@@ -141,7 +161,7 @@ end
|
|
|
141
161
|
Observes whether to show the idle UI
|
|
142
162
|
@return Observable<boolean>
|
|
143
163
|
]=]
|
|
144
|
-
function IdleServiceClient
|
|
164
|
+
function IdleServiceClient.ObserveShowIdleUI(self: IdleServiceClient): Observable.Observable<boolean>
|
|
145
165
|
return self._showIdleUI:Observe()
|
|
146
166
|
end
|
|
147
167
|
|
|
@@ -149,7 +169,7 @@ end
|
|
|
149
169
|
Returns a show idle bool value.
|
|
150
170
|
@return BoolValue
|
|
151
171
|
]=]
|
|
152
|
-
function IdleServiceClient
|
|
172
|
+
function IdleServiceClient.GetShowIdleUIBoolValue(self: IdleServiceClient): ValueObject.ValueObject<boolean>
|
|
153
173
|
assert(self._showIdleUI, "Not initialized")
|
|
154
174
|
|
|
155
175
|
return self._showIdleUI
|
|
@@ -159,7 +179,7 @@ end
|
|
|
159
179
|
Pushes a disabling function that disables idle UI
|
|
160
180
|
@return boolean
|
|
161
181
|
]=]
|
|
162
|
-
function IdleServiceClient
|
|
182
|
+
function IdleServiceClient.PushDisable(self: IdleServiceClient): () -> ()
|
|
163
183
|
if not RunService:IsRunning() then
|
|
164
184
|
return function() end
|
|
165
185
|
end
|
|
@@ -168,16 +188,16 @@ function IdleServiceClient:PushDisable()
|
|
|
168
188
|
return self._disableStack:PushState(true)
|
|
169
189
|
end
|
|
170
190
|
|
|
171
|
-
function IdleServiceClient
|
|
191
|
+
function IdleServiceClient._setEnabled(self: IdleServiceClient, enabled: boolean): ()
|
|
172
192
|
assert(type(enabled) == "boolean", "Bad enabled")
|
|
173
193
|
self._enabled.Value = enabled
|
|
174
194
|
end
|
|
175
195
|
|
|
176
|
-
function IdleServiceClient
|
|
196
|
+
function IdleServiceClient._updateShowIdleUI(self: IdleServiceClient): ()
|
|
177
197
|
self._showIdleUI.Value = self._humanoidIdle.Value and self._enabled.Value and not VRService.VREnabled
|
|
178
198
|
end
|
|
179
199
|
|
|
180
|
-
function IdleServiceClient
|
|
200
|
+
function IdleServiceClient._handleAliveHumanoidChanged(self: IdleServiceClient): ()
|
|
181
201
|
local humanoid = self._humanoidTracker.AliveHumanoid.Value
|
|
182
202
|
if not humanoid then
|
|
183
203
|
self._maid._humanoidMaid = nil
|
|
@@ -226,7 +246,7 @@ function IdleServiceClient:_handleAliveHumanoidChanged()
|
|
|
226
246
|
self._maid._humanoidMaid = maid
|
|
227
247
|
end
|
|
228
248
|
|
|
229
|
-
function IdleServiceClient
|
|
249
|
+
function IdleServiceClient.Destroy(self: IdleServiceClient): ()
|
|
230
250
|
self._maid:DoCleaning()
|
|
231
251
|
end
|
|
232
252
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
@class IdleService
|
|
4
4
|
]=]
|
|
@@ -10,8 +10,15 @@ local ServiceBag = require("ServiceBag")
|
|
|
10
10
|
local IdleService = {}
|
|
11
11
|
IdleService.ServiceName = "IdleService"
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
export type IdleService = typeof(setmetatable(
|
|
14
|
+
{} :: {
|
|
15
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
16
|
+
},
|
|
17
|
+
{} :: typeof({ __index = IdleService })
|
|
18
|
+
))
|
|
19
|
+
|
|
20
|
+
function IdleService.Init(self: IdleService, serviceBag: ServiceBag.ServiceBag): ()
|
|
21
|
+
assert(not (self :: any)._serviceBag, "Already initialized")
|
|
15
22
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
16
23
|
|
|
17
24
|
self._serviceBag:GetService(require("RagdollService"))
|