Player extensions of the Ragdoll plugin that work on both realms: reading the ragdoll state of a player and finding the ragdoll that stands in for them. The state and the ragdoll are data table variables of the player, so a client knows them for every player it is being sent.

Summary

Methods

Spawns a ragdoll copy of the player (model, skin, bodygroups, material and color) and stores it as their ragdoll entity.
Returns when the player gets up by themselves.
Returns how long the knocked out player stays out, for HUDs and the like.
Returns the table that describes the ragdoll of the player: what they get back when they get up, the damage immunity and the get up timer.
Returns the player's ragdoll entity: the body of a player who has fallen over or was knocked out, or the corpse of a dead one.
Returns the ragdoll state of the player.
Makes the fallen player start getting up by themselves, which is what the jump key and the getup command do.
Checks whether the player is lying on the ground and able to get up by themselves.
Checks whether the get up timer of the player is paused.
Checks whether the player is knocked out: lying on the ground, unable to get up until the state ends.
Checks whether the player is in any ragdoll state other than RAGDOLL_NONE.
Knocks the player out: they fall over, or stay down if they are fallen over already, and cannot get up by themselves until they come to.
Pauses the get up timer of the player, for example while someone is carrying them.
Lets go of the player's ragdoll and removes it, right away or after its decay time (unless PlayerCanRagdollDecay keeps it).
Clears the ragdoll state of the player without getting them up: no hook is asked, the player is not moved to their ragdoll and does not get their weapons back.
Resumes the get up timer of the player with the time it had left when it was paused.
Makes the fallen or knocked out player get up by themselves after a delay, replacing the timer they have and resuming a paused one.
Sets the networked ragdoll entity of the player.
Sets how long the ragdoll of the player ignores damage that was not dealt by a player, such as hitting the ground.
Sets the player's ragdoll state and creates or removes their ragdoll to match it.
wake_up()server
Brings the knocked out player to: they get up where their ragdoll is, unless the PlayerCanUnragdoll hook keeps them down.

Methods

Player:create_ragdoll_entity(decay, fallen, force)

server plugins/ragdoll/plugin/sv_plugin.lua:264

Spawns a ragdoll copy of the player (model, skin, bodygroups, material and color) and stores it as their ragdoll entity. Does nothing if they already have a valid one. A fallen player first leaves the vehicle they are in; they are then frozen, hidden and stripped of their weapons, and a fire they are burning with moves over to the ragdoll. They get everything back once the ragdoll is let go of or removed. Serverside only.

Parameters

  • decay Number optional, defaults to nil seconds the ragdoll remains after the ragdoll entity is reset; nil removes it right away
  • fallen Boolean optional, defaults to false whether the player has fallen over rather than died
  • force Vector optional, defaults to nil push to give to every bone of the ragdoll, shortened to 800 units so that it does not throw the ragdoll across the map

Returns

  • Entity the ragdoll, or nil if it could not be created

See also

Player:get_getup_time()

server plugins/ragdoll/plugin/sv_plugin.lua:442

Returns when the player gets up by themselves. Serverside only.

Returns

  • Number CurTime() at which they get up; nil if they have no get up timer or it is paused

Player:get_knockout_remaining()

shared plugins/ragdoll/plugin/lib/meta/sh_player.lua:47

Returns how long the knocked out player stays out, for HUDs and the like. Both realms know it, as the end of the get up timer is networked.

Returns

  • Number seconds until the player comes to by themselves; 0 if they are not knocked out; nil if they are knocked out without a timer, or while the timer is paused, and stay out until something wakes them

Player:get_ragdoll_data()

server plugins/ragdoll/plugin/sv_plugin.lua:241

Returns the table that describes the ragdoll of the player: what they get back when they get up, the damage immunity and the get up timer. Its fields are listed at the top of plugins/ragdoll/plugin/sv_plugin.lua. Serverside only.

Returns

  • Map the ragdoll data, or nil if the player has no ragdoll

Player:get_ragdoll_entity()

shared plugins/ragdoll/plugin/lib/meta/sh_player.lua:18

Returns the player's ragdoll entity: the body of a player who has fallen over or was knocked out, or the corpse of a dead one.

Returns

  • Entity the ragdoll, or a NULL entity if the player has none

Player:get_ragdoll_state()

shared plugins/ragdoll/plugin/lib/meta/sh_player.lua:11

Returns the ragdoll state of the player.

Returns

  • Number one of the RAGDOLL_ enums
  • RAGDOLL_NONE if the player is not ragdolled

Player:get_up(duration)

server plugins/ragdoll/plugin/sv_plugin.lua:497

Makes the fallen player start getting up by themselves, which is what the jump key and the getup command do. Refused if they are not fallen over (a knocked out player has to wait), if they already have a get up timer, running or paused, if someone is dragging their ragdoll (Player:get_dragger of the Pickup Objects plugin), or if the PlayerCanGetUp hook says no. Serverside only.

Parameters

  • duration Number optional, defaults to nil seconds it takes, never less than the ragdoll_getup_time config, which is also the default, nor more than 60

Returns

  • Boolean true if the player has started getting up

Player:is_fallen_over()

shared plugins/ragdoll/plugin/lib/meta/sh_player.lua:31

Checks whether the player is lying on the ground and able to get up by themselves.

Returns

  • Boolean

Player:is_getup_paused()

server plugins/ragdoll/plugin/sv_plugin.lua:483

Checks whether the get up timer of the player is paused. Serverside only.

Returns

  • Boolean

Player:is_knocked_out()

shared plugins/ragdoll/plugin/lib/meta/sh_player.lua:38

