-- handles player bleeding, including damage scales -- and blood trails function ihl.bleed(pl, woundType) if (ihls.playerIsWounded(pl)) then ihls.svDebugLog(pl, "Bleeding from " .. ihlc.hitGroupStrings[woundType]) -- scale the bleeding damage based on the hit group local bleedDamage = ihlc.bleedScales[woundType] pl:TakeDamage(bleedDamage, pl) -- find the ground beneath the player local tracedata = {} tracedata.start = pl:GetPos() tracedata.endpos = tracedata.start + Vector(0, 0, -8000) ihls.svDebugLog(pl, "tracedata.start=" .. tostring(tracedata.start)) ihls.svDebugLog(pl, "tracedata.endpos=" .. tostring(tracedata.endpos)) local trace = util.TraceLine(tracedata) ihls.svDebugLog(pl, "trace=" .. tostring(trace.HitPos)) -- put the trace into the floor, otherwise the decal -- may attach to the player if standing on the ground local pos1 = trace.HitPos + Vector(0, 0, -1) + trace.HitNormal local pos2 = trace.HitPos + Vector(0, 0, -1) - trace.HitNormal -- plant some blood under the player util.Decal("Blood", pos1, pos2) -- continue bleeding every period depending on the hitgroup local bleedInterval = ihlc.bleedIntervals[woundType] timer.Simple(bleedInterval, ihl.bleed, pl, woundType) end end