@quenty/ragdoll 15.24.0-canary.ae8d76d.0 → 15.24.1-canary.d9ea7a3.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/package.json +31 -31
  3. package/src/Client/Classes/RagdollCameraShakeClient.lua +72 -64
  4. package/src/Client/Classes/RagdollClient.lua +1 -2
  5. package/src/Client/Classes/RagdollHumanoidOnDeathClient.lua +2 -2
  6. package/src/Client/Classes/RagdollHumanoidOnFallClient.lua +1 -1
  7. package/src/Client/Classes/RagdollableClient.lua +5 -5
  8. package/src/Client/RagdollBindersClient.lua +5 -5
  9. package/src/Client/RagdollServiceClient.lua +1 -1
  10. package/src/Server/Classes/Ragdoll.lua +1 -1
  11. package/src/Server/Classes/RagdollCameraShake.lua +2 -3
  12. package/src/Server/Classes/RagdollHumanoidOnDeath.lua +2 -2
  13. package/src/Server/Classes/RagdollHumanoidOnFall.lua +1 -2
  14. package/src/Server/Classes/Ragdollable.lua +7 -7
  15. package/src/Server/Classes/UnragdollAutomatically.lua +37 -35
  16. package/src/Server/Classes/UnragdollAutomaticallyConstants.lua +3 -3
  17. package/src/Server/RagdollBindersServer.lua +6 -6
  18. package/src/Server/RagdollService.lua +1 -1
  19. package/src/Shared/Classes/BindableRagdollHumanoidOnFall.lua +3 -5
  20. package/src/Shared/Classes/RagdollHumanoidOnFallConstants.lua +2 -2
  21. package/src/Shared/Classes/RagdollableBase.lua +1 -1
  22. package/src/Shared/Interfaces/RagdollableInterface.lua +7 -8
  23. package/src/Shared/RagdollServiceConstants.lua +2 -2
  24. package/src/Shared/Rigging/RagdollAdditionalAttachmentUtils.lua +44 -22
  25. package/src/Shared/Rigging/RagdollBallSocketUtils.lua +163 -163
  26. package/src/Shared/Rigging/RagdollCollisionUtils.lua +60 -61
  27. package/src/Shared/Rigging/RagdollMotorData.lua +3 -3
  28. package/src/Shared/Rigging/RagdollMotorLimitData.lua +78 -78
  29. package/src/Shared/Rigging/RagdollMotorUtils.lua +2 -2
  30. package/src/Shared/Rigging/RxRagdollUtils.lua +3 -3
package/CHANGELOG.md CHANGED
@@ -3,7 +3,15 @@
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
- # [15.24.0-canary.ae8d76d.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@15.23.3...@quenty/ragdoll@15.24.0-canary.ae8d76d.0) (2025-05-10)
6
+ ## [15.24.1-canary.d9ea7a3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@15.24.0...@quenty/ragdoll@15.24.1-canary.d9ea7a3.0) (2025-05-12)
7
+
8
+ **Note:** Version bump only for package @quenty/ragdoll
9
+
10
+
11
+
12
+
13
+
14
+ # [15.24.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@15.23.3...@quenty/ragdoll@15.24.0) (2025-05-10)
7
15
 
8
16
 
9
17
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/ragdoll",
3
- "version": "15.24.0-canary.ae8d76d.0",
3
+ "version": "15.24.1-canary.d9ea7a3.0",
4
4
  "description": "Quenty's Ragdoll system for Roblox - Floppy fun ragdolls",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,39 +25,39 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/adorneedata": "7.19.0-canary.ae8d76d.0",
29
- "@quenty/attributeutils": "14.18.0-canary.ae8d76d.0",
30
- "@quenty/baseobject": "10.8.3",
31
- "@quenty/binder": "14.20.0-canary.ae8d76d.0",
32
- "@quenty/brio": "14.18.0-canary.ae8d76d.0",
33
- "@quenty/camera": "14.21.0-canary.ae8d76d.0",
34
- "@quenty/cancellabledelay": "3.5.2",
35
- "@quenty/characterutils": "12.19.0-canary.ae8d76d.0",
36
- "@quenty/draw": "7.8.4",
28
+ "@quenty/adorneedata": "7.19.0",
29
+ "@quenty/attributeutils": "14.18.0",
30
+ "@quenty/baseobject": "10.9.0",
31
+ "@quenty/binder": "14.20.1-canary.d9ea7a3.0",
32
+ "@quenty/brio": "14.18.0",
33
+ "@quenty/camera": "14.21.1-canary.d9ea7a3.0",
34
+ "@quenty/cancellabledelay": "3.6.0",
35
+ "@quenty/characterutils": "12.19.0",
36
+ "@quenty/draw": "7.9.0",
37
37
  "@quenty/enumutils": "3.4.2",
