@quenty/spawning 10.0.0 → 10.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 +8 -0
- package/package.json +8 -8
- package/src/Server/SpawnService.lua +12 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
# [10.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/spawning@10.0.0...@quenty/spawning@10.1.0) (2024-03-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/spawning
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [10.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/spawning@9.0.0...@quenty/spawning@10.0.0) (2024-02-14)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @quenty/spawning
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/spawning",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Centralized spawning system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
"Quenty"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@quenty/binder": "^14.
|
|
28
|
-
"@quenty/cmdrservice": "^13.
|
|
29
|
-
"@quenty/loader": "^10.
|
|
30
|
-
"@quenty/maid": "^3.
|
|
31
|
-
"@quenty/randomutils": "^6.
|
|
32
|
-
"@quenty/servicebag": "^11.
|
|
27
|
+
"@quenty/binder": "^14.1.0",
|
|
28
|
+
"@quenty/cmdrservice": "^13.1.0",
|
|
29
|
+
"@quenty/loader": "^10.1.0",
|
|
30
|
+
"@quenty/maid": "^3.1.0",
|
|
31
|
+
"@quenty/randomutils": "^6.1.0",
|
|
32
|
+
"@quenty/servicebag": "^11.1.0",
|
|
33
33
|
"@quentystudios/t": "^3.0.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "e0148dde5ca3864389a0faa2da66153a776acc1e"
|
|
39
39
|
}
|
|
@@ -32,12 +32,12 @@ function SpawnService:Init(serviceBag)
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
function SpawnService:Start()
|
|
35
|
-
local lastUpdateTime = (
|
|
35
|
+
local lastUpdateTime = (os.clock() - UPDATE_PERIOD_SEC + SPAWN_AFTER_GAME_START)
|
|
36
36
|
|
|
37
37
|
-- TODO: Smear across update pipeline
|
|
38
38
|
self._maid:GiveTask(RunService.Stepped:Connect(function()
|
|
39
|
-
if (lastUpdateTime + UPDATE_PERIOD_SEC) <=
|
|
40
|
-
lastUpdateTime =
|
|
39
|
+
if (lastUpdateTime + UPDATE_PERIOD_SEC) <= os.clock() then
|
|
40
|
+
lastUpdateTime = os.clock()
|
|
41
41
|
self:Update()
|
|
42
42
|
end
|
|
43
43
|
end))
|
|
@@ -48,7 +48,7 @@ function SpawnService:AddSpawnerBinder(spawnerBinder)
|
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
function SpawnService:Regenerate()
|
|
51
|
-
local startTime =
|
|
51
|
+
local startTime = os.clock()
|
|
52
52
|
|
|
53
53
|
for _, binder in pairs(self._spawnBinderGroupsServer.Spawners:GetBinders()) do
|
|
54
54
|
for _, spawner in pairs(binder:GetAll()) do
|
|
@@ -56,29 +56,28 @@ function SpawnService:Regenerate()
|
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
if (
|
|
60
|
-
warn(("SpawnService regenerate time: %0.4f ms"
|
|
59
|
+
if (os.clock() - startTime) >= 0.05 then
|
|
60
|
+
warn(string.format("SpawnService regenerate time: %0.4f ms", (os.clock() - startTime)*1000))
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
function SpawnService:Update()
|
|
65
65
|
debug.profilebegin("spawnService")
|
|
66
66
|
|
|
67
|
-
local startTime =
|
|
67
|
+
local startTime = os.clock()
|
|
68
68
|
local spawnerCount = 0
|
|
69
69
|
|
|
70
70
|
for _, binder in pairs(self._spawnBinderGroupsServer.Spawners:GetBinders()) do
|
|
71
|
-
local classStartTime =
|
|
71
|
+
local classStartTime = os.clock()
|
|
72
72
|
local classes = RandomUtils.shuffledCopy(binder:GetAll())
|
|
73
73
|
|
|
74
74
|
for _, spawner in pairs(classes) do
|
|
75
75
|
spawnerCount = spawnerCount + 1
|
|
76
76
|
spawner:SpawnUpdate(false)
|
|
77
77
|
|
|
78
|
-
if (
|
|
78
|
+
if (os.clock() - classStartTime) >= MAX_BUDGET_PER_CLASS then
|
|
79
79
|
if WARN_ON_CLASS_BUDGET_EXHAUST then
|
|
80
|
-
warn(("[SpawnService.Update] - Class %q ran out of execution budget at %0.4f ms")
|
|
81
|
-
:format(binder:GetTag(), (tick() - classStartTime)*1000))
|
|
80
|
+
warn(string.format("[SpawnService.Update] - Class %q ran out of execution budget at %0.4f ms", binder:GetTag(), (os.clock() - classStartTime)*1000))
|
|
82
81
|
end
|
|
83
82
|
break
|
|
84
83
|
end
|
|
@@ -86,9 +85,8 @@ function SpawnService:Update()
|
|
|
86
85
|
end
|
|
87
86
|
|
|
88
87
|
-- watch dog
|
|
89
|
-
if (
|
|
90
|
-
warn(("[SpawnService.Update] - Update time: %0.4f ms for %d spawners")
|
|
91
|
-
:format((tick() - startTime)*1000, spawnerCount))
|
|
88
|
+
if (os.clock() - startTime) >= TOTAL_BUDGET_BEFORE_WARN then
|
|
89
|
+
warn(string.format("[SpawnService.Update] - Update time: %0.4f ms for %d spawners", (os.clock() - startTime)*1000, spawnerCount))
|
|
92
90
|
end
|
|
93
91
|
|
|
94
92
|
debug.profileend()
|