@quenty/streamingutils 6.0.1 → 6.1.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 +11 -0
- package/package.json +2 -2
- package/src/Shared/StreamingUtils.lua +25 -1
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
|
+
# [6.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/streamingutils@6.0.1...@quenty/streamingutils@6.1.0) (2022-12-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Fix StreamingUtils failing if streaming is disabled ([2c0d29a](https://github.com/Quenty/NevermoreEngine/commit/2c0d29af66d4f512528ee99cf5bc3e8a81188a96))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [6.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/streamingutils@6.0.0...@quenty/streamingutils@6.0.1) (2022-11-04)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/streamingutils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/streamingutils",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Provides utilities for working with Roblox's streaming system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "a4f99aa40c45080db30be7117cada229572f1574"
|
|
36
36
|
}
|
|
@@ -5,12 +5,30 @@
|
|
|
5
5
|
|
|
6
6
|
local require = require(script.Parent.loader).load(script)
|
|
7
7
|
|
|
8
|
+
local Workspace = game:GetService("Workspace")
|
|
9
|
+
|
|
8
10
|
local Promise = require("Promise")
|
|
9
11
|
|
|
10
12
|
local StreamingUtils = {}
|
|
11
13
|
|
|
12
14
|
--[=[
|
|
13
|
-
Promises to stream the area around the player at the given position.
|
|
15
|
+
Promises to stream the area around the player at the given position. See [Player.RequestStreamAroundAsync]. Can
|
|
16
|
+
be called on both the client and the server.
|
|
17
|
+
|
|
18
|
+
```lua
|
|
19
|
+
StreamingUtils.promiseStreamAround(Players.LocalPlayer, Vector3.new(0, 10, 0), 30)
|
|
20
|
+
:Then(function()
|
|
21
|
+
print("Done streaming")
|
|
22
|
+
end)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Returns a resolved promise if streaming is not enabled as the area is guaranteed to be streamed in already.
|
|
26
|
+
|
|
27
|
+
:::warning
|
|
28
|
+
Requesting streaming around an area is not a guarantee that the content will be present when the request completes,
|
|
29
|
+
as streaming is affected by the client's network bandwidth, memory limitations, and other factors.
|
|
30
|
+
:::
|
|
31
|
+
|
|
14
32
|
@param player Player
|
|
15
33
|
@param position Vector3
|
|
16
34
|
@param timeOut number? -- Optional
|
|
@@ -21,7 +39,13 @@ function StreamingUtils.promiseStreamAround(player, position, timeOut)
|
|
|
21
39
|
assert(typeof(position) == "Vector3", "Bad position")
|
|
22
40
|
assert(type(timeOut) == "number" or timeOut == nil, "Bad timeOut")
|
|
23
41
|
|
|
42
|
+
-- Guaranteed to be streamed in, no need to do anything
|
|
43
|
+
if not Workspace.StreamingEnabled then
|
|
44
|
+
return Promise.resolved()
|
|
45
|
+
end
|
|
46
|
+
|
|
24
47
|
return Promise.spawn(function(resolve, reject)
|
|
48
|
+
|
|
25
49
|
local ok, err = pcall(function()
|
|
26
50
|
player:RequestStreamAroundAsync(position, timeOut)
|
|
27
51
|
end)
|