@quenty/ragdoll 15.23.4-canary.559.9f38947.0 → 15.24.0-canary.0a5db80.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 +2 -10
- package/package.json +31 -31
- package/src/Client/Classes/RagdollCameraShakeClient.lua +64 -72
- package/src/Client/Classes/RagdollClient.lua +2 -1
- package/src/Client/Classes/RagdollHumanoidOnDeathClient.lua +2 -2
- package/src/Client/Classes/RagdollHumanoidOnFallClient.lua +1 -1
- package/src/Client/Classes/RagdollableClient.lua +5 -5
- package/src/Client/RagdollBindersClient.lua +5 -5
- package/src/Client/RagdollServiceClient.lua +1 -1
- package/src/Server/Classes/Ragdoll.lua +1 -1
- package/src/Server/Classes/RagdollCameraShake.lua +3 -2
- package/src/Server/Classes/RagdollHumanoidOnDeath.lua +2 -2
- package/src/Server/Classes/RagdollHumanoidOnFall.lua +2 -1
- package/src/Server/Classes/Ragdollable.lua +7 -7
- package/src/Server/Classes/UnragdollAutomatically.lua +35 -37
- package/src/Server/Classes/UnragdollAutomaticallyConstants.lua +3 -3
- package/src/Server/RagdollBindersServer.lua +6 -6
- package/src/Server/RagdollService.lua +1 -1
- package/src/Shared/Classes/BindableRagdollHumanoidOnFall.lua +5 -3
- package/src/Shared/Classes/RagdollHumanoidOnFallConstants.lua +2 -2
- package/src/Shared/Classes/RagdollableBase.lua +1 -1
- package/src/Shared/Interfaces/RagdollableInterface.lua +8 -7
- package/src/Shared/RagdollServiceConstants.lua +2 -2
- package/src/Shared/Rigging/RagdollAdditionalAttachmentUtils.lua +22 -44
- package/src/Shared/Rigging/RagdollBallSocketUtils.lua +163 -163
- package/src/Shared/Rigging/RagdollCollisionUtils.lua +61 -60
- package/src/Shared/Rigging/RagdollMotorData.lua +3 -3
- package/src/Shared/Rigging/RagdollMotorLimitData.lua +78 -78
- package/src/Shared/Rigging/RagdollMotorUtils.lua +2 -2
- package/src/Shared/Rigging/RxRagdollUtils.lua +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,20 +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
|
+
# [15.24.0-canary.0a5db80.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@15.23.2...@quenty/ragdoll@15.24.0-canary.0a5db80.0) (2025-05-10)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
|
-
* Additional type checking updates ([
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## [15.23.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@15.23.2...@quenty/ragdoll@15.23.3) (2025-04-10)
|
|
18
|
-
|
|
19
|
-
**Note:** Version bump only for package @quenty/ragdoll
|
|
11
|
+
* Additional type checking updates ([7e008c5](https://github.com/Quenty/NevermoreEngine/commit/7e008c58547bd00b5904e56541454a38c8d72ccc))
|
|
20
12
|
|
|
21
13
|
|
|
22
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/ragdoll",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.24.0-canary.0a5db80.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.
|
|
29
|
-
"@quenty/attributeutils": "14.
|
|
30
|
-
"@quenty/baseobject": "10.
|
|
31
|
-
"@quenty/binder": "14.
|
|
32
|
-
"@quenty/brio": "14.
|
|
33
|
-
"@quenty/camera": "14.
|
|
34
|
-
"@quenty/cancellabledelay": "3.5.
|
|
35
|
-
"@quenty/characterutils": "12.
|
|
36
|
-
"@quenty/draw": "7.
|
|
28
|
+
"@quenty/adorneedata": "7.19.0-canary.0a5db80.0",
|
|
29
|
+
"@quenty/attributeutils": "14.18.0-canary.0a5db80.0",
|
|
30
|
+
"@quenty/baseobject": "10.9.0-canary.0a5db80.0",
|
|
31
|
+
"@quenty/binder": "14.20.0-canary.0a5db80.0",
|
|
32
|
+
"@quenty/brio": "14.18.0-canary.0a5db80.0",
|
|
33
|
+
"@quenty/camera": "14.21.0-canary.0a5db80.0",
|
|
34
|
+
"@quenty/cancellabledelay": "3.5.2",
|
|
35
|
+
"@quenty/characterutils": "12.19.0-canary.0a5db80.0",
|
|
36
|
+
"@quenty/draw": "7.9.0-canary.0a5db80.0",
|
|
37
37
|
"@quenty/enumutils": "3.4.2",
|
|
38
|
-
"@quenty/hapticfeedbackutils": "3.2.
|
|
39
|
-
"@quenty/instanceutils": "13.
|
|
40
|
-
"@quenty/loader": "10.
|
|
41
|
-
"@quenty/maid": "3.
|
|
42
|
-
"@quenty/motor6d": "7.
|
|
43
|
-
"@quenty/physicsutils": "8.
|
|
44
|
-
"@quenty/playerhumanoidbinder": "14.
|
|
45
|
-
"@quenty/promise": "10.
|
|
46
|
-
"@quenty/qframe": "10.
|
|
47
|
-
"@quenty/r15utils": "13.
|
|
48
|
-
"@quenty/remoting": "12.
|
|
49
|
-
"@quenty/rx": "13.
|
|
50
|
-
"@quenty/rxbinderutils": "14.
|
|
51
|
-
"@quenty/rxsignal": "7.
|
|
52
|
-
"@quenty/spring": "10.
|
|
53
|
-
"@quenty/steputils": "3.5.
|
|
54
|
-
"@quenty/table": "3.
|
|
55
|
-
"@quenty/tie": "10.
|
|
56
|
-
"@quenty/valuebaseutils": "13.
|
|
57
|
-
"@quenty/valueobject": "13.
|
|
38
|
+
"@quenty/hapticfeedbackutils": "3.2.2",
|
|
39
|
+
"@quenty/instanceutils": "13.18.0-canary.0a5db80.0",
|
|
40
|
+
"@quenty/loader": "10.9.0-canary.0a5db80.0",
|
|
41
|
+
"@quenty/maid": "3.5.0-canary.0a5db80.0",
|
|
42
|
+
"@quenty/motor6d": "7.21.0-canary.0a5db80.0",
|
|
43
|
+
"@quenty/physicsutils": "8.18.0-canary.0a5db80.0",
|
|
44
|
+
"@quenty/playerhumanoidbinder": "14.20.0-canary.0a5db80.0",
|
|
45
|
+
"@quenty/promise": "10.11.0-canary.0a5db80.0",
|
|
46
|
+
"@quenty/qframe": "10.11.0-canary.0a5db80.0",
|
|
47
|
+
"@quenty/r15utils": "13.18.0-canary.0a5db80.0",
|
|
48
|
+
"@quenty/remoting": "12.19.0-canary.0a5db80.0",
|
|
49
|
+
"@quenty/rx": "13.18.0-canary.0a5db80.0",
|
|
50
|
+
"@quenty/rxbinderutils": "14.20.0-canary.0a5db80.0",
|
|
51
|
+
"@quenty/rxsignal": "7.18.0-canary.0a5db80.0",
|
|
52
|
+
"@quenty/spring": "10.9.0-canary.0a5db80.0",
|
|
53
|
+
"@quenty/steputils": "3.5.5",
|
|
54
|
+
"@quenty/table": "3.8.0-canary.0a5db80.0",
|
|
55
|
+
"@quenty/tie": "10.21.0-canary.0a5db80.0",
|
|
56
|
+
"@quenty/valuebaseutils": "13.18.0-canary.0a5db80.0",
|
|
57
|
+
"@quenty/valueobject": "13.18.0-canary.0a5db80.0"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "0a5db8004684dc3e76fd5944599a22602d48cfa9"
|
|
63
63
|
}
|
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
local require = require(script.Parent.loader).load(script)
|
|
6
6
|
|
|
7
|
-
local RunService = game:GetService("RunService")
|
|
8
|
-
local UserInputService = game:GetService("UserInputService")
|
|
9
7
|
local Workspace = game:GetService("Workspace")
|
|
8
|
+
local UserInputService = game:GetService("UserInputService")
|
|
9
|
+
local RunService = game:GetService("RunService")
|
|
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")
|
|
17
16
|
local RagdollMotorUtils = require("RagdollMotorUtils")
|
|
18
17
|
local RagdollServiceClient = require("RagdollServiceClient")
|
|
19
18
|
local RxBrioUtils = require("RxBrioUtils")
|
|
20
19
|
local RxCharacterUtils = require("RxCharacterUtils")
|
|
21
20
|
local RxInstanceUtils = require("RxInstanceUtils")
|
|
22
21
|
local RxR15Utils = require("RxR15Utils")
|
|
22
|
+
local RagdollClient = require("RagdollClient")
|
|
23
23
|
|
|
24
24
|
local RagdollCameraShakeClient = setmetatable({}, BaseObject)
|
|
25
25
|
RagdollCameraShakeClient.ClassName = "RagdollCameraShakeClient"
|
|
@@ -34,27 +34,25 @@ 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)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return
|
|
46
|
-
end
|
|
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
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
local maid = brio:ToMaid()
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
maid:GiveTask(task.spawn(function()
|
|
49
|
+
-- Yield in the same way just to ensure no weird shakes.
|
|
50
|
+
RagdollMotorUtils.yieldUntilStepped()
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
end))
|
|
52
|
+
maid:GiveTask(self:_setupHapticFeedback())
|
|
53
|
+
maid:GiveTask(self:_setupCameraShake(self._cameraStackService:GetImpulseCamera()))
|
|
57
54
|
end))
|
|
55
|
+
end))
|
|
58
56
|
|
|
59
57
|
return self
|
|
60
58
|
end
|
|
@@ -69,63 +67,57 @@ function RagdollCameraShakeClient:_setupCameraShake(impulseCamera)
|
|
|
69
67
|
|
|
70
68
|
topMaid:GiveTask(RxInstanceUtils.observePropertyBrio(self._obj, "Parent", function(character)
|
|
71
69
|
return character ~= nil
|
|
72
|
-
end)
|
|
73
|
-
|
|
74
|
-
RxBrioUtils.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return
|
|
86
|
-
end
|
|
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
|
|
87
83
|
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
local maid = brio:ToMaid()
|
|
85
|
+
local state = brio:GetValue()
|
|
90
86
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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)
|
|
96
92
|
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
return state.upperTorso:GetVelocityAtPosition(headPosition)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
local lastVelocity = getEstimatedVelocityFromUpperTorso()
|
|
97
|
+
maid:GiveTask(RunService.Heartbeat:Connect(function()
|
|
98
|
+
debug.profilebegin("ragdollcamerashake")
|
|
99
|
+
|
|
100
|
+
local cameraCFrame = Workspace.CurrentCamera.CFrame
|
|
99
101
|
|
|
100
|
-
local
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
|
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
|
|
109
|
+
|
|
110
|
+
speed = 40
|
|
111
|
+
damper = 0.3
|
|
112
|
+
|
|
113
|
+
impulseCamera:Impulse(cameraCFrame:vectorToObjectSpace(-0.1*cameraCFrame.lookVector:Cross(dVelocity)), speed, damper)
|
|
123
114
|
end
|
|
115
|
+
end
|
|
124
116
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
end))
|
|
117
|
+
lastVelocity = velocity
|
|
118
|
+
debug.profileend()
|
|
128
119
|
end))
|
|
120
|
+
end))
|
|
129
121
|
|
|
130
122
|
return topMaid
|
|
131
123
|
end
|
|
@@ -139,7 +131,7 @@ function RagdollCameraShakeClient:_setupHapticFeedback()
|
|
|
139
131
|
end
|
|
140
132
|
|
|
141
133
|
maid:GiveTask(task.spawn(function()
|
|
142
|
-
for i
|
|
134
|
+
for i=1, 0, -0.1 do
|
|
143
135
|
HapticFeedbackUtils.setSmallVibration(lastInputType, i)
|
|
144
136
|
task.wait(0.05)
|
|
145
137
|
end
|
|
@@ -154,4 +146,4 @@ function RagdollCameraShakeClient:_setupHapticFeedback()
|
|
|
154
146
|
return maid
|
|
155
147
|
end
|
|
156
148
|
|
|
157
|
-
return Binder.new("RagdollCameraShake", RagdollCameraShakeClient)
|
|
149
|
+
return Binder.new("RagdollCameraShake", RagdollCameraShakeClient)
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
local require = require(script.Parent.loader).load(script)
|
|
18
18
|
|
|
19
|
+
|
|
19
20
|
local BaseObject = require("BaseObject")
|
|
20
21
|
local Binder = require("Binder")
|
|
21
22
|
|
|
@@ -37,4 +38,4 @@ function RagdollClient.new(humanoid, serviceBag)
|
|
|
37
38
|
return self
|
|
38
39
|
end
|
|
39
40
|
|
|
40
|
-
return Binder.new("Ragdoll", RagdollClient)
|
|
41
|
+
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 Players = game:GetService("Players")
|
|
11
10
|
local RunService = game:GetService("RunService")
|
|
11
|
+
local Players = game:GetService("Players")
|
|
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)
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
local require = require(script.Parent.loader).load(script)
|
|
9
9
|
|
|
10
|
-
local Binder = require("Binder")
|
|
11
|
-
local RagdollClient = require("RagdollClient")
|
|
12
10
|
local RagdollableBase = require("RagdollableBase")
|
|
11
|
+
local RagdollClient = require("RagdollClient")
|
|
12
|
+
local RxRagdollUtils = require("RxRagdollUtils")
|
|
13
|
+
local Binder = require("Binder")
|
|
13
14
|
local RagdollableInterface = require("RagdollableInterface")
|
|
14
15
|
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)
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
9
|
local BaseObject = require("BaseObject")
|
|
10
|
-
local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
|
|
11
10
|
local Ragdoll = require("Ragdoll")
|
|
11
|
+
local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
|
|
12
12
|
|
|
13
13
|
local RagdollCameraShake = setmetatable({}, BaseObject)
|
|
14
14
|
RagdollCameraShake.ClassName = "RagdollCameraShake"
|
|
@@ -26,7 +26,8 @@ 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
|
+
|
|
29
30
|
return self
|
|
30
31
|
end
|
|
31
32
|
|
|
32
|
-
return PlayerHumanoidBinder.new("RagdollCameraShake", RagdollCameraShake)
|
|
33
|
+
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 PlayerHumanoidBinder = require("PlayerHumanoidBinder")
|
|
11
10
|
local Ragdoll = require("Ragdoll")
|
|
11
|
+
local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
|
|
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,6 +45,7 @@ function RagdollHumanoidOnFall.new(humanoid, serviceBag)
|
|
|
45
45
|
self:_handleServerEvent(...)
|
|
46
46
|
end))
|
|
47
47
|
else
|
|
48
|
+
|
|
48
49
|
self._maid:GiveTask(self:_getOrCreateRagdollLogic().ShouldRagdoll.Changed:Connect(function()
|
|
49
50
|
self:_update()
|
|
50
51
|
end))
|
|
@@ -89,4 +90,4 @@ function RagdollHumanoidOnFall:_update()
|
|
|
89
90
|
end
|
|
90
91
|
end
|
|
91
92
|
|
|
92
|
-
return PlayerHumanoidBinder.new("RagdollHumanoidOnFall", RagdollHumanoidOnFall)
|
|
93
|
+
return PlayerHumanoidBinder.new("RagdollHumanoidOnFall", RagdollHumanoidOnFall)
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
|
+
local RagdollableBase = require("RagdollableBase")
|
|
9
10
|
local Maid = require("Maid")
|
|
10
11
|
local Motor6DStackHumanoid = require("Motor6DStackHumanoid")
|
|
11
12
|
local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
|
|
@@ -14,11 +15,10 @@ local RagdollAdditionalAttachmentUtils = require("RagdollAdditionalAttachmentUti
|
|
|
14
15
|
local RagdollBallSocketUtils = require("RagdollBallSocketUtils")
|
|
15
16
|
local RagdollCollisionUtils = require("RagdollCollisionUtils")
|
|
16
17
|
local RagdollMotorUtils = require("RagdollMotorUtils")
|
|
17
|
-
local RagdollableBase = require("RagdollableBase")
|
|
18
|
-
local RagdollableInterface = require("RagdollableInterface")
|
|
19
|
-
local Rx = require("Rx")
|
|
20
18
|
local RxBrioUtils = require("RxBrioUtils")
|
|
21
19
|
local RxRagdollUtils = require("RxRagdollUtils")
|
|
20
|
+
local RagdollableInterface = require("RagdollableInterface")
|
|
21
|
+
local Rx = require("Rx")
|
|
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,6 +8,7 @@ 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")
|
|
11
12
|
local CharacterUtils = require("CharacterUtils")
|
|
12
13
|
local Maid = require("Maid")
|
|
13
14
|
local Observable = require("Observable")
|
|
@@ -19,7 +20,6 @@ local RxBinderUtils = require("RxBinderUtils")
|
|
|
19
20
|
local RxBrioUtils = require("RxBrioUtils")
|
|
20
21
|
local RxInstanceUtils = require("RxInstanceUtils")
|
|
21
22
|
local UnragdollAutomaticallyConstants = require("UnragdollAutomaticallyConstants")
|
|
22
|
-
local cancellableDelay = require("cancellableDelay")
|
|
23
23
|
|
|
24
24
|
local UnragdollAutomatically = setmetatable({}, BaseObject)
|
|
25
25
|
UnragdollAutomatically.ClassName = "UnragdollAutomatically"
|
|
@@ -39,10 +39,8 @@ 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 =
|
|
43
|
-
|
|
44
|
-
self._unragdollAutomaticTime =
|
|
45
|
-
AttributeValue.new(self._obj, UnragdollAutomaticallyConstants.UNRAGDOLL_AUTOMATIC_TIME_ATTRIBUTE, 5)
|
|
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)
|
|
46
44
|
|
|
47
45
|
self._maid:GiveTask(self._ragdollBinder:ObserveInstance(self._obj, function()
|
|
48
46
|
self:_handleRagdollChanged(self._maid)
|
|
@@ -54,22 +52,20 @@ end
|
|
|
54
52
|
|
|
55
53
|
function UnragdollAutomatically:_handleRagdollChanged(maid)
|
|
56
54
|
if self._ragdollBinder:Get(self._obj) then
|
|
57
|
-
maid._unragdoll = self:_observeCanUnragdollTimer()
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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)
|
|
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);
|
|
71
61
|
end
|
|
72
|
-
end)
|
|
62
|
+
end);
|
|
63
|
+
Rx.distinct();
|
|
64
|
+
}):Subscribe(function(canUnragdoll)
|
|
65
|
+
if canUnragdoll then
|
|
66
|
+
self._ragdollBinder:Unbind(self._obj)
|
|
67
|
+
end
|
|
68
|
+
end)
|
|
73
69
|
else
|
|
74
70
|
maid._unragdoll = nil
|
|
75
71
|
end
|
|
@@ -79,8 +75,8 @@ function UnragdollAutomatically:_observeAlive()
|
|
|
79
75
|
return RxInstanceUtils.observeProperty(self._obj, "Health"):Pipe({
|
|
80
76
|
Rx.map(function(health)
|
|
81
77
|
return health > 0
|
|
82
|
-
end)
|
|
83
|
-
Rx.distinct()
|
|
78
|
+
end);
|
|
79
|
+
Rx.distinct();
|
|
84
80
|
})
|
|
85
81
|
end
|
|
86
82
|
|
|
@@ -95,21 +91,21 @@ function UnragdollAutomatically:_observeCanUnragdollTimer()
|
|
|
95
91
|
|
|
96
92
|
maid:GiveTask(RxBrioUtils.flatCombineLatest({
|
|
97
93
|
canUnragdoll = RxBrioUtils.flatCombineLatest({
|
|
98
|
-
enabled = self._unragdollAutomatically:Observe()
|
|
99
|
-
isFallingRagdoll = self:_observeIsFallingRagdoll()
|
|
94
|
+
enabled = self._unragdollAutomatically:Observe();
|
|
95
|
+
isFallingRagdoll = self:_observeIsFallingRagdoll();
|
|
100
96
|
}):Pipe({
|
|
101
97
|
Rx.map(function(state)
|
|
102
98
|
return state.enabled and not state.isFallingRagdoll
|
|
103
|
-
end)
|
|
104
|
-
Rx.distinct()
|
|
99
|
+
end);
|
|
100
|
+
Rx.distinct();
|
|
105
101
|
Rx.tap(function(canUnragdoll)
|
|
106
102
|
-- Ensure we reset timer if we change state
|
|
107
103
|
if canUnragdoll then
|
|
108
104
|
startTime = os.clock()
|
|
109
105
|
end
|
|
110
|
-
end)
|
|
111
|
-
})
|
|
112
|
-
time = self._unragdollAutomaticTime:Observe()
|
|
106
|
+
end);
|
|
107
|
+
});
|
|
108
|
+
time = self._unragdollAutomaticTime:Observe();
|
|
113
109
|
}):Subscribe(function(state)
|
|
114
110
|
if state.canUnragdoll then
|
|
115
111
|
maid._deferred = nil
|
|
@@ -125,6 +121,7 @@ function UnragdollAutomatically:_observeCanUnragdollTimer()
|
|
|
125
121
|
end)
|
|
126
122
|
end
|
|
127
123
|
else
|
|
124
|
+
|
|
128
125
|
isReady.Value = false
|
|
129
126
|
maid._deferred = nil
|
|
130
127
|
end
|
|
@@ -140,13 +137,14 @@ function UnragdollAutomatically:_observeCanUnragdollTimer()
|
|
|
140
137
|
end
|
|
141
138
|
|
|
142
139
|
function UnragdollAutomatically:_observeIsFallingRagdoll()
|
|
143
|
-
return RxBinderUtils.observeBoundClassBrio(self._ragdollHumanoidOnFallBinder, self._obj)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
+
})
|
|
150
148
|
end
|
|
151
149
|
|
|
152
|
-
return PlayerHumanoidBinder.new("UnragdollAutomatically", UnragdollAutomatically)
|
|
150
|
+
return PlayerHumanoidBinder.new("UnragdollAutomatically", UnragdollAutomatically)
|