@quenty/racketingropeconstraint 6.8.0 → 6.8.1-canary.417.052e8ba.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,25 @@
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.8.1-canary.417.052e8ba.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/racketingropeconstraint@6.8.0...@quenty/racketingropeconstraint@6.8.1-canary.417.052e8ba.0) (2023-10-11)
7
+
8
+
9
+ * feat!: RacketingRopeContraint exports binder ([65a385d](https://github.com/Quenty/NevermoreEngine/commit/65a385dce3e3f0bfdbd201b9b008fbb472bee7d9))
10
+
11
+
12
+ ### Features
13
+
14
+ * Add RacketingRopeConstraint interface ([1217260](https://github.com/Quenty/NevermoreEngine/commit/12172607c55082367764025f9ea67c7ae0c84b60))
15
+
16
+
17
+ ### BREAKING CHANGES
18
+
19
+ * This breaks the previous exported RacketingRopeConstraint
20
+
21
+
22
+
23
+
24
+
6
25
  # [6.8.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/racketingropeconstraint@6.7.0...@quenty/racketingropeconstraint@6.8.0) (2023-08-23)
7
26
 
8
27
  **Note:** Version bump only for package @quenty/racketingropeconstraint
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/racketingropeconstraint",
3
- "version": "6.8.0",
3
+ "version": "6.8.1-canary.417.052e8ba.0",
4
4
  "description": "Tries to racket a rope constraint back down to a reasonable length",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,13 +27,16 @@
27
27
  "Quenty"
28
28
  ],
29
29
  "dependencies": {
30
- "@quenty/baseobject": "^6.3.0",
31
- "@quenty/loader": "^6.3.0",
32
- "@quenty/overriddenproperty": "^6.3.0",
33
- "@quenty/promise": "^6.8.0"
30
+ "@quenty/baseobject": "6.3.1-canary.417.052e8ba.0",
31
+ "@quenty/binder": "8.27.1-canary.417.052e8ba.0",
32
+ "@quenty/loader": "6.3.1-canary.417.052e8ba.0",
33
+ "@quenty/overriddenproperty": "6.3.1-canary.417.052e8ba.0",
34
+ "@quenty/promise": "6.8.1-canary.417.052e8ba.0",
35
+ "@quenty/tie": "4.29.1-canary.417.052e8ba.0",
36
+ "@quenty/valueobject": "7.24.1-canary.417.052e8ba.0"
34
37
  },
35
38
  "publishConfig": {
36
39
  "access": "public"
37
40
  },
38
- "gitHead": "3b7e47e2180964b6b0b156d07814810e063ef7ed"
41
+ "gitHead": "052e8ba33437f71398c4c08c8dbcbf076022d388"
39
42
  }
@@ -8,8 +8,11 @@ local require = require(script.Parent.loader).load(script)
8
8
  local RunService = game:GetService("RunService")
9
9
 
10
10
  local BaseObject = require("BaseObject")
11
+ local Binder = require("Binder")
11
12
  local OverriddenProperty = require("OverriddenProperty")
12
13
  local Promise = require("Promise")
14
+ local RacketingRopeConstraintInterface = require("RacketingRopeConstraintInterface")
15
+ local ValueObject = require("ValueObject")
13
16
 
14
17
  local START_DISTANCE = 1000
15
18
 
@@ -23,6 +26,9 @@ function RacketingRopeConstraint.new(ropeConstraint)
23
26
  self._smallestDistance = START_DISTANCE
24
27
  self._targetDistance = 0.5
25
28
 
29
+ self._isConstrained = ValueObject.new(false, "boolean")
30
+ self._maid:GiveTask(self._isConstrained)
31
+
26
32
  self._maid:GiveTask(self._obj:GetPropertyChangedSignal("Enabled"):Connect(function()
27
33
  self:_handleActiveChanged()
28
34
  end))
@@ -40,11 +46,13 @@ function RacketingRopeConstraint.new(ropeConstraint)
40
46
  self._maid:GiveTask(self._overriddenLength)
41
47
  end
42
48
 
49
+ self._maid:GiveTask(RacketingRopeConstraintInterface:Implement(self._obj, self))
50
+
43
51
  return self
44
52
  end
45
53
 
46
54
  function RacketingRopeConstraint:PromiseConstrained()
47
- if self:_isValid() and self:_isConstrained() then
55
+ if self:_isValid() and self:_queryIsConstrained() then
48
56
  return Promise.resolved()
49
57
  end
50
58
 
@@ -57,7 +65,11 @@ function RacketingRopeConstraint:PromiseConstrained()
57
65
  return promise
58
66
  end
59
67
 
60
- function RacketingRopeConstraint:_isConstrained()
68
+ function RacketingRopeConstraint:ObserveIsConstrained()
69
+ return self._isConstrained:Observe()
70
+ end
71
+
72
+ function RacketingRopeConstraint:_queryIsConstrained()
61
73
  return self._obj.Length <= self._targetDistance
62
74
  end
63
75
 
@@ -94,11 +106,12 @@ function RacketingRopeConstraint:_update()
94
106
 
95
107
  self:_setLength(self._smallestDistance)
96
108
 
97
- if self:_isConstrained() then
109
+ if self:_queryIsConstrained() then
98
110
  self._maid._updateHeartbeat = nil
99
111
 
100
112
  if self._maid._pendingConstrainedPromise then
101
- if self:_isValid() and self:_isConstrained() then
113
+ if self:_isValid() and self:_queryIsConstrained() then
114
+ self._isConstrained.Value = true
102
115
  self._maid._pendingConstrainedPromise:Resolve()
103
116
  end
104
117
 
@@ -115,4 +128,4 @@ function RacketingRopeConstraint:_setLength(length)
115
128
  end
116
129
  end
117
130
 
118
- return RacketingRopeConstraint
131
+ return Binder.new("RacketingRopeConstraint", RacketingRopeConstraint)
@@ -0,0 +1,12 @@
1
+ --[=[
2
+ @class RacketingRopeConstraintInterface
3
+ ]=]
4
+
5
+ local require = require(script.Parent.loader).load(script)
6
+
7
+ local TieDefinition = require("TieDefinition")
8
+
9
+ return TieDefinition.new("RacketingRopeConstraint", {
10
+ PromiseConstrained = TieDefinition.Types.METHOD;
11
+ ObserveIsConstrained = TieDefinition.Types.METHOD;
12
+ })