@quenty/humanoidspeed 3.2.0 → 3.2.1-canary.270.0fe7bd3.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
+ ## [3.2.1-canary.270.0fe7bd3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/humanoidspeed@3.2.0...@quenty/humanoidspeed@3.2.1-canary.270.0fe7bd3.0) (2022-07-02)
7
+
8
+
9
+ ### Features
10
+
11
+ * Make HumanoidSpeed use RogueHumanoid package ([6e4ebe7](https://github.com/Quenty/NevermoreEngine/commit/6e4ebe7a968bf6cd8574c844fe1fb8e992682467))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/humanoidspeed@3.1.0...@quenty/humanoidspeed@3.2.0) (2022-06-24)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/humanoidspeed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/humanoidspeed",
3
- "version": "3.2.0",
3
+ "version": "3.2.1-canary.270.0fe7bd3.0",
4
4
  "description": "Handles humanoid speed in a centralized location",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,15 +27,16 @@
27
27
  "Quenty"
28
28
  ],
29
29
  "dependencies": {
30
- "@quenty/baseobject": "^5.0.0",
31
- "@quenty/binder": "^6.1.0",
32
- "@quenty/characterutils": "^5.1.0",
33
- "@quenty/loader": "^5.0.0",
34
- "@quenty/promise": "^5.0.0",
35
- "@quenty/table": "^3.1.0"
30
+ "@quenty/baseobject": "5.0.0",
31
+ "@quenty/binder": "6.1.1-canary.270.0fe7bd3.0",
32
+ "@quenty/characterutils": "5.1.0",
33
+ "@quenty/loader": "5.0.0",
34
+ "@quenty/promise": "5.0.0",
35
+ "@quenty/rogue-humanoid": "1.0.1-canary.270.0fe7bd3.0",
36
+ "@quenty/table": "3.1.0"
36
37
  },
37
38
  "publishConfig": {
38
39
  "access": "public"
39
40
  },
40
- "gitHead": "c61297d0df1ec45ff9dddf62043c628f3c285a5d"
41
+ "gitHead": "0fe7bd3216177265038ff7d3f83d1d47e748141c"
41
42
  }
@@ -9,6 +9,8 @@ local BinderProvider = require("BinderProvider")
9
9
  local Binder = require("Binder")
10
10
 
