From 742c9aad862048f957a7a51b67559de09ddace50 Mon Sep 17 00:00:00 2001 From: cypress Date: Sat, 26 Aug 2023 09:49:16 -0400 Subject: [PATCH] SERVER: Add punchangle when taking explosive damage --- source/server/damage.qc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/server/damage.qc b/source/server/damage.qc index c401ff3..7832aff 100644 --- a/source/server/damage.qc +++ b/source/server/damage.qc @@ -623,6 +623,22 @@ void(entity inflictor, entity attacker, float damage2, float mindamage, float ra final_damage *= 60; } DamageHandler (ent, ent, final_damage, S_EXPLOSIVE); + + // shake the camera on impact + vector distance; + distance = inflictor.angles - ent.angles; + + // just to prevent radical punchangles + while(distance_x > 10 || distance_x < -10) { + distance_x /= 2; + } + while(distance_y > 10 || distance_y < -10) { + distance_y /= 2; + } + + // apply + ent.punchangle_x = distance_x; + ent.punchangle_y = distance_y; } } else if (ent.classname == "explosive_barrel")