]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
50/50 probability for either a predator or prey to play the taunt, fixing a conflict...
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index 863f8b61c1f9d1775b5ad76d8e5626c2ee4f24df..29f8dbb341c626cf28d2d41beb1ef70f6f5c2a59 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
@@ -150,17 +166,8 @@ void Vore_AutoDigest(entity e)
                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
-\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.predator == e && head.team == e.team)\r
-                               return;\r
-               }\r
-       }\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
@@ -403,6 +410,41 @@ void Vore_StomachLeave()
        }\r
 }\r
 \r
+void Vore_AutoTaunt()\r
+{\r
+       // triggers ambient vore taunts, for both pred and prey\r
+\r
+       // 50/50 probability for either a predator or prey to play the taunt\r
+       if(random() < 0.5)\r
+       {\r
+               // predator taunts\r
+               if(self.stomach_load && !Stomach_TeamMates_check(self))\r
+               {\r
+                       if(!self.taunt_soundtime)\r
+                               SetAutoTaunt(self, time, TRUE, TAUNTTYPE_VOREPRED);\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, FALSE, 0);\r
+               }\r
+       }\r
+       else\r
+       {\r
+               // prey taunts\r
+               if(self.predator.classname == "player" && !(teams_matter && self.team == self.predator.team))\r
+               {\r
+                       if(!self.taunt_soundtime)\r
+                               SetAutoTaunt(self, time, TRUE, TAUNTTYPE_VOREPREY);\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, FALSE, 0);\r
+               }\r
+       }\r
+}\r
+\r
 void Vore()\r
 {\r
        // main vore code, this is where it all happens\r
@@ -413,6 +455,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