]> git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/g_damage.qc
Remove player model leaning from the code. It's too buggy, problematic, and not done...
[voretournament/voretournament.git] / data / qcsrc / server / g_damage.qc
index 9c7bce0a8b71186391c02e97fae3c58d4eeef0f4..1c7a4b2ebbe1c62b56c69b246fa324b24a0898e4 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
@@ -373,8 +382,9 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                                        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
+                                       portrait(attacker, targ);\r
                                }\r
                                else\r
                                {\r
@@ -389,8 +399,9 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                                        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
+                                       portrait(attacker, targ);\r
                                }\r
 \r
                                if(sv_gentle) {\r
@@ -456,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
@@ -622,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
@@ -686,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
@@ -709,7 +730,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                                {\r
                                                        teamdamage0 = max(attacker.dmg_team, cvar("g_teamdamage_threshold"));\r
                                                        attacker.dmg_team = attacker.dmg_team + damage;\r
-                                                       if(attacker.dmg_team > teamdamage0 && !g_ca)\r
+                                                       if(attacker.dmg_team > teamdamage0 && !g_ca && deathtype != DEATH_REGURGITATION)\r
                                                                mirrordamage = cvar("g_mirrordamage") * (attacker.dmg_team - teamdamage0);\r
                                                        mirrorforce = cvar("g_mirrordamage") * vlen(force);\r
                                                        if(g_ca)\r
@@ -777,6 +798,17 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        force = force * cvar("g_ctf_flagcarrier_selfforce");\r
                }\r
 \r
+               // skill-based damage offset for bots\r
+               if(skill && cvar("skill_offset"))\r
+               {\r
+                       float ofs;\r
+                       ofs = pow(skill / cvar("skill_offset_center"), cvar("skill_offset"));\r
+                       if(clienttype(attacker) == CLIENTTYPE_BOT)\r
+                               damage *= ofs;\r
+                       if(clienttype(targ) == CLIENTTYPE_BOT)\r
+                               damage /= ofs;\r
+               }\r
+\r
                // count the damage\r
                if(attacker)\r
                if(!targ.deadflag)\r
@@ -828,7 +860,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                                }\r
                                        }\r
                                }\r
-                               else\r
+                               else if(deathtype != DEATH_REGURGITATION)\r
                                {\r
                                        if(deathtype != DEATH_FIRE)\r
                                                attacker.typehitsound += 1;\r
@@ -837,6 +869,7 @@ 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