]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/g_damage.qc
Don't regurgitate fully digested prey silently by default
[voretournament/voretournament.git] / data / qcsrc / server / g_damage.qc
index 483ff0c7347dc4f7c9c3c29a595e8f9e5e11bb27..4b304b89eb8fcc4b7da34d84ccd720786b503432 100644 (file)
@@ -60,10 +60,10 @@ float damage_headshotbonus; // bonus multiplier for head shots, set to 0 after u
 .float taunt_soundtime;\r
 .float taunt_soundtype;\r
 \r
-void SetAutoTaunt(entity e, float t_soundtime, float soundtype)\r
+void SetAutoTaunt(entity e, float t_soundtime, float t_soundtype)\r
 {\r
        e.taunt_soundtime = t_soundtime;\r
-       e.taunt_soundtype = soundtype;\r
+       e.taunt_soundtype = t_soundtype;\r
 }\r
 \r
 float IsDifferentTeam(entity a, entity b)\r
@@ -293,6 +293,8 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                        bprint ("^1",s, "^1 burned to death\n");\r
                                else if (deathtype == DEATH_DIGESTION)\r
                                        bprint ("^1",s, "^1 was digested\n");\r
+                               else if (deathtype == DEATH_REGURGITATION)\r
+                                       bprint ("^1",s, "^1 regurgitated to death\n");\r
                                else if (deathtype == DEATH_STOMACHKICK)\r
                                        bprint ("^1",s, "^1 was ripped apart from the inside\n");\r
                                else if (deathtype != DEATH_TEAMCHANGE && deathtype != DEATH_QUIET)\r
@@ -382,6 +384,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                                }\r
                                                SetAutoTaunt(attacker, time + 1, TAUNTTYPE_DEATH);\r
                                        }\r
+                                       portrait(attacker, targ);\r
                                }\r
                                else\r
                                {\r
@@ -398,6 +401,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                                }\r
                                                SetAutoTaunt(attacker, time + 1, TAUNTTYPE_DEATH);\r
                                        }\r
+                                       portrait(attacker, targ);\r
                                }\r
 \r
                                if(sv_gentle) {\r
@@ -463,6 +467,8 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                                bprint ("^1",s, "^1 was burnt to death by ^1", a, "\n");\r
                                        else if (deathtype == DEATH_DIGESTION)\r
                                                bprint ("^1",s, "^1 was digested by ^1", a, "\n");\r
+                                       else if (deathtype == DEATH_REGURGITATION)\r
+                                               bprint ("^1",s, "^1 regurgitated to death due to ^1", a, "\n");\r
                                        else if (deathtype == DEATH_STOMACHKICK)\r
                                                bprint ("^1",s, "^1 was ripped apart from the inside by ^1", a, "\n");\r
                                        else if (deathtype == DEATH_CUSTOM)\r
@@ -629,6 +635,9 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                        LogDeath("accident", deathtype, targ, targ);\r
                }\r
 \r
+               // we lose all armor when we die\r
+               targ.armorvalue = 0;\r
+\r
                targ.death_origin = targ.origin;\r
                if(targ != attacker)\r
                        targ.killer_origin = attacker.origin;\r
@@ -693,6 +702,11 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                if (attacker.isbot)\r
                        damage = damage * bound(0.1, (skill + 5) * 0.1, 1);\r
 \r
+               // if a predator is taking damage, check if he should regurgitate his prey, based on the damage he took\r
+               if(cvar("g_balance_vore_escapeprobability"))\r
+               if(targ.stomach_load && random() < cvar("g_balance_vore_escapeprobability") * damage)\r
+                       targ.regurgitate_prepare = -1;\r
+\r
                // nullify damage if teamplay is on\r
                if(deathtype != DEATH_TELEFRAG)\r
                if(attacker.classname == "player")\r
@@ -844,10 +858,24 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                                attacker.teamkill_complain = time + 5;\r
                                                attacker.teamkill_soundtime = time + 0.4;\r
                                                attacker.teamkill_soundsource = targ;\r
+                                               portrait(targ, attacker);\r
                                        }\r
                                }\r
                        }\r
                }\r
+\r
+               // lean the player based on the amount of damage taken\r
+               if(cvar("g_leanplayer_damage"))\r
+               if(targ.classname == "player" && WEP_VALID(DEATH_WEAPONOF(deathtype))) // only for damage caused by weapons\r
+               {\r
+                       targ.leanangle_damage_loc = hitloc - targ.origin;\r
+                       targ.leanangle_damage_force += force * cvar("g_leanplayer_damage"); // keep existing force if any\r
+\r
+                       // bound angles to the specified limit\r
+                       targ.leanangle_damage_force_x = bound(-cvar("g_leanplayer_damage_max"), targ.leanangle_damage_force_x, cvar("g_leanplayer_damage_max"));\r
+                       targ.leanangle_damage_force_y = bound(-cvar("g_leanplayer_damage_max"), targ.leanangle_damage_force_y, cvar("g_leanplayer_damage_max"));\r
+                       targ.leanangle_damage_force_z = bound(-cvar("g_leanplayer_damage_max"), targ.leanangle_damage_force_z, cvar("g_leanplayer_damage_max"));\r
+               }\r
        }\r
 \r
        // apply push\r