1 .float regurgitate_prepare;
\r
2 .float system_delay, 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
6 const float steptime = 0.1;
\r
7 const float system_delay_time = 0.1;
\r
9 .float vore_oldmovetype, vore_oldsolid, vore_oldstomachload;
\r
11 entity Swallow_distance_check()
\r
13 // check if we can swallow a player instead of firing our weapon
\r
14 vector w_shotorg, w_shotdir;
\r
15 w_shotorg = self.origin + self.view_ofs;
\r
16 w_shotdir = v_forward;
\r
18 WarpZone_traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_vore_swallow_range"), FALSE, self, ANTILAG_LATENCY(self));
\r
19 if(trace_fraction < 1)
\r
20 if(trace_ent.classname == "player")
\r
25 float Swallow_condition_check(entity prey)
\r
27 // checks the necessary conditions for swallowing another player
\r
28 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
29 if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_velocitylimit"))
\r
30 if(self.eater.classname != "player") // we can't swallow players while inside someone's stomach ourselves
\r
32 if(self.stomach_load >= cvar("g_balance_vore_swallow_limit"))
\r
34 if(time > self.complain_swallow)
\r
36 play2(self, "weapons/unavailable.wav");
\r
37 sprint(self, strcat("You cannot swallow more than ^2", cvar_string("g_balance_vore_swallow_limit"), "^7 players at a time\n"));
\r
38 self.complain_swallow = time + complain_delay;
\r
43 if(cvar("g_vore_biggergut"))
\r
44 if(prey.stomach_load > self.stomach_load)
\r
46 if(time > self.complain_swallow)
\r
48 play2(self, "weapons/unavailable.wav");
\r
49 sprint(self, "You cannot swallow someone with a bigger stomach than yours\n");
\r
50 self.complain_swallow = time + complain_delay;
\r
59 void Vore_Weight_apply(entity e)
\r
61 // apply stomach weight that makes you heavier the more you eat
\r
62 // slowing the player is applied in cl_physics.qc
\r
63 if(e.stomach_load != e.vore_oldstomachload)
\r
64 e.gravity += 1 + (e.stomach_load * cvar("g_balance_vore_weight_gravity") - e.vore_oldstomachload);
\r
66 e.gravity = 0.00001; // 0 becomes 1 for .gravity, so do this to allow 0 gravity
\r
67 e.vore_oldstomachload = e.stomach_load;
\r
70 void Vore_Swallow(entity e)
\r
72 // this player is beening swallowed by another player, apply the proper changes
\r
73 e.vore_oldmovetype = e.movetype;
\r
74 e.vore_oldsolid = e.solid;
\r
76 setorigin(e, e.eater.origin);
\r
77 e.velocity = '0 0 0';
\r
78 e.movetype = MOVETYPE_FOLLOW;
\r
79 e.solid = SOLID_NOT;
\r
80 e.alpha = -1; // best way of hiding / showing the eaten player
\r
81 e.aiment = e.eater; // follow the predator. Is automatically unset
\r
82 e.view_ofs_z /= 2; // best positioning for the stomach model
\r
83 e.stat_eaten = TRUE;
\r
85 // drop keys (KH) and flags (CTF) when we get swallowed
\r
86 kh_Key_DropAll(e, FALSE);
\r
88 DropFlag(e.flagcarried, world, e.eater);
\r
90 if(stov(cvar_string("g_vore_regurgitatecolor_released")))
\r
91 e.colormod = stov(cvar_string("g_vore_regurgitatecolor_released"));
\r
93 PlayerSound(e.eater, playersound_swallow, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
\r
94 setanim(e.eater, e.eater.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing \ regurgitating
\r
95 e.eater.stomach_load += 1;
\r
96 e.eater.regurgitate_prepare = 0;
\r
97 Vore_Weight_apply(e.eater);
\r
99 e.system_delay = e.eater.system_delay = time + system_delay_time;
\r
102 void Vore_Regurgitate(entity e)
\r
104 // this player is being released from their predator, apply the proper changes
\r
105 e.movetype = e.vore_oldmovetype;
\r
106 if(e.health > 0) // leave SOLID_NOT for dead bodies
\r
107 e.solid = e.vore_oldsolid;
\r
108 e.alpha = default_player_alpha; // best way of hiding / showing the eaten player
\r
109 e.view_ofs_z *= 2; // best positioning for the stomach model
\r
110 e.stat_eaten = FALSE;
\r
113 local vector oldforward, oldright, oldup;
\r
114 oldforward = v_forward;
\r
115 oldright = v_right;
\r
117 makevectors(e.eater.v_angle);
\r
118 e.velocity = v_forward * cvar("g_balance_vore_regurgitate_force");
\r
119 e.eater.velocity += -v_forward * cvar("g_balance_vore_regurgitate_eaterforce");
\r
120 v_forward = oldforward;
\r
121 v_right = oldright;
\r
124 PlayerSound(e.eater, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
\r
125 setanim(e.eater, e.eater.anim_pain1, FALSE, TRUE, TRUE); // looks good for swallowing \ regurgitating
\r
126 pointparticles(particleeffectnum("regurgitate"), e.eater.origin, '0 0 0', 1);
\r
127 e.eater.stomach_load -= 1;
\r
128 e.eater.regurgitate_prepare = 0;
\r
129 e.eater.swallow_delay = time + cvar("g_balance_vore_swallow_delay");
\r
130 Vore_Weight_apply(e.eater);
\r
132 e.system_delay = e.eater.system_delay = time + system_delay_time;
\r
136 void Vore_Disconnect()
\r
138 // frees prey from their predators when someone disconnects or goes spectating
\r
140 // prey disconnects or goes spectating while inside someone's belly:
\r
141 if(self.eater.classname == "player")
\r
143 self.view_ofs_z += 25;
\r
144 self.stat_eaten = FALSE;
\r
145 self.eater.stomach_load -= 1;
\r
146 Vore_Weight_apply(self.eater);
\r
147 self.eater = world;
\r
150 // pred disconnects or goes spectating with players in their belly:
\r
151 else if(self.stomach_load > 0)
\r
154 FOR_EACH_PLAYER(head)
\r
156 if(head.eater == self)
\r
157 Vore_Regurgitate(head);
\r
162 .float digestion_step;
\r
165 // apply digestion to prey
\r
166 if(time > self.eater.digestion_step + steptime)
\r
168 Damage(self, self.eater, self.eater, cvar("g_balance_vore_digestion_damage"), DEATH_DIGESTION, self.origin, '0 0 0');
\r
169 if(cvar("g_balance_vore_digestion_vampire") && self.eater.health < cvar("g_balance_vore_digestion_vampire_stable"))
\r
170 self.eater.health += cvar("g_balance_vore_digestion_vampire");
\r
172 if (self.eater.digestsound_finished < time)
\r
174 self.eater.digestsound_finished = time + 0.5;
\r
175 PlayerSound (self.eater, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);
\r
177 self.eater.digestion_step = time;
\r
180 if(self.health <= 0)
\r
181 if(stov(cvar_string("g_vore_regurgitatecolor_digested")))
\r
182 self.colormod = stov(cvar_string("g_vore_regurgitatecolor_digested"));
\r
185 .float teamheal_step;
\r
186 void Vore_Teamheal()
\r
188 if(cvar("g_balance_vore_teamheal") && self.health < cvar("g_balance_vore_teamheal_stable"))
\r
189 if(time > self.teamheal_step + steptime)
\r
191 self.health += cvar("g_balance_vore_teamheal");
\r
192 self.teamheal_step = time;
\r
196 .float stomachkick_delay;
\r
197 void Vore_StomachKick()
\r
199 // allows prey to kick the predator's stomach and do some damage / attempt to escape, or bring the predator's digestion upon their self when there's no other option
\r
200 if(self.eater.classname != "player")
\r
203 // kick the predator's stomach and do damage, or escape if we are lucky
\r
204 if(self.BUTTON_ATCK)
\r
205 if(time > self.stomachkick_delay)
\r
208 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
209 Damage(self.eater, self, self, damage, DEATH_STOMACHKICK, self.eater.origin, '0 0 0');
\r
210 sound(self.eater, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM);
\r
212 if(cvar("g_balance_vore_kick_escapeprobability") >= random())
\r
213 Vore_Regurgitate(self);
\r
215 self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay");
\r
218 // start the predator's digestion
\r
219 if(self.BUTTON_ATCK2)
\r
221 centerprint(self.eater, strcat(self.netname, " has triggered your digestion"));
\r
222 self.eater.digesting = TRUE;
\r
226 .float gurglesound_finished, gurglesound_oldstomachload;
\r
227 void Vore_Gurglesound()
\r
229 if(time > self.gurglesound_finished || self.gurglesound_oldstomachload != self.stomach_load)
\r
231 GlobalSound(self.playersound_gurgle, CHAN_TRIGGER, VOICETYPE_GURGLE);
\r
233 self.gurglesound_finished = time + 11; // yes, hard coded sound length. I know it's bad but what can I do?
\r
234 self.gurglesound_oldstomachload = self.stomach_load;
\r
240 // if we are free, show our stomach load on the HUD. Otherwise, show the predator's
\r
241 if(self.eater.classname == "player")
\r
242 self.stat_stomachload = self.eater.stomach_load;
\r
244 self.stat_stomachload = self.stomach_load;
\r
246 // skip the vore system under some circumstances
\r
247 if(time < game_starttime)
\r
252 if(self.spectatee_status)
\r
254 if(time < self.system_delay)
\r
257 // --------------------------------
\r
258 // Code that addresses predators:
\r
259 // --------------------------------
\r
262 prey = Swallow_distance_check();
\r
264 // attempt to swallow our new prey if there's any in range
\r
265 if(self.BUTTON_ATCK && !self.BUTTON_REGURGITATE && self.swallow_delay < time)
\r
266 if(Swallow_condition_check(prey))
\r
269 Vore_Swallow(prey);
\r
270 self.swallow_delay = time + cvar("g_balance_vore_swallow_delay");
\r
272 if(self.team == prey.team && teamplay)
\r
273 centerprint(self, "You have swallowed a team mate, use caution!");
\r
275 // block firing for a small amount of time when voring, or we'll be firing the next frame after we swallow
\r
276 self.weapon_delay = time + 0.25;
\r
279 // start / stop digestion on command, if the player has someone in their stomach
\r
280 if(self.BUTTON_DIGEST)
\r
282 if(self.stomach_load)
\r
284 if(time > self.digest_button_delay)
\r
286 self.digesting = !self.digesting;
\r
287 self.digest_button_delay = time + button_delay;
\r
290 else if(time > self.complain_swallow)
\r
292 play2(self, "weapons/unavailable.wav");
\r
293 sprint(self, "There is nothing to digest\n");
\r
294 self.complain_swallow = time + complain_delay;
\r
297 if(!self.stomach_load)
\r
298 self.digesting = FALSE;
\r
300 // release players from this player's stomach on command
\r
301 if(self.BUTTON_REGURGITATE)
\r
303 if(self.stomach_load)
\r
305 if(time > self.regurgitate_button_delay)
\r
307 self.regurgitate_prepare = time + cvar("g_balance_vore_regurgitate_delay");
\r
308 PlayerSound(self, playersound_regurgitate_prepare, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
\r
309 self.regurgitate_button_delay = time + button_delay;
\r
312 else if(time > self.complain_swallow)
\r
314 play2(self, "weapons/unavailable.wav");
\r
315 sprint(self, "There is nothing to regurgitate\n");
\r
316 self.complain_swallow = time + complain_delay;
\r
320 if(cvar("g_vore_gurglesound"))
\r
321 Vore_Gurglesound();
\r
323 // --------------------------------
\r
324 // Code that addresses the prey:
\r
325 // --------------------------------
\r
327 if(self.eater.classname != "player")
\r
330 if(self.eater.deadflag || self.deadflag)
\r
331 Vore_Regurgitate(self);
\r
332 else if(self.eater.eater.classname == "player") // don't allow a player inside a player inside another player :)
\r
333 Vore_Regurgitate(self);
\r
334 else if(vlen(self.eater.velocity) > cvar("g_balance_vore_regurgitate_velocitylimit"))
\r
335 Vore_Regurgitate(self);
\r
337 // apply delayed regurgitating
\r
338 if(self.eater.regurgitate_prepare && time > self.eater.regurgitate_prepare)
\r
340 self.eater.regurgitate_prepare = 0;
\r
341 self.eater.complain_swallow = time + complain_delay;
\r
342 Vore_Regurgitate(self);
\r
345 if(self.eater.digesting == TRUE)
\r
347 if(teams_matter && self.team == self.eater.team)
\r
350 Vore_StomachKick();
\r