]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
test disabling ka pickup delay bones_was_here/ka_nodel
authorbones_was_here <bones_was_here@xonotic.au>
Fri, 7 Jul 2023 10:02:41 +0000 (20:02 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 7 Jul 2023 10:02:41 +0000 (20:02 +1000)
qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc
qcsrc/common/gamemodes/gamemode/tka/sv_tka.qc

index c50d0d2fc1b964645738a6629f70c96684bd9f8a..e68da03d97aed2c6797242e3ef23e586891e790a 100644 (file)
@@ -104,6 +104,7 @@ void ka_DamageEvent(entity this, entity inflictor, entity attacker, float damage
                ka_RespawnBall(this);
 }
 
+.entity kh_previous_owner;
 void ka_TouchEvent(entity this, entity toucher) // runs any time that the ball comes in contact with something
 {
        if (!this || game_stopped)
@@ -123,7 +124,8 @@ void ka_TouchEvent(entity this, entity toucher) // runs any time that the ball c
                sound(this, CH_TRIGGER, SND_KA_TOUCH, VOL_BASE, ATTEN_NORM);
                return;
        }
-       else if(this.wait > time) { return; }
+       else if(this.wait > time && this.kh_previous_owner == toucher)
+               return;
 
        // attach the ball to the player
        this.owner = toucher;
@@ -188,7 +190,8 @@ void ka_DropEvent(entity player) // runs any time that a player is supposed to l
        // reset the ball
        setattachment(ball, NULL, "");
        set_movetype(ball, MOVETYPE_BOUNCE);
-       ball.wait = time + 1;
+       ball.kh_previous_owner = player;
+       ball.wait = time + 0.5; // same as for thrown weapons
        settouch(ball, ka_TouchEvent);
        setthink(ball, ka_RespawnBall);
        ball.nextthink = time + autocvar_g_keepawayball_respawntime;
index 0be1e46639754422310e2d4789bb4d9637d6ca38..2629594ef5ea2445b264fd117b013bf9a090ad49 100644 (file)
@@ -81,6 +81,7 @@ void tka_TimeScoring(entity this)
        }
 }
 
+.entity kh_previous_owner;
 void tka_TouchEvent(entity this, entity toucher) // runs any time that the ball comes in contact with something
 {
        if (!this || game_stopped)
@@ -100,7 +101,8 @@ void tka_TouchEvent(entity this, entity toucher) // runs any time that the ball
                sound(this, CH_TRIGGER, SND_KA_TOUCH, VOL_BASE, ATTEN_NORM);
                return;
        }
-       else if(this.wait > time) { return; }
+       else if(this.wait > time && this.kh_previous_owner == toucher)
+               return;
 
        // attach the ball to the player
        this.owner = toucher;
@@ -172,7 +174,8 @@ void tka_DropEvent(entity player) // runs any time that a player is supposed to
        // reset the ball
        setattachment(ball, NULL, "");
        set_movetype(ball, MOVETYPE_BOUNCE);
-       ball.wait = time + 1;
+       ball.kh_previous_owner = player;
+       ball.wait = time + 0.5; // same as for thrown weapons
        settouch(ball, tka_TouchEvent);
        setthink(ball, tka_RespawnBall);
        ball.nextthink = time + autocvar_g_tkaball_respawntime;