@quenty/ragdoll 15.51.1 → 15.53.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 +9 -9
- 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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
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.53.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@15.52.0...@quenty/ragdoll@15.53.0) (2026-07-14)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- cast Tie interface at :Implement sites to dodge flaky symlink-nominal analyze errors ([17f54f8](https://github.com/Quenty/NevermoreEngine/commit/17f54f87c6d449386570b8a409175dc2d6d02016))
|
|
11
|
+
- **lint:** resolve selene unused-self and Rx shadowing from --!strict conversions ([3f4a085](https://github.com/Quenty/NevermoreEngine/commit/3f4a085911808146f10a2435efbe9e89dff8edff))
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- **ragdoll:** convert package to --!strict ([3f16ada](https://github.com/Quenty/NevermoreEngine/commit/3f16ada0d2371662bde94d8949a52f853152dac3))
|
|
16
|
+
|
|
17
|
+
# [15.52.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@15.51.1...@quenty/ragdoll@15.52.0) (2026-07-12)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @quenty/ragdoll
|
|
20
|
+
|
|
6
21
|
## [15.51.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@15.51.0...@quenty/ragdoll@15.51.1) (2026-06-05)
|
|
7
22
|
|
|
8
23
|
**Note:** Version bump only for package @quenty/ragdoll
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/ragdoll",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.53.0",
|
|
4
4
|
"description": "Quenty's Ragdoll system for Roblox - Floppy fun ragdolls",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"@quenty/adorneedata": "7.34.1",
|
|
32
32
|
"@quenty/attributeutils": "14.30.1",
|
|
33
33
|
"@quenty/baseobject": "10.13.0",
|
|
34
|
-
"@quenty/binder": "14.
|
|
34
|
+
"@quenty/binder": "14.37.0",
|
|
35
35
|
"@quenty/brio": "14.30.1",
|
|
36
|
-
"@quenty/camera": "14.
|
|
36
|
+
"@quenty/camera": "14.43.0",
|
|
37
37
|
"@quenty/cancellabledelay": "3.6.2",
|
|
38
38
|
"@quenty/characterutils": "12.32.1",
|
|
39
39
|
"@quenty/draw": "7.14.1",
|
|
@@ -42,26 +42,26 @@
|
|
|
42
42
|
"@quenty/instanceutils": "13.30.1",
|
|
43
43
|
"@quenty/loader": "10.11.0",
|
|
44
44
|
"@quenty/maid": "3.9.0",
|
|
45
|
-
"@quenty/motor6d": "7.
|
|
45
|
+
"@quenty/motor6d": "7.43.0",
|
|
46
46
|
"@quenty/physicsutils": "8.28.3",
|
|
47
|
-
"@quenty/playerhumanoidbinder": "14.
|
|
47
|
+
"@quenty/playerhumanoidbinder": "14.38.0",
|
|
48
48
|
"@quenty/promise": "10.18.1",
|
|
49
|
-
"@quenty/qframe": "10.
|
|
49
|
+
"@quenty/qframe": "10.23.0",
|
|
50
50
|
"@quenty/r15utils": "13.31.1",
|
|
51
51
|
"@quenty/remoting": "12.32.1",
|
|
52
52
|
"@quenty/rx": "13.28.3",
|
|
53
|
-
"@quenty/rxbinderutils": "14.
|
|
53
|
+
"@quenty/rxbinderutils": "14.37.0",
|
|
54
54
|
"@quenty/rxsignal": "7.28.3",
|
|
55
55
|
"@quenty/servicebag": "11.18.1",
|
|
56
56
|
"@quenty/spring": "10.12.0",
|
|
57
57
|
"@quenty/steputils": "3.6.3",
|
|
58
58
|
"@quenty/table": "3.9.2",
|
|
59
|
-
"@quenty/tie": "10.
|
|
59
|
+
"@quenty/tie": "10.41.0",
|
|
60
60
|
"@quenty/valuebaseutils": "13.30.1",
|
|
61
61
|
"@quenty/valueobject": "13.31.1"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "13f0162f4971a77378e55e9b7236aea94f0dd3a8"
|
|
67
67
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
@class RagdollCameraShakeClient
|
|
4
4
|
]=]
|
|
@@ -27,8 +27,20 @@ local RagdollCameraShakeClient = setmetatable({}, BaseObject)
|
|
|
27
27
|
RagdollCameraShakeClient.ClassName = "RagdollCameraShakeClient"
|
|
28
28
|
RagdollCameraShakeClient.__index = RagdollCameraShakeClient
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
export type RagdollCameraShakeClient =
|
|
31
|
+
typeof(setmetatable(
|
|
32
|
+
{} :: {
|
|
33
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
34
|
+
_ragdollServiceClient: any,
|
|
35
|
+
_cameraStackService: any,
|
|
36
|
+
_ragdollBinder: any,
|
|
37
|
+
},
|
|
38
|
+
{} :: typeof({ __index = RagdollCameraShakeClient })
|
|
39
|
+
))
|
|
40
|
+
& BaseObject.BaseObject
|
|
41
|
+
|
|
42
|
+
function RagdollCameraShakeClient.new(humanoid: Humanoid, serviceBag: ServiceBag.ServiceBag): RagdollCameraShakeClient
|
|
43
|
+
local self: RagdollCameraShakeClient = setmetatable(BaseObject.new(humanoid) :: any, RagdollCameraShakeClient)
|
|
32
44
|
|
|
33
45
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
34
46
|
self._ragdollServiceClient = self._serviceBag:GetService(RagdollServiceClient)
|
|
@@ -36,13 +48,13 @@ function RagdollCameraShakeClient.new(humanoid: Humanoid, serviceBag: ServiceBag
|
|
|
36
48
|
self._ragdollBinder = self._serviceBag:GetService(RagdollClient)
|
|
37
49
|
|
|
38
50
|
-- While we've got a charater and we're ragdolled
|
|
39
|
-
self._maid:GiveTask(RxCharacterUtils.observeIsOfLocalCharacterBrio(self._obj)
|
|
51
|
+
self._maid:GiveTask((RxCharacterUtils.observeIsOfLocalCharacterBrio(self._obj :: any) :: any)
|
|
40
52
|
:Pipe({
|
|
41
53
|
RxBrioUtils.switchMapBrio(function()
|
|
42
54
|
return self._ragdollBinder:ObserveBrio(self._obj)
|
|
43
55
|
end),
|
|
44
56
|
})
|
|
45
|
-
:Subscribe(function(brio)
|
|
57
|
+
:Subscribe(function(brio: any)
|
|
46
58
|
if brio:IsDead() then
|
|
47
59
|
return
|
|
48
60
|
end
|
|
@@ -61,7 +73,7 @@ function RagdollCameraShakeClient.new(humanoid: Humanoid, serviceBag: ServiceBag
|
|
|
61
73
|
return self
|
|
62
74
|
end
|
|
63
75
|
|
|
64
|
-
function RagdollCameraShakeClient
|
|
76
|
+
function RagdollCameraShakeClient._setupCameraShake(self: RagdollCameraShakeClient, impulseCamera: any): Maid.Maid
|
|
65
77
|
local topMaid = Maid.new()
|
|
66
78
|
|
|
67
79
|
-- TODO: Move out of this open source module
|
|
@@ -69,20 +81,20 @@ function RagdollCameraShakeClient:_setupCameraShake(impulseCamera)
|
|
|
69
81
|
-- Use the upper torso instead of the head because the upper torso shakes a lot less so
|
|
70
82
|
-- we get a stronger response to full character movement.
|
|
71
83
|
|
|
72
|
-
topMaid:GiveTask(RxInstanceUtils.observePropertyBrio(self._obj, "Parent", function(character)
|
|
84
|
+
topMaid:GiveTask((RxInstanceUtils.observePropertyBrio(self._obj :: any, "Parent", function(character)
|
|
73
85
|
return character ~= nil
|
|
74
|
-
end)
|
|
86
|
+
end) :: any)
|
|
75
87
|
:Pipe({
|
|
76
88
|
RxBrioUtils.switchMapBrio(function(character)
|
|
77
89
|
return RxBrioUtils.flatCombineLatestBrio({
|
|
78
90
|
upperTorso = RxR15Utils.observeCharacterPartBrio(character, "UpperTorso"),
|
|
79
91
|
head = RxR15Utils.observeCharacterPartBrio(character, "Head"),
|
|
80
|
-
}, function(state)
|
|
92
|
+
}, function(state: any)
|
|
81
93
|
return state.upperTorso and state.head
|
|
82
94
|
end)
|
|
83
95
|
end),
|
|
84
96
|
})
|
|
85
|
-
:Subscribe(function(brio)
|
|
97
|
+
:Subscribe(function(brio: any)
|
|
86
98
|
if brio:IsDead() then
|
|
87
99
|
return
|
|
88
100
|
end
|
|
@@ -132,7 +144,7 @@ function RagdollCameraShakeClient:_setupCameraShake(impulseCamera)
|
|
|
132
144
|
return topMaid
|
|
133
145
|
end
|
|
134
146
|
|
|
135
|
-
function RagdollCameraShakeClient
|
|
147
|
+
function RagdollCameraShakeClient._setupHapticFeedback(_self: RagdollCameraShakeClient): Maid.Maid
|
|
136
148
|
local maid = Maid.new()
|
|
137
149
|
|
|
138
150
|
local lastInputType = UserInputService:GetLastInputType()
|
|
@@ -149,11 +161,11 @@ function RagdollCameraShakeClient:_setupHapticFeedback()
|
|
|
149
161
|
HapticFeedbackUtils.setSmallVibration(lastInputType, 0)
|
|
150
162
|
|
|
151
163
|
maid:GiveTask(function()
|
|
152
|
-
HapticFeedbackUtils.smallVibrate(lastInputType)
|
|
164
|
+
(HapticFeedbackUtils :: any).smallVibrate(lastInputType)
|
|
153
165
|
end)
|
|
154
166
|
end))
|
|
155
167
|
|
|
156
168
|
return maid
|
|
157
169
|
end
|
|
158
170
|
|
|
159
|
-
return Binder.new("RagdollCameraShake", RagdollCameraShakeClient)
|
|
171
|
+
return Binder.new("RagdollCameraShake", RagdollCameraShakeClient :: any) :: Binder.Binder<RagdollCameraShakeClient>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Client side ragdolling meant to be used with a binder. This class exports a [Binder].
|
|
4
4
|
While a humanoid is bound with this class, it is ragdolled.
|
|
@@ -25,18 +25,27 @@ local RagdollClient = setmetatable({}, BaseObject)
|
|
|
25
25
|
RagdollClient.ClassName = "RagdollClient"
|
|
26
26
|
RagdollClient.__index = RagdollClient
|
|
27
27
|
|
|
28
|
+
export type RagdollClient =
|
|
29
|
+
typeof(setmetatable(
|
|
30
|
+
{} :: {
|
|
31
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
32
|
+
},
|
|
33
|
+
{} :: typeof({ __index = RagdollClient })
|
|
34
|
+
))
|
|
35
|
+
& BaseObject.BaseObject
|
|
36
|
+
|
|
28
37
|
--[=[
|
|
29
38
|
Constructs a new RagdollClient. This module exports a [Binder].
|
|
30
39
|
@param humanoid Humanoid
|
|
31
40
|
@param serviceBag ServiceBag
|
|
32
41
|
@return RagdollClient
|
|
33
42
|
]=]
|
|
34
|
-
function RagdollClient.new(humanoid: Humanoid, serviceBag: ServiceBag.ServiceBag)
|
|
35
|
-
local self = setmetatable(BaseObject.new(humanoid), RagdollClient)
|
|
43
|
+
function RagdollClient.new(humanoid: Humanoid, serviceBag: ServiceBag.ServiceBag): RagdollClient
|
|
44
|
+
local self: RagdollClient = setmetatable(BaseObject.new(humanoid) :: any, RagdollClient)
|
|
36
45
|
|
|
37
46
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
38
47
|
|
|
39
48
|
return self
|
|
40
49
|
end
|
|
41
50
|
|
|
42
|
-
return Binder.new("Ragdoll", RagdollClient)
|
|
51
|
+
return Binder.new("Ragdoll", RagdollClient :: any) :: Binder.Binder<RagdollClient>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Ragdolls the humanoid on death. Should be bound via [RagdollBindersClient].
|
|
4
4
|
|
|
@@ -22,50 +22,18 @@ local RagdollHumanoidOnDeathClient = setmetatable({}, BaseObject)
|
|
|
22
22
|
RagdollHumanoidOnDeathClient.ClassName = "RagdollHumanoidOnDeathClient"
|
|
23
23
|
RagdollHumanoidOnDeathClient.__index = RagdollHumanoidOnDeathClient
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if self._obj:GetState() == Enum.HumanoidStateType.Dead then
|
|
38
|
-
self:_handleDeath()
|
|
39
|
-
else
|
|
40
|
-
self._maid._diedEvent = self._obj.Died:Connect(function()
|
|
41
|
-
self:_handleDeath(self._obj)
|
|
42
|
-
end)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
return self
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
function RagdollHumanoidOnDeathClient:_getPlayer()
|
|
49
|
-
return CharacterUtils.getPlayerFromCharacter(self._obj)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
function RagdollHumanoidOnDeathClient:_handleDeath()
|
|
53
|
-
-- Disconnect!
|
|
54
|
-
self._maid._diedEvent = nil
|
|
55
|
-
|
|
56
|
-
if self:_getPlayer() == Players.LocalPlayer then
|
|
57
|
-
self._ragdollBinder:BindClient(self._obj)
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
local character = self._obj.Parent
|
|
61
|
-
self._maid:GiveTask(task.delay(Players.RespawnTime - 0.5, function()
|
|
62
|
-
if not character:IsDescendantOf(Workspace) then
|
|
63
|
-
return
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
-- fade into the mist...
|
|
67
|
-
RagdollHumanoidOnDeathClient.disableParticleEmittersAndFadeOutYielding(character, 0.4)
|
|
68
|
-
end))
|
|
25
|
+
export type RagdollHumanoidOnDeathClient =
|
|
26
|
+
typeof(setmetatable(
|
|
27
|
+
{} :: {
|
|
28
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
29
|
+
_ragdollBinder: any, -- Binder.Binder<RagdollClient.RagdollClient> (heavy cyclic binder; old solver can't hold it)
|
|
30
|
+
},
|
|
31
|
+
{} :: typeof({ __index = RagdollHumanoidOnDeathClient })
|
|
32
|
+
))
|
|
33
|
+
& BaseObject.BaseObject
|
|
34
|
+
|
|
35
|
+
function RagdollHumanoidOnDeathClient._getPlayer(self: RagdollHumanoidOnDeathClient): Player?
|
|
36
|
+
return CharacterUtils.getPlayerFromCharacter(self._obj :: Instance)
|
|
69
37
|
end
|
|
70
38
|
|
|
71
39
|
--[=[
|
|
@@ -75,9 +43,9 @@ end
|
|
|
75
43
|
@param character Model
|
|
76
44
|
@param duration number
|
|
77
45
|
]=]
|
|
78
|
-
function RagdollHumanoidOnDeathClient.disableParticleEmittersAndFadeOutYielding(character, duration)
|
|
46
|
+
function RagdollHumanoidOnDeathClient.disableParticleEmittersAndFadeOutYielding(character: Model, duration: number): ()
|
|
79
47
|
local descendants = character:GetDescendants()
|
|
80
|
-
local transparencies = {}
|
|
48
|
+
local transparencies: { [Instance]: number } = {}
|
|
81
49
|
for _, instance in descendants do
|
|
82
50
|
if instance:IsA("BasePart") or instance:IsA("Decal") then
|
|
83
51
|
transparencies[instance] = instance.Transparency
|
|
@@ -93,9 +61,60 @@ function RagdollHumanoidOnDeathClient.disableParticleEmittersAndFadeOutYielding(
|
|
|
93
61
|
t = t + dt
|
|
94
62
|
local alpha = math.min(t / duration, 1)
|
|
95
63
|
for part, initialTransparency in transparencies do
|
|
96
|
-
part.Transparency = (1 - alpha) * initialTransparency + alpha
|
|
64
|
+
(part :: BasePart).Transparency = (1 - alpha) * initialTransparency + alpha
|
|
97
65
|
end
|
|
98
66
|
end
|
|
99
67
|
end
|
|
100
68
|
|
|
101
|
-
|
|
69
|
+
function RagdollHumanoidOnDeathClient._handleDeath(self: RagdollHumanoidOnDeathClient): ()
|
|
70
|
+
-- Disconnect!
|
|
71
|
+
self._maid._diedEvent = nil
|
|
72
|
+
|
|
73
|
+
local humanoidObj = self._obj :: Humanoid
|
|
74
|
+
if self:_getPlayer() == Players.LocalPlayer then
|
|
75
|
+
self._ragdollBinder:BindClient(humanoidObj)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
local character = humanoidObj.Parent
|
|
79
|
+
self._maid:GiveTask(task.delay(Players.RespawnTime - 0.5, function()
|
|
80
|
+
if not character or not character:IsDescendantOf(Workspace) then
|
|
81
|
+
return
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
-- fade into the mist...
|
|
85
|
+
RagdollHumanoidOnDeathClient.disableParticleEmittersAndFadeOutYielding(character :: Model, 0.4)
|
|
86
|
+
end))
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
--[=[
|
|
90
|
+
Constructs a new RagdollHumanoidOnDeathClient. This module exports a [Binder].
|
|
91
|
+
@param humanoid Humanoid
|
|
92
|
+
@param serviceBag ServiceBag
|
|
93
|
+
@return RagdollHumanoidOnDeathClient
|
|
94
|
+
]=]
|
|
95
|
+
function RagdollHumanoidOnDeathClient.new(
|
|
96
|
+
humanoid: Humanoid,
|
|
97
|
+
serviceBag: ServiceBag.ServiceBag
|
|
98
|
+
): RagdollHumanoidOnDeathClient
|
|
99
|
+
local self: RagdollHumanoidOnDeathClient =
|
|
100
|
+
setmetatable(BaseObject.new(humanoid) :: any, RagdollHumanoidOnDeathClient)
|
|
101
|
+
|
|
102
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
103
|
+
self._ragdollBinder = self._serviceBag:GetService(RagdollClient)
|
|
104
|
+
|
|
105
|
+
local humanoidObj = self._obj :: Humanoid
|
|
106
|
+
if humanoidObj:GetState() == Enum.HumanoidStateType.Dead then
|
|
107
|
+
self:_handleDeath()
|
|
108
|
+
else
|
|
109
|
+
self._maid._diedEvent = humanoidObj.Died:Connect(function()
|
|
110
|
+
self:_handleDeath()
|
|
111
|
+
end)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
return self
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
return Binder.new(
|
|
118
|
+
"RagdollHumanoidOnDeath",
|
|
119
|
+
RagdollHumanoidOnDeathClient :: any
|
|
120
|
+
) :: Binder.Binder<RagdollHumanoidOnDeathClient>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Ragdolls the humanoid on fall. Should be bound via [RagdollBindersClient].
|
|
4
4
|
|
|
@@ -14,6 +14,7 @@ local BaseObject = require("BaseObject")
|
|
|
14
14
|
local BindableRagdollHumanoidOnFall = require("BindableRagdollHumanoidOnFall")
|
|
15
15
|
local Binder = require("Binder")
|
|
16
16
|
local CharacterUtils = require("CharacterUtils")
|
|
17
|
+
local Promise = require("Promise")
|
|
17
18
|
local RagdollClient = require("RagdollClient")
|
|
18
19
|
local RagdollHumanoidOnFallConstants = require("RagdollHumanoidOnFallConstants")
|
|
19
20
|
local ServiceBag = require("ServiceBag")
|
|
@@ -22,6 +23,20 @@ local RagdollHumanoidOnFallClient = setmetatable({}, BaseObject)
|
|
|
22
23
|
RagdollHumanoidOnFallClient.ClassName = "RagdollHumanoidOnFallClient"
|
|
23
24
|
RagdollHumanoidOnFallClient.__index = RagdollHumanoidOnFallClient
|
|
24
25
|
|
|
26
|
+
export type RagdollHumanoidOnFallClient =
|
|
27
|
+
typeof(setmetatable(
|
|
28
|
+
{} :: {
|
|
29
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
30
|
+
_ragdollBinder: Binder.Binder<RagdollClient.RagdollClient>,
|
|
31
|
+
_ragdollLogic: BindableRagdollHumanoidOnFall.BindableRagdollHumanoidOnFall?,
|
|
32
|
+
-- PromiseRemoteEventMixin surface (injected at runtime)
|
|
33
|
+
_remoteEventName: string,
|
|
34
|
+
PromiseRemoteEvent: (self: any) -> Promise.Promise<RemoteEvent>,
|
|
35
|
+
},
|
|
36
|
+
{} :: typeof({ __index = RagdollHumanoidOnFallClient })
|
|
37
|
+
))
|
|
38
|
+
& BaseObject.BaseObject
|
|
39
|
+
|
|
25
40
|
require("PromiseRemoteEventMixin"):Add(RagdollHumanoidOnFallClient, RagdollHumanoidOnFallConstants.REMOTE_EVENT_NAME)
|
|
26
41
|
|
|
27
42
|
--[=[
|
|
@@ -30,17 +45,21 @@ require("PromiseRemoteEventMixin"):Add(RagdollHumanoidOnFallClient, RagdollHuman
|
|
|
30
45
|
@param serviceBag ServiceBag
|
|
31
46
|
@return RagdollHumanoidOnFallClient
|
|
32
47
|
]=]
|
|
33
|
-
function RagdollHumanoidOnFallClient.new(
|
|
34
|
-
|
|
48
|
+
function RagdollHumanoidOnFallClient.new(
|
|
49
|
+
humanoid: Humanoid,
|
|
50
|
+
serviceBag: ServiceBag.ServiceBag
|
|
51
|
+
): RagdollHumanoidOnFallClient
|
|
52
|
+
local self: RagdollHumanoidOnFallClient = setmetatable(BaseObject.new(humanoid) :: any, RagdollHumanoidOnFallClient)
|
|
35
53
|
|
|
36
54
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
37
55
|
self._ragdollBinder = self._serviceBag:GetService(RagdollClient)
|
|
38
56
|
|
|
39
|
-
local player = CharacterUtils.getPlayerFromCharacter(
|
|
57
|
+
local player = CharacterUtils.getPlayerFromCharacter(humanoid)
|
|
40
58
|
if player == Players.LocalPlayer then
|
|
41
|
-
|
|
59
|
+
local ragdollLogic = self._maid:Add(BindableRagdollHumanoidOnFall.new(humanoid, self._ragdollBinder))
|
|
60
|
+
self._ragdollLogic = ragdollLogic
|
|
42
61
|
|
|
43
|
-
self._maid:GiveTask(
|
|
62
|
+
self._maid:GiveTask(ragdollLogic.ShouldRagdoll.Changed:Connect(function()
|
|
44
63
|
self:_update()
|
|
45
64
|
end))
|
|
46
65
|
end
|
|
@@ -48,13 +67,18 @@ function RagdollHumanoidOnFallClient.new(humanoid: Humanoid, serviceBag: Service
|
|
|
48
67
|
return self
|
|
49
68
|
end
|
|
50
69
|
|
|
51
|
-
function RagdollHumanoidOnFallClient
|
|
52
|
-
|
|
53
|
-
|
|
70
|
+
function RagdollHumanoidOnFallClient._update(self: RagdollHumanoidOnFallClient): ()
|
|
71
|
+
local ragdollLogic = self._ragdollLogic
|
|
72
|
+
if ragdollLogic and ragdollLogic.ShouldRagdoll.Value then
|
|
73
|
+
local obj = assert(self._obj, "No obj")
|
|
74
|
+
self._ragdollBinder:BindClient(obj)
|
|
54
75
|
self:PromiseRemoteEvent():Then(function(remoteEvent)
|
|
55
76
|
remoteEvent:FireServer(true)
|
|
56
77
|
end)
|
|
57
78
|
end
|
|
58
79
|
end
|
|
59
80
|
|
|
60
|
-
return Binder.new(
|
|
81
|
+
return Binder.new(
|
|
82
|
+
"RagdollHumanoidOnFall",
|
|
83
|
+
RagdollHumanoidOnFallClient :: any
|
|
84
|
+
) :: Binder.Binder<RagdollHumanoidOnFallClient>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Initialize via [RagdollServiceClient].
|
|
4
4
|
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
local require = require(script.Parent.loader).load(script)
|
|
10
10
|
|
|
11
11
|
local Binder = require("Binder")
|
|
12
|
+
local Observable = require("Observable")
|
|
12
13
|
local RagdollClient = require("RagdollClient")
|
|
13
14
|
local RagdollableBase = require("RagdollableBase")
|
|
14
15
|
local RagdollableInterface = require("RagdollableInterface")
|
|
@@ -20,41 +21,51 @@ local RagdollableClient = setmetatable({}, RagdollableBase)
|
|
|
20
21
|
RagdollableClient.ClassName = "RagdollableClient"
|
|
21
22
|
RagdollableClient.__index = RagdollableClient
|
|
22
23
|
|
|
24
|
+
export type RagdollableClient =
|
|
25
|
+
typeof(setmetatable(
|
|
26
|
+
{} :: {
|
|
27
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
28
|
+
_ragdollBinder: Binder.Binder<RagdollClient.RagdollClient>,
|
|
29
|
+
},
|
|
30
|
+
{} :: typeof({ __index = RagdollableClient })
|
|
31
|
+
))
|
|
32
|
+
& RagdollableBase.RagdollableBase
|
|
33
|
+
|
|
23
34
|
--[=[
|
|
24
35
|
Constructs a new RagdollableClient. Should be done via [Binder]. See [RagdollBindersClient].
|
|
25
36
|
@param humanoid Humanoid
|
|
26
37
|
@param serviceBag ServiceBag
|
|
27
38
|
@return RagdollableClient
|
|
28
39
|
]=]
|
|
29
|
-
function RagdollableClient.new(humanoid: Humanoid, serviceBag: ServiceBag.ServiceBag)
|
|
30
|
-
local self = setmetatable(RagdollableBase.new(humanoid), RagdollableClient)
|
|
40
|
+
function RagdollableClient.new(humanoid: Humanoid, serviceBag: ServiceBag.ServiceBag): RagdollableClient
|
|
41
|
+
local self: RagdollableClient = setmetatable(RagdollableBase.new(humanoid) :: any, RagdollableClient)
|
|
31
42
|
|
|
32
43
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
33
44
|
self._ragdollBinder = self._serviceBag:GetService(RagdollClient)
|
|
34
45
|
|
|
35
|
-
self._maid:GiveTask(self._ragdollBinder:Observe(self._obj):Subscribe(function(ragdoll)
|
|
46
|
+
self._maid:GiveTask(self._ragdollBinder:Observe(self._obj :: Instance):Subscribe(function(ragdoll)
|
|
36
47
|
self:_onRagdollChanged(ragdoll)
|
|
37
48
|
end))
|
|
38
49
|
|
|
39
|
-
self._maid:GiveTask(RagdollableInterface.Client:Implement(self._obj, self))
|
|
50
|
+
self._maid:GiveTask((RagdollableInterface :: any).Client:Implement(self._obj :: Instance, self))
|
|
40
51
|
|
|
41
52
|
return self
|
|
42
53
|
end
|
|
43
54
|
|
|
44
|
-
function RagdollableClient
|
|
45
|
-
return self._ragdollBinder:Observe(self._obj):Pipe({
|
|
46
|
-
Rx.map(function(value)
|
|
55
|
+
function RagdollableClient.ObserveIsRagdolled(self: RagdollableClient): Observable.Observable<boolean>
|
|
56
|
+
return (self._ragdollBinder:Observe(self._obj :: Instance) :: any):Pipe({
|
|
57
|
+
Rx.map(function(value): any
|
|
47
58
|
return value and true or false
|
|
48
59
|
end),
|
|
49
60
|
})
|
|
50
61
|
end
|
|
51
62
|
|
|
52
|
-
function RagdollableClient
|
|
63
|
+
function RagdollableClient._onRagdollChanged(self: RagdollableClient, ragdoll: any): ()
|
|
53
64
|
if ragdoll then
|
|
54
|
-
self._maid._ragdoll = RxRagdollUtils.runLocal(self._obj)
|
|
65
|
+
self._maid._ragdoll = RxRagdollUtils.runLocal(self._obj :: Humanoid)
|
|
55
66
|
else
|
|
56
67
|
self._maid._ragdoll = nil
|
|
57
68
|
end
|
|
58
69
|
end
|
|
59
70
|
|
|
60
|
-
return Binder.new("Ragdollable", RagdollableClient)
|
|
71
|
+
return Binder.new("Ragdollable", RagdollableClient :: any) :: Binder.Binder<RagdollableClient>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Initializes the RagdollService on the client.
|
|
4
4
|
|
|
@@ -16,12 +16,20 @@ local ServiceBag = require("ServiceBag")
|
|
|
16
16
|
local RagdollServiceClient = {}
|
|
17
17
|
RagdollServiceClient.ServiceName = "RagdollServiceClient"
|
|
18
18
|
|
|
19
|
+
export type RagdollServiceClient = typeof(setmetatable(
|
|
20
|
+
{} :: {
|
|
21
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
22
|
+
_screenShakeEnabled: AttributeValue.AttributeValue<boolean>,
|
|
23
|
+
},
|
|
24
|
+
{} :: typeof({ __index = RagdollServiceClient })
|
|
25
|
+
))
|
|
26
|
+
|
|
19
27
|
--[=[
|
|
20
28
|
Initializes the ragdoll service on the client. Should be done via [ServiceBag].
|
|
21
29
|
@param serviceBag ServiceBag
|
|
22
30
|
]=]
|
|
23
|
-
function RagdollServiceClient
|
|
24
|
-
assert(not self._serviceBag, "Already initialized")
|
|
31
|
+
function RagdollServiceClient.Init(self: RagdollServiceClient, serviceBag: ServiceBag.ServiceBag): ()
|
|
32
|
+
assert(not (self :: any)._serviceBag, "Already initialized")
|
|
25
33
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
26
34
|
|
|
27
35
|
-- External
|
|
@@ -43,7 +51,7 @@ end
|
|
|
43
51
|
Sets screen shake enabled for the local player
|
|
44
52
|
@param value boolelan
|
|
45
53
|
]=]
|
|
46
|
-
function RagdollServiceClient
|
|
54
|
+
function RagdollServiceClient.SetScreenShakeEnabled(self: RagdollServiceClient, value: boolean): ()
|
|
47
55
|
assert(type(value) == "boolean", "Bad value")
|
|
48
56
|
|
|
49
57
|
self._screenShakeEnabled.Value = value
|
|
@@ -53,7 +61,7 @@ end
|
|
|
53
61
|
Returns wheher screenshake is enabled.
|
|
54
62
|
@return boolean
|
|
55
63
|
]=]
|
|
56
|
-
function RagdollServiceClient
|
|
64
|
+
function RagdollServiceClient.GetScreenShakeEnabled(self: RagdollServiceClient): boolean
|
|
57
65
|
assert(self._serviceBag, "Not initialized")
|
|
58
66
|
|
|
59
67
|
return self._screenShakeEnabled.Value
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Base class for ragdolls, meant to be used with binders. This class exports a [Binder].
|
|
4
4
|
While a humanoid is bound with this class, it is ragdolled.
|
|
@@ -38,16 +38,18 @@ local Ragdoll = setmetatable({}, BaseObject)
|
|
|
38
38
|
Ragdoll.ClassName = "Ragdoll"
|
|
39
39
|
Ragdoll.__index = Ragdoll
|
|
40
40
|
|
|
41
|
+
export type Ragdoll = typeof(setmetatable({} :: {}, {} :: typeof({ __index = Ragdoll }))) & BaseObject.BaseObject
|
|
42
|
+
|
|
41
43
|
--[=[
|
|
42
44
|
Constructs a new Ragdoll. Should be done via [Binder]. See [RagdollBindersServer].
|
|
43
45
|
@param humanoid Humanoid
|
|
44
46
|
@param _serviceBag ServiceBag
|
|
45
47
|
@return Ragdoll
|
|
46
48
|
]=]
|
|
47
|
-
function Ragdoll.new(humanoid: Humanoid, _serviceBag: ServiceBag.ServiceBag)
|
|
48
|
-
local self = setmetatable(BaseObject.new(humanoid), Ragdoll)
|
|
49
|
+
function Ragdoll.new(humanoid: Humanoid, _serviceBag: ServiceBag.ServiceBag): Ragdoll
|
|
50
|
+
local self: Ragdoll = setmetatable(BaseObject.new(humanoid) :: any, Ragdoll)
|
|
49
51
|
|
|
50
52
|
return self
|
|
51
53
|
end
|
|
52
54
|
|
|
53
|
-
return Binder.new("Ragdoll", Ragdoll)
|
|
55
|
+
return Binder.new("Ragdoll", Ragdoll :: any) :: Binder.Binder<Ragdoll>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Shakes the camera on ragdoll. This class exports a [Binder].
|
|
4
4
|
@server
|
|
@@ -16,14 +16,24 @@ local RagdollCameraShake = setmetatable({}, BaseObject)
|
|
|
16
16
|
RagdollCameraShake.ClassName = "RagdollCameraShake"
|
|
17
17
|
RagdollCameraShake.__index = RagdollCameraShake
|
|
18
18
|
|
|
19
|
+
export type RagdollCameraShake =
|
|
20
|
+
typeof(setmetatable(
|
|
21
|
+
{} :: {
|
|
22
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
23
|
+
_ragdollBinder: any,
|
|
24
|
+
},
|
|
25
|
+
{} :: typeof({ __index = RagdollCameraShake })
|
|
26
|
+
))
|
|
27
|
+
& BaseObject.BaseObject
|
|
28
|
+
|
|
19
29
|
--[=[
|
|
20
30
|
Constructs a new RagdollCameraShake. This class exports a [Binder].
|
|
21
31
|
@param humanoid Humanoid
|
|
22
32
|
@param serviceBag ServiceBag
|
|
23
33
|
@return RagdollCameraShake
|
|
24
34
|
]=]
|
|
25
|
-
function RagdollCameraShake.new(humanoid: Humanoid, serviceBag: ServiceBag.ServiceBag)
|
|
26
|
-
local self = setmetatable(BaseObject.new(humanoid), RagdollCameraShake)
|
|
35
|
+
function RagdollCameraShake.new(humanoid: Humanoid, serviceBag: ServiceBag.ServiceBag): RagdollCameraShake
|
|
36
|
+
local self: RagdollCameraShake = setmetatable(BaseObject.new(humanoid) :: any, RagdollCameraShake)
|
|
27
37
|
|
|
28
38
|
self._serviceBag = assert(serviceBag, "Bad serviceBag")
|
|
29
39
|
self._ragdollBinder = self._serviceBag:GetService(Ragdoll)
|
|
@@ -31,4 +41,7 @@ function RagdollCameraShake.new(humanoid: Humanoid, serviceBag: ServiceBag.Servi
|
|
|
31
41
|
return self
|
|
32
42
|
end
|
|
33
43
|
|
|
34
|
-
return PlayerHumanoidBinder.new(
|
|
44
|
+
return PlayerHumanoidBinder.new(
|
|
45
|
+
"RagdollCameraShake",
|
|
46
|
+
RagdollCameraShake :: any
|
|
47
|
+
) :: PlayerHumanoidBinder.PlayerHumanoidBinder<RagdollCameraShake>
|