]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
Tilted view when receiving stomach kicks
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index ae7a55f27207965449f495499dab00b294856501..e5452e6a739c3775376955e8438afe1241da7d68 100644 (file)
@@ -72,6 +72,22 @@ float Swallow_condition_check(entity prey)
        return FALSE;\r
 }\r
 \r
+float Stomach_TeamMates_check(entity pred)\r
+{\r
+       // checks if a player's stomach contains any team mates\r
+\r
+       entity head;\r
+       if(teams_matter)\r
+       {\r
+               FOR_EACH_PLAYER(head)\r
+               {\r
+                       if(head.predator == pred && head.team == pred.team)\r
+                               return TRUE;\r
+               }\r
+       }\r
+       return FALSE;\r
+}\r
+\r
 float Vore_CanLeave()\r
 {\r
        if(self.predator.classname == "player")\r
@@ -144,23 +160,14 @@ void Vore_AutoDigest(entity e)
 {\r
        // if the predator has the autodigest preference enabled, begin digesting new prey automatically\r
 \r
-       if not(cvar("g_vore_digestion"))\r
-               return;\r
-       if not(e.cvar_cl_vore_autodigest)\r
+       if(!cvar("g_vore_digestion") || e.digesting)\r
                return;\r
-       if(clienttype(e) != CLIENTTYPE_REAL)\r
-               return; // this feature is only for players\r
-\r
-       entity head;\r
-       if(teams_matter)\r
-       {\r
-               FOR_EACH_PLAYER(head)\r
-               {\r
-                       // never begin automatic digestion if we've swallowed a team mate\r
-                       if(head.team == e.team)\r
-                               return;\r
-               }\r
-       }\r
+       if(!e.cvar_cl_vore_autodigest || clienttype(e) != CLIENTTYPE_REAL)\r
+               return; // this feature is only for players, not bots\r
+       if(e.stomach_load > 1)\r
+               return; // don't start digestion if we already ate someone, as that means we manually disabled it after the first prey and want it off\r
+       if(Stomach_TeamMates_check(e))\r
+               return; // never begin automatic digestion if we've swallowed a team mate\r
 \r
        e.digesting = TRUE;\r
 }\r
@@ -381,6 +388,7 @@ void Vore_StomachKick()
                damage = ceil(random() * (cvar("g_balance_vore_kick_damage_max") - cvar("g_balance_vore_kick_damage_min")) + cvar("g_balance_vore_kick_damage_min"));\r
                Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, v_forward * cvar("g_balance_vore_kick_force"));\r
                sound(self.predator, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM);\r
+               self.predator.punchangle_x -= self.predator.cvar_cl_vore_kick_punchangle;\r
 \r
                if(random() < cvar("g_balance_vore_kick_escapeprobability"))\r
                        Vore_Regurgitate(self);\r
@@ -403,6 +411,43 @@ void Vore_StomachLeave()
        }\r
 }\r
 \r
+void Vore_AutoTaunt()\r
+{\r
+       // triggers ambient vore taunts, for both pred and prey\r
+\r
+       float taunt_time;\r
+\r
+       // predator taunts\r
+       if(self.stomach_load && !Stomach_TeamMates_check(self))\r
+       {\r
+               if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played\r
+               {\r
+                       taunt_time = random() * (cvar("sv_vore_autotaunt_repeat_max") - cvar("sv_vore_autotaunt_repeat_min")) + cvar("sv_vore_autotaunt_repeat_min");\r
+                       SetAutoTaunt(self, time + taunt_time, TAUNTTYPE_VOREPRED);\r
+               }\r
+       }\r
+       else if(self.taunt_soundtype == TAUNTTYPE_VOREPRED)\r
+       {\r
+               // we have a predator taunt scheduled, but are no longer a (suitable) predator, so remove it\r
+               SetAutoTaunt(self, 0, 0);\r
+       }\r
+\r
+       // prey taunts\r
+       if(self.predator.classname == "player" && !(teams_matter && self.team == self.predator.team))\r
+       {\r
+               if(!self.taunt_soundtime) // taunt_soundtime becomes 0 once the taunt has played\r
+               {\r
+                       taunt_time = random() * (cvar("sv_vore_autotaunt_repeat_max") - cvar("sv_vore_autotaunt_repeat_min")) + cvar("sv_vore_autotaunt_repeat_min");\r
+                       SetAutoTaunt(self, time + taunt_time, TAUNTTYPE_VOREPREY);\r
+               }\r
+       }\r
+       else if(self.taunt_soundtype == TAUNTTYPE_VOREPREY)\r
+       {\r
+               // we have a prey taunt scheduled, but are no longer a (suitable) prey, so remove it\r
+               SetAutoTaunt(self, 0, 0);\r
+       }\r
+}\r
+\r
 void Vore()\r
 {\r
        // main vore code, this is where it all happens\r
@@ -413,6 +458,8 @@ void Vore()
                return;\r
        }\r
 \r
+       Vore_AutoTaunt();\r
+\r
        // wash the goo away from players once they leave the stomach\r
        if(self.predator.classname != "player")\r
        if(stov(cvar_string("g_vore_regurgitatecolor_release")))\r
@@ -488,9 +535,18 @@ void Vore()
        prey = Swallow_player_check();\r
 \r
        // attempt to swallow our new prey if we pressed the attack button, and there's any in range\r
-       if(self.BUTTON_ATCK)\r
+       self.stat_canswallow = 0;\r
        if(Swallow_condition_check(prey))\r
-               Vore_Swallow(prey);\r
+       {\r
+               // canswallow stat, used by the HUD\r
+               if(teams_matter && prey.team == self.team)\r
+                       self.stat_canswallow = 2;\r
+               else\r
+                       self.stat_canswallow = 1;\r
+\r
+               if(self.BUTTON_ATCK)\r
+                       Vore_Swallow(prey);\r
+       }\r
 \r
        // toggle digestion, if the player has someone in their stomach\r
        if(self.BUTTON_DIGEST && cvar("g_vore_digestion"))\r