]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Recycle the lifetime field instead of using a dedicated field in the nexball code
authorterencehill <piuntn@gmail.com>
Tue, 6 Apr 2021 17:17:11 +0000 (19:17 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 6 Apr 2021 17:18:08 +0000 (19:18 +0200)
qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc
qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qh

index ca5f1a32d59f953cc3131307d3f9454cfafced11..c0cce8e1506baf32ab5217100cad69bfe6c70fa3 100644 (file)
@@ -97,7 +97,7 @@ void nexball_setstatus(entity this)
        this.items &= ~IT_KEY1;
        if(this.ballcarried)
        {
-               if(this.ballcarried.teamtime && (this.ballcarried.teamtime < time))
+               if(this.ballcarried.lifetime && (this.ballcarried.lifetime < time))
                {
                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_NEXBALL_RETURN_HELD));
                        entity e = this.ballcarried;
@@ -163,7 +163,7 @@ void GiveBall(entity plyr, entity ball)
        setorigin(ball, plyr.origin + plyr.view_ofs);
 
        if(ball.team != plyr.team)
-               ball.teamtime = time + autocvar_g_nexball_basketball_delay_hold_forteam;
+               ball.lifetime = time + autocvar_g_nexball_basketball_delay_hold_forteam;
 
        ball.owner = ball.pusher = plyr; //"owner" is set to the player carrying, "pusher" to the last player who touched it
        ball.weaponentity_fld = weaponentity;
@@ -214,7 +214,7 @@ void DropBall(entity ball, vector org, vector vel)
        ball.nb_droptime = time;
        settouch(ball, basketball_touch);
        setthink(ball, ResetBall);
-       ball.nextthink = min(time + autocvar_g_nexball_delay_idle, ball.teamtime);
+       ball.nextthink = min(time + autocvar_g_nexball_delay_idle, ball.lifetime);
 
        if(STAT(NB_METERSTART, ball.owner))
        {
@@ -244,7 +244,7 @@ void InitBall(entity this)
        this.cnt = 0;
        setthink(this, ResetBall);
        this.nextthink = time + autocvar_g_nexball_delay_idle + 3;
-       this.teamtime = 0;
+       this.lifetime = 0;
        this.pusher = NULL;
        this.team = false;
        _sound(this, CH_TRIGGER, this.noise1, VOL_BASE, ATTEN_NORM);
@@ -256,7 +256,7 @@ void ResetBall(entity this)
 {
        if(this.cnt < 2)        // step 1
        {
-               if(time == this.teamtime)
+               if(time == this.lifetime)
                        Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_NEXBALL_RETURN_HELD));
 
                settouch(this, func_null);
@@ -352,7 +352,7 @@ void basketball_touch(entity this, entity toucher)
        {
                _sound(this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
                if(this.velocity && !this.cnt)
-                       this.nextthink = min(time + autocvar_g_nexball_delay_idle, this.teamtime);
+                       this.nextthink = min(time + autocvar_g_nexball_delay_idle, this.lifetime);
        }
 }
 
index 902de157f89cbd60d58a056aad3c03653bcdd783..d1cd4c66807ea0754549b9ca41d16ebff252ab78 100644 (file)
@@ -51,6 +51,4 @@ float nb_teams;
 .entity nb_dropper;
 .float nb_droptime;
 
-.float teamtime;
-
 float g_nexball_meter_period;