]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
Limit g_balance_vore_swallow_limit between 1 and 9. This fixes some small bugs, such...
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index e95332a50e9652f27ae28e8edd2effecd589505a..0b0e01cd115677bd1d5fa31959204123b95d9f1c 100644 (file)
@@ -43,8 +43,8 @@ float Swallow_condition_check(entity prey)
                        swallow_complain = "You cannot swallow your team mates\n";\r
                else if(!cvar("g_vore_spawnshield") && prey.spawnshieldtime > time)\r
                        swallow_complain = "You cannot swallow someone protected by the spawn shield\n";\r
-               else if(self.stomach_load >= cvar("g_balance_vore_swallow_limit"))\r
-                       swallow_complain = strcat("You cannot swallow more than ^2", cvar_string("g_balance_vore_swallow_limit"), "^7 players at a time\n");\r
+               else if(self.stomach_load >= g_balance_vore_swallow_limit)\r
+                       swallow_complain = strcat("You cannot swallow more than ^2", ftos(g_balance_vore_swallow_limit), "^7 players at a time\n");\r
                else if(cvar("g_vore_biggergut") && prey.stomach_load > self.stomach_load)\r
                        swallow_complain = "You cannot swallow someone with a bigger stomach than yours\n";\r
                else if(cvar("g_vore_biggersize") && prey.scale > self.scale)\r
@@ -98,20 +98,16 @@ float Vore_CanLeave()
 // position the camera properly for prey\r
 void Vore_SetPreyPositions()\r
 {\r
+       // self is the predator and head is the prey\r
+\r
        local entity head;\r
-       local vector oldforward, oldright, oldup;\r
-       local float position_counter;\r
        local vector origin_apply;\r
-       oldforward = v_forward;\r
-       oldright = v_right;\r
-       oldup = v_up;\r
-\r
-       makevectors(self.v_angle);\r
+       local float position_counter;\r
 \r
        // In order to allow prey to see each other in the stomach, we must position each occupant differently,\r
-       // else all players would overlap in the center. To do this, we run a loop on all players in the same stomach.\r
+       // else all players overlap in the center. To do this, we run a loop on all players in the same stomach.\r
        // For each player, the origin is updated, then a new origin is used for the next player.\r
-       // This requires that no more than 9 players can be in a stomach at a time!\r
+       // This requires that no more than 9 players may be in the stomach at a time!\r
        FOR_EACH_PLAYER(head)\r
        {\r
                if(head.predator == self)\r
@@ -148,24 +144,19 @@ void Vore_SetPreyPositions()
                                default:\r
                                        break;\r
                        }\r
+\r
                        // since prey have their predators set as an aiment, view_ofs will specify the real origin of prey, not just the view offset\r
-                       origin_apply_x *= v_forward_x; // position depends on the predator's rotation\r
-                       origin_apply_y *= v_forward_y; // position depends on the predator's rotation\r
                        head.view_ofs = PL_PREY_VIEW_OFS + origin_apply * cvar("g_vore_neighborprey_distance");\r
+                       head.view_ofs_z *= self.scale; // stomach center depends on predator scale\r
+\r
+                       // change prey height based on scale\r
+                       float prey_height;\r
+                               prey_height = (head.scale - self.scale) * cvar("g_healthsize_vore_pos");\r
+                       head.view_ofs_z += prey_height;\r
+\r
                        position_counter += 1;\r
                }\r
        }\r
-\r
-       v_forward = oldforward;\r
-       v_right = oldright;\r
-       v_up = oldup;\r
-\r
-       /*float prey_height;\r
-       if(self.fakeprey)\r
-               prey_height = (self.scale - self.fakepredator.scale) * cvar("g_healthsize_vore_pos");\r
-       else\r
-               prey_height = (self.scale - self.predator.scale) * cvar("g_healthsize_vore_pos");\r
-       self.view_ofs_z += prey_height;*/\r
 }\r
 \r
 .float gurgle_oldstomachload;\r
@@ -378,18 +369,25 @@ void Vore_Digest()
 {\r
        // apply digestion to prey\r
 \r
-       if(time > self.predator.digestion_step)\r
+       if(time > self.digestion_step)\r
        {\r
-               Damage(self, self.predator, self.predator, cvar("g_balance_vore_digestion_damage"), DEATH_DIGESTION, self.origin, '0 0 0');\r
+               // if distributed digestion is enabled, reduce digestion strength by the number of prey in our stomach\r
+               float reduce;\r
+               if(cvar("g_balance_vore_digestion_distribute"))\r
+                       reduce = self.predator.stomach_load;\r
+               else\r
+                       reduce = 1;\r
+\r
+               Damage(self, self.predator, self.predator, cvar("g_balance_vore_digestion_damage") / reduce, DEATH_DIGESTION, self.origin, '0 0 0');\r
                if(cvar("g_balance_vore_digestion_vampire") && self.predator.health < cvar("g_balance_vore_digestion_vampire_stable"))\r
-                       self.predator.health += cvar("g_balance_vore_digestion_vampire");\r
+                       self.predator.health += cvar("g_balance_vore_digestion_vampire") / reduce;\r
 \r
                if (self.predator.digestsound_finished < time)\r
                {\r
                        PlayerSound (self.predator, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);\r
                        self.predator.digestsound_finished = time + 0.5;\r
                }\r
-               self.predator.digestion_step = time + steptime;\r
+               self.digestion_step = time + steptime;\r
        }\r
 \r
        if(self.deadflag != DEAD_NO)\r
@@ -431,9 +429,6 @@ void Vore_StomachKick()
                self.predator.punchangle_x -= cvar("g_balance_vore_kick_predator_punchangle");\r
                self.punchangle_x += cvar("g_balance_vore_kick_prey_punchangle");\r
 \r
-               if(random() < cvar("g_balance_vore_kick_escapeprobability"))\r
-                       Vore_Regurgitate(self);\r
-\r
                self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay");\r
        }\r
 }\r