@quenty/cmdrservice 3.4.0 → 3.5.1-canary.8533eea.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
+ ## [3.5.1-canary.8533eea.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/cmdrservice@3.5.0...@quenty/cmdrservice@3.5.1-canary.8533eea.0) (2021-12-18)
7
+
8
+ **Note:** Version bump only for package @quenty/cmdrservice
9
+
10
+
11
+
12
+
13
+
14
+ # [3.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/cmdrservice@3.4.0...@quenty/cmdrservice@3.5.0) (2021-12-09)
15
+
16
+
17
+ ### Features
18
+
19
+ * CmdrService allows access to cmdr via /cmdr for mobile access ([ee9e233](https://github.com/Quenty/NevermoreEngine/commit/ee9e233862805bcbfc8c3c0a2698f405ba8c65cc))
20
+
21
+
22
+
23
+
24
+
6
25
  # [3.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/cmdrservice@3.3.1...@quenty/cmdrservice@3.4.0) (2021-12-05)
7
26
 
8
27
 
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014 Quenty
3
+ Copyright (c) 2014-2021 Quenty
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/cmdrservice",
3
- "version": "3.4.0",
3
+ "version": "3.5.1-canary.8533eea.0",
4
4
  "description": "Bridge between cmdr and Nevermore services using servicebag",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,12 +25,12 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/loader": "^3.1.1",
29
- "@quenty/permissionprovider": "^4.3.1",
30
- "@quenty/promise": "^3.2.0",
31
- "@quenty/remoting": "^3.2.0",
32
- "@quenty/servicebag": "^3.2.1",
33
- "@quenty/templateprovider": "^3.4.0"
28
+ "@quenty/loader": "3.1.1",
29
+ "@quenty/permissionprovider": "4.3.2-canary.8533eea.0",
30
+ "@quenty/promise": "3.2.1-canary.8533eea.0",
31
+ "@quenty/remoting": "3.2.1-canary.8533eea.0",
32
+ "@quenty/servicebag": "3.2.1",
33
+ "@quenty/templateprovider": "3.4.1-canary.8533eea.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@quentystudios/cmdr": "^1.8.4-quenty.1"
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "1c4c7e66fb0c7c611aecfa633d9531a0b2f715b2"
41
+ "gitHead": "8533eeade3bf6835c0295785c1c326b9abee3222"
42
42
  }
@@ -1,24 +1,31 @@
1
- ---
1
+ --- Loads cmdr on the client
2
2
  -- @module CmdrServiceClient
3
3
  -- @author Quenty
4
4
 
5
5
  local require = require(script.Parent.loader).load(script)
6
6
 
7
7
  local ReplicatedStorage = game:GetService("ReplicatedStorage")
8
+ local Players = game:GetService("Players")
8
9
 
9
10
  local promiseChild = require("promiseChild")
10
11
  local PromiseUtils = require("PromiseUtils")
11
12
  local PermissionServiceClient = require("PermissionServiceClient")
13
+ local Maid = require("Maid")
14
+ local String = require("String")
12
15
 
13
16
  local CmdrServiceClient = {}
14
17
 
15
18
  function CmdrServiceClient:Init(serviceBag)
16
- assert(serviceBag, "No serviceBag")
19
+ assert(not self._serviceBag, "Already initialized")
20
+ self._serviceBag = assert(serviceBag, "No serviceBag")
17
21
 
22
+ self._maid = Maid.new()
18
23
  self._permissionService = serviceBag:GetService(PermissionServiceClient)
19
24
  end
20
25
 
21
26
  function CmdrServiceClient:Start()
27
+ assert(self._serviceBag, "Not initialized")
28
+
22
29
  PromiseUtils.all({
23
30
  self:PromiseCmdr(),
24
31
  self._permissionService:PromisePermissionProvider()
@@ -28,18 +35,31 @@ function CmdrServiceClient:Start()
28
35
  })
29
36
  :Then(function(cmdr, isAdmin)
30
37
  if isAdmin then
31
- cmdr:SetActivationUnlocksMouse(true)
32
- cmdr:SetActivationKeys({ Enum.KeyCode.F2 })
33
-
34
- -- Default blink for debugging purposes
35
- cmdr.Dispatcher:Run("bind", Enum.KeyCode.G.Name, "blink")
38
+ self:_setBindings(cmdr)
36
39
  else
37
40
  cmdr:SetActivationKeys({})
38
41
  end
39
42
  end)
40
43
  end
41
44
 
45
+ function CmdrServiceClient:_setBindings(cmdr)
46
+ cmdr:SetActivationUnlocksMouse(true)
47
+ cmdr:SetActivationKeys({ Enum.KeyCode.F2 })
48
+
49
+ -- enable activation on mobile
50
+ self._maid:GiveTask(Players.LocalPlayer.Chatted:Connect(function(chat)
51
+ if String.startsWith(chat, "/cmdr") then
52
+ cmdr:Show()
53
+ end
54
+ end))
55
+
56
+ -- Default blink for debugging purposes
57
+ cmdr.Dispatcher:Run("bind", Enum.KeyCode.G.Name, "blink")
58
+ end
59
+
42
60
  function CmdrServiceClient:PromiseCmdr()
61
+ assert(self._serviceBag, "Not initialized")
62
+
43
63
  if self._cmdrPromise then
44
64
  return self._cmdrPromise
45
65
  end