1 .float regurgitate_prepare;
\r
2 .float swallow_delay, digest_button_delay, regurgitate_button_delay;
\r
3 .float complain_swallow;
\r
4 const float complain_delay = 1;
\r
5 const float button_delay = 0.5;
\r
7 .float vore_oldmovetype, vore_oldsolid, vore_oldstomachload;
\r
9 entity Swallow_distance_check()
\r
11 // check if we can swallow a player instead of firing our weapon
\r
12 vector w_shotorg, w_shotdir;
\r
13 w_shotorg = self.origin + self.view_ofs;
\r
14 w_shotdir = v_forward;
\r
16 WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_vore_swallow_range"), FALSE, self, ANTILAG_LATENCY(self));
\r
17 if(trace_fraction < 1)
\r
18 if(trace_ent.classname == "player")
\r
23 float Swallow_condition_check(entity prey)
\r
25 // checks the necessary conditions for swallowing another player
\r
26 if(prey.classname == "player" && prey.eater.classname != "player" && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach
\r
27 if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_velocitylimit"))
\r
28 if(self.eater.classname != "player") // we can't swallow players while inside someone's stomach ourselves
\r
30 if(self.stomach_load >= cvar("g_balance_vore_swallow_limit"))
\r
32 if(time > self.complain_swallow)
\r
34 play2(self, "weapons/unavailable.wav");
\r
35 sprint(self, strcat("You cannot swallow more than ^2", cvar_string("g_balance_vore_swallow_limit"), "^7 players at a time\n"));
\r
36 self.complain_swallow = time + complain_delay;
\r
41 if(cvar("g_vore_biggergut"))
\r
42 if(prey.stomach_load > self.stomach_load)
\r
44 if(time > self.complain_swallow)
\r
46 play2(self, "weapons/unavailable.wav");
\r
47 sprint(self, "You cannot swallow someone with a bigger stomach than yours\n");
\r
48 self.complain_swallow = time + complain_delay;
\r
57 void Vore_Weight_apply(entity e)
\r
59 // apply stomach weight that makes you heavier the more you eat
\r
60 // slowing the player is applied in cl_physics.qc
\r
61 if(e.stomach_load != e.vore_oldstomachload)
\r
62 e.gravity += 1 + (e.stomach_load * cvar("g_balance_vore_weight_gravity") - e.vore_oldstomachload);
\r
64 e.gravity = 0.00001; // 0 becomes 1 for .gravity, so do this to allow 0 gravity
\r
65 e.vore_oldstomachload = e.stomach_load;
\r
68 void Vore_Swallow(entity e)
\r
70 // this player is beening swallowed by another player, apply the proper changes
\r
71 e.vore_oldmovetype = e.movetype;
\r
72 e.vore_oldsolid = e.solid;
\r
74 setorigin(e, e.eater.origin);
\r
75 e.velocity = '0 0 0';
\r
76 e.movetype = MOVETYPE_FOLLOW;
\r
77 e.solid = SOLID_NOT;
\r
78 e.alpha = -1; // best way of hiding / showing the eaten player
\r
79 e.aiment = e.eater; // follow the predator. Is automatically unset
\r
80 e.view_ofs_z /= 2; // best positioning for the stomach model
\r
81 e.stat_eaten = TRUE;
\r
83 // drop keys (KH) and flags (CTF) when we get swallowed
\r
84 kh_Key_DropAll(e, FALSE);
\r
86 DropFlag(e.flagcarried, world, e.eater);
\r
88 if(stov(cvar_string("g_vore_regurgitatecolor_released")))
\r
89 e.colormod = stov(cvar_string("g_vore_regurgitatecolor_released"));
\r
91 PlayerSound(e.eater, playersound_swallow, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
\r
92 setanim(e.eater, e.eater.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing \ regurgitating
\r
93 e.eater.stomach_load += 1;
\r
94 e.eater.regurgitate_prepare = 0;
\r
95 Vore_Weight_apply(e.eater);
\r
98 void Vore_Regurgitate(entity e)
\r
100 // this player is being released from their predator, apply the proper changes
\r
101 e.movetype = e.vore_oldmovetype;
\r
102 if(e.health > 0) // leave SOLID_NOT for dead bodies
\r
103 e.solid = e.vore_oldsolid;
\r
104 e.alpha = 0; // best way of hiding / showing the eaten player
\r
105 e.view_ofs_z *= 2; // best positioning for the stomach model
\r
106 e.stat_eaten = FALSE;
\r
108 PlayerSound(e.eater, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
\r
109 setanim(e.eater, e.eater.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing \ regurgitating
\r
110 pointparticles(particleeffectnum("regurgitate"), e.eater.origin, '0 0 0', 1);
\r
111 e.eater.stomach_load -= 1;
\r
112 e.eater.regurgitate_prepare = 0;
\r
113 Vore_Weight_apply(e.eater);
\r
117 void Vore_Disconnect()
\r
119 // frees prey from their predators when someone disconnects or goes spectating
\r
121 // prey disconnects or goes spectating while inside someone's belly:
\r
122 if(self.eater.classname == "player")
\r
124 self.view_ofs_z += 25;
\r
125 self.stat_eaten = FALSE;
\r
126 self.eater.stomach_load -= 1;
\r
127 Vore_Weight_apply(self.eater);
\r
128 self.eater = world;
\r
131 // pred disconnects or goes spectating with players in their belly:
\r
132 else if(self.stomach_load > 0)
\r
135 FOR_EACH_PLAYER(head)
\r
137 if(head.eater == self)
\r
138 Vore_Regurgitate(head);
\r
143 .float digestion_step;
\r
146 // apply digestion to prey
\r
147 if(time > self.eater.digestion_step + 0.1)
\r
149 Damage(self, self.eater, self.eater, cvar("g_balance_vore_digestion_damage"), DEATH_DIGESTION, self.origin, '0 0 0');
\r
150 if(cvar("g_balance_vore_digestion_vampire") && self.eater.health < cvar("g_balance_vore_digestion_vampire_stable"))
\r
151 self.eater.health += cvar("g_balance_vore_digestion_vampire");
\r
153 if (self.eater.digestsound_finished < time)
\r
155 self.eater.digestsound_finished = time + 0.5;
\r
156 sound (self.eater, CHAN_PLAYER, "player/digest.wav", VOL_BASE, ATTN_NORM);
\r
158 self.eater.digestion_step = time;
\r
161 if(self.health <= 0)
\r
162 if(stov(cvar_string("g_vore_regurgitatecolor_digested")))
\r
163 self.colormod = stov(cvar_string("g_vore_regurgitatecolor_digested"));
\r
166 .float stomachkick_delay;
\r
167 void Vore_StomachKick()
\r
169 // allows prey to kick the predator's stomach and do some damage, or bring the predator's digestion upon their self when there's no other option
\r
170 if(self.eater.classname != "player")
\r
173 // kick the predator's stomach and do damage
\r
174 if(self.BUTTON_ATCK)
\r
175 if(time > self.stomachkick_delay)
\r
178 damage = ceil(random() * (cvar("g_balance_vore_kick_damage_max") - cvar("g_balance_vore_kick_damage_min")) + cvar("g_balance_vore_kick_damage_min"));
\r
180 Damage(self.eater, self, self, damage, DEATH_STOMACHKICK, self.eater.origin, '0 0 0');
\r
181 sound(self.eater, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM);
\r
182 self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay");
\r
185 // start the predator's digestion
\r
186 if(self.BUTTON_ATCK2)
\r
188 centerprint(self.eater, strcat(self.netname, " triggered your digestion"));
\r
189 self.eater.digesting = TRUE;
\r
195 // skip the vore system under some circumstances
\r
196 if(time < game_starttime)
\r
201 if(self.spectatee_status)
\r
204 // --------------------------------
\r
205 // Code that addresses predators:
\r
206 // --------------------------------
\r
209 prey = Swallow_distance_check();
\r
211 // attempt to swallow our new prey if there's any in range
\r
212 if(self.BUTTON_ATCK && !self.BUTTON_REGURGITATE && self.swallow_delay < time)
\r
213 if(Swallow_condition_check(prey))
\r
216 Vore_Swallow(prey);
\r
217 self.swallow_delay = time + cvar("g_balance_vore_swallow_delay");
\r
219 if(self.team == prey.team && teamplay)
\r
220 centerprint(self, "You have swallowed a team mate, use caution!");
\r
222 // block firing for a small amount of time when voring, or we'll be firing the next frame after we swallow
\r
223 self.weapon_delay = time + 0.25;
\r
226 // start / stop digestion on command, if the player has someone in their stomach
\r
227 if(self.BUTTON_DIGEST)
\r
229 if(self.stomach_load)
\r
231 if(time > self.digest_button_delay)
\r
233 self.digesting = !self.digesting;
\r
234 self.digest_button_delay = time + button_delay;
\r
237 else if(time > self.complain_swallow)
\r
239 play2(self, "weapons/unavailable.wav");
\r
240 sprint(self, "There is nothing to digest\n");
\r
241 self.complain_swallow = time + complain_delay;
\r
244 if(!self.stomach_load)
\r
245 self.digesting = FALSE;
\r
247 // release players from this player's stomach on command
\r
248 if(self.BUTTON_REGURGITATE)
\r
250 if(self.stomach_load)
\r
252 if(time > self.regurgitate_button_delay)
\r
254 self.regurgitate_prepare = time + cvar("g_balance_vore_regurgitate_delay");
\r
255 PlayerSound(self, playersound_regurgitate_prepare, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
\r
256 self.regurgitate_button_delay = time + button_delay;
\r
259 else if(time > self.complain_swallow)
\r
261 play2(self, "weapons/unavailable.wav");
\r
262 sprint(self, "There is nothing to regurgitate\n");
\r
263 self.complain_swallow = time + complain_delay;
\r
267 // --------------------------------
\r
268 // Code that addresses the prey:
\r
269 // --------------------------------
\r
271 if(self.eater.classname != "player")
\r
274 if(self.eater.deadflag || self.deadflag)
\r
275 Vore_Regurgitate(self);
\r
276 else if(self.eater.eater.classname == "player") // don't allow a player inside a player inside another player :)
\r
277 Vore_Regurgitate(self);
\r
278 else if(vlen(self.eater.velocity) > cvar("g_balance_vore_regurgitate_velocitylimit"))
\r
279 Vore_Regurgitate(self);
\r
281 // apply delayed regurgitating
\r
282 if(self.eater.regurgitate_prepare && time > self.eater.regurgitate_prepare)
\r
284 self.eater.regurgitate_prepare = 0;
\r
285 self.eater.complain_swallow = time + complain_delay;
\r
286 Vore_Regurgitate(self);
\r
289 if(self.eater.digesting == TRUE)
\r
292 Vore_StomachKick();
\r