@quenty/friendutils 12.38.1 → 12.39.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 +6 -0
- package/package.json +3 -2
- package/src/Shared/RxFriendUtils.lua +34 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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
|
+
# [12.39.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/friendutils@12.38.1...@quenty/friendutils@12.39.0) (2026-08-24)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- Retry on GetCore failure ([c8a595a](https://github.com/Quenty/NevermoreEngine/commit/c8a595a01876ff9324f81a4790ea478086740d2a))
|
|
11
|
+
|
|
6
12
|
## [12.38.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/friendutils@12.38.0...@quenty/friendutils@12.38.1) (2026-08-14)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @quenty/friendutils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/friendutils",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.39.0",
|
|
4
4
|
"description": "Utlity functions to help find friends of a user. Also contains utility to make testing in studio easier.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@quenty/brio": "14.35.2",
|
|
32
|
+
"@quenty/coreguiutils": "10.24.0",
|
|
32
33
|
"@quenty/loader": "10.11.1",
|
|
33
34
|
"@quenty/maid": "3.11.1",
|
|
34
35
|
"@quenty/nevermore-test-runner": "1.5.1",
|
|
@@ -41,5 +42,5 @@
|
|
|
41
42
|
"publishConfig": {
|
|
42
43
|
"access": "public"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "eb9bb06284b3e3ec4140eedadc54cfe2296a52e1"
|
|
45
46
|
}
|
|
@@ -10,13 +10,16 @@ local require = require(script.Parent.loader).load(script)
|
|
|
10
10
|
local CollectionService = game:GetService("CollectionService")
|
|
11
11
|
local Players = game:GetService("Players")
|
|
12
12
|
local RunService = game:GetService("RunService")
|
|
13
|
-
local StarterGui = game:GetService("StarterGui")
|
|
14
13
|
|
|
15
14
|
local Brio = require("Brio")
|
|
15
|
+
local CoreGuiUtils = require("CoreGuiUtils")
|
|
16
16
|
local Maid = require("Maid")
|
|
17
17
|
local Observable = require("Observable")
|
|
18
18
|
local PlayerMock = require("PlayerMock")
|
|
19
19
|
|
|
20
|
+
local MAX_GET_CORE_ATTEMPTS = 5
|
|
21
|
+
local GET_CORE_INITIAL_WAIT_TIME = 0.5
|
|
22
|
+
|
|
20
23
|
local RxFriendUtils = {}
|
|
21
24
|
|
|
22
25
|
local function getUserId(player: Player): number
|
|
@@ -157,17 +160,39 @@ function RxFriendUtils.observeFriendsInServerAsBrios(player: Player?): Observabl
|
|
|
157
160
|
-- Handle changes for players already in this server.
|
|
158
161
|
-- There's a non-zero chance these get removed someday... :(
|
|
159
162
|
-- https://devforum.roblox.com/t/playerfriendedevent-was-deleted-from-corescripts/696683
|
|
160
|
-
-- So just incase these connections throw,
|
|
163
|
+
-- So just incase these connections throw, retrieve them off-thread so we don't error out the whole observable.
|
|
161
164
|
-- Only allow this while the game is running too
|
|
162
165
|
if observedPlayer == Players.LocalPlayer and RunService:IsRunning() then
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
maid:GiveTask(StarterGui:GetCore("PlayerUnfriendedEvent").Event:Connect(function(otherPlayer: Player)
|
|
168
|
-
handleFriendState(otherPlayer, false)
|
|
169
|
-
end))
|
|
166
|
+
-- Getting the core yields, so the subscription may be cleaned up before it resolves.
|
|
167
|
+
local cancelled = false
|
|
168
|
+
maid:GiveTask(function()
|
|
169
|
+
cancelled = true
|
|
170
170
|
end)
|
|
171
|
+
|
|
172
|
+
local function connectCoreEvent(coreName: string, isFriendsWith: boolean)
|
|
173
|
+
local promise = maid:GivePromise(
|
|
174
|
+
CoreGuiUtils.promiseRetryGetCore(MAX_GET_CORE_ATTEMPTS, GET_CORE_INITIAL_WAIT_TIME, coreName)
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
promise:Then(function(coreEvent)
|
|
178
|
+
if cancelled then
|
|
179
|
+
return
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
maid:GiveTask(coreEvent.Event:Connect(function(otherPlayer: Player)
|
|
183
|
+
handleFriendState(otherPlayer, isFriendsWith)
|
|
184
|
+
end))
|
|
185
|
+
end, function(err)
|
|
186
|
+
if cancelled then
|
|
187
|
+
return
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
warn(`[RxFriendUtils] Couldn't get core {coreName}: {tostring(err)}`)
|
|
191
|
+
end)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
connectCoreEvent("PlayerFriendedEvent", true)
|
|
195
|
+
connectCoreEvent("PlayerUnfriendedEvent", false)
|
|
171
196
|
end
|
|
172
197
|
|
|
173
198
|
return maid
|