]> git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/vore.qc
Consumable items now add to stomach load as well
[voretournament/voretournament.git] / data / qcsrc / server / vore.qc
index 9d3079f266bcb67a623119ecc0e385dc6611d03f..22528981ec0f88161868326a7f5f3af0d44b1d4d 100644 (file)
@@ -121,7 +121,6 @@ void Vore_SetPreyPositions(entity pred)
        // pred is the predator and head is the prey\r
 \r
        local entity head;\r
-       local vector origin_apply;\r
 \r
        // In order to allow prey to see each other in the stomach, we must position each occupant differently,\r
        // else all players overlap in the center. To do this, we use a random origin on all players in the same stomach.\r
@@ -129,12 +128,10 @@ void Vore_SetPreyPositions(entity pred)
        {\r
                if(head.predator == pred)\r
                {\r
-                       origin_apply_x = PL_PREY_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance");\r
-                       origin_apply_y = PL_PREY_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance");\r
-                       origin_apply_z = PL_PREY_VIEW_OFS_z * pred.scale;\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
-                       head.view_ofs = origin_apply;\r
+                       head.view_ofs_x = PL_PREY_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance");\r
+                       head.view_ofs_y = PL_PREY_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance");\r
+                       head.view_ofs_z = PL_PREY_VIEW_OFS_z;\r
                }\r
        }\r
 }\r
@@ -155,6 +152,8 @@ void Vore_StomachLoad_Apply()
 {\r
        // apply stomach weight that makes you heavier and larger the more you eat\r
        // slowing the player is done in cl_physics.qc\r
+       if(self.classname != "player")\r
+               return;\r
 \r
        entity e;\r
        float prey_mass;\r
@@ -176,6 +175,11 @@ void Vore_StomachLoad_Apply()
                        self.stomach_load += floor(prey_mass);\r
                }\r
        }\r
+       for(e = world; (e = find(e, classname, "consumable")); )\r
+       {\r
+               if(e.predator == self)\r
+                       self.stomach_load += floor(self.dmg);\r
+       }\r
 \r
        // apply weight\r
        self.gravity = 1 + (self.stomach_load / self.stomach_maxload) * cvar("g_balance_vore_load_pred_weight");\r
@@ -899,4 +903,7 @@ void Vore()
        // Ugly workaround for a Keyhunt issue. Your team's key can still be given to you while in the stomach\r
        // (at round start), which is pretty ugly and wrong. So attempt to drop keys each frame for prey\r
        kh_Key_DropAll(self, FALSE);\r
+\r
+       // always position camera at the center of the stomach, to reduce probability of the view poking out\r
+       self.view_ofs_z = PL_PREY_VIEW_OFS_z * self.predator.scale;\r
 }
\ No newline at end of file