From 8b12ff5889a7a23a5ddb063a81c06db599642f2d Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 6 Apr 2021 19:17:11 +0200 Subject: [PATCH] Recycle the lifetime field instead of using a dedicated field in the nexball code --- .../common/gamemodes/gamemode/nexball/sv_nexball.qc | 12 ++++++------ .../common/gamemodes/gamemode/nexball/sv_nexball.qh | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc index ca5f1a32d..c0cce8e15 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qc @@ -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); } } diff --git a/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qh b/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qh index 902de157f..d1cd4c668 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qh +++ b/qcsrc/common/gamemodes/gamemode/nexball/sv_nexball.qh @@ -51,6 +51,4 @@ float nb_teams; .entity nb_dropper; .float nb_droptime; -.float teamtime; - float g_nexball_meter_period; -- 2.39.2