@quenty/ragdoll 5.1.0 → 5.1.2
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 +16 -0
- package/package.json +3 -3
- package/src/Client/Classes/RagdollClient.lua +10 -1
- package/src/Client/Classes/RagdollHumanoidOnDeathClient.lua +9 -1
- package/src/Client/Classes/RagdollHumanoidOnFallClient.lua +9 -0
- package/src/Client/Classes/RagdollableClient.lua +9 -0
- package/src/Client/RagdollBindersClient.lua +45 -2
- package/src/Server/Classes/Ragdoll.lua +24 -1
- package/src/Server/Classes/RagdollHumanoidOnDeath.lua +10 -3
- package/src/Server/Classes/RagdollHumanoidOnFall.lua +10 -0
- package/src/Server/Classes/Ragdollable.lua +8 -0
- package/src/Server/Classes/UnragdollAutomatically.lua +8 -0
- package/src/Server/RagdollBindersServer.lua +78 -5
- package/src/Shared/Classes/BindableRagdollHumanoidOnFall.lua +7 -1
- package/src/Shared/Classes/RagdollHumanoidOnFallConstants.lua +1 -0
- package/src/Shared/RagdollConstants.lua +1 -0
- package/src/Shared/RagdollRigging.lua +29 -0
- package/src/Shared/RagdollUtils.lua +34 -2
- package/src/Shared/RagdollableConstants.lua +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
## [5.1.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@5.1.1...@quenty/ragdoll@5.1.2) (2022-01-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/ragdoll
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [5.1.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@5.1.0...@quenty/ragdoll@5.1.1) (2022-01-06)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @quenty/ragdoll
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [5.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/ragdoll@5.0.2...@quenty/ragdoll@5.1.0) (2022-01-03)
|
|
7
23
|
|
|
8
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/ragdoll",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.2",
|
|
4
4
|
"description": "Quenty's Ragdoll system for Roblox - Floppy fun ragdolls",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@quenty/baseobject": "^3.3.0",
|
|
29
29
|
"@quenty/binder": "^4.6.0",
|
|
30
|
-
"@quenty/camera": "^5.1.
|
|
30
|
+
"@quenty/camera": "^5.1.1",
|
|
31
31
|
"@quenty/characterutils": "^3.4.0",
|
|
32
32
|
"@quenty/hapticfeedbackutils": "^2.1.1",
|
|
33
33
|
"@quenty/humanoidanimatorutils": "^2.0.1",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "0efa1afd34157a4b4273f1621d7cc86bb48d6b41"
|
|
47
47
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Client side ragdolling meant to be used with a binder
|
|
2
|
+
Client side ragdolling meant to be used with a binder. See [RagdollBindersClient].
|
|
3
|
+
While a humanoid is bound with this class, it is ragdolled.
|
|
4
|
+
|
|
5
|
+
@client
|
|
3
6
|
@class RagdollClient
|
|
4
7
|
]=]
|
|
5
8
|
|
|
@@ -19,6 +22,12 @@ local RagdollClient = setmetatable({}, BaseObject)
|
|
|
19
22
|
RagdollClient.ClassName = "RagdollClient"
|
|
20
23
|
RagdollClient.__index = RagdollClient
|
|
21
24
|
|
|
25
|
+
--[=[
|
|
26
|
+
Constructs a new RagdollClient. Should be done via [Binder]. See [RagdollBindersClient].
|
|
27
|
+
@param humanoid Humanoid
|
|
28
|
+
@param serviceBag ServiceBag
|
|
29
|
+
@return RagdollClient
|
|
30
|
+
]=]
|
|
22
31
|
function RagdollClient.new(humanoid, serviceBag)
|
|
23
32
|
local self = setmetatable(BaseObject.new(humanoid), RagdollClient)
|
|
24
33
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Ragdolls the humanoid on death
|
|
2
|
+
Ragdolls the humanoid on death. Should be bound via [RagdollBindersClient].
|
|
3
|
+
|
|
4
|
+
@client
|
|
3
5
|
@class RagdollHumanoidOnDeathClient
|
|
4
6
|
]=]
|
|
5
7
|
|
|
@@ -17,6 +19,12 @@ local RagdollHumanoidOnDeathClient = setmetatable({}, BaseObject)
|
|
|
17
19
|
RagdollHumanoidOnDeathClient.ClassName = "RagdollHumanoidOnDeathClient"
|
|
18
20
|
RagdollHumanoidOnDeathClient.__index = RagdollHumanoidOnDeathClient
|
|
19
21
|
|
|
22
|
+
--[=[
|
|
23
|
+
Constructs a new RagdollHumanoidOnDeathClient. Should be done via [Binder]. See [RagdollBindersClient].
|
|
24
|
+
@param humanoid Humanoid
|
|
25
|
+
@param serviceBag ServiceBag
|
|
26
|
+
@return RagdollHumanoidOnDeathClient
|
|
27
|
+
]=]
|
|
20
28
|
function RagdollHumanoidOnDeathClient.new(humanoid, serviceBag)
|
|
21
29
|
local self = setmetatable(BaseObject.new(humanoid), RagdollHumanoidOnDeathClient)
|
|
22
30
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
--[=[
|
|
2
|
+
Ragdolls the humanoid on death. Should be bound via [RagdollBindersClient].
|
|
3
|
+
|
|
4
|
+
@client
|
|
2
5
|
@class RagdollHumanoidOnFallClient
|
|
3
6
|
]=]
|
|
4
7
|
|
|
@@ -18,6 +21,12 @@ RagdollHumanoidOnFallClient.__index = RagdollHumanoidOnFallClient
|
|
|
18
21
|
|
|
19
22
|
require("PromiseRemoteEventMixin"):Add(RagdollHumanoidOnFallClient, RagdollHumanoidOnFallConstants.REMOTE_EVENT_NAME)
|
|
20
23
|
|
|
24
|
+
--[=[
|
|
25
|
+
Constructs a new RagdollHumanoidOnFallClient. Should be done via [Binder]. See [RagdollBindersClient].
|
|
26
|
+
@param humanoid Humanoid
|
|
27
|
+
@param serviceBag ServiceBag
|
|
28
|
+
@return RagdollHumanoidOnFallClient
|
|
29
|
+
]=]
|
|
21
30
|
function RagdollHumanoidOnFallClient.new(humanoid, serviceBag)
|
|
22
31
|
local self = setmetatable(BaseObject.new(humanoid), RagdollHumanoidOnFallClient)
|
|
23
32
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
--[=[
|
|
2
|
+
Should be bound via [RagdollBindersClient].
|
|
3
|
+
|
|
4
|
+
@client
|
|
2
5
|
@class RagdollableClient
|
|
3
6
|
]=]
|
|
4
7
|
|
|
@@ -22,6 +25,12 @@ RagdollableClient.__index = RagdollableClient
|
|
|
22
25
|
|
|
23
26
|
require("PromiseRemoteEventMixin"):Add(RagdollableClient, RagdollableConstants.REMOTE_EVENT_NAME)
|
|
24
27
|
|
|
28
|
+
--[=[
|
|
29
|
+
Constructs a new RagdollableClient. Should be done via [Binder]. See [RagdollBindersClient].
|
|
30
|
+
@param humanoid Humanoid
|
|
31
|
+
@param serviceBag ServiceBag
|
|
32
|
+
@return RagdollableClient
|
|
33
|
+
]=]
|
|
25
34
|
function RagdollableClient.new(humanoid, serviceBag)
|
|
26
35
|
local self = setmetatable(BaseObject.new(humanoid), RagdollableClient)
|
|
27
36
|
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Holds binders
|
|
2
|
+
Holds binders for Ragdolls on the client. Be sure to initialize on the server. See [RagdollBindersClient] for details.
|
|
3
|
+
Be sure to use a [ServiceBag] to initialize this service.
|
|
4
|
+
|
|
5
|
+
```lua
|
|
6
|
+
-- Client.lua
|
|
7
|
+
|
|
8
|
+
local serviceBag = require("ServiceBag")
|
|
9
|
+
serviceBag:GetService(require("RagdollBindersClient"))
|
|
10
|
+
|
|
11
|
+
serviceBag:Init()
|
|
12
|
+
serviceBag:Start()
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
@client
|
|
3
16
|
@class RagdollBindersClient
|
|
4
17
|
]=]
|
|
5
18
|
|
|
@@ -9,10 +22,40 @@ local BinderProvider = require("BinderProvider")
|
|
|
9
22
|
local Binder = require("Binder")
|
|
10
23
|
|
|
11
24
|
return BinderProvider.new(function(self, serviceBag)
|
|
25
|
+
--[=[
|
|
26
|
+
Apply this binder to a humanoid to ragdoll it. Humanoid must already have [Ragdollable] defined.
|
|
27
|
+
|
|
28
|
+
```lua
|
|
29
|
+
local ragdoll = serviceBag:GetService(RagdollBindersClient).Ragdoll:Get(humanoid)
|
|
30
|
+
if ragdoll then
|
|
31
|
+
print("Is ragdolled")
|
|
32
|
+
else
|
|
33
|
+
print("Not ragdolled")
|
|
34
|
+
end
|
|
35
|
+
```
|
|
36
|
+
@prop Ragdoll Binder<RagdollClient>
|
|
37
|
+
@within RagdollBindersClient
|
|
38
|
+
]=]
|
|
12
39
|
self:Add(Binder.new("Ragdoll", require("RagdollClient"), serviceBag))
|
|
40
|
+
|
|
41
|
+
--[=[
|
|
42
|
+
Enables ragdolling on a humanoid.
|
|
43
|
+
@prop Ragdollable Binder<RagdollableClient>
|
|
44
|
+
@within RagdollBindersClient
|
|
45
|
+
]=]
|
|
13
46
|
self:Add(Binder.new("Ragdollable", require("RagdollableClient"), serviceBag))
|
|
14
47
|
|
|
15
|
-
|
|
48
|
+
--[=[
|
|
49
|
+
Automatically applies ragdoll upon humanoid death.
|
|
50
|
+
@prop RagdollaRagdollHumanoidOnDeathble Binder<RagdollHumanoidOnDeathClient>
|
|
51
|
+
@within RagdollBindersClient
|
|
52
|
+
]=]
|
|
16
53
|
self:Add(Binder.new("RagdollHumanoidOnDeath", require("RagdollHumanoidOnDeathClient"), serviceBag))
|
|
54
|
+
|
|
55
|
+
--[=[
|
|
56
|
+
Automatically applies ragdoll upon humanoid fall.
|
|
57
|
+
@prop RagdollHumanoidOnFall Binder<RagdollHumanoidOnFallClient>
|
|
58
|
+
@within RagdollBindersClient
|
|
59
|
+
]=]
|
|
17
60
|
self:Add(Binder.new("RagdollHumanoidOnFall", require("RagdollHumanoidOnFallClient"), serviceBag))
|
|
18
61
|
end)
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Base class for ragdolls, meant to be used with binders
|
|
2
|
+
Base class for ragdolls, meant to be used with binders. See [RagdollBindersServer].
|
|
3
|
+
While a humanoid is bound with this class, it is ragdolled.
|
|
4
|
+
|
|
5
|
+
```lua
|
|
6
|
+
-- Be sure to do the service init on the client too
|
|
7
|
+
local serviceBag = require("ServiceBag")
|
|
8
|
+
local ragdollBindersServer = serviceBag:GetService(require("RagdollBindersServer"))
|
|
9
|
+
|
|
10
|
+
serviceBag:Init()
|
|
11
|
+
serviceBag:Start()
|
|
12
|
+
|
|
13
|
+
-- Enable ragdoll
|
|
14
|
+
ragdollBindersServer.Ragdoll:Bind(humanoid)
|
|
15
|
+
|
|
16
|
+
-- Disable ragdoll
|
|
17
|
+
ragdollBindersServer.Ragdoll:Unbind(humanoid)
|
|
18
|
+
```
|
|
19
|
+
|
|
3
20
|
@class Ragdoll
|
|
4
21
|
]=]
|
|
5
22
|
|
|
@@ -11,6 +28,12 @@ local Ragdoll = setmetatable({}, BaseObject)
|
|
|
11
28
|
Ragdoll.ClassName = "Ragdoll"
|
|
12
29
|
Ragdoll.__index = Ragdoll
|
|
13
30
|
|
|
31
|
+
--[=[
|
|
32
|
+
Constructs a new Ragdoll. Should be done via [Binder]. See [RagdollBindersServer].
|
|
33
|
+
@param humanoid Humanoid
|
|
34
|
+
@param _serviceBag ServiceBag
|
|
35
|
+
@return Ragdoll
|
|
36
|
+
]=]
|
|
14
37
|
function Ragdoll.new(humanoid, _serviceBag)
|
|
15
38
|
local self = setmetatable(BaseObject.new(humanoid), Ragdoll)
|
|
16
39
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Ragdolls the humanoid on death
|
|
2
|
+
Ragdolls the humanoid on death.
|
|
3
|
+
@server
|
|
3
4
|
@class RagdollHumanoidOnDeath
|
|
4
5
|
]=]
|
|
5
6
|
|
|
@@ -12,8 +13,14 @@ local RagdollHumanoidOnDeath = setmetatable({}, BaseObject)
|
|
|
12
13
|
RagdollHumanoidOnDeath.ClassName = "RagdollHumanoidOnDeath"
|
|
13
14
|
RagdollHumanoidOnDeath.__index = RagdollHumanoidOnDeath
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
--[=[
|
|
17
|
+
Constructs a new RagdollHumanoidOnDeath. Should be done via [Binder]. See [RagdollBindersServer].
|
|
18
|
+
@param humanoid Humanoid
|
|
19
|
+
@param serviceBag ServiceBag
|
|
20
|
+
@return RagdollHumanoidOnDeath
|
|
21
|
+
]=]
|
|
22
|
+
function RagdollHumanoidOnDeath.new(humanoid, serviceBag)
|
|
23
|
+
local self = setmetatable(BaseObject.new(humanoid), RagdollHumanoidOnDeath)
|
|
17
24
|
|
|
18
25
|
self._ragdollBinder = serviceBag:GetService(RagdollBindersServer).Ragdoll
|
|
19
26
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
--[=[
|
|
2
|
+
When a humanoid is bound with this, it will ragdoll upon falling. Recommended that you use
|
|
3
|
+
[UnragdollAutomatically] in conjunction with this.
|
|
4
|
+
|
|
5
|
+
@server
|
|
2
6
|
@class RagdollHumanoidOnFall
|
|
3
7
|
]=]
|
|
4
8
|
|
|
@@ -14,6 +18,12 @@ local RagdollHumanoidOnFall = setmetatable({}, BaseObject)
|
|
|
14
18
|
RagdollHumanoidOnFall.ClassName = "RagdollHumanoidOnFall"
|
|
15
19
|
RagdollHumanoidOnFall.__index = RagdollHumanoidOnFall
|
|
16
20
|
|
|
21
|
+
--[=[
|
|
22
|
+
Constructs a new RagdollHumanoidOnFall. Should be done via [Binder]. See [RagdollBindersServer].
|
|
23
|
+
@param humanoid Humanoid
|
|
24
|
+
@param serviceBag ServiceBag
|
|
25
|
+
@return RagdollHumanoidOnFall
|
|
26
|
+
]=]
|
|
17
27
|
function RagdollHumanoidOnFall.new(humanoid, serviceBag)
|
|
18
28
|
local self = setmetatable(BaseObject.new(humanoid), RagdollHumanoidOnFall)
|
|
19
29
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
--[=[
|
|
2
|
+
Should be bound to any humanoid that is ragdollable. See [RagdollBindersServer].
|
|
3
|
+
@server
|
|
2
4
|
@class Ragdollable
|
|
3
5
|
]=]
|
|
4
6
|
|
|
@@ -18,6 +20,12 @@ local Ragdollable = setmetatable({}, BaseObject)
|
|
|
18
20
|
Ragdollable.ClassName = "Ragdollable"
|
|
19
21
|
Ragdollable.__index = Ragdollable
|
|
20
22
|
|
|
23
|
+
--[=[
|
|
24
|
+
Constructs a new Ragdollable. Should be done via [Binder]. See [RagdollBindersServer].
|
|
25
|
+
@param humanoid Humanoid
|
|
26
|
+
@param serviceBag ServiceBag
|
|
27
|
+
@return Ragdollable
|
|
28
|
+
]=]
|
|
21
29
|
function Ragdollable.new(humanoid, serviceBag)
|
|
22
30
|
local self = setmetatable(BaseObject.new(humanoid), Ragdollable)
|
|
23
31
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
--[=[
|
|
2
|
+
When a humanoid is tagged with this, it will unragdoll automatically.
|
|
3
|
+
@server
|
|
2
4
|
@class UnragdollAutomatically
|
|
3
5
|
]=]
|
|
4
6
|
|
|
@@ -15,6 +17,12 @@ local UnragdollAutomatically = setmetatable({}, BaseObject)
|
|
|
15
17
|
UnragdollAutomatically.ClassName = "UnragdollAutomatically"
|
|
16
18
|
UnragdollAutomatically.__index = UnragdollAutomatically
|
|
17
19
|
|
|
20
|
+
--[=[
|
|
21
|
+
Constructs a new UnragdollAutomatically. Should be done via [Binder]. See [RagdollBindersServer].
|
|
22
|
+
@param humanoid Humanoid
|
|
23
|
+
@param serviceBag ServiceBag
|
|
24
|
+
@return UnragdollAutomatically
|
|
25
|
+
]=]
|
|
18
26
|
function UnragdollAutomatically.new(humanoid, serviceBag)
|
|
19
27
|
local self = setmetatable(BaseObject.new(humanoid), UnragdollAutomatically)
|
|
20
28
|
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Holds binders
|
|
2
|
+
Holds binders for Ragdoll system. Be sure to initialize on the client too. See [RagdollBindersClient].
|
|
3
|
+
Be sure to use a [ServiceBag] to initialize this service.
|
|
4
|
+
|
|
5
|
+
```lua
|
|
6
|
+
-- Server.lua
|
|
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
|
+
```
|
|
16
|
+
|
|
17
|
+
@server
|
|
3
18
|
@class RagdollBindersServer
|
|
4
19
|
]=]
|
|
5
20
|
|
|
@@ -10,14 +25,72 @@ local Binder = require("Binder")
|
|
|
10
25
|
local PlayerHumanoidBinder = require("PlayerHumanoidBinder")
|
|
11
26
|
|
|
12
27
|
return BinderProvider.new(function(self, serviceBag)
|
|
28
|
+
--[=[
|
|
29
|
+
Apply this [Binder] to a humanoid to ragdoll it. Humanoid must already have [Ragdollable] defined.
|
|
30
|
+
|
|
31
|
+
```lua
|
|
32
|
+
local ragdollBinder = serviceBag:GetService(RagdollBindersClient).Ragdoll
|
|
33
|
+
|
|
34
|
+
local ragdoll = ragdollBinder:Get(humanoid)
|
|
35
|
+
if ragdoll then
|
|
36
|
+
print("Is ragdolled")
|
|
37
|
+
ragdollBinder:Unbind(humanoid)
|
|
38
|
+
else
|
|
39
|
+
print("Not ragdolled")
|
|
40
|
+
ragdollBinder:Bind(humanoid)
|
|
41
|
+
end
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
You can also use [RxBinderUtils.observeBoundClass] to observe whether a humanoid is ragdolled using an [Observable].
|
|
45
|
+
|
|
46
|
+
:::info
|
|
47
|
+
Like any usage of [Observable], be sure to give the [Subscription] to a [Maid] (or call
|
|
48
|
+
[Subscription.Destroy] on it) once done with the event connection.
|
|
49
|
+
:::
|
|
50
|
+
|
|
51
|
+
```lua
|
|
52
|
+
local maid = Maid.new()
|
|
53
|
+
|
|
54
|
+
local ragdollBinder = serviceBag:GetService(RagdollBindersClient).Ragdoll
|
|
55
|
+
maid:GiveTask(RxBinderUtils.observeBoundClass(ragdollBinder, humanoid):Subscribe(function(ragdoll)
|
|
56
|
+
if ragdoll then
|
|
57
|
+
print("Ragdolled!")
|
|
58
|
+
else
|
|
59
|
+
print("Not ragdolled")
|
|
60
|
+
end
|
|
61
|
+
end))
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
@prop Ragdoll Binder<Ragdoll>
|
|
65
|
+
@within RagdollBindersServer
|
|
66
|
+
]=]
|
|
13
67
|
self:Add(Binder.new("Ragdoll", require("Ragdoll"), serviceBag))
|
|
68
|
+
|
|
69
|
+
--[=[
|
|
70
|
+
Enables ragdolling on a humanoid.
|
|
71
|
+
@prop Ragdollable PlayerHumanoidBinder<Ragdollable>
|
|
72
|
+
@within RagdollBindersServer
|
|
73
|
+
]=]
|
|
14
74
|
self:Add(PlayerHumanoidBinder.new("Ragdollable", require("Ragdollable"), serviceBag))
|
|
15
75
|
|
|
76
|
+
--[=[
|
|
77
|
+
Automatically applies ragdoll upon humanoid death.
|
|
78
|
+
@prop RagdollHumanoidOnDeath PlayerHumanoidBinder<RagdollHumanoidOnDeath>
|
|
79
|
+
@within RagdollBindersServer
|
|
80
|
+
]=]
|
|
16
81
|
self:Add(PlayerHumanoidBinder.new("RagdollHumanoidOnDeath", require("RagdollHumanoidOnDeath"), serviceBag))
|
|
82
|
+
|
|
83
|
+
--[=[
|
|
84
|
+
Automatically applies ragdoll upon humanoid fall.
|
|
85
|
+
@prop RagdollHumanoidOnFall PlayerHumanoidBinder<RagdollHumanoidOnFall>
|
|
86
|
+
@within RagdollBindersServer
|
|
87
|
+
]=]
|
|
17
88
|
self:Add(PlayerHumanoidBinder.new("RagdollHumanoidOnFall", require("RagdollHumanoidOnFall"), serviceBag))
|
|
18
|
-
self:Add(PlayerHumanoidBinder.new("UnragdollAutomatically", require("UnragdollAutomatically"), serviceBag))
|
|
19
89
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
90
|
+
--[=[
|
|
91
|
+
Automatically unragdolls the humanoid.
|
|
92
|
+
@prop UnragdollAutomatically PlayerHumanoidBinder<UnragdollAutomatically>
|
|
93
|
+
@within RagdollBindersServer
|
|
94
|
+
]=]
|
|
95
|
+
self:Add(PlayerHumanoidBinder.new("UnragdollAutomatically", require("UnragdollAutomatically"), serviceBag))
|
|
23
96
|
end)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Ragdolls the humanoid on fall
|
|
2
|
+
Ragdolls the humanoid on fall. This is the base class.
|
|
3
3
|
@class BindableRagdollHumanoidOnFall
|
|
4
4
|
]=]
|
|
5
5
|
|
|
@@ -16,6 +16,12 @@ local BindableRagdollHumanoidOnFall = setmetatable({}, BaseObject)
|
|
|
16
16
|
BindableRagdollHumanoidOnFall.ClassName = "BindableRagdollHumanoidOnFall"
|
|
17
17
|
BindableRagdollHumanoidOnFall.__index = BindableRagdollHumanoidOnFall
|
|
18
18
|
|
|
19
|
+
--[=[
|
|
20
|
+
Constructs a new BindableRagdollHumanoidOnFall.
|
|
21
|
+
@param humanoid Humanoid
|
|
22
|
+
@param ragdollBinder Binder<Ragdoll | RagdollClient>
|
|
23
|
+
@return BindableRagdollHumanoidOnFall
|
|
24
|
+
]=]
|
|
19
25
|
function BindableRagdollHumanoidOnFall.new(humanoid, ragdollBinder)
|
|
20
26
|
local self = setmetatable(BaseObject.new(humanoid), BindableRagdollHumanoidOnFall)
|
|
21
27
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
--[=[
|
|
2
|
+
Rigging data for humaoid ragdolls.
|
|
2
3
|
@class RagdollRigging
|
|
3
4
|
]=]
|
|
4
5
|
|
|
@@ -393,6 +394,11 @@ local function getMotorSet(model, motorSet)
|
|
|
393
394
|
return motors
|
|
394
395
|
end
|
|
395
396
|
|
|
397
|
+
--[=[
|
|
398
|
+
Creates joints on a model for a given rig type.
|
|
399
|
+
@param model Model
|
|
400
|
+
@param rigType HumanoidRigType
|
|
401
|
+
]=]
|
|
396
402
|
function RagdollRigging.createRagdollJoints(model, rigType)
|
|
397
403
|
local parts = indexParts(model)
|
|
398
404
|
if rigType == Enum.HumanoidRigType.R6 then
|
|
@@ -408,6 +414,10 @@ function RagdollRigging.createRagdollJoints(model, rigType)
|
|
|
408
414
|
end
|
|
409
415
|
end
|
|
410
416
|
|
|
417
|
+
--[=[
|
|
418
|
+
Removes ragdoll joints for a given model
|
|
419
|
+
@param model Model
|
|
420
|
+
]=]
|
|
411
421
|
function RagdollRigging.removeRagdollJoints(model)
|
|
412
422
|
for _, descendant in pairs(model:GetDescendants()) do
|
|
413
423
|
-- Remove BallSockets and NoCollides, leave the additional Attachments
|
|
@@ -419,6 +429,11 @@ function RagdollRigging.removeRagdollJoints(model)
|
|
|
419
429
|
end
|
|
420
430
|
end
|
|
421
431
|
|
|
432
|
+
--[=[
|
|
433
|
+
Retrieves all joint motors for a given rigType
|
|
434
|
+
@param model Model
|
|
435
|
+
@param rigType HumanoidRigType
|
|
436
|
+
]=]
|
|
422
437
|
function RagdollRigging.getMotors(model, rigType)
|
|
423
438
|
-- Note: We intentionally do not disable the root joint so that the mechanism root of the
|
|
424
439
|
-- character stays consistent when we break joints on the client. This avoid the need for the client to wait
|
|
@@ -436,6 +451,13 @@ function RagdollRigging.getMotors(model, rigType)
|
|
|
436
451
|
return motors
|
|
437
452
|
end
|
|
438
453
|
|
|
454
|
+
--[=[
|
|
455
|
+
Disables all particle emitters and fades them out. Yields for the duration.
|
|
456
|
+
|
|
457
|
+
@yields
|
|
458
|
+
@param character Model
|
|
459
|
+
@param duration number
|
|
460
|
+
]=]
|
|
439
461
|
function RagdollRigging.disableParticleEmittersAndFadeOutYielding(character, duration)
|
|
440
462
|
if RunService:IsServer() then
|
|
441
463
|
-- This causes a lot of unnecesarry replicated property changes
|
|
@@ -464,6 +486,13 @@ function RagdollRigging.disableParticleEmittersAndFadeOutYielding(character, dur
|
|
|
464
486
|
end
|
|
465
487
|
end
|
|
466
488
|
|
|
489
|
+
--[=[
|
|
490
|
+
Applies a sliding friction torque to the character making it stiffer and stiffer. Yields.
|
|
491
|
+
|
|
492
|
+
@yields
|
|
493
|
+
@param character Model
|
|
494
|
+
@param duration number
|
|
495
|
+
]=]
|
|
467
496
|
function RagdollRigging.easeJointFriction(character, duration)
|
|
468
497
|
local descendants = character:GetDescendants()
|
|
469
498
|
-- { { joint, initial friction, end friction }, ... }
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
--[=[
|
|
2
|
-
Utility
|
|
2
|
+
Utility methods for ragdolling. See [Ragdoll] and [RagdollClient] which call into this class.
|
|
3
|
+
If you want to make ragdolls without binders, this class may work for you.
|
|
4
|
+
|
|
3
5
|
@class RagdollUtils
|
|
4
6
|
]=]
|
|
5
7
|
|
|
@@ -19,6 +21,12 @@ local RagdollUtils = {}
|
|
|
19
21
|
|
|
20
22
|
local EMPTY_FUNCTION = function() end
|
|
21
23
|
|
|
24
|
+
--[=[
|
|
25
|
+
Sets up state monitoring for when the humanoid changes to ensure ragdoll is smooth.
|
|
26
|
+
|
|
27
|
+
@param humanoid Humanoid
|
|
28
|
+
@return Maid
|
|
29
|
+
]=]
|
|
22
30
|
function RagdollUtils.setupState(humanoid)
|
|
23
31
|
local maid = Maid.new()
|
|
24
32
|
|
|
@@ -68,7 +76,17 @@ function RagdollUtils.setupState(humanoid)
|
|
|
68
76
|
return maid
|
|
69
77
|
end
|
|
70
78
|
|
|
71
|
-
--
|
|
79
|
+
--[=[
|
|
80
|
+
Prevents animations from being applied on the humanoid torso on both
|
|
81
|
+
the server and client.
|
|
82
|
+
|
|
83
|
+
:::note
|
|
84
|
+
We need this on all clients/servers to override animations!
|
|
85
|
+
:::
|
|
86
|
+
|
|
87
|
+
@param humanoid Humanoid
|
|
88
|
+
@return Maid
|
|
89
|
+
]=]
|
|
72
90
|
function RagdollUtils.preventAnimationTransformLoop(humanoid)
|
|
73
91
|
local maid = Maid.new()
|
|
74
92
|
|
|
@@ -95,6 +113,13 @@ function RagdollUtils.preventAnimationTransformLoop(humanoid)
|
|
|
95
113
|
return maid
|
|
96
114
|
end
|
|
97
115
|
|
|
116
|
+
--[=[
|
|
117
|
+
Sets up the motors so that ragdoll can go, applying velocities to the ragdoll.
|
|
118
|
+
This needs to occur on the network owner of the character first.
|
|
119
|
+
|
|
120
|
+
@param humanoid Humanoid
|
|
121
|
+
@return Maid
|
|
122
|
+
]=]
|
|
98
123
|
function RagdollUtils.setupMotors(humanoid)
|
|
99
124
|
local character = humanoid.Parent
|
|
100
125
|
local rigType = humanoid.RigType
|
|
@@ -171,6 +196,13 @@ function RagdollUtils.setupMotors(humanoid)
|
|
|
171
196
|
end
|
|
172
197
|
end
|
|
173
198
|
|
|
199
|
+
--[=[
|
|
200
|
+
If the head is not a mesh part, this resizes the head into a mesh part with correct
|
|
201
|
+
physics, and ensures the head scaling is correct.
|
|
202
|
+
|
|
203
|
+
@param humanoid Humanoid
|
|
204
|
+
@return MaidTask
|
|
205
|
+
]=]
|
|
174
206
|
function RagdollUtils.setupHead(humanoid)
|
|
175
207
|
local model = humanoid.Parent
|
|
176
208
|
if not model then
|