Don't enable the oxygen bar when frozen or in lava/slime; also fix the oxygen bar...
authorterencehill <piuntn@gmail.com>
Tue, 12 May 2020 19:32:25 +0000 (21:32 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 12 May 2020 19:32:25 +0000 (21:32 +0200)
qcsrc/server/client.qc
qcsrc/server/sv_main.qc

index bb92c6b..e60c2ab 100644 (file)
@@ -2606,10 +2606,14 @@ void PlayerPreThink (entity this)
 
 void DrownPlayer(entity this)
 {
-       if(IS_DEAD(this) || game_stopped || time < game_starttime)
+       if(IS_DEAD(this) || game_stopped || time < game_starttime || this.vehicle
+               || STAT(FROZEN, this) || this.watertype != CONTENT_WATER)
+       {
+               this.air_finished = 0;
                return;
+       }
 
-       if (this.waterlevel != WATERLEVEL_SUBMERGED || this.vehicle)
+       if (this.waterlevel != WATERLEVEL_SUBMERGED)
        {
                if(this.air_finished && this.air_finished < time)
                        PlayerSound(this, playersound_gasp, CH_PLAYER, VOL_BASE, VOICETYPE_PLAYERSOUND);
index 3aef76e..2f2de95 100644 (file)
@@ -80,8 +80,6 @@ void CreatureFrame_Liquids(entity this)
                }
 
                CreatureFrame_hotliquids(this);
-               if (!this.air_finished)
-                       this.air_finished = time + autocvar_g_balance_contents_drowndelay;
        }
        else
        {
@@ -91,7 +89,6 @@ void CreatureFrame_Liquids(entity this)
                        this.flags &= ~FL_INWATER;
                        this.dmgtime = 0;
                }
-               this.air_finished = 0;
        }
 }