Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void () make_bubbles =
- {
- local entity bubble;
- bubble = spawn ();
- setmodel (bubble, "progs/s_bubble.spr");
- setorigin (bubble, self.origin);
- bubble.movetype = MOVETYPE_FLY;
- bubble.solid = SOLID_TRIGGER;
- bubble.velocity = '0 0 7';
- bubble.nextthink = (time + 0.5);
- bubble.think = bubble_bob;
- bubble.touch = bubble_remove;
- bubble.classname = "bubble";
- bubble.frame = FALSE;
- bubble.cnt = FALSE;
- setsize (bubble, '0 0 0', '1 1 1');
- self.nextthink = ((time + random ()) + 0.5);
- self.think = make_bubbles;
- sound (bubble, CHAN_AUTO, "uwater.wav", 0.5, 2); // Underwater sound
- };
- void () bubble_split =
- {
- local entity bubble;
- bubble = spawn ();
- setmodel (bubble, "progs/s_bubble.spr");
- setorigin (bubble, self.origin);
- bubble.movetype = MOVETYPE_FLY;
- bubble.solid = SOLID_TRIGGER;
- bubble.velocity = self.velocity;
- bubble.nextthink = (time + 0.5);
- bubble.think = bubble_bob;
- bubble.touch = bubble_remove;
- bubble.classname = "bubble";
- bubble.frame = TRUE;
- bubble.cnt = MOVETYPE_BOUNCE;
- setsize (bubble, '0 0 0', '1 1 1');
- sound (bubble, CHAN_AUTO, "uwater.wav", 0.5, 2); // Underwater sound
- self.frame = TRUE;
- self.cnt = MOVETYPE_BOUNCE;
- if ((self.waterlevel != 3))
- remove (self);
- };
- void () bubble_remove =
- {
- self.reserve = self.reserve + 1; // Counting number of touches
- if (!self.solid)
- self.flags = self.flags - (self.flags & FL_WATERJUMP);
- if ((other.classname == self.classname))
- {
- self.origin_y = other.origin_x ;
- self.origin_x = other.origin_y ;
- }
- if (other.solid && self.classname != other.classname)
- {
- if (self.reserve > 10)
- return;
- self.velocity_z = self.velocity_z * 0.9;
- self.velocity_x = self.velocity_x * nrandom ();
- self.velocity_y = self.velocity_y * nrandom ();
- }
- };
- void () bubble_bob =
- {
- local float rnd1;
- local float rnd2;
- local float rnd3;
- local vector vtmp1;
- local vector modi;
- self.cnt = (self.cnt + TRUE);
- if ((self.cnt == MOVETYPE_STEP))
- {
- bubble_split ();
- }
- makevectors (self.angles);
- traceline (self.origin, self.origin + '0 0 4', TRUE, self);
- if (trace_inopen)
- {
- self.movetype = MOVETYPE_NOCLIP;
- self.solid = 0;
- self.touch = SUB_Null;
- setsize (self, '-8 -8 -8', '8 8 8');
- }
- if (!self.solid)
- self.flags = self.flags - (self.flags & FL_WATERJUMP);
- if (!(self.waterlevel))
- {
- sound (self, CHAN_RUNE, "misc/water1.wav", 1, ATTN_IDLE);
- SUB_Remove();
- }
- rnd1 = (self.velocity_x + (-10 + (random () * 20)));
- rnd2 = (self.velocity_y + (-10 + (random () * 20)));
- rnd3 = ((self.velocity_z + MOVETYPE_BOUNCE) + (random () * MOVETYPE_BOUNCE));
- if ((rnd1 > MOVETYPE_BOUNCE))
- {
- rnd1 = MOVETYPE_FLY;
- }
- if ((rnd1 < -10))
- {
- rnd1 = CONTENT_LAVA;
- }
- if ((rnd2 > MOVETYPE_BOUNCE))
- {
- rnd2 = MOVETYPE_FLY;
- }
- if ((rnd2 < -10))
- {
- rnd2 = CONTENT_LAVA;
- }
- if ((rnd3 < MOVETYPE_BOUNCE))
- {
- rnd3 = 5;
- }
- if ((rnd3 > 30))
- {
- rnd3 = 25;
- }
- self.velocity_x = rnd1;
- self.velocity_y = rnd2;
- self.velocity_z = rnd3;
- self.nextthink = (time + 0.5);
- self.think = bubble_bob;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement