]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_client.qc
Update announcer countdown system with different types, update debugprint
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index b3e651a258fa1d1ebc3fe95bf45bf36e190e7d93..479dea7599407b803bed7b34b3afd2a07d7032bc 100644 (file)
@@ -17,7 +17,7 @@ float ClientData_Send(entity to, float sf)
        entity e;
 
        e = to;
-       if(to.classname == "spectator")
+       if(IS_SPEC(to))
                e = to.enemy;
 
        sf = 0;
@@ -68,7 +68,7 @@ void ClientData_Touch(entity e)
        FOR_EACH_REALCLIENT(e2)
        {
                if(e2 != e)
-                       if(e2.classname == "spectator")
+                       if(IS_SPEC(e2))
                                if(e2.enemy == e)
                                        e2.clientdata.SendFlags = 1;
        }
@@ -147,7 +147,7 @@ void PutObserverInServer (void)
                error("No spawnpoints for observers?!?\n");
        RemoveGrapplingHook(self); // Wazat's Grappling Hook
 
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
        {
                msg_entity = self;
                WriteByte(MSG_ONE, SVC_SETVIEW);
@@ -166,13 +166,11 @@ void PutObserverInServer (void)
 
        MUTATOR_CALLHOOK(MakePlayerObserver);
 
-       minstagib_stop_countdown(self);
-
        Portal_ClearAll(self);
        
        if(self.alivetime)
        {
-               if(!inWarmupStage)
+               if(!warmup_stage)
                        PlayerStats_Event(self, PLAYERSTATS_ALIVETIME, time - self.alivetime);
                self.alivetime = 0;
        }
@@ -356,12 +354,11 @@ PutClientInServer
 Called when a client spawns in the server
 =============
 */
-
 void PutClientInServer (void)
 {
-       if(clienttype(self) == CLIENTTYPE_BOT)
+       if(IS_BOT_CLIENT(self))
                self.classname = "player";
-       else if(clienttype(self) == CLIENTTYPE_REAL)
+       else if(IS_REAL_CLIENT(self))
        {
                msg_entity = self;
                WriteByte(MSG_ONE, SVC_SETVIEW);
@@ -376,7 +373,8 @@ void PutClientInServer (void)
        if(gameover)
                self.classname = "observer";
 
-       if(self.classname == "player") {
+       if(IS_PLAYER(self))
+       {
                entity spot, oldself;
                float j;
 
@@ -406,7 +404,7 @@ void PutClientInServer (void)
                self.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
                if(autocvar_g_playerclip_collisions)
                        self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
-               if(clienttype(self) == CLIENTTYPE_BOT && autocvar_g_botclip_collisions)
+               if(IS_BOT_CLIENT(self) && autocvar_g_botclip_collisions)
                        self.dphitcontentsmask |= DPCONTENTS_BOTCLIP;
                self.frags = FRAGS_PLAYER;
                if(INDEPENDENT_PLAYERS)
@@ -415,10 +413,7 @@ void PutClientInServer (void)
                if(autocvar__notarget)
                        self.flags |= FL_NOTARGET;
                self.takedamage = DAMAGE_AIM;
-               if(g_minstagib)
-                       self.effects = EF_FULLBRIGHT;
-               else
-                       self.effects = 0;
+               self.effects = 0;
                self.effects |= EF_TELEPORT_BIT | EF_RESTARTANIM_BIT;
                self.air_finished = time + 12;
                self.dmg = 2;
@@ -429,7 +424,7 @@ void PutClientInServer (void)
                        self.nex_charge = autocvar_g_balance_nex_charge_start;
                }
 
-               if(inWarmupStage)
+               if(warmup_stage)
                {
                        self.ammo_shells = warmup_start_ammo_shells;
                        self.ammo_nails = warmup_start_ammo_nails;
@@ -514,11 +509,9 @@ void PutClientInServer (void)
                self.oldvelocity = self.velocity;
                self.fire_endtime = -1;
 
-               msg_entity = self;
-               WRITESPECTATABLE_MSG_ONE({
-                       WriteByte(MSG_ONE, SVC_TEMPENTITY);
-                       WriteByte(MSG_ONE, TE_CSQC_SPAWN);
-               });
+               entity spawnevent = spawn();
+               spawnevent.owner = self;
+               Net_LinkEntity(spawnevent, FALSE, 0.5, SpawnEvent_Send);
 
                self.model = "";
                FixPlayermodel();
@@ -600,15 +593,14 @@ void PutClientInServer (void)
                self.weaponname = "";
                self.switchingweapon = 0;
 
-               if(!inWarmupStage)
+               if(!warmup_stage)
                        if(!self.alivetime)
                                self.alivetime = time;
 
                antilag_clear(self);
-
-               if (autocvar_g_spawnsound)
-                       soundat(world, self.origin, CH_TRIGGER, "misc/spawn.wav", VOL_BASE, ATTN_NORM);
-       } else if(self.classname == "observer") {
+       }
+       else if(IS_OBSERVER(self))
+       {
                PutObserverInServer ();
        }
 }
@@ -637,7 +629,6 @@ float ClientInit_SendEntity(entity to, float sf)
        else
                WriteString(MSG_ENTITY, "");
        WriteByte(MSG_ENTITY, self.count * 255.0); // g_balance_armor_blockpercent
-       WriteByte(MSG_ENTITY, self.cnt * 255.0); // g_balance_weaponswitchdelay
        WriteCoord(MSG_ENTITY, self.bouncefactor); // g_balance_grenadelauncher_bouncefactor
        WriteCoord(MSG_ENTITY, self.bouncestop); // g_balance_grenadelauncher_bouncestop
        WriteCoord(MSG_ENTITY, self.ebouncefactor); // g_balance_grenadelauncher_bouncefactor
@@ -660,11 +651,6 @@ void ClientInit_CheckUpdate()
                self.count = autocvar_g_balance_armor_blockpercent;
                self.SendFlags |= 1;
        }
-       if(self.cnt != autocvar_g_balance_weaponswitchdelay)
-       {
-               self.cnt = autocvar_g_balance_weaponswitchdelay;
-               self.SendFlags |= 1;
-       }
        if(self.bouncefactor != autocvar_g_balance_grenadelauncher_bouncefactor)
        {
                self.bouncefactor = autocvar_g_balance_grenadelauncher_bouncefactor;
@@ -822,10 +808,10 @@ void KillIndicator_Think()
        {
                if(self.cnt <= 10)
                        setmodel(self, strcat("models/sprites/", ftos(self.cnt), ".spr32"));
-               if(clienttype(self.owner) == CLIENTTYPE_REAL)
+               if(IS_REAL_CLIENT(self.owner))
                {
                        if(self.cnt <= 10)
-                               { Send_Notification(NOTIF_ONE, self.owner, MSG_ANNCE, Announcer_PickNumber(self.cnt)); }
+                               { Send_Notification(NOTIF_ONE, self.owner, MSG_ANNCE, Announcer_PickNumber(CNT_KILL, self.cnt)); }
                }
                self.nextthink = time + 1;
                self.cnt -= 1;
@@ -866,7 +852,7 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
                        self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
                }
 
-               if(killtime <= 0 || self.classname != "player" || self.deadflag != DEAD_NO)
+               if(killtime <= 0 || !IS_PLAYER(self) || self.deadflag != DEAD_NO)
                {
                        ClientKill_Now();
                }
@@ -908,28 +894,28 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
                if(targetteam == 0) // just die
                {
                        self.killindicator.colormod = '0 0 0';
-                       if(clienttype(self) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(self))
                        if(self.killindicator.cnt > 0)
                                Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, self.killindicator.cnt);
                }
                else if(targetteam == -1) // auto
                {
                        self.killindicator.colormod = '0 1 0';
-                       if(clienttype(self) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(self))
                        if(self.killindicator.cnt > 0)
                                Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, self.killindicator.cnt);
                }
                else if(targetteam == -2) // spectate
                {
                        self.killindicator.colormod = '0.5 0.5 0.5';
-                       if(clienttype(self) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(self))
                        if(self.killindicator.cnt > 0)
                                Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, self.killindicator.cnt);
                }
                else
                {
                        self.killindicator.colormod = Team_ColorRGB(targetteam);
-                       if(clienttype(self) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(self))
                        if(self.killindicator.cnt > 0)
                                Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, APP_TEAM_NUM_4(targetteam, CENTER_TEAMCHANGE_), self.killindicator.cnt);
                }
