@quenty/ragdoll 15.52.0 → 15.54.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 +15 -0
- package/package.json +10 -10
- package/src/Client/Classes/RagdollCameraShakeClient.lua +25 -13
- package/src/Client/Classes/RagdollClient.lua +13 -4
- package/src/Client/Classes/RagdollHumanoidOnDeathClient.lua +68 -49
- package/src/Client/Classes/RagdollHumanoidOnFallClient.lua +34 -10
- package/src/Client/Classes/RagdollableClient.lua +22 -11
- package/src/Client/RagdollServiceClient.lua +13 -5
- package/src/Server/Classes/Ragdoll.lua +6 -4
- package/src/Server/Classes/RagdollCameraShake.lua +17 -4
- package/src/Server/Classes/RagdollHumanoidOnDeath.lua +23 -9
- package/src/Server/Classes/RagdollHumanoidOnFall.lua +45 -23
- package/src/Server/Classes/Ragdollable.lua +52 -34
- package/src/Server/Classes/UnragdollAutomatically.lua +84 -62
- package/src/Server/RagdollBindersServer.lua +2 -2
- package/src/Shared/Classes/BindableRagdollHumanoidOnFall.lua +35 -18
- package/src/Shared/Classes/RagdollableBase.lua +30 -19
- package/src/Shared/Rigging/RagdollAdditionalAttachmentUtils.lua +24 -19
- package/src/Shared/Rigging/RagdollBallSocketUtils.lua +19 -10
- package/src/Shared/Rigging/RagdollCollisionUtils.lua +10 -10
- package/src/Shared/Rigging/RagdollMotorLimitData.lua +1 -1
- package/src/Shared/Rigging/RagdollMotorUtils.lua +43 -23
- package/src/Shared/Rigging/RxRagdollUtils.lua +28 -28
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Utility methods to assist with rigging the ragdoll in real-time.
|
|
4
4
|
|
|
@@ -10,8 +10,10 @@ local require = require(script.Parent.loader).load(script)
|
|
|
10
10
|
local Players = game:GetService("Players")
|
|
11
11
|
local RunService = game:GetService("RunService")
|
|
12
12
|
|
|
13
|
+
local Brio = require("Brio")
|
|
13
14
|
local CharacterUtils = require("CharacterUtils")
|
|
14
15
|
local Maid = require("Maid")
|
|
16
|
+
local Observable = require("Observable")
|
|
15
17
|
local RagdollMotorUtils = require("RagdollMotorUtils")
|
|
16
18
|
local RxBrioUtils = require("RxBrioUtils")
|
|
17
19
|
local RxInstanceUtils = require("RxInstanceUtils")
|
|
@@ -25,8 +27,8 @@ local RxRagdollUtils = {}
|
|
|
25
27
|
@param humanoid Humanoid
|
|
26
28
|
@return Observable<Enum.RigType>
|
|
27
29
|
]=]
|
|
28
|
-
function RxRagdollUtils.observeRigType(humanoid: Humanoid)
|
|
29
|
-
return RxInstanceUtils.observeProperty(humanoid, "RigType")
|
|
30
|
+
function RxRagdollUtils.observeRigType(humanoid: Humanoid): Observable.Observable<Enum.HumanoidRigType>
|
|
31
|
+
return RxInstanceUtils.observeProperty(humanoid, "RigType") :: any
|
|
30
32
|
end
|
|
31
33
|
|
|
32
34
|
--[=[
|
|
@@ -35,13 +37,13 @@ end
|
|
|
35
37
|
@param humanoid Humanoid
|
|
36
38
|
@return Observable<Model>
|
|
37
39
|
]=]
|
|
38
|
-
function RxRagdollUtils.observeCharacterBrio(humanoid: Humanoid)
|
|
40
|
+
function RxRagdollUtils.observeCharacterBrio(humanoid: Humanoid): Observable.Observable<Brio.Brio<Model>>
|
|
39
41
|
return RxInstanceUtils.observePropertyBrio(humanoid, "Parent", function(value)
|
|
40
42
|
return value ~= nil
|
|
41
|
-
end)
|
|
43
|
+
end) :: any
|
|
42
44
|
end
|
|
43
45
|
|
|
44
|
-
function RxRagdollUtils.suppressRootPartCollision(character: Model)
|
|
46
|
+
function RxRagdollUtils.suppressRootPartCollision(character: Model): Maid.Maid
|
|
45
47
|
assert(typeof(character) == "Instance" and character:IsA("Model"), "Bad character")
|
|
46
48
|
|
|
47
49
|
local topMaid = Maid.new()
|
|
@@ -51,7 +53,7 @@ function RxRagdollUtils.suppressRootPartCollision(character: Model)
|
|
|
51
53
|
return
|
|
52
54
|
end
|
|
53
55
|
|
|
54
|
-
local rootPart = brio:GetValue()
|
|
56
|
+
local rootPart = brio:GetValue() :: BasePart
|
|
55
57
|
local maid = brio:ToMaid()
|
|
56
58
|
|
|
57
59
|
local oldProperties = rootPart.CustomPhysicalProperties
|
|
@@ -75,7 +77,7 @@ function RxRagdollUtils.suppressRootPartCollision(character: Model)
|
|
|
75
77
|
return topMaid
|
|
76
78
|
end
|
|
77
79
|
|
|
78
|
-
function RxRagdollUtils.enforceHeadCollision(character: Model)
|
|
80
|
+
function RxRagdollUtils.enforceHeadCollision(character: Model): Maid.Maid
|
|
79
81
|
assert(typeof(character) == "Instance" and character:IsA("Model"), "Bad character")
|
|
80
82
|
|
|
81
83
|
local topMaid = Maid.new()
|
|
@@ -86,17 +88,18 @@ function RxRagdollUtils.enforceHeadCollision(character: Model)
|
|
|
86
88
|
end
|
|
87
89
|
|
|
88
90
|
local maid, head = brio:ToMaidAndValue()
|
|
89
|
-
|
|
91
|
+
local headPart = head :: BasePart
|
|
92
|
+
headPart.CanCollide = true
|
|
90
93
|
|
|
91
94
|
maid:GiveTask(function()
|
|
92
|
-
|
|
95
|
+
headPart.CanCollide = false
|
|
93
96
|
end)
|
|
94
97
|
end))
|
|
95
98
|
|
|
96
99
|
return topMaid
|
|
97
100
|
end
|
|
98
101
|
|
|
99
|
-
function RxRagdollUtils.enforceHumanoidStateMachineOff(character: Model, humanoid: Humanoid)
|
|
102
|
+
function RxRagdollUtils.enforceHumanoidStateMachineOff(character: Model, humanoid: Humanoid): Maid.Maid
|
|
100
103
|
assert(typeof(character) == "Instance" and character:IsA("Model"), "Bad character")
|
|
101
104
|
|
|
102
105
|
local topMaid = Maid.new()
|
|
@@ -117,7 +120,7 @@ function RxRagdollUtils.enforceHumanoidStateMachineOff(character: Model, humanoi
|
|
|
117
120
|
return topMaid
|
|
118
121
|
end
|
|
119
122
|
|
|
120
|
-
function RxRagdollUtils.enforceLimbCollisions(character: Model)
|
|
123
|
+
function RxRagdollUtils.enforceLimbCollisions(character: Model): Maid.Maid
|
|
121
124
|
assert(typeof(character) == "Instance" and character:IsA("Model"), "Bad character")
|
|
122
125
|
|
|
123
126
|
local topMaid = Maid.new()
|
|
@@ -145,29 +148,30 @@ function RxRagdollUtils.enforceLimbCollisions(character: Model)
|
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
topMaid:GiveTask(RxInstanceUtils.observeChildrenBrio(character, function(child)
|
|
148
|
-
return child:IsA("BasePart") and LIMB_NAMES[child.Name]
|
|
151
|
+
return child:IsA("BasePart") and LIMB_NAMES[child.Name] == true
|
|
149
152
|
end):Subscribe(function(brio)
|
|
150
153
|
if brio:IsDead() then
|
|
151
154
|
return
|
|
152
155
|
end
|
|
153
156
|
|
|
154
157
|
local maid, part = brio:ToMaidAndValue()
|
|
155
|
-
|
|
158
|
+
local basePart = part :: BasePart
|
|
159
|
+
basePart.CanCollide = true
|
|
156
160
|
maid:GiveTask(function()
|
|
157
|
-
|
|
161
|
+
basePart.CanCollide = false
|
|
158
162
|
end)
|
|
159
163
|
end))
|
|
160
164
|
|
|
161
165
|
return topMaid
|
|
162
166
|
end
|
|
163
167
|
|
|
164
|
-
function RxRagdollUtils.runLocal(humanoid: Humanoid)
|
|
168
|
+
function RxRagdollUtils.runLocal(humanoid: Humanoid): Maid.Maid
|
|
165
169
|
local topMaid = Maid.new()
|
|
166
170
|
|
|
167
|
-
topMaid:GiveTask(RxBrioUtils.flatCombineLatest({
|
|
171
|
+
topMaid:GiveTask((RxBrioUtils.flatCombineLatest({
|
|
168
172
|
character = RxRagdollUtils.observeCharacterBrio(humanoid),
|
|
169
173
|
rigType = RxRagdollUtils.observeRigType(humanoid),
|
|
170
|
-
}):Subscribe(function(state)
|
|
174
|
+
}) :: any):Subscribe(function(state)
|
|
171
175
|
if state.character and state.rigType then
|
|
172
176
|
local character = state.character
|
|
173
177
|
local rigType = state.rigType
|
|
@@ -201,30 +205,26 @@ function RxRagdollUtils.runLocal(humanoid: Humanoid)
|
|
|
201
205
|
debug.profileend()
|
|
202
206
|
end
|
|
203
207
|
|
|
204
|
-
topMaid._current = maid
|
|
208
|
+
(topMaid :: any)._current = maid
|
|
205
209
|
else
|
|
206
|
-
topMaid._current = nil
|
|
210
|
+
(topMaid :: any)._current = nil
|
|
207
211
|
end
|
|
208
212
|
end))
|
|
209
213
|
|
|
210
214
|
return topMaid
|
|
211
215
|
end
|
|
212
216
|
|
|
213
|
-
function RxRagdollUtils.enforceHumanoidState(humanoid: Humanoid)
|
|
217
|
+
function RxRagdollUtils.enforceHumanoidState(humanoid: Humanoid): Maid.Maid
|
|
214
218
|
local maid = Maid.new()
|
|
215
|
-
humanoid:ChangeState(Enum.HumanoidStateType.Physics)
|
|
216
|
-
|
|
217
|
-
-- If you're holding a humanoid and jump, then the humanoid state
|
|
218
|
-
-- changes to your humanoid's state.
|
|
219
|
-
|
|
220
|
-
maid._keepAsPhysics = humanoid.StateChanged:Connect(function(_old, new)
|
|
219
|
+
humanoid:ChangeState(Enum.HumanoidStateType.Physics); -- If you're holding a humanoid and jump, then the humanoid state -- changes to your humanoid's state.
|
|
220
|
+
(maid :: any)._keepAsPhysics = humanoid.StateChanged:Connect(function(_old, new)
|
|
221
221
|
if new ~= Enum.HumanoidStateType.Physics and new ~= Enum.HumanoidStateType.Dead then
|
|
222
222
|
humanoid:ChangeState(Enum.HumanoidStateType.Physics)
|
|
223
223
|
end
|
|
224
224
|
end)
|
|
225
225
|
|
|
226
226
|
maid:GiveTask(function()
|
|
227
|
-
maid._keepAsPhysics = nil
|
|
227
|
+
(maid :: any)._keepAsPhysics = nil
|
|
228
228
|
|
|
229
229
|
if humanoid:GetState() ~= Enum.HumanoidStateType.Dead then
|
|
230
230
|
humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
|