Hooks hooks
Part of Ragdoll
Hooks called by Ragdoll
Summary
Hooks
PlayerDeathThink hook, run again by the Ragdoll plugin.Hooks
Asks whether a fallen player may start getting up by themselves. Called on the server
when they press the jump key or run the getup command (Player:get_up), not when a
get up timer was given to them by something else.
Parameters
- target Player The player lying on the ground
Returns
- Boolean Return false to keep the player down
Called from
Call sites
Asks whether a player may be knocked out. Called on the server before a player who
is not knocked out already is, whether by Player:knock_out, the knockout command or
a stunstick hit, and before the PlayerCanRagdoll hook.
Parameters
- target Player The player who is about to be knocked out
- attacker Entity Whoever is knocking them out; nil if nobody in particular
- duration Number Seconds after which they would come to; nil if they stay out until something wakes them
Returns
- Boolean Return false to keep the player conscious
Called from
fall_down
Call sites
Asks whether a player may be put into a ragdoll state. Called on the server before a living player falls over or is knocked out, before the state of a player who is already down is changed, and before a corpse is left for a player who died on their feet.
Parameters
- target Player The player
- state Number The RAGDOLL_ state they are about to enter
- delay Number Seconds after which they would get up by themselves; nil if they stay down
- data Map Their ragdoll data if they are already lying on the ground, nil otherwise
Returns
- Boolean Return false to prevent it. A dead player then leaves no corpse, but is still in the RAGDOLL_DUMMY state until they respawn
Called from
can_ragdoll
Call sites
Asks whether a ragdoll that its player has left behind may be removed once its decay time has passed. Called on the server when the player respawns, gets up or disconnects, for ragdolls that have a decay time; a ragdoll without one is removed right away and does not run the hook.
Parameters
- owner Player The player the ragdoll belonged to; they are leaving the server when the hook is run for a disconnect
- ragdoll Entity The ragdoll
- decay Number Seconds after which the ragdoll is removed
Returns
- Boolean Return false to keep the ragdoll; whoever does so becomes responsible for removing it
Called from
decay_ragdoll
Call sites
PlayerCanUnragdoll(self, current, self.ragdoll_data)
server plugins/ragdoll/plugin/sv_plugin.lua:689Asks whether a player who is lying on the ground may get back up. Called on the server when their get up timer runs out or something sets their state to RAGDOLL_NONE. Not called when the state is cleared because they respawn or leave, nor when their ragdoll has been removed.
Parameters
- target Player The player
- state Number The RAGDOLL_ state they are in
- data Map Their ragdoll data, see plugins/ragdoll/plugin/sv_plugin.lua
Returns
- Boolean Return false to keep the player down
Called from
Call sites
GMod's PlayerDeathThink hook, run again by the Ragdoll plugin.
Besides the engine's own calls, the plugin runs it on the server from its PlayerThink
handler for every dead player who is ragdolled. This call ignores what the handlers
return.
Parameters
- actor Player The dead player
Called from
Call sites
Called on the server after a player has been knocked out: they lie on the ground unable to get up, hear and are heard by nobody over voice chat and cannot switch characters until they come to.
Parameters
- target Player The player who was knocked out
- duration Number Seconds after which they come to by themselves; nil if they stay out until something wakes them
- attacker Entity Whoever knocked them out; nil if nobody in particular
Called from
fall_down
Call sites
PlayerRagdollCanTakeDamage(owner, entity, damage_info)
server plugins/ragdoll/plugin/sv_hooks.lua:252Asks whether damage dealt to the ragdoll of a living player is passed on to them. Called on the server for every hit the ragdoll takes once its immunity is over, and during the immunity for hits dealt by players.
Parameters
- owner Player The player lying on the ground
- ragdoll Entity Their ragdoll
- damage_info CTakeDamageInfo The damage
Returns
- Boolean Return false to keep the player from taking the damage
Called from
Call sites
Called on the server when the decay time of a ragdoll that its player has left behind is up, right before the ragdoll is removed. Not called for a ragdoll that is removed without a decay time, such as the one a player gets up from.
Parameters
- owner Player The player the ragdoll belonged to; no longer valid if they have left the server
- ragdoll Entity The ragdoll, still valid
Call sites
Called on the server after a player has entered a ragdoll state: they fell over, were knocked out, were switched between the two while lying on the ground, or died and left a corpse.
Parameters
- target Player The player
- state Number The RAGDOLL_ state they are in now
- data Map Their ragdoll data, see plugins/ragdoll/plugin/sv_plugin.lua
Called from
ragdolled
Call sites
PlayerUnragdolled(target, state, data, reset == true)
server plugins/ragdoll/plugin/sv_plugin.lua:166Called on the server after a player has left a ragdoll state: they got back up, respawned after their death, or were reset while lying on the ground.
Parameters
- target Player The player
- state Number The RAGDOLL_ state they were in
- data Map The ragdoll data they had, see plugins/ragdoll/plugin/sv_plugin.lua; nil if they had no ragdoll
- reset Boolean True if the state was cleared because the player is respawning or leaving, false if they got up where their ragdoll was
Called from
unragdoll
Call sites
Called on the server after a knocked out player has come to: their knockout timer ran out, something got them up or made them merely fallen over, or their state was cleared because they respawn or leave. Not called when they die while knocked out.
Parameters
- target Player The player
- reset Boolean True if the state was cleared because the player is respawning or leaving, false if they came to where they lay
Called from
unragdollfall_down
Call sites
Asks whether the overlay of a fallen player should be drawn: the darkened screen with the 'press jump' prompt, or the blacked out screen of a knocked out player. Called on the client on every HUD paint while the local player is fallen over or knocked out. The get up progress bar is a timed action and is not affected.
Returns
- Boolean Return false to hide the overlay