@quenty/playerinputmode 4.2.1 → 4.3.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,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
+ # [4.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerinputmode@4.2.1...@quenty/playerinputmode@4.3.0) (2023-12-14)
7
+
8
+
9
+ ### Features
10
+
11
+ * Handle not having a local player setup ([544a28b](https://github.com/Quenty/NevermoreEngine/commit/544a28b4c1e10f72e335583bd4e7ef6102a8eb0e))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [4.2.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerinputmode@4.2.0...@quenty/playerinputmode@4.2.1) (2023-10-28)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/playerinputmode
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/playerinputmode",
3
- "version": "4.2.1",
3
+ "version": "4.3.0",
4
4
  "description": "Service that takes active input modes from the player and exposes it to every other player via the server.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -26,18 +26,20 @@
26
26
  "Quenty"
27
27
  ],
28
28
  "dependencies": {
29
- "@quenty/attributeutils": "^9.1.1",
30
- "@quenty/inputmode": "^8.2.1",
31
- "@quenty/loader": "^7.0.0",
29
+ "@quenty/attributeutils": "^9.2.0",
30
+ "@quenty/brio": "^9.2.0",
31
+ "@quenty/inputmode": "^8.3.0",
32
+ "@quenty/loader": "^7.1.0",
32
33
  "@quenty/maid": "^2.6.0",
33
- "@quenty/promise": "^7.0.0",
34
- "@quenty/remoting": "^7.1.1",
35
- "@quenty/rx": "^8.1.1",
36
- "@quenty/servicebag": "^7.0.0",
37
- "@quenty/table": "^3.3.0"
34
+ "@quenty/playerutils": "^3.3.0",
35
+ "@quenty/promise": "^7.1.0",
36
+ "@quenty/remoting": "^7.2.0",
37
+ "@quenty/rx": "^8.2.0",
38
+ "@quenty/servicebag": "^7.1.0",
39
+ "@quenty/table": "^3.4.0"
38
40
  },
39
41
  "publishConfig": {
40
42
  "access": "public"
41
43
  },
42
- "gitHead": "440aca7ce2b50b74317ee05fdc0b8d1e58001af3"
44
+ "gitHead": "2c2dbbc0cb2fbb46b4f3270c559c63890fe18b26"
43
45
  }
@@ -4,8 +4,6 @@
4
4
 
5
5
  local require = require(script.Parent.loader).load(script)
6
6
 
7
- local Players = game:GetService("Players")
8
-
9
7
  local InputModeTypes = require("InputModeTypes")
10
8
  local InputModeTypeSelector = require("InputModeTypeSelector")
11
9
  local Maid = require("Maid")
@@ -14,6 +12,8 @@ local PromiseGetRemoteEvent = require("PromiseGetRemoteEvent")
14
12
  local Rx = require("Rx")
15
13
  local PlayerInputModeUtils = require("PlayerInputModeUtils")
16
14
  local PlayerInputModeTypes = require("PlayerInputModeTypes")
15
+ local RxPlayerUtils = require("RxPlayerUtils")
16
+ local RxBrioUtils = require("RxBrioUtils")
17
17
 
18
18
  local PlayerInputModeServiceClient = {}
19
19
  PlayerInputModeServiceClient.ServiceName = "PlayerInputModeServiceClient"
@@ -36,22 +36,27 @@ function PlayerInputModeServiceClient:Start()
36
36
  self._maid:GiveTask(self._selector)
37
37
 
38
38
  self:_promiseRemoteEvent():Then(function(remoteEvent)
39
- self._maid:GiveTask(self._selector:ObserveActiveInputType():Pipe({
39
+ self._maid:GiveTask(RxBrioUtils.flatCombineLatest({
40
+ activeMode = self._selector:ObserveActiveInputType();
41
+ localPlayer = RxPlayerUtils.observeLocalPlayerBrio();
42
+ }):Pipe({
40
43
  Rx.throttleTime(1, { leading = true; trailing = true });
41
- }):Subscribe(function(activeMode)
44
+ }):Subscribe(function(state)
42
45
  local modeType
43
- if activeMode == InputModeTypes.Gamepads then
46
+ if state.activeMode == InputModeTypes.Gamepads then
44
47
  modeType = PlayerInputModeTypes.GAMEPAD
45
- elseif activeMode == InputModeTypes.Keyboard then
48
+ elseif state.activeMode == InputModeTypes.Keyboard then
46
49
  modeType = PlayerInputModeTypes.KEYBOARD
47
- elseif activeMode == InputModeTypes.Touch then
50
+ elseif state.activeMode == InputModeTypes.Touch then
48
51
  modeType = PlayerInputModeTypes.TOUCH
49
52
  else
50
53
  error("Bad activeMode")
51
54
  end
52
55
 
53
- PlayerInputModeUtils.setPlayerInputModeType(Players.LocalPlayer, modeType)
54
- remoteEvent:FireServer(PlayerInputModeServiceConstants.REQUEST_SET_INPUT_MODE, modeType)
56
+ if state.localPlayer then
57
+ PlayerInputModeUtils.setPlayerInputModeType(state.localPlayer, modeType)
58
+ remoteEvent:FireServer(PlayerInputModeServiceConstants.REQUEST_SET_INPUT_MODE, modeType)
59
+ end
55
60
  end))
56
61
  end)
57
62
  end