Back to TPG

TPG.Protection.SecondsSinceDamage

S🏷️ Protection

Part of TPG namespace

TPG.Protection.SecondsSinceDamage(ply)
View on GitHub|gamemode/player/sv_protection.lua:279-283
📋 Has LDoc👁️ 0 viewsUpdated 1 month ago

Description

"Am I in a fight right now?" Used by the loadout re-kit (core/sv_commands.lua) to decide whether a respawn-to-change-kit is a legitimate one or an escape from a fight that's going badly. Answered by the clock below rather than by proximity or line of sight, because taking fire is the thing that actually matters and it costs one timestamp to know. Never having been hit reads as "not in combat", which is the right answer for a fresh spawn and for anyone the round hasn't touched yet. (stamped by the EntityTakeDamage hook below), or math.huge if they never have this life.

Parameters

NameTypeDescription
plyPlayer

Returns

TypeDescription
numberSeconds since `ply` last took damage that actually landed

Examples

No examples available.

Used In

No usages found in the codebase.