}\r
\r
// position the camera properly for prey\r
-void Vore_SetCamera()\r
+void Vore_SetPreyPositions()\r
{\r
- if not(self.stat_eaten)\r
- return;\r
+ // self is the predator and head is the prey\r
\r
- self.view_ofs = PL_PREY_VIEW_OFS;\r
+ local entity head;\r
+ local vector origin_apply;\r
+ local float position_counter;\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
+ // 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 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 may be in the stomach at a time!\r
+ FOR_EACH_PLAYER(head)\r
+ {\r
+ if(head.predator == self)\r
+ {\r
+ switch(position_counter)\r
+ {\r
+ case 0:\r
+ origin_apply = '0 0 0'; // first occupant sits in the middle\r
+ break;\r
+ case 1:\r
+ origin_apply = '1 0 0'; // second occupant sits in the front\r
+ break;\r
+ case 2:\r
+ origin_apply = '-1 0 0'; // third occupant sits in the back\r
+ break;\r
+ case 3:\r
+ origin_apply = '0 1 0'; // fourth occupant sits in the right\r
+ break;\r
+ case 4:\r
+ origin_apply = '0 -1 0'; // fifth occupant sits in the left\r
+ break;\r
+ case 5:\r
+ origin_apply = '1 1 0'; // sixth occupant sits in the front-right\r
+ break;\r
+ case 6:\r
+ origin_apply = '-1 1 0'; // seventh occupant sits in the back-right\r
+ break;\r
+ case 7:\r
+ origin_apply = '1 -1 0'; // eigth occupant sits in the front-left\r
+ break;\r
+ case 8:\r
+ origin_apply = '-1 -1 0'; // ninth occupant sits in the back-left\r
+ break;\r
+ 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
+ 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
\r
.float gurgle_oldstomachload;\r
{\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(cvar("g_balance_vore_digestion_vampire") && self.predator.health < cvar("g_balance_vore_digestion_vampire_stable"))\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
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
// Code that addresses the prey:\r
// --------------------------------\r
\r
- Vore_SetCamera();\r
+ Vore_SetPreyPositions();\r
\r
// keepdeadprey - detach dead prey if their predator died or got swallowed\r
if(self.fakeprey)\r