Hooks hooks
Part of Limb Damage
Hooks called by Limb Damage
Summary
Hooks
Limbs:damage, Limbs:damage_limbs or Limbs:set_damage.Limbs:heal, Limbs:heal_all or Limbs:set_damage.Limbs:reset is called.Hooks
Lets plugins change how strongly an effect of limb damage applies to a player, for example to make a faction immune to it. Called on both realms whenever the strength of an effect is asked for and the limbs behind it are hurt: for 'run' and 'jump' on every movement command of the player, for 'aim' on every frame of the local player. On the client it is only ever called for the local player. Movement is predicted, so a handler for 'run' or 'jump' has to be shared and return the same value on both realms.
Parameters
- target Player The player the effect applies to
- effect String 'run', 'jump' or 'aim'
- fraction Number Strength from the damage of the limbs, above 0 and up to 1
Returns
- Number Strength to use instead, from 0 (no effect) to 1; nothing to keep it
Called from
Call sites
Lets plugins change which limbs of a player are hurt by damage they have taken. Called on the server after the damage has been dealt to a player who survived it, while limb damage is enabled, also when the damage has no location and the table is empty. Every handler may change the table, so a handler should return nothing to let the others run.
-- Explosions hurt every limb a little.
function MyPlugin:AdjustLimbHits(victim, damage_info, hits, amount)
if damage_info:IsExplosionDamage() then
for _, limb_id in ipairs(Limbs:all()) do
hits[limb_id] = (hits[limb_id] or 0) + amount * 0.25
end
end
end
Parameters
- victim Player The player who has taken the damage
- damage_info CTakeDamageInfo The damage that was dealt; changing it has no effect
- hits Map Limb damage to add by limb ID, modified in place: the hit limb for a traced hit, both legs for fall damage, empty for damage without a location
- amount Number Health that the player has lost to the damage
Called from
Call sites
Lets plugins change how much the limbs of a player recover on their own. Called on the server once a minute for every living player who has a hurt limb, while limb damage is enabled.
Parameters
- actor Player The player whose limbs are about to recover
- amount Number Damage that is about to be taken off each hurt limb, from the 'limbs_recovery' config
Returns
- Number Amount to take off instead, 0 for no recovery; nothing to keep it
Called from
Call sites
Called on the server after a limb of a player has been hurt, whether by damage the
player took or through Limbs:damage, Limbs:damage_limbs or Limbs:set_damage.
Not called for a hit on a limb that is already crippled.
Parameters
- target Player The player whose limb was hurt
- limb String Limb ID
- amount Number Damage that was added to the limb, in whole points
- damage Number Damage of the limb now, up to 100
Called from
change_limbs
Call sites
Called on the server after a limb of a player has been healed, whether by natural
recovery or through Limbs:heal, Limbs:heal_all or Limbs:set_damage. Not called
when all limbs are cleared at once, which runs PlayerLimbsReset instead.
Parameters
- target Player The player whose limb was healed
- limb String Limb ID
- amount Number Damage that was taken off the limb, in whole points
- damage Number Damage of the limb now, 0 once it is healthy
Called from
change_limbs
Call sites
Called on the server after all limbs of a player have been cleared at once: when the
player dies or when Limbs:reset is called. Not called if no limb was hurt.
Parameters
- target Player The player whose limbs were reset
Called from
Call sites
Asks whether the body diagram of the Limbs plugin should be drawn on the HUD. Called on the client every frame in which the diagram is visible or fading out.
Returns
- Boolean Return false to hide the diagram