@quenty/playerhumanoidbinder 9.4.0 → 10.0.0-canary.c90a5c7.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,12 +3,9 @@
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
- # [9.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerhumanoidbinder@9.3.0...@quenty/playerhumanoidbinder@9.4.0) (2024-01-08)
6
+ # [10.0.0-canary.c90a5c7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerhumanoidbinder@9.3.0...@quenty/playerhumanoidbinder@10.0.0-canary.c90a5c7.0) (2024-01-08)
7
7
 
8
-
9
- ### Features
10
-
11
- * Use new HumanoidTrackerService ([0eee429](https://github.com/Quenty/NevermoreEngine/commit/0eee4290ca3894cefdcb86331f0531c3be65cbce))
8
+ **Note:** Version bump only for package @quenty/playerhumanoidbinder
12
9
 
13
10
 
14
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/playerhumanoidbinder",
3
- "version": "9.4.0",
3
+ "version": "10.0.0-canary.c90a5c7.0",
4
4
  "description": "Binder that will automatically bind to each player's humanoid",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,14 +25,14 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/binder": "^9.4.0",
29
- "@quenty/humanoidtracker": "^8.4.0",
30
- "@quenty/loader": "^7.3.0",
31
- "@quenty/maid": "^2.6.0",
32
- "@quenty/valueobject": "^8.4.0"
28
+ "@quenty/binder": "10.0.0-canary.c90a5c7.0",
29
+ "@quenty/humanoidtracker": "9.0.0-canary.c90a5c7.0",
30
+ "@quenty/loader": "8.0.0-canary.c90a5c7.0",
31
+ "@quenty/maid": "2.6.0",
32
+ "@quenty/valueobject": "9.0.0-canary.c90a5c7.0"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "075fb03a03f12ade8758f667767ba738204e0c4b"
37
+ "gitHead": "c90a5c74ac7045804ba6018fc3424e406d13f21a"
38
38
  }
@@ -9,8 +9,8 @@ local Players = game:GetService("Players")
9
9
 
10
10
  local Binder = require("Binder")
11
11
  local Maid = require("Maid")
12
+ local HumanoidTracker = require("HumanoidTracker")
12
13
  local ValueObject = require("ValueObject")
13
- local HumanoidTrackerService = require("HumanoidTrackerService")
14
14
 
15
15
  local PlayerHumanoidBinder = setmetatable({}, Binder)
16
16
  PlayerHumanoidBinder.ClassName = "PlayerHumanoidBinder"
@@ -33,15 +33,10 @@ end
33
33
  Inits the binder. See [Binder.Init].
34
34
  Should be done via a [ServiceBag].
35
35
 
36
- @param serviceBag ServiceBag
37
36
  @param ... any
38
37
  ]=]
39
- function PlayerHumanoidBinder:Init(serviceBag, ...)
40
- self._serviceBag = assert(serviceBag, "No serviceBag")
41
-
42
- getmetatable(PlayerHumanoidBinder).Init(self, serviceBag, ...)
43
-
44
- self._humanoidTrackerService = self._serviceBag:GetService(HumanoidTrackerService)
38
+ function PlayerHumanoidBinder:Init(...)
39
+ getmetatable(PlayerHumanoidBinder).Init(self, ...)
45
40
 
46
41
  if not self._shouldTag then
47
42
  self._shouldTag = ValueObject.new(true, "boolean")
@@ -94,7 +89,8 @@ function PlayerHumanoidBinder:_bindTagging(doUnbinding)
94
89
  if self._shouldTag.Value then
95
90
  local maid = Maid.new()
96
91
 
97
- local playerMaid = maid:Add(Maid.new())
92
+ local playerMaid = Maid.new()
93
+ maid:GiveTask(playerMaid)
98
94
 
99
95
  maid:GiveTask(Players.PlayerAdded:Connect(function(player)
100
96
  self:_handlePlayerAdded(playerMaid, player)
@@ -127,11 +123,19 @@ function PlayerHumanoidBinder:_handlePlayerAdded(playerMaid, player)
127
123
  local maid = Maid.new()
128
124
 
129
125
  -- TODO: Use HumanoidTrackerService
130
- maid:GiveTask(self._humanoidTrackerService:ObserveHumanoid(player):Subscribe(function(humanoid)
131
- if humanoid then
132
- self:Bind(humanoid)
126
+ local tracker = HumanoidTracker.new(player)
127
+ maid:GiveTask(tracker)
128
+
129
+ local function handleHumanoid(newHumanoid)
130
+ if newHumanoid then
131
+ self:Bind(newHumanoid)
133
132
  end
134
- end))
133
+ end
134
+
135
+ maid:GiveTask(tracker.Humanoid.Changed:Connect(handleHumanoid))
136
+
137
+ -- Bind humanoid
138
+ handleHumanoid(tracker.Humanoid.Value)
135
139
 
136
140
  playerMaid[player] = maid
137
141
  end