@rbxts/falldown 1.0.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/LICENSE +21 -0
- package/out/index.d.ts +103 -0
- package/out/init.luau +1629 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 irishfix
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/out/index.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Signal } from "@rbxts/beacon";
|
|
2
|
+
/**
|
|
3
|
+
* Interface representing an active ragdoll instance. Users receive pre-constructed instances from {@linkcode Falldown.RagdollCharacter}.
|
|
4
|
+
* @interface
|
|
5
|
+
* @see {@linkcode Falldown}
|
|
6
|
+
* @see {@linkcode Falldown.RagdollCharacter}
|
|
7
|
+
*/
|
|
8
|
+
export interface IActiveRagdoll {
|
|
9
|
+
/** The character `Model` that is currently ragdolled. */
|
|
10
|
+
readonly Character: Model;
|
|
11
|
+
/** The `Humanoid` instance of the ragdolled character. */
|
|
12
|
+
readonly Humanoid: Humanoid;
|
|
13
|
+
/** Signal that fires when the ragdoll is destroyed. Fires after character removal, manual {@linkcode Destroy} call, or automatic duration expiry.
|
|
14
|
+
* @see {@linkcode IActiveRagdoll.Destroy}
|
|
15
|
+
*/
|
|
16
|
+
readonly Destroyed: Signal<void>;
|
|
17
|
+
/** Signal that fires when the ragdoll's getup animation completes and the character is restored to normal control. Fires before {@linkcode Destroyed}.
|
|
18
|
+
* @see {@linkcode IActiveRagdoll.Destroyed}
|
|
19
|
+
*/
|
|
20
|
+
readonly Ended: Signal<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Applies velocity to the ragdolled character using different distribution modes.
|
|
23
|
+
* @param velocity - The velocity vector to apply (in studs/second)
|
|
24
|
+
* @param mode - The velocity distribution mode from {@linkcode Falldown.VelocityMode}
|
|
25
|
+
* @see {@linkcode Falldown.VelocityMode}
|
|
26
|
+
* @see {@linkcode IActiveRagdoll.AddRandomVelocity}
|
|
27
|
+
*/
|
|
28
|
+
AddVelocity(velocity: Vector3, mode: (typeof Falldown.VelocityMode)[keyof typeof Falldown.VelocityMode]): void;
|
|
29
|
+
/**
|
|
30
|
+
* Applies random velocity to each body part independently in all directions. Each part receives random velocity with components in range `[-maxVelocity, maxVelocity]`.
|
|
31
|
+
* @param maxVelocity - Maximum velocity magnitude for each axis (in studs/second)
|
|
32
|
+
* @see {@linkcode IActiveRagdoll.AddVelocity}
|
|
33
|
+
*/
|
|
34
|
+
AddRandomVelocity(maxVelocity: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* Manually ends the ragdoll state and restores the character to normal control. Plays the appropriate getup animation, removes ragdoll constraints, positions character upright, and fires {@linkcode Ended} and {@linkcode Destroyed} signals.
|
|
37
|
+
* @see {@linkcode IActiveRagdoll.Ended}
|
|
38
|
+
* @see {@linkcode IActiveRagdoll.Destroyed}
|
|
39
|
+
* @see {@linkcode Falldown.UnragdollCharacter}
|
|
40
|
+
*/
|
|
41
|
+
Destroy(): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Main Falldown class providing static methods for ragdolling characters in Roblox. Creates realistic ragdoll physics by replacing Motor6Ds with constraints, managing collision groups, and providing smooth getup animations.
|
|
45
|
+
* @static
|
|
46
|
+
* @see {@linkcode IActiveRagdoll}
|
|
47
|
+
* @see {@linkcode Falldown.VelocityMode}
|
|
48
|
+
*/
|
|
49
|
+
export declare class Falldown {
|
|
50
|
+
/**
|
|
51
|
+
* Enum used to represent how velocity should be distributed across a ragdolled character's body parts.
|
|
52
|
+
* @static
|
|
53
|
+
* @readonly
|
|
54
|
+
* @enum {number}
|
|
55
|
+
* @see {@linkcode IActiveRagdoll.AddVelocity}
|
|
56
|
+
*/
|
|
57
|
+
static VelocityMode: {
|
|
58
|
+
/** Applies velocity only to the HumanoidRootPart. Most efficient for general movement like falling or launching. */
|
|
59
|
+
readonly RootOnly: 0;
|
|
60
|
+
/** Applies the full velocity vector to every body part independently. Creates the strongest force, useful for powerful impacts. */
|
|
61
|
+
readonly AllEqual: 1;
|
|
62
|
+
/** Divides the velocity magnitude evenly across all body parts. Total momentum remains constant regardless of part count. Good for realistic physics. */
|
|
63
|
+
readonly SplitEqual: 2;
|
|
64
|
+
/** Each part gets a random velocity from 0 to the specified magnitude in the same direction. Creates varied motion, useful for explosions. */
|
|
65
|
+
readonly RandomMax: 3;
|
|
66
|
+
};
|
|
67
|
+
private static readonly _activeRagdolls;
|
|
68
|
+
private static MakeProxies;
|
|
69
|
+
private static CreateActiveRagdollR6;
|
|
70
|
+
private static CreateActiveRagdollR15;
|
|
71
|
+
/**
|
|
72
|
+
* Converts a character into a ragdoll with physics-based movement. Detects R6/R15 rig automatically, replaces Motor6Ds with constraints, creates collision proxies, and sets up automatic recovery.
|
|
73
|
+
* @static
|
|
74
|
+
* @param character - The character `Model` to ragdoll. Must have a Humanoid.
|
|
75
|
+
* @param standupFadeTime - Duration (in seconds) for the fade clone to remain visible after standing up. Recommended: 0.3-0.7 seconds.
|
|
76
|
+
* @param automaticDuration - Optional. If provided, the ragdoll will automatically end after this many seconds. If omitted, you must manually call {@linkcode IActiveRagdoll.Destroy} to end the ragdoll.
|
|
77
|
+
* @param getupFront - Optional. Animation to play when getting up while facing forward (belly down). If not provided, character snaps to standing.
|
|
78
|
+
* @param getupBack - Optional. Animation to play when getting up while facing backward (back down). If not provided, character snaps to standing.
|
|
79
|
+
* @returns An {@linkcode IActiveRagdoll} interface if successful, or `undefined` if character is already ragdolled, has no Humanoid, or is missing required body parts.
|
|
80
|
+
* @see {@linkcode IActiveRagdoll}
|
|
81
|
+
* @see {@linkcode Falldown.UnragdollCharacter}
|
|
82
|
+
* @see {@linkcode Falldown.VelocityMode}
|
|
83
|
+
*/
|
|
84
|
+
static RagdollCharacter(character: Model, standupFadeTime: number, automaticDuration?: number, getupFront?: Animation, getupBack?: Animation): IActiveRagdoll | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Manually ends the ragdoll state for a specific character. Equivalent to calling {@linkcode IActiveRagdoll.Destroy} on the ragdoll instance. If the character is not currently ragdolled, this method does nothing.
|
|
87
|
+
* @static
|
|
88
|
+
* @param character - The character `Model` to un-ragdoll
|
|
89
|
+
* @param delayTime - Optional. If provided, delays the un-ragdoll by this many seconds. If omitted, un-ragdolls immediately.
|
|
90
|
+
* @see {@linkcode IActiveRagdoll.Destroy}
|
|
91
|
+
* @see {@linkcode Falldown.RagdollCharacter}
|
|
92
|
+
* @see {@linkcode Falldown.UnragdollAllCharacters}
|
|
93
|
+
*/
|
|
94
|
+
static UnragdollCharacter(character: Model, delayTime?: number): void;
|
|
95
|
+
/**
|
|
96
|
+
* Ends the ragdoll state for ALL currently ragdolled characters. Useful for game-wide effects like round resets or emergency cleanup. Each character performs their getup animation independently.
|
|
97
|
+
* @static
|
|
98
|
+
* @param delayTime - Optional. If provided, delays the un-ragdoll by this many seconds for all characters. If omitted, un-ragdolls all immediately.
|
|
99
|
+
* @see {@linkcode Falldown.UnragdollCharacter}
|
|
100
|
+
* @see {@linkcode Falldown.RagdollCharacter}
|
|
101
|
+
*/
|
|
102
|
+
static UnragdollAllCharacters(delayTime?: number): void;
|
|
103
|
+
}
|