if(prey.classname == "player" && !prey.stat_eaten && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach\r
if(self.classname == "player" && !self.stat_eaten && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves\r
if(!self.BUTTON_REGURGITATE && time > self.action_delay)\r
- if not(cvar("g_balance_vore_load_pred_speedcap") && vlen(self.velocity) > cvar("g_balance_vore_load_pred_speedcap") / (self.stomach_maxload / self.stomach_load))\r
{\r
+ float prey_mass;\r
+ prey_mass = cvar("g_balance_vore_load_prey_mass");\r
+ if(cvar("g_healthsize"))\r
+ prey_mass *= prey.scale;\r
+\r
string swallow_complain;\r
if(teams_matter && prey.team == self.team && !cvar("g_vore_teamvore"))\r
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 >= self.stomach_maxload)\r
- swallow_complain = "You do not have any more room to swallow this player.\n";\r
+ else if(self.stomach_load + prey_mass > self.stomach_maxload)\r
+ swallow_complain = strcat("You don't have any room to swallow this player. Their mass is ^3", ftos(prey_mass), "^7 and your remaining capacity is ^3", ftos(self.stomach_maxload - self.stomach_load), "\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
}\r
\r
// position the camera properly for prey\r
-void Vore_SetPreyPositions()\r
+void Vore_SetPreyPositions(entity pred)\r
{\r
- // self is the predator and head is the prey\r
+ // pred is the predator and head is the prey\r
\r
local entity head;\r
local vector origin_apply;\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 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
+ // else all players overlap in the center. To do this, we use a random origin on all players in the same stomach.\r
FOR_EACH_PLAYER(head)\r
{\r
- if(head.predator == self)\r
+ if(head.predator == pred)\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
+ 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;\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
+ head.view_ofs = origin_apply;\r
+ head.view_ofs_z *= pred.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
+ prey_height = (head.scale - pred.scale) * cvar("g_healthsize_vore_pos");\r
head.view_ofs_z += prey_height;\r
-\r
- position_counter += 1;\r
}\r
}\r
}\r
// slowing the player is done in cl_physics.qc\r
\r
entity e;\r
- float vore_mass;\r
+ float prey_mass;\r
+\r
+ // apply the stomach capacity of the predator\r
+ self.stomach_maxload = cvar("g_balance_vore_load_pred_capacity");\r
+ if(cvar("g_healthsize"))\r
+ self.stomach_maxload *= self.scale;\r
+ self.stomach_maxload = floor(self.stomach_maxload);\r
\r
self.stomach_load = 0; // start from zero\r
FOR_EACH_PLAYER(e)\r
{\r
- if(e.predator == self && e.classname == "player")\r
+ if(e.predator == self)\r
{\r
- vore_mass = cvar("g_balance_vore_load_prey_mass");\r
+ prey_mass = cvar("g_balance_vore_load_prey_mass");\r
if(cvar("g_healthsize"))\r
- vore_mass *= e.scale;\r
- self.stomach_load += floor(vore_mass);\r
+ prey_mass *= e.scale;\r
+ self.stomach_load += floor(prey_mass);\r
}\r
}\r
\r
- // apply the stomach capacity of the predator\r
- self.stomach_maxload = cvar("g_balance_vore_load_pred_capacity");\r
- if(cvar("g_healthsize"))\r
- self.stomach_maxload *= self.scale;\r
- self.stomach_maxload = floor(self.stomach_maxload);\r
-\r
// apply weight\r
self.gravity = 1 + (self.stomach_load / self.stomach_maxload) * cvar("g_balance_vore_load_pred_weight");\r
if(!self.gravity && self.stomach_load)\r
e.predator.spawnshieldtime = 0; // lose spawn shield when we vore\r
e.predator.hitsound += 1; // play this for team mates too, as we could be swallowing them to heal them\r
Vore_AutoDigest(e.predator);\r
+ Vore_SetPreyPositions(e.predator);\r
\r
// block firing for a small amount of time, or we'll be firing the next frame after we swallow\r
e.predator.weapon_delay = time + button_delay_time;\r
e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_punchangle");\r
e.predator.regurgitate_prepare = 0;\r
e.predator.action_delay = time + cvar("g_balance_vore_action_delay");\r
+ Vore_SetPreyPositions(e.predator);\r
\r
// block firing for a small amount of time, or we'll be firing the next frame\r
e.weapon_delay = time + button_delay_time;\r
// this entity is like e.predator but for dead prey, to avoid conflicts\r
e.fakepredator = e.predator;\r
e.fakeprey = TRUE;\r
+ Vore_SetPreyPositions(e.predator);\r
\r
// first release the prey from the predator, as dead prey needs to be attached differently\r
// the predator's stomach load is also decreased, as dead prey doesn't count any more\r
{\r
// if distributed digestion is enabled, reduce digestion strength by the amount of prey in our stomach\r
float vore_offset;\r
- if(cvar("g_balance_vore_digestion_distribute"))\r
- vore_offset = self.predator.stomach_maxload / self.predator.stomach_load;\r
- else\r
- vore_offset = 1;\r
+ vore_offset = 1;\r
+ if(cvar("g_balance_vore_digestion_distribute")) // apply distributed digestion damage\r
+ vore_offset *= self.predator.stomach_load / self.predator.stomach_maxload;\r
+ if(cvar("g_healthsize") && cvar("g_balance_vore_digestion_scalediff")) // apply player scale to digestion damage\r
+ vore_offset *= pow(self.scale / self.predator.scale, cvar("g_balance_vore_digestion_scalediff"));\r
+ vore_offset = ceil(vore_offset);\r
\r
float damage;\r
damage = cvar("g_balance_vore_digestion_damage") / vore_offset;\r
\r
- // apply player scale to digestion damage\r
- if(cvar("g_healthsize") && cvar("g_balance_vore_digestion_scalediff"))\r
- damage *= pow(self.predator.scale / self.scale, cvar("g_balance_vore_digestion_scalediff"));\r
-\r
Damage(self, self.predator, self.predator, 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
self.predator.health += cvar("g_balance_vore_digestion_vampire") / vore_offset;\r
}\r
}\r
\r
+.float regurgitatecolor_particles_tick;\r
void Vore()\r
{\r
// main vore code, this is where it all happens\r
if(!self.stat_eaten)\r
if(stov(cvar_string("g_vore_regurgitatecolor_release")))\r
if(self.colormod)\r
- if(cvar("g_vore_regurgitatecolor_release_fade"))\r
+ if(self.colormod != '1 1 1')\r
{\r
- self.colormod_x += cvar("g_vore_regurgitatecolor_release_fade") * frametime;\r
- if(self.colormod_x > 1)\r
- self.colormod_x = 1;\r
- self.colormod_y += cvar("g_vore_regurgitatecolor_release_fade") * frametime;\r
- if(self.colormod_y > 1)\r
- self.colormod_y = 1;\r
- self.colormod_z += cvar("g_vore_regurgitatecolor_release_fade") * frametime;\r
- if(self.colormod_z > 1)\r
- self.colormod_z = 1;\r
+ if(cvar("g_vore_regurgitatecolor_release_fade"))\r
+ {\r
+ self.colormod_x += cvar("g_vore_regurgitatecolor_release_fade") * frametime;\r
+ if(self.colormod_x > 1)\r
+ self.colormod_x = 1;\r
+ self.colormod_y += cvar("g_vore_regurgitatecolor_release_fade") * frametime;\r
+ if(self.colormod_y > 1)\r
+ self.colormod_y = 1;\r
+ self.colormod_z += cvar("g_vore_regurgitatecolor_release_fade") * frametime;\r
+ if(self.colormod_z > 1)\r
+ self.colormod_z = 1;\r
+ }\r
+\r
+ if(cvar("g_vore_regurgitatecolor_particles"))\r
+ if(self.regurgitatecolor_particles_tick < time)\r
+ {\r
+ pointparticles(particleeffectnum("vore_regurgitate_constant"), self.origin, '0 0 0', 1);\r
+ self.regurgitatecolor_particles_tick = time + cvar("g_vore_regurgitatecolor_particles") * vlen(self.colormod);\r
+ dprint(strcat(ftos(cvar("g_vore_regurgitatecolor_particles") * vlen(self.colormod)), " --------\n"));\r
+ }\r
}\r
\r
// set all vore stats\r
}\r
}\r
\r
+ // set the predator's stomach load and capacity\r
+ Vore_StomachLoad_Apply();\r
+\r
// apply delays and skip the vore system under some circumstances\r
if(!cvar("g_vore")) // the vore system is disabled\r
{\r
entity prey;\r
prey = Swallow_player_check();\r
\r
- // set the predator's stomach load and capacity\r
- Vore_StomachLoad_Apply();\r
-\r
// attempt to swallow our new prey if we pressed the attack button, and there's any in range\r
self.stat_canswallow = 0;\r
if(Swallow_condition_check(prey))\r
// Code that addresses the prey:\r
// --------------------------------\r
\r
- Vore_SetPreyPositions();\r
-\r
- // keepdeadprey - detach dead prey if their predator died or got swallowed\r
- if(self.fakeprey)\r
- if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.stat_eaten)\r
- Vore_DeadPrey_Detach(self);\r
-\r
if(!self.stat_eaten)\r
return;\r
\r
- if(self.deadflag != DEAD_NO)\r
+ if(self.deadflag != DEAD_NO) // we're dead, do what we must\r
{\r
Vore_PreyRelease(self, FALSE);\r
return;\r
}\r
\r
- if(self.predator.deadflag != DEAD_NO)\r
+ if(self.fakeprey) // detach dead prey if their predator died or got eaten\r
+ if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.stat_eaten)\r
+ Vore_DeadPrey_Detach(self);\r
+ if(self.predator.deadflag != DEAD_NO) // do we want to be in a dead furry x_x\r
+ {\r
Vore_Regurgitate(self);\r
- else if(cvar("g_balance_vore_load_pred_speedcap") && vlen(self.predator.velocity) > cvar("g_balance_vore_load_pred_speedcap") / (self.stomach_maxload / self.stomach_load))\r
+ return;\r
+ }\r
+ if(self.predator.stomach_load > self.predator.stomach_maxload) // the predator got beyond his capacity after eating, so some prey must pop out\r
+ {\r
Vore_Regurgitate(self);\r
+ return;\r
+ }\r
+ if(cvar("g_balance_vore_load_pred_speedcap") && vlen(self.predator.velocity) >= cvar("g_balance_vore_load_pred_speedcap") / (self.predator.stomach_load / self.predator.stomach_maxload)) // predator's going too fast, gets sick and throws up\r
+ {\r
+ Vore_Regurgitate(self);\r
+ return;\r
+ }\r
\r
// apply delayed regurgitating if it was scheduled\r
if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare)\r