@@ -942,7 +928,7 @@ void ClientKill (void)
        if(gameover) return;
        if(self.player_blocked) return;
        if(self.freezetag_frozen) return;
-
+       
        ClientKill_TeamChange(0);
 }
 
@@ -1021,7 +1007,7 @@ void ClientConnect (void)
 {
        float t;
 
-       if(self.flags & FL_CLIENT)
+       if(IS_CLIENT(self))
        {
                print("Warning: ClientConnect, but already connected!\n");
                return;
@@ -1062,7 +1048,7 @@ void ClientConnect (void)
        // identify the right forced team
        if(autocvar_g_campaign)
        {
-               if(clienttype(self) == CLIENTTYPE_REAL) // only players, not bots
+               if(IS_REAL_CLIENT(self)) // only players, not bots
                {
                        switch(autocvar_g_campaign_forceteam)
                        {
@@ -1129,11 +1115,11 @@ void ClientConnect (void)
 
        PlayerStats_AddEvent(sprintf("kills-%d", self.playerid));
 
-    if(clienttype(self) == CLIENTTYPE_BOT)
+    if(IS_BOT_CLIENT(self))
         PlayerStats_AddPlayer(self);
 
        if(autocvar_sv_eventlog)
-               GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((clienttype(self) == CLIENTTYPE_REAL) ? self.netaddress : "bot"), ":", self.netname));
+               GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot"), ":", self.netname));
 
        LogTeamchange(self.playerid, self.team, 1);
 
@@ -1141,7 +1127,7 @@ void ClientConnect (void)
 
        self.netname_previous = strzone(self.netname);
 
-       if((self.classname == STR_PLAYER && teamplay))
+       if(IS_PLAYER(self) && teamplay)
                Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(self, INFO_JOIN_CONNECT_TEAM_), self.netname);
        else
                Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_JOIN_CONNECT, self.netname);
@@ -1186,7 +1172,7 @@ void ClientConnect (void)
        self.jointime = time;
        self.allowed_timeouts = autocvar_sv_timeout_number;
 
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
        {
                if(!autocvar_g_campaign)
                {
@@ -1238,7 +1224,7 @@ void ClientConnect (void)
 
        self.model_randomizer = random();
 
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
                sv_notice_join();
 
        MUTATOR_CALLHOOK(ClientConnect);
@@ -1257,7 +1243,7 @@ void ClientDisconnect (void)
        if(self.vehicle)
            vehicles_exit(VHEF_RELESE);
 
-       if not(self.flags & FL_CLIENT)
+       if not(IS_CLIENT(self))
        {
                print("Warning: ClientDisconnect without ClientConnect\n");
                return;
@@ -1414,7 +1400,7 @@ void respawn(void)
 
 void play_countdown(float finished, string samp)
 {
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
                if(floor(finished - time - frametime) != floor(finished - time))
                        if(finished - time < 6)
                                sound (self, CH_INFO, samp, VOL_BASE, ATTN_NORM);
@@ -1432,61 +1418,13 @@ void player_powerups (void)
 
        self.effects &~= (EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
 
-       if(self.alpha < 0 || self.deadflag) // don't apply the flags if the player is gibbed
+       if((self.alpha < 0 || self.deadflag) && !self.vehicle) // don't apply the flags if the player is gibbed
                return;
 
        Fire_ApplyDamage(self);
        Fire_ApplyEffect(self);
 
-       if (g_minstagib)
-       {
-               self.effects |= EF_FULLBRIGHT;
-
-               if (self.items & IT_STRENGTH)
-               {
-                       play_countdown(self.strength_finished, "misc/poweroff.wav");
-                       if (time > self.strength_finished)
-                       {
-                               self.alpha = default_player_alpha;
-                               self.exteriorweaponentity.alpha = default_weapon_alpha;
-                               self.items &~= IT_STRENGTH;
-                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_INVISIBILITY, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
-                       }
-               }
-               else
-               {
-                       if (time < self.strength_finished)
-                       {
-                               self.alpha = g_minstagib_invis_alpha;
-                               self.exteriorweaponentity.alpha = g_minstagib_invis_alpha;
-                               self.items |= IT_STRENGTH;
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
-                       }
-               }
-
-               if (self.items & IT_INVINCIBLE)
-               {
-                       play_countdown(self.invincible_finished, "misc/poweroff.wav");
-                       if (time > self.invincible_finished)
-                       {
-                               self.items = self.items - (self.items & IT_INVINCIBLE);
-                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SPEED, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED);
-                       }
-               }
-               else
-               {
-                       if (time < self.invincible_finished)
-                       {
-                               self.items = self.items | IT_INVINCIBLE;
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED);
-                       }
-               }
-       }
-       else // if we're not in minstagib, continue. I added this else to replace the "return" which was here that broke the callhook for this function -- This code is nasty.
+       if not(g_minstagib)
        {
                if (self.items & IT_STRENGTH)
                {
@@ -1579,15 +1517,6 @@ void player_powerups (void)
        if(autocvar_g_fullbrightplayers)
                self.effects = self.effects | EF_FULLBRIGHT;
 
-       // midair gamemode: damage only while in the air
-       // if in midair mode, being on ground grants temporary invulnerability
-       // (this is so that multishot weapon don't clear the ground flag on the
-       // first damage in the frame, leaving the player vulnerable to the
-       // remaining hits in the same frame)
-       if (self.flags & FL_ONGROUND)
-       if (g_midair)
-               self.spawnshieldtime = max(self.spawnshieldtime, time + autocvar_g_midair_shieldtime);
-
        if (time >= game_starttime)
        if (time < self.spawnshieldtime)
                self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
@@ -1831,7 +1760,7 @@ float SpectateUpdate() {
        if (self == self.enemy)
                return 0;
 
-       if(self.enemy.classname != "player")
+       if not(IS_PLAYER(self.enemy))
                return 0;
 
        SpectateCopy(self.enemy);
@@ -1981,7 +1910,7 @@ void ShowRespawnCountdown()
                {
                        self.respawn_countdown = number - 1;
                        if(ceil(self.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
-                               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(number)); 
+                               { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number)); }
                }
        }
 }
@@ -2050,7 +1979,7 @@ float nJoinAllowed(entity ignore) {
 
        float currentlyPlaying = 0;
        FOR_EACH_REALCLIENT(e)
-               if(e.classname == "player" || e.caplayer == 1)
+               if(IS_PLAYER(e) || e.caplayer == 1)
                        currentlyPlaying += 1;
 
        if(currentlyPlaying < autocvar_g_maxplayers)
@@ -2064,7 +1993,7 @@ float nJoinAllowed(entity ignore) {
  * g_maxplayers_spectator_blocktime seconds
  */
 void checkSpectatorBlock() {
-       if(self.classname == "spectator" || self.classname == "observer") {
+       if(IS_SPEC(self) || IS_OBSERVER(self)) {
                if( time > (self.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
                        Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
                        dropclient(self);
@@ -2077,7 +2006,7 @@ void PrintWelcomeMessage()
        if(self.motd_actived_time == 0)
        {
                if (autocvar_g_campaign) {
-                       if ((self.classname == "player" && self.BUTTON_INFO) || (self.classname != "player")) {
+                       if ((IS_PLAYER(self) && self.BUTTON_INFO) || (!IS_PLAYER(self))) {
                                self.motd_actived_time = time;
                                Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, campaign_message);
                        }
@@ -2093,7 +2022,7 @@ void PrintWelcomeMessage()
                if (autocvar_g_campaign) {
                        if (self.BUTTON_INFO)
                                self.motd_actived_time = time;
-                       else if ((time - self.motd_actived_time > 2) && self.classname == "player") { // hide it some seconds after BUTTON_INFO has been released
+                       else if ((time - self.motd_actived_time > 2) && IS_PLAYER(self)) { // hide it some seconds after BUTTON_INFO has been released
                                self.motd_actived_time = 0;
                                Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD);
                        }
@@ -2200,7 +2129,7 @@ void SpectatorThink()
 
 void PlayerUseKey()
 {
-       if(self.classname != "player")
+       if not(IS_PLAYER(self))
                return;
 
        if(self.vehicle)
@@ -2309,10 +2238,11 @@ void PlayerPreThink (void)
                self.usekeypressed = self.BUTTON_USE;
        }
 
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
                PrintWelcomeMessage();
 
-       if(self.classname == "player") {
+       if(IS_PLAYER(self))
+       {
 
                CheckRules_Player();
 
@@ -2351,9 +2281,6 @@ void PlayerPreThink (void)
                        player_powerups();
                }
 
-               if (g_minstagib)
-                       minstagib_ammocheck();
-
                if (self.deadflag != DEAD_NO)
                {
                        if(self.personal && g_race_qualifying)
@@ -2419,8 +2346,6 @@ void PlayerPreThink (void)
                float do_crouch = self.BUTTON_CROUCH;
                if(self.hook.state)
                        do_crouch = 0;
-               if(self.health <= g_bloodloss)
-                       do_crouch = 1;
                if(self.vehicle)
                        do_crouch = 0;
                if(self.freezetag_frozen)
@@ -2452,15 +2377,6 @@ void PlayerPreThink (void)
                        }
                }
 
-               if(self.health <= g_bloodloss && self.deadflag == DEAD_NO)
-               {
-                       if(self.bloodloss_timer < time)
-                       {
-                               self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0');
-                               self.bloodloss_timer = time + 0.5 + random() * 0.5;
-                       }
-               }
-
                FixPlayermodel();
 
                GrapplingHookFrame();
@@ -2488,9 +2404,6 @@ void PlayerPreThink (void)
 
                if(frametime)
                        player_anim();
-
-               if(g_nexball)
-                       nexball_setstatus();
                
                // secret status
                secrets_setstatus();
@@ -2502,9 +2415,9 @@ void PlayerPreThink (void)
                if (intermission_running)
                        IntermissionThink ();   // otherwise a button could be missed between
                return;
-       } else if(self.classname == "observer") {
+       } else if(IS_OBSERVER(self)) {
                ObserverThink();
-       } else if(self.classname == "spectator") {
+       } else if(IS_SPEC(self)) {
                SpectatorThink();
        }
 
@@ -2513,9 +2426,9 @@ void PlayerPreThink (void)
 
        float oldspectatee_status;
        oldspectatee_status = self.spectatee_status;
-       if(self.classname == "spectator")
+       if(IS_SPEC(self))
                self.spectatee_status = num_for_edict(self.enemy);
-       else if(self.classname == "observer")
+       else if(IS_OBSERVER(self))
                self.spectatee_status = num_for_edict(self);
        else
                self.spectatee_status = 0;
@@ -2599,11 +2512,16 @@ void PlayerPostThink (void)
                stuffcmd(self, strcat("name ", self.netname, substring(ftos(random()), 2, -1), "\n"));
        }
 
-       if(sv_maxidle && frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
+       if(sv_maxidle > 0 && frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
+       if(IS_PLAYER(self) || sv_maxidle_spectatorsareidle)
        {
                if (time - self.parm_idlesince < 1) // instead of (time == self.parm_idlesince) to support sv_maxidle <= 10
                {
-                       if(self.idlekick_lasttimeleft) { self.idlekick_lasttimeleft = 0; }
+                       if(self.idlekick_lasttimeleft)
+                       {
+                               self.idlekick_lasttimeleft = 0;
+                               Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_IDLING);
+                       }
                }
                else
                {
@@ -2623,7 +2541,7 @@ void PlayerPostThink (void)
                        else if(timeleft <= 10)
                        {
                                if(timeleft != self.idlekick_lasttimeleft)
-                                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(timeleft));
+                                       { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft)); }
                                self.idlekick_lasttimeleft = timeleft;
                        }
                }
@@ -2640,7 +2558,7 @@ void PlayerPostThink (void)
 
        //CheckPlayerJump();
 
-       if(self.classname == "player") {
+       if(IS_PLAYER(self)) {
                CheckRules_Player();
                UpdateChatBubble();
                if (self.impulse)