@quenty/playerhumanoidbinder 9.3.1-canary.d08dd64.0 → 9.4.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 +5 -2
- package/package.json +7 -7
- package/src/Server/PlayerHumanoidBinder.lua +13 -17
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
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
|
-
|
|
6
|
+
# [9.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerhumanoidbinder@9.3.0...@quenty/playerhumanoidbinder@9.4.0) (2024-01-08)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Use new HumanoidTrackerService ([0eee429](https://github.com/Quenty/NevermoreEngine/commit/0eee4290ca3894cefdcb86331f0531c3be65cbce))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/playerhumanoidbinder",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.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.
|
|
29
|
-
"@quenty/humanoidtracker": "8.
|
|
30
|
-
"@quenty/loader": "7.
|
|
31
|
-
"@quenty/maid": "2.6.0",
|
|
32
|
-
"@quenty/valueobject": "8.
|
|
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"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "075fb03a03f12ade8758f667767ba738204e0c4b"
|
|
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")
|
|
13
12
|
local ValueObject = require("ValueObject")
|
|
13
|
+
local HumanoidTrackerService = require("HumanoidTrackerService")
|
|
14
14
|
|
|
15
15
|
local PlayerHumanoidBinder = setmetatable({}, Binder)
|
|
16
16
|
PlayerHumanoidBinder.ClassName = "PlayerHumanoidBinder"
|
|
@@ -33,10 +33,15 @@ end
|
|
|
33
33
|
Inits the binder. See [Binder.Init].
|
|
34
34
|
Should be done via a [ServiceBag].
|
|
35
35
|
|
|
36
|
+
@param serviceBag ServiceBag
|
|
36
37
|
@param ... any
|
|
37
38
|
]=]
|
|
38
|
-
function PlayerHumanoidBinder:Init(...)
|
|
39
|
-
|
|
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)
|
|
40
45
|
|
|
41
46
|
if not self._shouldTag then
|
|
42
47
|
self._shouldTag = ValueObject.new(true, "boolean")
|
|
@@ -89,8 +94,7 @@ function PlayerHumanoidBinder:_bindTagging(doUnbinding)
|
|
|
89
94
|
if self._shouldTag.Value then
|
|
90
95
|
local maid = Maid.new()
|
|
91
96
|
|
|
92
|
-
local playerMaid = Maid.new()
|
|
93
|
-
maid:GiveTask(playerMaid)
|
|
97
|
+
local playerMaid = maid:Add(Maid.new())
|
|
94
98
|
|
|
95
99
|
maid:GiveTask(Players.PlayerAdded:Connect(function(player)
|
|
96
100
|
self:_handlePlayerAdded(playerMaid, player)
|
|
@@ -123,19 +127,11 @@ function PlayerHumanoidBinder:_handlePlayerAdded(playerMaid, player)
|
|
|
123
127
|
local maid = Maid.new()
|
|
124
128
|
|
|
125
129
|
-- TODO: Use HumanoidTrackerService
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
local function handleHumanoid(newHumanoid)
|
|
130
|
-
if newHumanoid then
|
|
131
|
-
self:Bind(newHumanoid)
|
|
130
|
+
maid:GiveTask(self._humanoidTrackerService:ObserveHumanoid(player):Subscribe(function(humanoid)
|
|
131
|
+
if humanoid then
|
|
132
|
+
self:Bind(humanoid)
|
|
132
133
|
end
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
maid:GiveTask(tracker.Humanoid.Changed:Connect(handleHumanoid))
|
|
136
|
-
|
|
137
|
-
-- Bind humanoid
|
|
138
|
-
handleHumanoid(tracker.Humanoid.Value)
|
|
134
|
+
end))
|
|
139
135
|
|
|
140
136
|
playerMaid[player] = maid
|
|
141
137
|
end
|