11
11
  return BinderProvider.new(function(self, serviceBag)
12
+ serviceBag:GetService(require("RogueHumanoidServiceClient"))
13
+
12
14
  --[=[
13
15
  @prop HumanoidSpeed Binder<HumanoidSpeedClient>
14
16
  @within HumanoidSpeedBindersClient
@@ -9,8 +9,6 @@ local require = require(script.Parent.loader).load(script)
9
9
 
10
10
  local BaseObject = require("BaseObject")
11
11
  local CharacterUtils = require("CharacterUtils")
12
- local HumanoidSpeedConstants = require("HumanoidSpeedConstants")
13
- local promiseChild = require("promiseChild")
14
12
 
15
13
  local HumanoidSpeedClient = setmetatable({}, BaseObject)
16
14
  HumanoidSpeedClient.ClassName = "HumanoidSpeedClient"
@@ -22,14 +20,6 @@ function HumanoidSpeedClient.new(humanoid)
22
20
  return self
23
21
  end
24
22
 
25
- --[=[
26
- Retrieves a promise that resolves speed value
27
- @return Promise<Instance>
28
- ]=]
29
- function HumanoidSpeedClient:PromiseSpeedValue()
30
- return self._maid:GivePromise(promiseChild(self._obj , HumanoidSpeedConstants.SPEED_VALUE_NAME))
31
- end
32
-
33
23
  --[=[
34
24
  Gets the player for this humanoid
35
25
  @return Player?
@@ -7,10 +7,8 @@
7
7
 
8
8
  local require = require(script.Parent.loader).load(script)
9
9
 
10
- local HttpService = game:GetService("HttpService")
11
-
12
10
  local BaseObject = require("BaseObject")
13
- local HumanoidSpeedConstants = require("HumanoidSpeedConstants")
11
+ local RogueHumanoidProperties = require("RogueHumanoidProperties")
14
12
 
15
13
  local HumanoidSpeed = setmetatable({}, BaseObject)
16
14
  HumanoidSpeed.ClassName = "HumanoidSpeed"
@@ -19,25 +17,14 @@ HumanoidSpeed.__index = HumanoidSpeed
19
17
  --[=[
20
18
  Constructs a new HumanoidSpeed
21
19
  @param humanoid Humanoid
20
+ @param serviceBag ServiceBag
22
21
  @return HumanoidSpeed
23
22
  ]=]
24
- function HumanoidSpeed.new(humanoid)
23
+ function HumanoidSpeed.new(humanoid, serviceBag)
25
24
  local self = setmetatable(BaseObject.new(humanoid), HumanoidSpeed)
26
25
 
27
- self._defaultSpeed = self._obj.WalkSpeed
28
-
29
- self._speedValue = Instance.new("IntValue")
30
- self._speedValue.Name = HumanoidSpeedConstants.SPEED_VALUE_NAME
31
- self._speedValue.Value = humanoid.WalkSpeed
32
- self._speedValue.Parent = humanoid
33
-
34
- self._multipliers = {} -- Multiplicitive, [key] = mult, takes product of this list
35
- self._adders = {} -- [key] = added
36
-
37
- self._maid:GiveTask(self._speedValue.Changed:Connect(function()
38
- self:_update()
39
- end))
40
- self:_update()
26
+ self._serviceBag = assert(serviceBag, "No serviceBag")
27
+ self._properties = RogueHumanoidProperties:GetPropertyTable(self._serviceBag, self._obj)
41
28
 
42
29
  return self
43
30
  end
@@ -47,8 +34,7 @@ end
47
34
  @param defaultSpeed number
48
35
  ]=]
49
36
  function HumanoidSpeed:SetDefaultSpeed(defaultSpeed)
50
- self._defaultSpeed = defaultSpeed
51
- self:_update()
37
+ self._properties.WalkSpeed:SetBaseValue(defaultSpeed)
52
38
  end
53
39
 
54
40
  --[=[
@@ -60,16 +46,7 @@ function HumanoidSpeed:ApplySpeedMultiplier(multiplier)
60
46
  assert(type(multiplier) == "number", "Bad multiplier")
61
47
  assert(multiplier >= 0, "Bad multiplier")
62
48
 
63
- local key = HttpService:GenerateGUID(false)
64
- self._multipliers[key] = multiplier
65
-
66
- self:_update()
67
-
68
- return function()
69
- if self.Destroy then
70
- self:_removeSpeedMultiplier(key)
71
- end
72
- end
49
+ return self._properties.WalkSpeed:CreateMultiplier(multiplier)
73
50
  end
74
51
 
75
52
  --[=[
@@ -80,50 +57,7 @@ end
80
57
  function HumanoidSpeed:ApplySpeedAdditive(amount)
81
58
  assert(type(amount) == "number", "Bad amount")
82
59
 
83
- local key = HttpService:GenerateGUID(false)
84
- self._adders[key] = amount
85
-
86
- self:_update()
87
-
88
- return function()
89
- if self.Destroy then
90
- self:_removeSpeedAdder(key)
91
- end
92
- end
93
- end
94
-
95
- function HumanoidSpeed:_removeSpeedMultiplier(key)
96
- self._multipliers[key] = nil
97
- self:_update()
98
- end
99
-
100
-
101
- function HumanoidSpeed:_removeSpeedAdder(key)
102
- self._adders[key] = nil
103
- self:_update()
104
- end
105
-
106
-
107
- function HumanoidSpeed:_getMultiplier()
108
- local mult = 1
109
- for _, item in pairs(self._multipliers) do
110
- mult = mult * item
111
- end
112
- return mult
113
- end
114
-
115
- function HumanoidSpeed:_getBaseSpeed()
116
- local current = self._defaultSpeed
117
- for _, item in pairs(self._adders) do
118
- current = current + item
119
- end
120
- return current
121
- end
122
-
123
- function HumanoidSpeed:_update()
124
- local mult = self:_getMultiplier()
125
- self._speedValue.Value = mult*self:_getBaseSpeed()
126
- self._obj.WalkSpeed = self._speedValue.Value
60
+ return self._properties.WalkSpeed:CreateAdditive(amount)
127
61
  end
128
62
 
129
63
  return HumanoidSpeed
@@ -9,6 +9,8 @@ local BinderProvider = require("BinderProvider")
9
9
  local Binder = require("Binder")
10
10
 
11
11
  return BinderProvider.new(function(self, serviceBag)
12
+ serviceBag:GetService(require("RogueHumanoidService"))
13
+
12
14
  --[=[
13
15
  @prop HumanoidSpeed Binder<HumanoidSpeed>
14
16
  @within HumanoidSpeedBindersServer
@@ -1,11 +0,0 @@
1
- --[=[
2
- @class HumanoidSpeedConstants
3
- ]=]
4
-
5
- local require = require(script.Parent.loader).load(script)
6
-
7
- local Table = require("Table")
8
-
9
- return Table.readonly({
10
- SPEED_VALUE_NAME = "HumanoidSpeedValue";
11
- })