@quenty/softshutdown 2.0.1 → 2.2.0-canary.4096cd9.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,25 @@
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.2.0-canary.4096cd9.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/softshutdown@2.1.0...@quenty/softshutdown@2.2.0-canary.4096cd9.0) (2022-09-08)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add BindToCloseService package and implement across places binding to close ([afdd829](https://github.com/Quenty/NevermoreEngine/commit/afdd829538c9d0ce2d6f51ad9fee9063f0f5bd24))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/softshutdown@2.0.1...@quenty/softshutdown@2.1.0) (2022-08-22)
18
+
19
+ **Note:** Version bump only for package @quenty/softshutdown
20
+
21
+
22
+
23
+
24
+
6
25
  ## [2.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/softshutdown@2.0.0...@quenty/softshutdown@2.0.1) (2022-08-16)
7
26
 
8
27
  **Note:** Version bump only for package @quenty/softshutdown
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/softshutdown",
3
- "version": "2.0.1",
3
+ "version": "2.2.0-canary.4096cd9.0",
4
4
  "description": "This service lets you shut down servers without losing a bunch of players. When game.OnClose is called, the script teleports everyone in the server into a reserved server.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -29,22 +29,23 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@quenty/attributeutils": "^7.0.1",
33
- "@quenty/baseobject": "^5.1.1",
34
- "@quenty/basicpane": "^6.0.1",
35
- "@quenty/blend": "^5.0.1",
36
- "@quenty/clienttranslator": "^7.0.1",
37
- "@quenty/datastore": "^6.0.1",
38
- "@quenty/loader": "^5.0.1",
39
- "@quenty/maid": "^2.4.0",
40
- "@quenty/math": "^2.2.0",
41
- "@quenty/promise": "^5.1.1",
42
- "@quenty/rx": "^6.0.1",
43
- "@quenty/servicebag": "^5.1.1",
44
- "@quenty/table": "^3.1.0",
45
- "@quenty/teleportserviceutils": "^2.2.1",
46
- "@quenty/uiobjectutils": "^2.1.0",
47
- "@quenty/valuebaseutils": "^6.0.1"
32
+ "@quenty/attributeutils": "7.2.0-canary.4096cd9.0",
33
+ "@quenty/baseobject": "5.1.1",
34
+ "@quenty/basicpane": "6.2.0-canary.4096cd9.0",
35
+ "@quenty/bindtocloseservice": "1.1.0-canary.4096cd9.0",
36
+ "@quenty/blend": "5.2.0-canary.4096cd9.0",
37
+ "@quenty/clienttranslator": "7.2.0-canary.4096cd9.0",
38
+ "@quenty/datastore": "6.2.0-canary.4096cd9.0",
39
+ "@quenty/loader": "5.0.1",
40
+ "@quenty/maid": "2.4.0",
41
+ "@quenty/math": "2.2.0",
42
+ "@quenty/promise": "5.2.0-canary.4096cd9.0",
43
+ "@quenty/rx": "6.2.0-canary.4096cd9.0",
44
+ "@quenty/servicebag": "5.3.0-canary.4096cd9.0",
45
+ "@quenty/table": "3.1.0",
46
+ "@quenty/teleportserviceutils": "2.3.0-canary.4096cd9.0",
47
+ "@quenty/uiobjectutils": "2.2.0-canary.4096cd9.0",
48
+ "@quenty/valuebaseutils": "6.2.0-canary.4096cd9.0"
48
49
  },
49
- "gitHead": "340ac324c03fb3b844bbbe7ca57ee88874a724c9"
50
+ "gitHead": "4096cd94d2c38d382b7aafe8cb2fcb8bb340d051"
50
51
  }
@@ -26,11 +26,16 @@ local Maid = require("Maid")
26
26
  local Promise = require("Promise")
27
27
  local SoftShutdownConstants = require("SoftShutdownConstants")
28
28
  local TeleportServiceUtils = require("TeleportServiceUtils")
29
+ local BindToCloseService = require("BindToCloseService")
29
30
 
30
31
  local SoftShutdownService = {}
31
32
  SoftShutdownService.ServiceName = "SoftShutdownService"
32
33
 
33
- function SoftShutdownService:Init()
34
+ function SoftShutdownService:Init(serviceBag)
35
+ self._serviceBag = assert(serviceBag, "No serviceBag")
36
+
37
+ self._bindToCloseService = self._serviceBag:GetService(BindToCloseService)
38
+
34
39
  self._dataStore = DataStoreService:GetDataStore("IsSoftShutdownServer")
35
40
  self._maid = Maid.new()
36
41
 
@@ -38,10 +43,9 @@ function SoftShutdownService:Init()
38
43
  if isLobby then
39
44
  self:_promiseRedirectAllPlayers()
40
45
  else
41
- game:BindToClose(function()
42
- local promise = self:_promiseTeleportPlayersToLobby()
43
- promise:Wait()
44
- end)
46
+ self._maid:GiveTask(self._bindToCloseService:RegisterPromiseOnCloseCallback(function()
47
+ return self:_promiseTeleportPlayersToLobby()
48
+ end))
45
49
  end
46
50
  end)
47
51
  end
@@ -57,4 +57,8 @@ local clientScript = script.ClientScript
57
57
  clientScript.Name = "QuentySoftShutdownClientScript"
58
58
  clientScript:Clone().Parent = ReplicatedFirst
59
59
 
60
- require(server.SoftShutdownService):Init()
60
+ local serviceBag = require(server.ServiceBag).new()
61
+ serviceBag:GetService(require(server.SoftShutdownService))
62
+
63
+ serviceBag:Init()
64
+ serviceBag:Start()