@quenty/ragdoll 9.27.2 → 9.28.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 +8 -0
- package/package.json +7 -7
- package/src/Client/Classes/RagdollClient.lua +14 -5
- package/src/Client/Classes/RagdollHumanoidOnDeathClient.lua +6 -5
- package/src/Client/Classes/RagdollHumanoidOnFallClient.lua +6 -4
- package/src/Client/Classes/RagdollableClient.lua +9 -9
- package/src/Client/RagdollBindersClient.lua +7 -14
- package/src/Client/RagdollServiceClient.lua +6 -0
- package/src/Server/Classes/Ragdoll.lua +14 -6
- package/src/Server/Classes/RagdollHumanoidOnDeath.lua +7 -5
- package/src/Server/Classes/RagdollHumanoidOnFall.lua +6 -4
- package/src/Server/Classes/Ragdollable.lua +12 -11
- package/src/Server/Classes/UnragdollAutomatically.lua +18 -14
- package/src/Server/RagdollBindersServer.lua +10 -20
- package/src/Server/RagdollService.lua +15 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
# [9.28.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@9.27.2...@quenty/ragdoll@9.28.0) (2023-06-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/ragdoll
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [9.27.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@9.27.1...@quenty/ragdoll@9.27.2) (2023-06-23)
|
|
7
15
|
|
|
8
16
|
**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": "9.
|
|
3
|
+
"version": "9.28.0",
|
|
4
4
|
"description": "Quenty's Ragdoll system for Roblox - Floppy fun ragdolls",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@quenty/attributeutils": "^8.16.0",
|
|
29
29
|
"@quenty/baseobject": "^6.2.1",
|
|
30
|
-
"@quenty/binder": "^8.
|
|
30
|
+
"@quenty/binder": "^8.19.0",
|
|
31
31
|
"@quenty/brio": "^8.14.0",
|
|
32
|
-
"@quenty/camera": "^9.
|
|
32
|
+
"@quenty/camera": "^9.17.0",
|
|
33
33
|
"@quenty/cancellabledelay": "^3.4.0",
|
|
34
34
|
"@quenty/characterutils": "^6.8.0",
|
|
35
35
|
"@quenty/draw": "^4.2.0",
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"@quenty/instanceutils": "^7.15.0",
|
|
39
39
|
"@quenty/loader": "^6.2.1",
|
|
40
40
|
"@quenty/maid": "^2.5.0",
|
|
41
|
-
"@quenty/motor6d": "^1.
|
|
42
|
-
"@quenty/playerhumanoidbinder": "^8.
|
|
41
|
+
"@quenty/motor6d": "^1.25.0",
|
|
42
|
+
"@quenty/playerhumanoidbinder": "^8.19.0",
|
|
43
43
|
"@quenty/promise": "^6.6.0",
|
|
44
44
|
"@quenty/qframe": "^6.9.0",
|
|
45
45
|
"@quenty/r15utils": "^7.16.0",
|
|
46
46
|
"@quenty/remoting": "^6.6.0",
|
|
47
47
|
"@quenty/rx": "^7.12.0",
|
|
48
|
-
"@quenty/rxbinderutils": "^8.
|
|
48
|
+
"@quenty/rxbinderutils": "^8.20.0",
|
|
49
49
|
"@quenty/spring": "^6.3.0",
|
|
50
50
|
"@quenty/steputils": "^3.2.0",
|
|
51
51
|
"@quenty/table": "^3.2.0",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "5d8f00296517b2a1aff2db540728f5e689a0c3e3"
|
|
59
59
|
}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Client side ragdolling meant to be used with a binder.
|
|
2
|
+
Client side ragdolling meant to be used with a binder. This class exports a [Binder].
|
|
3
3
|
While a humanoid is bound with this class, it is ragdolled.
|
|
4
4
|
|
|
5
|
+
:::tip
|
|
6
|
+
Initialize this whole system through [RagdollServiceClient].
|
|
7
|
+
:::
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
serviceBag:GetService(require("RagdollClient"))
|
|
11
|
+
```
|
|
12
|
+
|
|
5
13
|
@client
|
|
6
14
|
@class RagdollClient
|
|
7
15
|
]=]
|
|
@@ -14,21 +22,22 @@ local UserInputService = game:GetService("UserInputService")
|
|
|
14
22
|
local RunService = game:GetService("RunService")
|
|
15
23
|
|
|
16
24
|
local BaseObject = require("BaseObject")
|
|
25
|
+
local Binder = require("Binder")
|
|
17
26
|
local CameraStackService = require("CameraStackService")
|
|
18
27
|
local CharacterUtils = require("CharacterUtils")
|
|
19
28
|
local HapticFeedbackUtils = require("HapticFeedbackUtils")
|
|
20
|
-
local RagdollServiceClient = require("RagdollServiceClient")
|
|
21
29
|
local RagdollMotorUtils = require("RagdollMotorUtils")
|
|
22
|
-
local
|
|
30
|
+
local RagdollServiceClient = require("RagdollServiceClient")
|
|
23
31
|
local RxBrioUtils = require("RxBrioUtils")
|
|
24
32
|
local RxInstanceUtils = require("RxInstanceUtils")
|
|
33
|
+
local RxR15Utils = require("RxR15Utils")
|
|
25
34
|
|
|
26
35
|
local RagdollClient = setmetatable({}, BaseObject)
|
|
27
36
|
RagdollClient.ClassName = "RagdollClient"
|
|
28
37
|
RagdollClient.__index = RagdollClient
|
|
29
38
|
|
|
30
39
|
--[=[
|
|
31
|
-
Constructs a new RagdollClient.
|
|
40
|
+
Constructs a new RagdollClient. This module exports a [Binder].
|
|
32
41
|
@param humanoid Humanoid
|
|
33
42
|
@param serviceBag ServiceBag
|
|
34
43
|
@return RagdollClient
|
|
@@ -135,4 +144,4 @@ function RagdollClient:_setupHapticFeedback()
|
|
|
135
144
|
end)
|
|
136
145
|
end
|
|
137
146
|
|
|
138
|
-
return RagdollClient
|
|
147
|
+
return Binder.new("Ragdoll", RagdollClient)
|
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
local require = require(script.Parent.loader).load(script)
|
|
9
9
|
|
|
10
10
|
local RunService = game:GetService("RunService")
|
|
11
|
-
|
|
12
11
|
local Players = game:GetService("Players")
|
|
13
12
|
local Workspace = game:GetService("Workspace")
|
|
14
13
|
|
|
15
14
|
local BaseObject = require("BaseObject")
|
|
16
|
-
local
|
|
15
|
+
local Binder = require("Binder")
|
|
17
16
|
local CharacterUtils = require("CharacterUtils")
|
|
17
|
+
local RagdollClient = require("RagdollClient")
|
|
18
18
|
|
|
19
19
|
local RagdollHumanoidOnDeathClient = setmetatable({}, BaseObject)
|
|
20
20
|
RagdollHumanoidOnDeathClient.ClassName = "RagdollHumanoidOnDeathClient"
|
|
21
21
|
RagdollHumanoidOnDeathClient.__index = RagdollHumanoidOnDeathClient
|
|
22
22
|
|
|
23
23
|
--[=[
|
|
24
|
-
Constructs a new RagdollHumanoidOnDeathClient.
|
|
24
|
+
Constructs a new RagdollHumanoidOnDeathClient. This module exports a [Binder].
|
|
25
25
|
@param humanoid Humanoid
|
|
26
26
|
@param serviceBag ServiceBag
|
|
27
27
|
@return RagdollHumanoidOnDeathClient
|
|
@@ -29,7 +29,8 @@ RagdollHumanoidOnDeathClient.__index = RagdollHumanoidOnDeathClient
|
|
|
29
29
|
function RagdollHumanoidOnDeathClient.new(humanoid, serviceBag)
|
|
30
30
|
local self = setmetatable(BaseObject.new(humanoid), RagdollHumanoidOnDeathClient)
|
|
31
31
|
|
|
32
|
-
self.
|
|
32
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
33
|
+
self._ragdollBinder = self._serviceBag:GetService(RagdollClient)
|
|
33
34
|
|
|
34
35
|
if self._obj:GetState() == Enum.HumanoidStateType.Dead then
|
|
35
36
|
self:_handleDeath()
|
|
@@ -95,4 +96,4 @@ function RagdollHumanoidOnDeathClient.disableParticleEmittersAndFadeOutYielding(
|
|
|
95
96
|
end
|
|
96
97
|
end
|
|
97
98
|
|
|
98
|
-
return RagdollHumanoidOnDeathClient
|
|
99
|
+
return Binder.new("RagdollHumanoidOnDeath", RagdollHumanoidOnDeathClient)
|
|
@@ -11,8 +11,9 @@ local Players = game:GetService("Players")
|
|
|
11
11
|
|
|
12
12
|
local BaseObject = require("BaseObject")
|
|
13
13
|
local BindableRagdollHumanoidOnFall = require("BindableRagdollHumanoidOnFall")
|
|
14
|
+
local Binder = require("Binder")
|
|
14
15
|
local CharacterUtils = require("CharacterUtils")
|
|
15
|
-
local
|
|
16
|
+
local RagdollClient = require("RagdollClient")
|
|
16
17
|
local RagdollHumanoidOnFallConstants = require("RagdollHumanoidOnFallConstants")
|
|
17
18
|
|
|
18
19
|
local RagdollHumanoidOnFallClient = setmetatable({}, BaseObject)
|
|
@@ -22,7 +23,7 @@ RagdollHumanoidOnFallClient.__index = RagdollHumanoidOnFallClient
|
|
|
22
23
|
require("PromiseRemoteEventMixin"):Add(RagdollHumanoidOnFallClient, RagdollHumanoidOnFallConstants.REMOTE_EVENT_NAME)
|
|
23
24
|
|
|
24
25
|
--[=[
|
|
25
|
-
Constructs a new RagdollHumanoidOnFallClient.
|
|
26
|
+
Constructs a new RagdollHumanoidOnFallClient. This module exports a [Binder].
|
|
26
27
|
@param humanoid Humanoid
|
|
27
28
|
@param serviceBag ServiceBag
|
|
28
29
|
@return RagdollHumanoidOnFallClient
|
|
@@ -30,7 +31,8 @@ require("PromiseRemoteEventMixin"):Add(RagdollHumanoidOnFallClient, RagdollHuman
|
|
|
30
31
|
function RagdollHumanoidOnFallClient.new(humanoid, serviceBag)
|
|
31
32
|
local self = setmetatable(BaseObject.new(humanoid), RagdollHumanoidOnFallClient)
|
|
32
33
|
|
|
33
|
-
self.
|
|
34
|
+
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
35
|
+
self._ragdollBinder = self._serviceBag:GetService(RagdollClient)
|
|
34
36
|
|
|
35
37
|
local player = CharacterUtils.getPlayerFromCharacter(self._obj)
|
|
36
38
|
if player == Players.LocalPlayer then
|
|
@@ -54,4 +56,4 @@ function RagdollHumanoidOnFallClient:_update()
|
|
|
54
56
|
end
|
|
55
57
|
end
|
|
56
58
|
|
|
57
|
-
return RagdollHumanoidOnFallClient
|
|
59
|
+
return Binder.new("RagdollHumanoidOnFall", RagdollHumanoidOnFallClient)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
|
|
2
|
+
Initialize via [RagdollServiceClient].
|
|
3
3
|
|
|
4
4
|
@client
|
|
5
5
|
@class RagdollableClient
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
local require = require(script.Parent.loader).load(script)
|
|
9
9
|
|
|
10
10
|
local BaseObject = require("BaseObject")
|
|
11
|
-
local
|
|
11
|
+
local RagdollClient = require("RagdollClient")
|
|
12
12
|
local RxRagdollUtils = require("RxRagdollUtils")
|
|
13
|
+
local Binder = require("Binder")
|
|
13
14
|
|
|
14
15
|
local RagdollableClient = setmetatable({}, BaseObject)
|
|
15
16
|
RagdollableClient.ClassName = "RagdollableClient"
|
|
@@ -25,22 +26,21 @@ function RagdollableClient.new(humanoid, serviceBag)
|
|
|
25
26
|
local self = setmetatable(BaseObject.new(humanoid), RagdollableClient)
|
|
26
27
|
|
|
27
28
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
28
|
-
self.
|
|
29
|
+
self._ragdollBinder = self._serviceBag:GetService(RagdollClient)
|
|
29
30
|
|
|
30
|
-
self._maid:GiveTask(self.
|
|
31
|
-
self:_onRagdollChanged()
|
|
31
|
+
self._maid:GiveTask(self._ragdollBinder:Observe(self._obj):Subscribe(function(ragdoll)
|
|
32
|
+
self:_onRagdollChanged(ragdoll)
|
|
32
33
|
end))
|
|
33
|
-
self:_onRagdollChanged()
|
|
34
34
|
|
|
35
35
|
return self
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
function RagdollableClient:_onRagdollChanged()
|
|
39
|
-
if
|
|
38
|
+
function RagdollableClient:_onRagdollChanged(ragdoll)
|
|
39
|
+
if ragdoll then
|
|
40
40
|
self._maid._ragdoll = RxRagdollUtils.runLocal(self._obj)
|
|
41
41
|
else
|
|
42
42
|
self._maid._ragdoll = nil
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
return RagdollableClient
|
|
46
|
+
return Binder.new("Ragdollable", RagdollableClient)
|
|
@@ -2,15 +2,9 @@
|
|
|
2
2
|
Holds binders for Ragdolls on the client. Be sure to initialize on the server. See [RagdollBindersClient] for details.
|
|
3
3
|
Be sure to use a [ServiceBag] to initialize this service.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
local serviceBag = require("ServiceBag")
|
|
9
|
-
serviceBag:GetService(require("RagdollBindersClient"))
|
|
10
|
-
|
|
11
|
-
serviceBag:Init()
|
|
12
|
-
serviceBag:Start()
|
|
13
|
-
```
|
|
5
|
+
:::tip
|
|
6
|
+
Binders can be retrieved directly through a [ServiceBag] now.
|
|
7
|
+
:::
|
|
14
8
|
|
|
15
9
|
@client
|
|
16
10
|
@class RagdollBindersClient
|
|
@@ -19,7 +13,6 @@
|
|
|
19
13
|
local require = require(script.Parent.loader).load(script)
|
|
20
14
|
|
|
21
15
|
local BinderProvider = require("BinderProvider")
|
|
22
|
-
local Binder = require("Binder")
|
|
23
16
|
|
|
24
17
|
return BinderProvider.new(script.Name, function(self, serviceBag)
|
|
25
18
|
--[=[
|
|
@@ -36,26 +29,26 @@ return BinderProvider.new(script.Name, function(self, serviceBag)
|
|
|
36
29
|
@prop Ragdoll Binder<RagdollClient>
|
|
37
30
|
@within RagdollBindersClient
|
|
38
31
|
]=]
|
|
39
|
-
self:Add(
|
|
32
|
+
self:Add(serviceBag:GetService(require("RagdollClient")))
|
|
40
33
|
|
|
41
34
|
--[=[
|
|
42
35
|
Enables ragdolling on a humanoid.
|
|
43
36
|
@prop Ragdollable Binder<RagdollableClient>
|
|
44
37
|
@within RagdollBindersClient
|
|
45
38
|
]=]
|
|
46
|
-
self:Add(
|
|
39
|
+
self:Add(serviceBag:GetService(require("RagdollableClient")))
|
|
47
40
|
|
|
48
41
|
--[=[
|
|
49
42
|
Automatically applies ragdoll upon humanoid death.
|
|
50
43
|
@prop RagdollaRagdollHumanoidOnDeathble Binder<RagdollHumanoidOnDeathClient>
|
|
51
44
|
@within RagdollBindersClient
|
|
52
45
|
]=]
|
|
53
|
-
self:Add(
|
|
46
|
+
self:Add(serviceBag:GetService(require("RagdollHumanoidOnDeathClient")))
|
|
54
47
|
|
|
55
48
|
--[=[
|
|
56
49
|
Automatically applies ragdoll upon humanoid fall.
|
|
57
50
|
@prop RagdollHumanoidOnFall Binder<RagdollHumanoidOnFallClient>
|
|
58
51
|
@within RagdollBindersClient
|
|
59
52
|
]=]
|
|
60
|
-
self:Add(
|
|
53
|
+
self:Add(serviceBag:GetService(require("RagdollHumanoidOnFallClient")))
|
|
61
54
|
end)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
--[=[
|
|
2
|
+
Initializes the RagdollService on the client.
|
|
3
|
+
|
|
2
4
|
@client
|
|
3
5
|
@class RagdollServiceClient
|
|
4
6
|
]=]
|
|
@@ -26,6 +28,10 @@ function RagdollServiceClient:Init(serviceBag)
|
|
|
26
28
|
self._serviceBag:GetService(require("CameraStackService"))
|
|
27
29
|
|
|
28
30
|
-- Internal
|
|
31
|
+
self._serviceBag:GetService(require("RagdollClient"))
|
|
32
|
+
self._serviceBag:GetService(require("RagdollableClient"))
|
|
33
|
+
self._serviceBag:GetService(require("RagdollHumanoidOnDeathClient"))
|
|
34
|
+
self._serviceBag:GetService(require("RagdollHumanoidOnFallClient"))
|
|
29
35
|
self._serviceBag:GetService(require("RagdollBindersClient"))
|
|
30
36
|
|
|
31
37
|
self._screenShakeEnabled = true
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Base class for ragdolls, meant to be used with binders.
|
|
2
|
+
Base class for ragdolls, meant to be used with binders. This class exports a [Binder].
|
|
3
3
|
While a humanoid is bound with this class, it is ragdolled.
|
|
4
4
|
|
|
5
|
+
:::tip
|
|
6
|
+
Initialize this whole system through [RagdollService].
|
|
7
|
+
:::
|
|
8
|
+
|
|
5
9
|
```lua
|
|
6
10
|
-- Be sure to do the service init on the client too
|
|
7
|
-
local
|
|
8
|
-
local
|
|
11
|
+
local ServiceBag = require("ServiceBag")
|
|
12
|
+
local Ragdoll = require("Ragdoll")
|
|
13
|
+
|
|
14
|
+
local serviceBag = ServiceBag.new()
|
|
15
|
+
serviceBag:GetService(require("RagdollService"))
|
|
9
16
|
|
|
10
17
|
serviceBag:Init()
|
|
11
18
|
serviceBag:Start()
|
|
12
19
|
|
|
13
20
|
-- Enable ragdoll
|
|
14
|
-
|
|
21
|
+
Ragdoll:Tag(humanoid)
|
|
15
22
|
|
|
16
23
|
-- Disable ragdoll
|
|
17
|
-
|
|
24
|
+
Ragdoll:Untag(humanoid)
|
|
18
25
|
```
|
|
19
26
|
|
|
20
27
|
@class Ragdoll
|
|
@@ -23,6 +30,7 @@
|
|
|
23
30
|
local require = require(script.Parent.loader).load(script)
|
|
24
31
|
|
|
25
32
|
local BaseObject = require("BaseObject")
|
|
33
|
+
local Binder = require("Binder")
|
|
26
34
|
|
|
27
35
|
local Ragdoll = setmetatable({}, BaseObject)
|
|
28
36
|
Ragdoll.ClassName = "Ragdoll"
|
|
@@ -40,4 +48,4 @@ function Ragdoll.new(humanoid, _serviceBag)
|
|
|
40
48
|
return self
|
|
41
49
|
end
|
|
42
50
|
|
|
43
|
-
return Ragdoll
|
|
51
|
+
return Binder.new("Ragdoll", Ragdoll)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Ragdolls the humanoid on death.
|
|
2
|
+
Ragdolls the humanoid on death. This class exports a [Binder].
|
|
3
3
|
@server
|
|
4
4
|
@class RagdollHumanoidOnDeath
|
|
5
5
|
]=]
|
|
@@ -7,14 +7,15 @@
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
9
|
local BaseObject = require("BaseObject")
|
|
10
|
-
local
|
|
10
|
+
local Ragdoll = require("Ragdoll")
|
|
11
|
+
local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
|
|
11
12
|
|
|
12
13
|
local RagdollHumanoidOnDeath = setmetatable({}, BaseObject)
|
|
13
14
|
RagdollHumanoidOnDeath.ClassName = "RagdollHumanoidOnDeath"
|
|
14
15
|
RagdollHumanoidOnDeath.__index = RagdollHumanoidOnDeath
|
|
15
16
|
|
|
16
17
|
--[=[
|
|
17
|
-
Constructs a new RagdollHumanoidOnDeath.
|
|
18
|
+
Constructs a new RagdollHumanoidOnDeath. This class exports a [Binder].
|
|
18
19
|
@param humanoid Humanoid
|
|
19
20
|
@param serviceBag ServiceBag
|
|
20
21
|
@return RagdollHumanoidOnDeath
|
|
@@ -22,7 +23,8 @@ RagdollHumanoidOnDeath.__index = RagdollHumanoidOnDeath
|
|
|
22
23
|
function RagdollHumanoidOnDeath.new(humanoid, serviceBag)
|
|
23
24
|
local self = setmetatable(BaseObject.new(humanoid), RagdollHumanoidOnDeath)
|
|
24
25
|
|
|
25
|
-
self.
|
|
26
|
+
self._serviceBag = assert(serviceBag, "Bad serviceBag")
|
|
27
|
+
self._ragdollBinder = self._serviceBag:GetService(Ragdoll)
|
|
26
28
|
|
|
27
29
|
self._obj.BreakJointsOnDeath = false
|
|
28
30
|
self._maid:GiveTask(function()
|
|
@@ -38,4 +40,4 @@ function RagdollHumanoidOnDeath.new(humanoid, serviceBag)
|
|
|
38
40
|
return self
|
|
39
41
|
end
|
|
40
42
|
|
|
41
|
-
return RagdollHumanoidOnDeath
|
|
43
|
+
return PlayerHumanoidBinder.new("RagdollHumanoidOnDeath", RagdollHumanoidOnDeath)
|
|
@@ -11,7 +11,8 @@ local require = require(script.Parent.loader).load(script)
|
|
|
11
11
|
local BaseObject = require("BaseObject")
|
|
12
12
|
local BindableRagdollHumanoidOnFall = require("BindableRagdollHumanoidOnFall")
|
|
13
13
|
local CharacterUtils = require("CharacterUtils")
|
|
14
|
-
local
|
|
14
|
+
local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
|
|
15
|
+
local Ragdoll = require("Ragdoll")
|
|
15
16
|
local RagdollHumanoidOnFallConstants = require("RagdollHumanoidOnFallConstants")
|
|
16
17
|
|
|
17
18
|
local RagdollHumanoidOnFall = setmetatable({}, BaseObject)
|
|
@@ -19,7 +20,7 @@ RagdollHumanoidOnFall.ClassName = "RagdollHumanoidOnFall"
|
|
|
19
20
|
RagdollHumanoidOnFall.__index = RagdollHumanoidOnFall
|
|
20
21
|
|
|
21
22
|
--[=[
|
|
22
|
-
Constructs a new RagdollHumanoidOnFall. Should be done via [Binder]. See [
|
|
23
|
+
Constructs a new RagdollHumanoidOnFall. Should be done via [Binder]. See [Ragdoll].
|
|
23
24
|
@param humanoid Humanoid
|
|
24
25
|
@param serviceBag ServiceBag
|
|
25
26
|
@return RagdollHumanoidOnFall
|
|
@@ -27,7 +28,8 @@ RagdollHumanoidOnFall.__index = RagdollHumanoidOnFall
|
|
|
27
28
|
function RagdollHumanoidOnFall.new(humanoid, serviceBag)
|
|
28
29
|
local self = setmetatable(BaseObject.new(humanoid), RagdollHumanoidOnFall)
|
|
29
30
|
|
|
30
|
-
self.
|
|
31
|
+
self._serviceBag = assert(serviceBag, "Bad serviceBag")
|
|
32
|
+
self._ragdollBinder = self._serviceBag:GetService(Ragdoll)
|
|
31
33
|
|
|
32
34
|
local player = CharacterUtils.getPlayerFromCharacter(self._obj)
|
|
33
35
|
if player then
|
|
@@ -89,4 +91,4 @@ function RagdollHumanoidOnFall:_update()
|
|
|
89
91
|
end
|
|
90
92
|
end
|
|
91
93
|
|
|
92
|
-
return RagdollHumanoidOnFall
|
|
94
|
+
return PlayerHumanoidBinder.new("RagdollHumanoidOnFall", RagdollHumanoidOnFall)
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Should be bound to any humanoid that is ragdollable.
|
|
2
|
+
Should be bound to any humanoid that is ragdollable. This class exports a [Binder].
|
|
3
3
|
@server
|
|
4
4
|
@class Ragdollable
|
|
5
5
|
]=]
|
|
6
6
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
|
-
local RxBrioUtils = require("RxBrioUtils")
|
|
10
9
|
local BaseObject = require("BaseObject")
|
|
11
|
-
local RagdollBindersServer = require("RagdollBindersServer")
|
|
12
|
-
local RxRagdollUtils = require("RxRagdollUtils")
|
|
13
10
|
local Maid = require("Maid")
|
|
11
|
+
local Motor6DBindersServer = require("Motor6DBindersServer")
|
|
12
|
+
local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
|
|
13
|
+
local Ragdoll = require("Ragdoll")
|
|
14
14
|
local RagdollAdditionalAttachmentUtils = require("RagdollAdditionalAttachmentUtils")
|
|
15
|
-
local RagdollCollisionUtils = require("RagdollCollisionUtils")
|
|
16
15
|
local RagdollBallSocketUtils = require("RagdollBallSocketUtils")
|
|
17
|
-
local
|
|
16
|
+
local RagdollCollisionUtils = require("RagdollCollisionUtils")
|
|
18
17
|
local RagdollMotorUtils = require("RagdollMotorUtils")
|
|
18
|
+
local RxBrioUtils = require("RxBrioUtils")
|
|
19
|
+
local RxRagdollUtils = require("RxRagdollUtils")
|
|
19
20
|
|
|
20
21
|
local Ragdollable = setmetatable({}, BaseObject)
|
|
21
22
|
Ragdollable.ClassName = "Ragdollable"
|
|
22
23
|
Ragdollable.__index = Ragdollable
|
|
23
24
|
|
|
24
25
|
--[=[
|
|
25
|
-
Constructs a new Ragdollable.
|
|
26
|
+
Constructs a new Ragdollable. This class exports a [Binder].
|
|
26
27
|
@param humanoid Humanoid
|
|
27
28
|
@param serviceBag ServiceBag
|
|
28
29
|
@return Ragdollable
|
|
@@ -31,7 +32,7 @@ function Ragdollable.new(humanoid, serviceBag)
|
|
|
31
32
|
local self = setmetatable(BaseObject.new(humanoid), Ragdollable)
|
|
32
33
|
|
|
33
34
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
34
|
-
self.
|
|
35
|
+
self._ragdollBinder = self._serviceBag:GetService(Ragdoll)
|
|
35
36
|
self._motor6DBindersServer = self._serviceBag:GetService(Motor6DBindersServer)
|
|
36
37
|
|
|
37
38
|
self._motor6DBindersServer.Motor6DStackHumanoid:Bind(self._obj)
|
|
@@ -58,7 +59,7 @@ function Ragdollable.new(humanoid, serviceBag)
|
|
|
58
59
|
end
|
|
59
60
|
end))
|
|
60
61
|
|
|
61
|
-
self._maid:GiveTask(self.
|
|
62
|
+
self._maid:GiveTask(self._ragdollBinder:ObserveInstance(self._obj, function()
|
|
62
63
|
self:_onRagdollChanged()
|
|
63
64
|
end))
|
|
64
65
|
self:_onRagdollChanged()
|
|
@@ -67,7 +68,7 @@ function Ragdollable.new(humanoid, serviceBag)
|
|
|
67
68
|
end
|
|
68
69
|
|
|
69
70
|
function Ragdollable:_onRagdollChanged()
|
|
70
|
-
if self.
|
|
71
|
+
if self._ragdollBinder:Get(self._obj) then
|
|
71
72
|
self:_setRagdollEnabled(true)
|
|
72
73
|
else
|
|
73
74
|
self:_setRagdollEnabled(false)
|
|
@@ -86,4 +87,4 @@ function Ragdollable:_setRagdollEnabled(isEnabled)
|
|
|
86
87
|
end
|
|
87
88
|
end
|
|
88
89
|
|
|
89
|
-
return Ragdollable
|
|
90
|
+
return PlayerHumanoidBinder.new("Ragdollable", Ragdollable)
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
When a humanoid is tagged with this, it will unragdoll automatically.
|
|
2
|
+
When a humanoid is tagged with this, it will unragdoll automatically. This class exports a [Binder].
|
|
3
3
|
@server
|
|
4
4
|
@class UnragdollAutomatically
|
|
5
5
|
]=]
|
|
6
6
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
|
+
local AttributeValue = require("AttributeValue")
|
|
9
10
|
local BaseObject = require("BaseObject")
|
|
10
|
-
local
|
|
11
|
+
local cancellableDelay = require("cancellableDelay")
|
|
11
12
|
local CharacterUtils = require("CharacterUtils")
|
|
12
|
-
local AttributeValue = require("AttributeValue")
|
|
13
13
|
local Maid = require("Maid")
|
|
14
|
-
local UnragdollAutomaticallyConstants = require("UnragdollAutomaticallyConstants")
|
|
15
|
-
local cancellableDelay = require("cancellableDelay")
|
|
16
14
|
local Observable = require("Observable")
|
|
15
|
+
local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
|
|
16
|
+
local Ragdoll = require("Ragdoll")
|
|
17
|
+
local RagdollHumanoidOnFall = require("RagdollHumanoidOnFall")
|
|
17
18
|
local Rx = require("Rx")
|
|
18
|
-
local RxInstanceUtils = require("RxInstanceUtils")
|
|
19
|
-
local RxBrioUtils = require("RxBrioUtils")
|
|
20
19
|
local RxBinderUtils = require("RxBinderUtils")
|
|
20
|
+
local RxBrioUtils = require("RxBrioUtils")
|
|
21
|
+
local RxInstanceUtils = require("RxInstanceUtils")
|
|
22
|
+
local UnragdollAutomaticallyConstants = require("UnragdollAutomaticallyConstants")
|
|
21
23
|
|
|
22
24
|
local UnragdollAutomatically = setmetatable({}, BaseObject)
|
|
23
25
|
UnragdollAutomatically.ClassName = "UnragdollAutomatically"
|
|
24
26
|
UnragdollAutomatically.__index = UnragdollAutomatically
|
|
25
27
|
|
|
26
28
|
--[=[
|
|
27
|
-
Constructs a new UnragdollAutomatically.
|
|
29
|
+
Constructs a new UnragdollAutomatically. This class exports a [Binder].
|
|
28
30
|
@param humanoid Humanoid
|
|
29
31
|
@param serviceBag ServiceBag
|
|
30
32
|
@return UnragdollAutomatically
|
|
@@ -32,13 +34,15 @@ UnragdollAutomatically.__index = UnragdollAutomatically
|
|
|
32
34
|
function UnragdollAutomatically.new(humanoid, serviceBag)
|
|
33
35
|
local self = setmetatable(BaseObject.new(humanoid), UnragdollAutomatically)
|
|
34
36
|
|
|
35
|
-
self.
|
|
37
|
+
self._serviceBag = assert(serviceBag, "Bad serviceBag")
|
|
38
|
+
self._ragdollBinder = self._serviceBag:GetService(Ragdoll)
|
|
39
|
+
self._ragdollHumanoidOnFallBinder = self._serviceBag:GetService(RagdollHumanoidOnFall)
|
|
36
40
|
self._player = CharacterUtils.getPlayerFromCharacter(self._obj)
|
|
37
41
|
|
|
38
42
|
self._unragdollAutomatically = AttributeValue.new(self._obj, UnragdollAutomaticallyConstants.UNRAGDOLL_AUTOMATICALLY_ATTRIBUTE, true)
|
|
39
43
|
self._unragdollAutomaticTime = AttributeValue.new(self._obj, UnragdollAutomaticallyConstants.UNRAGDOLL_AUTOMATIC_TIME_ATTRIBUTE, 5)
|
|
40
44
|
|
|
41
|
-
self._maid:GiveTask(self.
|
|
45
|
+
self._maid:GiveTask(self._ragdollBinder:ObserveInstance(self._obj, function()
|
|
42
46
|
self:_handleRagdollChanged(self._maid)
|
|
43
47
|
end))
|
|
44
48
|
self:_handleRagdollChanged(self._maid)
|
|
@@ -47,7 +51,7 @@ function UnragdollAutomatically.new(humanoid, serviceBag)
|
|
|
47
51
|
end
|
|
48
52
|
|
|
49
53
|
function UnragdollAutomatically:_handleRagdollChanged(maid)
|
|
50
|
-
if self.
|
|
54
|
+
if self._ragdollBinder:Get(self._obj) then
|
|
51
55
|
maid._unragdoll = self:_observeCanUnragdollTimer():Pipe({
|
|
52
56
|
Rx.switchMap(function(state)
|
|
53
57
|
if state then
|
|
@@ -59,7 +63,7 @@ function UnragdollAutomatically:_handleRagdollChanged(maid)
|
|
|
59
63
|
Rx.distinct();
|
|
60
64
|
}):Subscribe(function(canUnragdoll)
|
|
61
65
|
if canUnragdoll then
|
|
62
|
-
self.
|
|
66
|
+
self._ragdollBinder:Unbind(self._obj)
|
|
63
67
|
end
|
|
64
68
|
end)
|
|
65
69
|
else
|
|
@@ -133,7 +137,7 @@ function UnragdollAutomatically:_observeCanUnragdollTimer()
|
|
|
133
137
|
end
|
|
134
138
|
|
|
135
139
|
function UnragdollAutomatically:_observeIsFallingRagdoll()
|
|
136
|
-
return RxBinderUtils.observeBoundClassBrio(self.
|
|
140
|
+
return RxBinderUtils.observeBoundClassBrio(self._ragdollHumanoidOnFallBinder, self._obj)
|
|
137
141
|
:Pipe({
|
|
138
142
|
RxBrioUtils.switchMapBrio(function(ragdollHumanoidOnFall)
|
|
139
143
|
return ragdollHumanoidOnFall:ObserveIsFalling()
|
|
@@ -143,4 +147,4 @@ function UnragdollAutomatically:_observeIsFallingRagdoll()
|
|
|
143
147
|
})
|
|
144
148
|
end
|
|
145
149
|
|
|
146
|
-
return UnragdollAutomatically
|
|
150
|
+
return PlayerHumanoidBinder.new("UnragdollAutomatically", UnragdollAutomatically)
|
|
@@ -2,17 +2,9 @@
|
|
|
2
2
|
Holds binders for Ragdoll system. Be sure to initialize on the client too. See [RagdollBindersClient].
|
|
3
3
|
Be sure to use a [ServiceBag] to initialize this service.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
local serviceBag = require("ServiceBag")
|
|
9
|
-
local ragdollBindersServer = serviceBag:GetService(require("RagdollBindersServer"))
|
|
10
|
-
serviceBag:Init()
|
|
11
|
-
|
|
12
|
-
ragdollBindersServer.RagdollHumanoidOnDeath:SetAutomaticTagging(false)
|
|
13
|
-
|
|
14
|
-
serviceBag:Start()
|
|
15
|
-
```
|
|
5
|
+
:::tip
|
|
6
|
+
Binders can be retrieved directly through a [ServiceBag] now.
|
|
7
|
+
:::
|
|
16
8
|
|
|
17
9
|
@server
|
|
18
10
|
@class RagdollBindersServer
|
|
@@ -21,15 +13,13 @@
|
|
|
21
13
|
local require = require(script.Parent.loader).load(script)
|
|
22
14
|
|
|
23
15
|
local BinderProvider = require("BinderProvider")
|
|
24
|
-
local Binder = require("Binder")
|
|
25
|
-
local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
|
|
26
16
|
|
|
27
17
|
return BinderProvider.new(script.Name, function(self, serviceBag)
|
|
28
18
|
--[=[
|
|
29
19
|
Apply this [Binder] to a humanoid to ragdoll it. Humanoid must already have [Ragdollable] defined.
|
|
30
20
|
|
|
31
21
|
```lua
|
|
32
|
-
local ragdollBinder = serviceBag:GetService(
|
|
22
|
+
local ragdollBinder = serviceBag:GetService(RagdollBindersServer).Ragdoll
|
|
33
23
|
|
|
34
24
|
local ragdoll = ragdollBinder:Get(humanoid)
|
|
35
25
|
if ragdoll then
|
|
@@ -51,7 +41,7 @@ return BinderProvider.new(script.Name, function(self, serviceBag)
|
|
|
51
41
|
```lua
|
|
52
42
|
local maid = Maid.new()
|
|
53
43
|
|
|
54
|
-
local ragdollBinder = serviceBag:GetService(
|
|
44
|
+
local ragdollBinder = serviceBag:GetService(RagdollBindersServer).Ragdoll
|
|
55
45
|
maid:GiveTask(RxBinderUtils.observeBoundClass(ragdollBinder, humanoid):Subscribe(function(ragdoll)
|
|
56
46
|
if ragdoll then
|
|
57
47
|
print("Ragdolled!")
|
|
@@ -64,33 +54,33 @@ return BinderProvider.new(script.Name, function(self, serviceBag)
|
|
|
64
54
|
@prop Ragdoll Binder<Ragdoll>
|
|
65
55
|
@within RagdollBindersServer
|
|
66
56
|
]=]
|
|
67
|
-
self:Add(
|
|
57
|
+
self:Add(serviceBag:GetService(require("Ragdoll")))
|
|
68
58
|
|
|
69
59
|
--[=[
|
|
70
60
|
Enables ragdolling on a humanoid.
|
|
71
61
|
@prop Ragdollable PlayerHumanoidBinder<Ragdollable>
|
|
72
62
|
@within RagdollBindersServer
|
|
73
63
|
]=]
|
|
74
|
-
self:Add(
|
|
64
|
+
self:Add(serviceBag:GetService(require("Ragdollable")))
|
|
75
65
|
|
|
76
66
|
--[=[
|
|
77
67
|
Automatically applies ragdoll upon humanoid death.
|
|
78
68
|
@prop RagdollHumanoidOnDeath PlayerHumanoidBinder<RagdollHumanoidOnDeath>
|
|
79
69
|
@within RagdollBindersServer
|
|
80
70
|
]=]
|
|
81
|
-
self:Add(
|
|
71
|
+
self:Add(serviceBag:GetService(require("RagdollHumanoidOnDeath")))
|
|
82
72
|
|
|
83
73
|
--[=[
|
|
84
74
|
Automatically applies ragdoll upon humanoid fall.
|
|
85
75
|
@prop RagdollHumanoidOnFall PlayerHumanoidBinder<RagdollHumanoidOnFall>
|
|
86
76
|
@within RagdollBindersServer
|
|
87
77
|
]=]
|
|
88
|
-
self:Add(
|
|
78
|
+
self:Add(serviceBag:GetService(require("RagdollHumanoidOnFall")))
|
|
89
79
|
|
|
90
80
|
--[=[
|
|
91
81
|
Automatically unragdolls the humanoid.
|
|
92
82
|
@prop UnragdollAutomatically PlayerHumanoidBinder<UnragdollAutomatically>
|
|
93
83
|
@within RagdollBindersServer
|
|
94
84
|
]=]
|
|
95
|
-
self:Add(
|
|
85
|
+
self:Add(serviceBag:GetService(require("UnragdollAutomatically")))
|
|
96
86
|
end)
|
|
@@ -20,11 +20,19 @@ function RagdollService:Init(serviceBag)
|
|
|
20
20
|
self._serviceBag:GetService(require("Motor6DService"))
|
|
21
21
|
|
|
22
22
|
-- Internal
|
|
23
|
-
self.
|
|
23
|
+
self._serviceBag:GetService(require("RagdollBindersServer"))
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
self.
|
|
27
|
-
self.
|
|
25
|
+
-- Binders
|
|
26
|
+
self._serviceBag:GetService(require("Ragdoll"))
|
|
27
|
+
self._serviceBag:GetService(require("Ragdollable"))
|
|
28
|
+
self._serviceBag:GetService(require("RagdollHumanoidOnDeath"))
|
|
29
|
+
self._serviceBag:GetService(require("RagdollHumanoidOnFall"))
|
|
30
|
+
self._serviceBag:GetService(require("UnragdollAutomatically"))
|
|
31
|
+
|
|
32
|
+
-- Configure
|
|
33
|
+
self._serviceBag:GetService(require("RagdollHumanoidOnDeath")):SetAutomaticTagging(false)
|
|
34
|
+
self._serviceBag:GetService(require("RagdollHumanoidOnFall")):SetAutomaticTagging(false)
|
|
35
|
+
self._serviceBag:GetService(require("UnragdollAutomatically")):SetAutomaticTagging(false)
|
|
28
36
|
end
|
|
29
37
|
|
|
30
38
|
--[=[
|
|
@@ -35,7 +43,7 @@ function RagdollService:SetRagdollOnFall(ragdollOnFall)
|
|
|
35
43
|
assert(self._serviceBag, "Not initialized")
|
|
36
44
|
assert(type(ragdollOnFall) == "boolean", "Bad ragdollOnFall")
|
|
37
45
|
|
|
38
|
-
self.
|
|
46
|
+
self._serviceBag:GetService(require("RagdollHumanoidOnFall")):SetAutomaticTagging(ragdollOnFall)
|
|
39
47
|
end
|
|
40
48
|
|
|
41
49
|
--[=[
|
|
@@ -46,7 +54,7 @@ function RagdollService:SetRagdollOnDeath(ragdollOnDeath)
|
|
|
46
54
|
assert(self._serviceBag, "Not initialized")
|
|
47
55
|
assert(type(ragdollOnDeath) == "boolean", "Bad ragdollOnDeath")
|
|
48
56
|
|
|
49
|
-
self.
|
|
57
|
+
self._serviceBag:GetService(require("RagdollHumanoidOnDeath")):SetAutomaticTagging(ragdollOnDeath)
|
|
50
58
|
end
|
|
51
59
|
|
|
52
60
|
--[=[
|
|
@@ -57,7 +65,7 @@ function RagdollService:SetUnragdollAutomatically(unragdollAutomatically)
|
|
|
57
65
|
assert(self._serviceBag, "Not initialized")
|
|
58
66
|
assert(type(unragdollAutomatically) == "boolean", "Bad unragdollAutomatically")
|
|
59
67
|
|
|
60
|
-
self.
|
|
68
|
+
self._serviceBag:GetService(require("UnragdollAutomatically")):SetAutomaticTagging(unragdollAutomatically)
|
|
61
69
|
end
|
|
62
70
|
|
|
63
71
|
return RagdollService
|