]> git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/g_damage.qc
Damage player leaning: Skip if the target origin and hit location are the same. Preve...
[voretournament/voretournament.git] / data / qcsrc / server / g_damage.qc
index 86b2952efed93fc107136fd9212442b29c69d2c2..22ed5de1ab1a68d1641b6abae6f25c32aacf35d8 100644 (file)
@@ -56,8 +56,15 @@ float damage_headshotbonus; // bonus multiplier for head shots, set to 0 after u
 .float teamkill_soundtime;\r
 .entity teamkill_soundsource;\r
 .entity pusher;\r
+\r
 .float taunt_soundtime;\r
+.float taunt_soundtype;\r
 \r
+void SetAutoTaunt(entity e, float t_soundtime, float t_soundtype)\r
+{\r
+       e.taunt_soundtime = t_soundtime;\r
+       e.taunt_soundtype = t_soundtype;\r
+}\r
 \r
 float IsDifferentTeam(entity a, entity b)\r
 {\r
@@ -286,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
@@ -367,13 +376,13 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                                centerprint(targ, strcat(DAMAGE_CENTERPRINT_SPACER, a,"^1 made you their meal ^7", GetAdvancedDeathReports(attacker)));\r
                                        } else {\r
                                                if((cvar("sv_fragmessage_information_typefrag")) && (targ.BUTTON_CHAT)) {\r
-                                                       centerprint(attacker, strcat(DAMAGE_CENTERPRINT_SPACER, blood_message, "^1You typeate ^7", s, GetAdvancedDeathReports(targ)));\r
-                                                       centerprint(targ, strcat(DAMAGE_CENTERPRINT_SPACER, victim_message, "^1You were typeeaten by ^7", a, GetAdvancedDeathReports(attacker)));\r
+                                                       centerprint(attacker, strcat(DAMAGE_CENTERPRINT_SPACER, blood_message, "^1You type-ate ^7", s, GetAdvancedDeathReports(targ)));\r
+                                                       centerprint(targ, strcat(DAMAGE_CENTERPRINT_SPACER, victim_message, "^1You were type-eaten by ^7", a, GetAdvancedDeathReports(attacker)));\r
                                                } else {\r
                                                        centerprint(attacker, strcat(DAMAGE_CENTERPRINT_SPACER, blood_message, "^4You ate ^7", s, GetAdvancedDeathReports(targ)));\r
                                                        centerprint(targ, strcat(DAMAGE_CENTERPRINT_SPACER, victim_message, "^1You were eaten by ^7", a, GetAdvancedDeathReports(attacker)));\r
                                                }\r
-                                               attacker.taunt_soundtime = time + 1;\r
+                                               SetAutoTaunt(attacker, time + 1, TAUNTTYPE_DEATH);\r
                                        }\r
                                }\r
                                else\r
@@ -383,13 +392,13 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                                centerprint(targ, strcat(DAMAGE_CENTERPRINT_SPACER, a,"^1 scored against you ^7", GetAdvancedDeathReports(attacker)));\r
                                        } else {\r
                                                if((cvar("sv_fragmessage_information_typefrag")) && (targ.BUTTON_CHAT)) {\r
-                                                       centerprint(attacker, strcat(DAMAGE_CENTERPRINT_SPACER, blood_message, "^1You typefragged ^7", s, GetAdvancedDeathReports(targ)));\r
-                                                       centerprint(targ, strcat(DAMAGE_CENTERPRINT_SPACER, victim_message, "^1You were typefragged by ^7", a, GetAdvancedDeathReports(attacker)));\r
+                                                       centerprint(attacker, strcat(DAMAGE_CENTERPRINT_SPACER, blood_message, "^1You type-ate ^7", s, GetAdvancedDeathReports(targ)));\r
+                                                       centerprint(targ, strcat(DAMAGE_CENTERPRINT_SPACER, victim_message, "^1You were type-eaten by ^7", a, GetAdvancedDeathReports(attacker)));\r
                                                } else {\r
                                                        centerprint(attacker, strcat(DAMAGE_CENTERPRINT_SPACER, blood_message, "^4You killed ^7", s, GetAdvancedDeathReports(targ)));\r
                                                        centerprint(targ, strcat(DAMAGE_CENTERPRINT_SPACER, victim_message, "^1You were killed by ^7", a, GetAdvancedDeathReports(attacker)));\r
                                                }\r
-                                               attacker.taunt_soundtime = time + 1;\r
+                                               SetAutoTaunt(attacker, time + 1, TAUNTTYPE_DEATH);\r
                                        }\r
                                }\r
 \r
@@ -456,6 +465,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
@@ -471,7 +482,12 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                        GiveFrags(attacker, targ, 0); // for logging\r
                                }\r
                                else\r
-                                       GiveFrags(attacker, targ, 1);\r
+                               {\r
+                                       if(cvar("g_vore_reversescoring") && deathtype == DEATH_DIGESTION) // reversed vore scoring\r
+                                               GiveFrags(targ, attacker, 1);\r
+                                       else\r
+                                               GiveFrags(attacker, targ, 1);\r
+                               }\r
 \r
                                if (targ.killcount > 2) {\r
                                        if(sv_gentle)\r
@@ -681,6 +697,18 @@ 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
+               {\r
+                       entity e;\r
+                       FOR_EACH_PLAYER(e)\r
+                       {\r
+                               if(e.predator != world && e.predator == targ)\r
+                               if(random() < cvar("g_balance_vore_escapeprobability") * damage)\r
+                                       Vore_Regurgitate(e);\r
+                       }\r
+               }\r
+\r
                // nullify damage if teamplay is on\r
                if(deathtype != DEATH_TELEFRAG)\r
                if(attacker.classname == "player")\r
@@ -836,6 +864,19 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                }\r
                        }\r
                }\r
+\r
+               // lean the player based on the amount of damage taken\r
+               if(cvar("g_leanplayer_damage"))\r
+               {\r
+                       if(hitloc != targ.origin) // prevents a bug\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