38
- "@quenty/hapticfeedbackutils": "3.2.2",
39
- "@quenty/instanceutils": "13.18.0-canary.ae8d76d.0",
40
- "@quenty/loader": "10.8.3",
41
- "@quenty/maid": "3.4.3",
42
- "@quenty/motor6d": "7.21.0-canary.ae8d76d.0",
43
- "@quenty/physicsutils": "8.18.0-canary.ae8d76d.0",
44
- "@quenty/playerhumanoidbinder": "14.20.0-canary.ae8d76d.0",
45
- "@quenty/promise": "10.11.0-canary.ae8d76d.0",
46
- "@quenty/qframe": "10.11.0-canary.ae8d76d.0",
47
- "@quenty/r15utils": "13.18.0-canary.ae8d76d.0",
48
- "@quenty/remoting": "12.19.0-canary.ae8d76d.0",
49
- "@quenty/rx": "13.18.0-canary.ae8d76d.0",
50
- "@quenty/rxbinderutils": "14.20.0-canary.ae8d76d.0",
51
- "@quenty/rxsignal": "7.18.0-canary.ae8d76d.0",
52
- "@quenty/spring": "10.9.0-canary.ae8d76d.0",
53
- "@quenty/steputils": "3.5.5",
54
- "@quenty/table": "3.7.4",
55
- "@quenty/tie": "10.21.0-canary.ae8d76d.0",
56
- "@quenty/valuebaseutils": "13.18.0-canary.ae8d76d.0",
57
- "@quenty/valueobject": "13.18.0-canary.ae8d76d.0"
38
+ "@quenty/hapticfeedbackutils": "3.3.0",
39
+ "@quenty/instanceutils": "13.18.0",
40
+ "@quenty/loader": "10.9.0",
41
+ "@quenty/maid": "3.5.0",
42
+ "@quenty/motor6d": "7.21.1-canary.d9ea7a3.0",
43
+ "@quenty/physicsutils": "8.18.0",
44
+ "@quenty/playerhumanoidbinder": "14.20.1-canary.d9ea7a3.0",
45
+ "@quenty/promise": "10.11.0",
46
+ "@quenty/qframe": "10.11.0",
47
+ "@quenty/r15utils": "13.18.0",
48
+ "@quenty/remoting": "12.19.0",
49
+ "@quenty/rx": "13.18.0",
50
+ "@quenty/rxbinderutils": "14.20.1-canary.d9ea7a3.0",
51
+ "@quenty/rxsignal": "7.18.0",
52
+ "@quenty/spring": "10.9.0",
53
+ "@quenty/steputils": "3.6.0",
54
+ "@quenty/table": "3.8.0",
55
+ "@quenty/tie": "10.21.0",
56
+ "@quenty/valuebaseutils": "13.18.0",
57
+ "@quenty/valueobject": "13.18.0"
58
58
  },
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "ae8d76d996594e017ac4bfa19f3c064ebe307cd8"
62
+ "gitHead": "d9ea7a314a7d50712e6abac75d29901c1edea556"
63
63
  }
@@ -4,22 +4,22 @@
4
4
 
5
5
  local require = require(script.Parent.loader).load(script)
6
6
 
7
- local Workspace = game:GetService("Workspace")
8
- local UserInputService = game:GetService("UserInputService")
9
7
  local RunService = game:GetService("RunService")
8
+ local UserInputService = game:GetService("UserInputService")
9
+ local Workspace = game:GetService("Workspace")
10
10
 
11
11
  local BaseObject = require("BaseObject")
12
12
  local Binder = require("Binder")
13
13
  local CameraStackService = require("CameraStackService")
14
14
  local HapticFeedbackUtils = require("HapticFeedbackUtils")
15
15
  local Maid = require("Maid")
16
+ local RagdollClient = require("RagdollClient")
16
17
  local RagdollMotorUtils = require("RagdollMotorUtils")
17
18
  local RagdollServiceClient = require("RagdollServiceClient")
18
19
  local RxBrioUtils = require("RxBrioUtils")
19
20
  local RxCharacterUtils = require("RxCharacterUtils")
