@quenty/teamutils 10.15.0 → 10.15.1-canary.534.c6c59e8.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
+ ## [10.15.1-canary.534.c6c59e8.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/teamutils@10.15.0...@quenty/teamutils@10.15.1-canary.534.c6c59e8.0) (2025-02-18)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add RxTeamUtils.observePlayerTeam(player) and RxTeamUtils.observePlayerTeamColor(player) ([046d6cd](https://github.com/Quenty/NevermoreEngine/commit/046d6cd192234c7165a1b4820aa68efad484ce4c))
12
+
13
+
14
+
15
+
16
+
6
17
  # [10.15.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/teamutils@10.14.0...@quenty/teamutils@10.15.0) (2024-12-15)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/teamutils
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/teamutils",
3
- "version": "10.15.0",
3
+ "version": "10.15.1-canary.534.c6c59e8.0",
4
4
  "description": "Team utility methods",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,11 +28,11 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@quenty/brio": "^14.15.0",
32
- "@quenty/instanceutils": "^13.15.0",
33
- "@quenty/loader": "^10.7.1",
34
- "@quenty/maid": "^3.4.0",
35
- "@quenty/rx": "^13.15.0"
31
+ "@quenty/brio": "14.15.1-canary.534.c6c59e8.0",
32
+ "@quenty/instanceutils": "13.15.1-canary.534.c6c59e8.0",
33
+ "@quenty/loader": "10.7.2-canary.534.c6c59e8.0",
34
+ "@quenty/maid": "3.4.0",
35
+ "@quenty/rx": "13.15.1-canary.534.c6c59e8.0"
36
36
  },
37
- "gitHead": "0a20ace4dc7d38f8c889bf73b716b33e8a767c54"
37
+ "gitHead": "c6c59e8e4b98466955aafe50473027d316ab4ac7"
38
38
  }
@@ -12,9 +12,38 @@ local Observable = require("Observable")
12
12
  local Maid = require("Maid")
13
13
  local Brio = require("Brio")
14
14
  local RxBrioUtils = require("RxBrioUtils")
15
+ local RxInstanceUtils = require("RxInstanceUtils")
16
+ local Rx = require("Rx")
15
17
 
16
18
  local RxTeamUtils = {}
17
19
 
20
+ function RxTeamUtils.observePlayerTeam(player)
21
+ return Rx.combineLatest({
22
+ team = RxInstanceUtils.observeProperty(player, "Team");
23
+ neutral = RxInstanceUtils.observeProperty(player, "Neutral")
24
+ }):Pipe({
25
+ Rx.map(function(state)
26
+ if state.neutral then
27
+ return nil
28
+ end
29
+
30
+ return state.team
31
+ end)
32
+ })
33
+ end
34
+
35
+ function RxTeamUtils.observePlayerTeamColor(player)
36
+ return RxTeamUtils.observePlayerTeam(player):Pipe({
37
+ Rx.switchMap(function(team)
38
+ if team then
39
+ return RxInstanceUtils.observeProperty(team, "TeamColor")
40
+ else
41
+ return Rx.of(nil)
42
+ end
43
+ end)
44
+ })
45
+ end
46
+
18
47
  --[=[
19
48
  Observes all players on a taem.
20
49
 
@@ -6,13 +6,21 @@
6
6
  local TeamUtils = {}
7
7
 
8
8
  function TeamUtils.areTeamMates(playerA, playerB)
9
- if playerA.Neutral or playerB.Neutral then
9
+ local teamA = TeamUtils.getTeam(playerA)
10
+ local teamB = TeamUtils.getTeam(playerB)
11
+ if not teamA or not teamB then
10
12
  return false
11
13
  end
12
- if not playerA.Team or not playerB.Team then
13
- return false
14
+
15
+ return teamA == teamB
16
+ end
17
+
18
+ function TeamUtils.getTeam(player)
19
+ if player.Neutral then
20
+ return nil
14
21
  end
15
- return playerA.Team == playerB.Team
22
+
23
+ return player.Team
16
24
  end
17
25
 
18
26
  return TeamUtils