Checks whether the player is knocked out: lying on the ground, unable to get up until the state ends.

Returns

  • Boolean

Checks whether the player is in any ragdoll state other than RAGDOLL_NONE. Note that this includes dead players, who are in the RAGDOLL_DUMMY state until they respawn.

Returns

  • Boolean

Player:knock_out(duration, options)

server plugins/ragdoll/plugin/sv_plugin.lua:716

Knocks the player out: they fall over, or stay down if they are fallen over already, and cannot get up by themselves until they come to. While they are out they are not heard over voice chat and cannot switch characters. The PlayerCanKnockOut hook can refuse; PlayerKnockedOut runs afterwards and PlayerWokeUp once they come to. Serverside only.

target:knock_out(30, { attacker = actor }) -- out for half a minute
target:knock_out() -- out until something wakes them

Parameters

  • duration Number optional, defaults to nil seconds after which the player comes to by themselves; nil or 0 keeps them out until Player:wake_up, Player:set_getup_time or staff gets them up
  • options Map optional, defaults to nil optional settings: attacker (Entity whoever knocks the player out) and force (Vector push given to the ragdoll)

Returns

  • Boolean true if the player is knocked out now

See also

Player:pause_getup_time()

server plugins/ragdoll/plugin/sv_plugin.lua:452

Pauses the get up timer of the player, for example while someone is carrying them. The player cannot start getting up by themselves while it is paused. Serverside only.

Returns

  • Boolean true if a running timer was paused

See also

Player:reset_ragdoll_entity(reset)

server plugins/ragdoll/plugin/sv_plugin.lua:372

Lets go of the player's ragdoll and removes it, right away or after its decay time (unless PlayerCanRagdollDecay keeps it). A player whose body the ragdoll had taken over gets it back: unless they are dead or being reset, they are moved to the ragdoll, given their weapons and view back and keep burning if the ragdoll was. Serverside only.

Parameters

  • reset Boolean optional, defaults to false the player is being respawned: only make them visible, solid and able to move again

Player:reset_ragdoll_state()

server plugins/ragdoll/plugin/sv_plugin.lua:520

Clears the ragdoll state of the player without getting them up: no hook is asked, the player is not moved to their ragdoll and does not get their weapons back. This is what happens when a player respawns or leaves; the corpse of a dead player then stays for its decay time. Runs PlayerUnragdolled if the player was ragdolled. Serverside only.

Player:resume_getup_time()

server plugins/ragdoll/plugin/sv_plugin.lua:473

Resumes the get up timer of the player with the time it had left when it was paused. Serverside only.

Returns

  • Boolean true if a paused timer was resumed

See also

Player:set_getup_time(delay)

server plugins/ragdoll/plugin/sv_plugin.lua:415

Makes the fallen or knocked out player get up by themselves after a delay, replacing the timer they have and resuming a paused one. The timer is a timed action called 'getup', which shows the player a progress bar. Serverside only.

target:set_getup_time(10) -- get up in ten seconds
target:set_getup_time() -- stay down until something else gets the player up

Parameters

  • delay Number optional, defaults to nil seconds until the player gets up; nil or 0 only stops the timer

Returns

  • Boolean false if the player is not alive and lying on the ground

See also

Player:set_ragdoll_entity(entity)

server plugins/ragdoll/plugin/sv_plugin.lua:248

Sets the networked ragdoll entity of the player. Does not spawn or remove anything. Serverside only.

Parameters

  • entity Entity

Player:set_ragdoll_immunity(delay)

server plugins/ragdoll/plugin/sv_plugin.lua:397

Sets how long the ragdoll of the player ignores damage that was not dealt by a player, such as hitting the ground. Does nothing if the player has no ragdoll. Serverside only.

Parameters

  • delay Number optional, defaults to nil seconds of immunity from now on; nil ends it

Player:set_ragdoll_state(state, delay, options)

server plugins/ragdoll/plugin/sv_plugin.lua:665

Sets the player's ragdoll state and creates or removes their ragdoll to match it. RAGDOLL_FALLENOVER and RAGDOLL_KNOCKEDOUT put a living player on the ground as a ragdoll, with the 'fallen' action; a fallen player may get up by themselves, a knocked out one may not. RAGDOLL_DUMMY leaves a corpse that stays for the ragdoll_decay_time config after the player respawns. RAGDOLL_NONE gets a player who is lying on the ground back up where their ragdoll is. The PlayerCanRagdoll and PlayerCanUnragdoll hooks can refuse the change; PlayerRagdolled and PlayerUnragdolled run after it. Serverside only.

target:set_ragdoll_state(RAGDOLL_FALLENOVER) -- fall over until they get up by themselves
target:set_ragdoll_state(RAGDOLL_KNOCKEDOUT, 30) -- knock out for half a minute
target:set_ragdoll_state(RAGDOLL_NONE) -- get back up

Parameters

  • state Number optional, defaults to RAGDOLL_NONE one of the RAGDOLL_ enums
  • delay Number optional, defaults to nil seconds after which a fallen or knocked out player gets up by themselves; nil leaves them down until something gets them up
  • options Map optional, defaults to nil optional settings for falling over: force (Vector push given to the ragdoll, such as the force of the damage that knocked the player down) and attacker (Entity whoever knocked the player out, passed to the knockout hooks)

Returns

  • Boolean true if the player is now in the state, false if a hook has refused or the state does not apply to them

See also

Brings the knocked out player to: they get up where their ragdoll is, unless the PlayerCanUnragdoll hook keeps them down. Serverside only.

Returns

  • Boolean true if the player is up; false if they were not knocked out or a hook has refused

See also

Defined in