20
21
  local RxInstanceUtils = require("RxInstanceUtils")
21
22
  local RxR15Utils = require("RxR15Utils")
22
- local RagdollClient = require("RagdollClient")
23
23
 
24
24
  local RagdollCameraShakeClient = setmetatable({}, BaseObject)
25
25
  RagdollCameraShakeClient.ClassName = "RagdollCameraShakeClient"
@@ -34,25 +34,27 @@ function RagdollCameraShakeClient.new(humanoid: Humanoid, serviceBag)
34
34
  self._ragdollBinder = self._serviceBag:GetService(RagdollClient)
35
35
 
36
36
  -- While we've got a charater and we're ragdolled
37
- self._maid:GiveTask(RxCharacterUtils.observeIsOfLocalCharacterBrio(self._obj):Pipe({
38
- RxBrioUtils.switchMapBrio(function()
39
- return self._ragdollBinder:ObserveBrio(self._obj)
40
- end);
41
- }):Subscribe(function(brio)
42
- if brio:IsDead() then
43
- return
44
- end
37
+ self._maid:GiveTask(RxCharacterUtils.observeIsOfLocalCharacterBrio(self._obj)
38
+ :Pipe({
39
+ RxBrioUtils.switchMapBrio(function()
40
+ return self._ragdollBinder:ObserveBrio(self._obj)
41
+ end),
42
+ })
43
+ :Subscribe(function(brio)
44
+ if brio:IsDead() then
45
+ return
46
+ end
45
47
 
46
- local maid = brio:ToMaid()
48
+ local maid = brio:ToMaid()
47
49
 
48
- maid:GiveTask(task.spawn(function()
49
- -- Yield in the same way just to ensure no weird shakes.
50
- RagdollMotorUtils.yieldUntilStepped()
50
+ maid:GiveTask(task.spawn(function()
51
+ -- Yield in the same way just to ensure no weird shakes.
52
+ RagdollMotorUtils.yieldUntilStepped()
51
53
 
52
- maid:GiveTask(self:_setupHapticFeedback())
53
- maid:GiveTask(self:_setupCameraShake(self._cameraStackService:GetImpulseCamera()))
54
+ maid:GiveTask(self:_setupHapticFeedback())
55
+ maid:GiveTask(self:_setupCameraShake(self._cameraStackService:GetImpulseCamera()))
56
+ end))
54
57
  end))
55
- end))
56
58
 
57
59
  return self
58
60
  end
@@ -67,57 +69,63 @@ function RagdollCameraShakeClient:_setupCameraShake(impulseCamera)
67
69
 
68
70
  topMaid:GiveTask(RxInstanceUtils.observePropertyBrio(self._obj, "Parent", function(character)
69
71
  return character ~= nil
70
- end):Pipe({
71
- RxBrioUtils.switchMapBrio(function(character)
72
- return RxBrioUtils.flatCombineLatestBrio({
73
- upperTorso = RxR15Utils.observeCharacterPartBrio(character, "UpperTorso");
74
- head = RxR15Utils.observeCharacterPartBrio(character, "Head")
75
- }, function(state)
76
- return state.upperTorso and state.head
77
- end)
78
- end);
79
- }):Subscribe(function(brio)
80
- if brio:IsDead() then
81
- return
82
- end
83
-
84
- local maid = brio:ToMaid()
85
- local state = brio:GetValue()
86
-
87
- local function getEstimatedVelocityFromUpperTorso()
88
- -- TODO: Consider neck attachments
89
- local headOffset = state.upperTorso.Size*Vector3.new(0, 0.5, 0)
90
- + state.head.Size*Vector3.new(0, 0.5, 0)
91
- local headPosition = state.upperTorso.CFrame:PointToWorldSpace(headOffset)
92
-
93
- return state.upperTorso:GetVelocityAtPosition(headPosition)
94
- end
95
-
96
- local lastVelocity = getEstimatedVelocityFromUpperTorso()
97
- maid:GiveTask(RunService.Heartbeat:Connect(function()
98
- debug.profilebegin("ragdollcamerashake")
72
+ end)
73
+ :Pipe({
74
+ RxBrioUtils.switchMapBrio(function(character)
75
+ return RxBrioUtils.flatCombineLatestBrio({
76
+ upperTorso = RxR15Utils.observeCharacterPartBrio(character, "UpperTorso"),
77
+ head = RxR15Utils.observeCharacterPartBrio(character, "Head"),
78
+ }, function(state)
79
+ return state.upperTorso and state.head
80
+ end)
81
+ end),
82
+ })
83
+ :Subscribe(function(brio)
84
+ if brio:IsDead() then
85
+ return
86
+ end
99
87
 
100
- local cameraCFrame = Workspace.CurrentCamera.CFrame
88
+ local maid = brio:ToMaid()
89
+ local state = brio:GetValue()
101
90
 
102
- local velocity = getEstimatedVelocityFromUpperTorso()
103
- local dVelocity = velocity - lastVelocity
104
- if dVelocity.magnitude >= 0 then
105
- if self._ragdollServiceClient:GetScreenShakeEnabled() then
106
- -- Defaults, but we should tune these
107
- local speed = 20
108
- local damper = 0.5
91
+ local function getEstimatedVelocityFromUpperTorso()
92
+ -- TODO: Consider neck attachments
93
+ local headOffset = state.upperTorso.Size * Vector3.new(0, 0.5, 0)
94
+ + state.head.Size * Vector3.new(0, 0.5, 0)
95
+ local headPosition = state.upperTorso.CFrame:PointToWorldSpace(headOffset)
109
96
 
110
- speed = 40
111
- damper = 0.3
97
+ return state.upperTorso:GetVelocityAtPosition(headPosition)
98
+ end
112
99
 
113
- impulseCamera:Impulse(cameraCFrame:vectorToObjectSpace(-0.1*cameraCFrame.lookVector:Cross(dVelocity)), speed, damper)
100
+ local lastVelocity = getEstimatedVelocityFromUpperTorso()
101
+ maid:GiveTask(RunService.Heartbeat:Connect(function()
102
+ debug.profilebegin("ragdollcamerashake")
103
+
104
+ local cameraCFrame = Workspace.CurrentCamera.CFrame
105
+
106
+ local velocity = getEstimatedVelocityFromUpperTorso()
107
+ local dVelocity = velocity - lastVelocity
108
+ if dVelocity.magnitude >= 0 then
109
+ if self._ragdollServiceClient:GetScreenShakeEnabled() then
110
+ -- Defaults, but we should tune these
111
+ local speed = 20
112
+ local damper = 0.5
113
+
114
+ speed = 40
115
+ damper = 0.3
116
+
117
+ impulseCamera:Impulse(
118
+ cameraCFrame:vectorToObjectSpace(-0.1 * cameraCFrame.lookVector:Cross(dVelocity)),
119
+ speed,
120
+ damper
121
+ )
122
+ end
114
123
  end
115
- end
116
124
 
117
- lastVelocity = velocity
118
- debug.profileend()
125
+ lastVelocity = velocity
126
+ debug.profileend()
127
+ end))
119
128
  end))
120
- end))
121
129
 
122
130
  return topMaid
123
131
  end
@@ -131,7 +139,7 @@ function RagdollCameraShakeClient:_setupHapticFeedback()
131
139
  end
132
140
 
133
141
  maid:GiveTask(task.spawn(function()
134
- for i=1, 0, -0.1 do
142
+ for i = 1, 0, -0.1 do
135
143
  HapticFeedbackUtils.setSmallVibration(lastInputType, i)
136
144
  task.wait(0.05)
137
145
  end
@@ -146,4 +154,4 @@ function RagdollCameraShakeClient:_setupHapticFeedback()
146
154
  return maid
147
155
  end
148
156
 
149
- return Binder.new("RagdollCameraShake", RagdollCameraShakeClient)
157
+ return Binder.new("RagdollCameraShake", RagdollCameraShakeClient)
@@ -16,7 +16,6 @@
16
16
 
17
17
  local require = require(script.Parent.loader).load(script)
18
18
 
19
-
20
19
  local BaseObject = require("BaseObject")
21
20
  local Binder = require("Binder")
22
21
 
@@ -38,4 +37,4 @@ function RagdollClient.new(humanoid, serviceBag)
38
37
  return self
39
38
  end
40
39
 
41
- return Binder.new("Ragdoll", RagdollClient)
40
+ return Binder.new("Ragdoll", RagdollClient)
@@ -7,8 +7,8 @@
7
7
 
8
8
  local require = require(script.Parent.loader).load(script)
9
9
 
10
- local RunService = game:GetService("RunService")
11
10
  local Players = game:GetService("Players")
11
+ local RunService = game:GetService("RunService")
12
12
  local Workspace = game:GetService("Workspace")
13
13
 
14
14
  local BaseObject = require("BaseObject")
@@ -96,4 +96,4 @@ function RagdollHumanoidOnDeathClient.disableParticleEmittersAndFadeOutYielding(
96
96
  end
97
97
  end
98
98
 
99
- return Binder.new("RagdollHumanoidOnDeath", RagdollHumanoidOnDeathClient)
99
+ return Binder.new("RagdollHumanoidOnDeath", RagdollHumanoidOnDeathClient)
@@ -55,4 +55,4 @@ function RagdollHumanoidOnFallClient:_update()
55
55
  end
56
56
  end
57
57
 
58
- return Binder.new("RagdollHumanoidOnFall", RagdollHumanoidOnFallClient)
58
+ return Binder.new("RagdollHumanoidOnFall", RagdollHumanoidOnFallClient)
@@ -7,12 +7,12 @@
7
7
 
8
8
  local require = require(script.Parent.loader).load(script)
9
9
 
10
- local RagdollableBase = require("RagdollableBase")
11
- local RagdollClient = require("RagdollClient")
12
- local RxRagdollUtils = require("RxRagdollUtils")
13
10
  local Binder = require("Binder")
11
+ local RagdollClient = require("RagdollClient")
12
+ local RagdollableBase = require("RagdollableBase")
14
13
  local RagdollableInterface = require("RagdollableInterface")
15
14
  local Rx = require("Rx")
15
+ local RxRagdollUtils = require("RxRagdollUtils")
16
16
 
17
17
  local RagdollableClient = setmetatable({}, RagdollableBase)
18
18
  RagdollableClient.ClassName = "RagdollableClient"
@@ -43,7 +43,7 @@ function RagdollableClient:ObserveIsRagdolled()
43
43
  return self._ragdollBinder:Observe(self._obj):Pipe({
44
44
  Rx.map(function(value)
45
45
  return value and true or false
46
- end)
46
+ end),
47
47
  })
48
48
  end
49
49
 
@@ -55,4 +55,4 @@ function RagdollableClient:_onRagdollChanged(ragdoll)
55
55
  end
56
56
  end
57
57
 
58
- return Binder.new("Ragdollable", RagdollableClient)
58
+ return Binder.new("Ragdollable", RagdollableClient)
@@ -17,7 +17,7 @@ local require = require(script.Parent.loader).load(script)
17
17
  local BinderProvider = require("BinderProvider")
18
18
 
19
19
  return BinderProvider.new(script.Name, function(self, serviceBag)
20
- --[=[
20
+ --[=[
21
21
  Apply this binder to a humanoid to ragdoll it. Humanoid must already have [Ragdollable] defined.
22
22
 
23
23
  ```lua
@@ -33,24 +33,24 @@ return BinderProvider.new(script.Name, function(self, serviceBag)
33
33
  ]=]
34
34
  self:Add(serviceBag:GetService(require("RagdollClient")))
35
35
 
36
- --[=[
36
+ --[=[
37
37
  Enables ragdolling on a humanoid.
38
38
  @prop Ragdollable Binder<RagdollableClient>
39
39
  @within RagdollBindersClient
40
40
  ]=]
41
41
  self:Add(serviceBag:GetService(require("RagdollableClient")))
42
42
 
43
- --[=[
43
+ --[=[
44
44
  Automatically applies ragdoll upon humanoid death.
45
45
  @prop RagdollaRagdollHumanoidOnDeathble Binder<RagdollHumanoidOnDeathClient>
46
46
  @within RagdollBindersClient
47
47
  ]=]
48
48
  self:Add(serviceBag:GetService(require("RagdollHumanoidOnDeathClient")))
49
49
 
50
- --[=[
50
+ --[=[
51
51
  Automatically applies ragdoll upon humanoid fall.
52
52
  @prop RagdollHumanoidOnFall Binder<RagdollHumanoidOnFallClient>
53
53
  @within RagdollBindersClient
54
54
  ]=]
55
55
  self:Add(serviceBag:GetService(require("RagdollHumanoidOnFallClient")))
56
- end)
56
+ end)
@@ -58,4 +58,4 @@ function RagdollServiceClient:GetScreenShakeEnabled()
58
58
  return self._screenShakeEnabled.Value
59
59
  end
60
60
 
61
- return RagdollServiceClient
61
+ return RagdollServiceClient
@@ -49,4 +49,4 @@ function Ragdoll.new(humanoid: Humanoid, _serviceBag: ServiceBag.ServiceBag)
49
49
  return self
50
50
  end
51
51
 
52
- return Binder.new("Ragdoll", Ragdoll)
52
+ return Binder.new("Ragdoll", Ragdoll)
@@ -7,8 +7,8 @@
7
7
  local require = require(script.Parent.loader).load(script)
8
8
 
9
9
  local BaseObject = require("BaseObject")
10
- local Ragdoll = require("Ragdoll")
11
10
  local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
11
+ local Ragdoll = require("Ragdoll")
12
12
 
13
13
  local RagdollCameraShake = setmetatable({}, BaseObject)
14
14
  RagdollCameraShake.ClassName = "RagdollCameraShake"
@@ -26,8 +26,7 @@ function RagdollCameraShake.new(humanoid: Humanoid, serviceBag)
26
26
  self._serviceBag = assert(serviceBag, "Bad serviceBag")
27
27
  self._ragdollBinder = self._serviceBag:GetService(Ragdoll)
28
28
 
29
-
30
29
  return self
31
30
  end
32
31
 
33
- return PlayerHumanoidBinder.new("RagdollCameraShake", RagdollCameraShake)
32
+ return PlayerHumanoidBinder.new("RagdollCameraShake", RagdollCameraShake)
@@ -7,8 +7,8 @@
7
7
  local require = require(script.Parent.loader).load(script)
8
8
 
9
9
  local BaseObject = require("BaseObject")
10
- local Ragdoll = require("Ragdoll")
11
10
  local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
11
+ local Ragdoll = require("Ragdoll")
12
12
 
13
13
  local RagdollHumanoidOnDeath = setmetatable({}, BaseObject)
14
14
  RagdollHumanoidOnDeath.ClassName = "RagdollHumanoidOnDeath"
@@ -40,4 +40,4 @@ function RagdollHumanoidOnDeath.new(humanoid, serviceBag)
40
40
  return self
41
41
  end
42
42
 
43
- return PlayerHumanoidBinder.new("RagdollHumanoidOnDeath", RagdollHumanoidOnDeath)
43
+ return PlayerHumanoidBinder.new("RagdollHumanoidOnDeath", RagdollHumanoidOnDeath)
@@ -45,7 +45,6 @@ function RagdollHumanoidOnFall.new(humanoid, serviceBag)
45
45
  self:_handleServerEvent(...)
46
46
  end))
47
47
  else
48
-
49
48
  self._maid:GiveTask(self:_getOrCreateRagdollLogic().ShouldRagdoll.Changed:Connect(function()
50
49
  self:_update()
51
50
  end))
@@ -90,4 +89,4 @@ function RagdollHumanoidOnFall:_update()
90
89
  end
91
90
  end
92
91
 
93
- return PlayerHumanoidBinder.new("RagdollHumanoidOnFall", RagdollHumanoidOnFall)
92
+ return PlayerHumanoidBinder.new("RagdollHumanoidOnFall", RagdollHumanoidOnFall)
@@ -6,7 +6,6 @@
6
6
 
7
7
  local require = require(script.Parent.loader).load(script)
8
8
 
9
- local RagdollableBase = require("RagdollableBase")
10
9
  local Maid = require("Maid")
11
10
  local Motor6DStackHumanoid = require("Motor6DStackHumanoid")
12
11
  local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
@@ -15,10 +14,11 @@ local RagdollAdditionalAttachmentUtils = require("RagdollAdditionalAttachmentUti
15
14
  local RagdollBallSocketUtils = require("RagdollBallSocketUtils")
16
15
  local RagdollCollisionUtils = require("RagdollCollisionUtils")
17
16
  local RagdollMotorUtils = require("RagdollMotorUtils")
18
- local RxBrioUtils = require("RxBrioUtils")
19
- local RxRagdollUtils = require("RxRagdollUtils")
17
+ local RagdollableBase = require("RagdollableBase")
20
18
  local RagdollableInterface = require("RagdollableInterface")
21
19
  local Rx = require("Rx")
20
+ local RxBrioUtils = require("RxBrioUtils")
21
+ local RxRagdollUtils = require("RxRagdollUtils")
22
22
 
23
23
  local Ragdollable = setmetatable({}, RagdollableBase)
24
24
  Ragdollable.ClassName = "Ragdollable"
@@ -41,8 +41,8 @@ function Ragdollable.new(humanoid, serviceBag)
41
41
  -- Ensure predefined physics rig immediatelly on the server.
42
42
  -- We do this so during replication loop-back there's no chance of death.
43
43
  self._maid:GiveTask(RxBrioUtils.flatCombineLatest({
44
- character = RxRagdollUtils.observeCharacterBrio(self._obj);
45
- rigType = RxRagdollUtils.observeRigType(self._obj);
44
+ character = RxRagdollUtils.observeCharacterBrio(self._obj),
45
+ rigType = RxRagdollUtils.observeRigType(self._obj),
46
46
  }):Subscribe(function(state)
47
47
  if state.character and state.rigType then
48
48
  local maid = Maid.new()
@@ -74,7 +74,7 @@ function Ragdollable:ObserveIsRagdolled()
74
74
  return self._ragdollBinder:Observe(self._obj):Pipe({
75
75
  Rx.map(function(value)
76
76
  return value and true or false
77
- end)
77
+ end),
78
78
  })
79
79
  end
80
80
 
@@ -98,4 +98,4 @@ function Ragdollable:_setRagdollEnabled(isEnabled)
98
98
  end
99
99
  end
100
100
 
101
- return PlayerHumanoidBinder.new("Ragdollable", Ragdollable)
101
+ return PlayerHumanoidBinder.new("Ragdollable", Ragdollable)
@@ -8,7 +8,6 @@ local require = require(script.Parent.loader).load(script)
8
8
 
9
9
  local AttributeValue = require("AttributeValue")
10
10
  local BaseObject = require("BaseObject")
11
- local cancellableDelay = require("cancellableDelay")
12
11
  local CharacterUtils = require("CharacterUtils")
13
12
  local Maid = require("Maid")
14
13
  local Observable = require("Observable")
@@ -20,6 +19,7 @@ local RxBinderUtils = require("RxBinderUtils")
20
19
  local RxBrioUtils = require("RxBrioUtils")
21
20
  local RxInstanceUtils = require("RxInstanceUtils")
22
21
  local UnragdollAutomaticallyConstants = require("UnragdollAutomaticallyConstants")
22
+ local cancellableDelay = require("cancellableDelay")
23
23
 
24
24
  local UnragdollAutomatically = setmetatable({}, BaseObject)
25
25
  UnragdollAutomatically.ClassName = "UnragdollAutomatically"
@@ -39,8 +39,10 @@ function UnragdollAutomatically.new(humanoid, serviceBag)
39
39
  self._ragdollHumanoidOnFallBinder = self._serviceBag:GetService(RagdollHumanoidOnFall)
40
40
  self._player = CharacterUtils.getPlayerFromCharacter(self._obj)
41
41
 
42
- self._unragdollAutomatically = AttributeValue.new(self._obj, UnragdollAutomaticallyConstants.UNRAGDOLL_AUTOMATICALLY_ATTRIBUTE, true)
43
- self._unragdollAutomaticTime = AttributeValue.new(self._obj, UnragdollAutomaticallyConstants.UNRAGDOLL_AUTOMATIC_TIME_ATTRIBUTE, 5)
42
+ self._unragdollAutomatically =
43
+ AttributeValue.new(self._obj, UnragdollAutomaticallyConstants.UNRAGDOLL_AUTOMATICALLY_ATTRIBUTE, true)
44
+ self._unragdollAutomaticTime =
45
+ AttributeValue.new(self._obj, UnragdollAutomaticallyConstants.UNRAGDOLL_AUTOMATIC_TIME_ATTRIBUTE, 5)
44
46
 
45
47
  self._maid:GiveTask(self._ragdollBinder:ObserveInstance(self._obj, function()
46
48
  self:_handleRagdollChanged(self._maid)
@@ -52,20 +54,22 @@ end
52
54
 
53
55
  function UnragdollAutomatically:_handleRagdollChanged(maid)
54
56
  if self._ragdollBinder:Get(self._obj) then
55
- maid._unragdoll = self:_observeCanUnragdollTimer():Pipe({
56
- Rx.switchMap(function(state)
57
- if state then
58
- return self:_observeAlive()
59
- else
60
- return Rx.of(false);
57
+ maid._unragdoll = self:_observeCanUnragdollTimer()
58
+ :Pipe({
59
+ Rx.switchMap(function(state)
60
+ if state then
61
+ return self:_observeAlive()
62
+ else
63
+ return Rx.of(false)
64
+ end
65
+ end),
66
+ Rx.distinct(),
67
+ })
68
+ :Subscribe(function(canUnragdoll)
69
+ if canUnragdoll then
70
+ self._ragdollBinder:Unbind(self._obj)
61
71
  end
62
- end);
63
- Rx.distinct();
64
- }):Subscribe(function(canUnragdoll)
65
- if canUnragdoll then
66
- self._ragdollBinder:Unbind(self._obj)
67
- end
68
- end)
72
+ end)
69
73
  else
70
74
  maid._unragdoll = nil
71
75
  end
@@ -75,8 +79,8 @@ function UnragdollAutomatically:_observeAlive()
75
79
  return RxInstanceUtils.observeProperty(self._obj, "Health"):Pipe({
76
80
  Rx.map(function(health)
77
81
  return health > 0
78
- end);
79
- Rx.distinct();
82
+ end),
83
+ Rx.distinct(),
80
84
  })
81
85
  end
82
86
 
@@ -91,21 +95,21 @@ function UnragdollAutomatically:_observeCanUnragdollTimer()
91
95
 
92
96
  maid:GiveTask(RxBrioUtils.flatCombineLatest({
93
97
  canUnragdoll = RxBrioUtils.flatCombineLatest({
94
- enabled = self._unragdollAutomatically:Observe();
95
- isFallingRagdoll = self:_observeIsFallingRagdoll();
98
+ enabled = self._unragdollAutomatically:Observe(),
99
+ isFallingRagdoll = self:_observeIsFallingRagdoll(),
96
100
  }):Pipe({
97
101
  Rx.map(function(state)
98
102
  return state.enabled and not state.isFallingRagdoll
99
- end);
100
- Rx.distinct();
103
+ end),
104
+ Rx.distinct(),
101
105
  Rx.tap(function(canUnragdoll)
102
106
  -- Ensure we reset timer if we change state
103
107
  if canUnragdoll then
104
108
  startTime = os.clock()
105
109
  end
106
- end);
107
- });
108
- time = self._unragdollAutomaticTime:Observe();
110
+ end),
111
+ }),
112
+ time = self._unragdollAutomaticTime:Observe(),
109
113
  }):Subscribe(function(state)
110
114
  if state.canUnragdoll then
111
115
  maid._deferred = nil
@@ -121,7 +125,6 @@ function UnragdollAutomatically:_observeCanUnragdollTimer()
121
125
  end)
122
126
  end
123
127
  else
124
-
125
128
  isReady.Value = false
126
129
  maid._deferred = nil
127
130
  end
@@ -137,14 +140,13 @@ function UnragdollAutomatically:_observeCanUnragdollTimer()
137
140
  end
138
141
 
139
142
  function UnragdollAutomatically:_observeIsFallingRagdoll()
140
- return RxBinderUtils.observeBoundClassBrio(self._ragdollHumanoidOnFallBinder, self._obj)
141
- :Pipe({
142
- RxBrioUtils.switchMapBrio(function(ragdollHumanoidOnFall)
143
- return ragdollHumanoidOnFall:ObserveIsFalling()
144
- end);
145
- RxBrioUtils.emitOnDeath(false);
146
- Rx.distinct();
147
- })
143
+ return RxBinderUtils.observeBoundClassBrio(self._ragdollHumanoidOnFallBinder, self._obj):Pipe({
144
+ RxBrioUtils.switchMapBrio(function(ragdollHumanoidOnFall)
145
+ return ragdollHumanoidOnFall:ObserveIsFalling()
146
+ end),
147
+ RxBrioUtils.emitOnDeath(false),
148
+ Rx.distinct(),
149
+ })
148
150
  end
149
151
 
150
- return PlayerHumanoidBinder.new("UnragdollAutomatically", UnragdollAutomatically)
152
+ return PlayerHumanoidBinder.new("UnragdollAutomatically", UnragdollAutomatically)
@@ -7,6 +7,6 @@ local require = require(script.Parent.loader).load(script)
7
7
  local Table = require("Table")
8
8
 
9
9
  return Table.readonly({
10
- UNRAGDOLL_AUTOMATICALLY_ATTRIBUTE = "UnragdollAutomatically";
11
- UNRAGDOLL_AUTOMATIC_TIME_ATTRIBUTE = "UnragdollAutomaticTime";
12
- })
10
+ UNRAGDOLL_AUTOMATICALLY_ATTRIBUTE = "UnragdollAutomatically",
11
+ UNRAGDOLL_AUTOMATIC_TIME_ATTRIBUTE = "UnragdollAutomaticTime",
12
+ })