set g_keepawayball_effects 0 "Add together the numbers you want: EF_ADDITIVE (32) / EF_NODEPTHTEST (8192) / EF_DIMLIGHT (8)"
set g_keepawayball_trail_color 254 "particle trail color from player/ball"
set g_keepawayball_damageforcescale 3 "Scale of force which is applied to the ball by weapons/explosions/etc"
+set g_keepawayball_pickup_delay 1 "time until the ball can be picked up again after getting dropped"
set g_keepawayball_respawntime 10 "if no one picks up the ball, how long to wait until the ball respawns"
-set g_keepawayball_wait 1 "time until the ball can be picked up again after getting dropped"
// ==========
float autocvar_g_keepaway_score_timeinterval;
float autocvar_g_keepawayball_damageforcescale;
int autocvar_g_keepawayball_effects;
+float autocvar_g_keepawayball_pickup_delay;
float autocvar_g_keepawayball_respawntime;
-float autocvar_g_keepawayball_wait;
int autocvar_g_keepawayball_trail_color;
bool ka_ballcarrier_waypointsprite_visible_for_player(entity this, entity player, entity view) // runs on waypoints which are attached to ballcarriers, updates once per frame
player.effects &= ~autocvar_g_keepaway_ballcarrier_effects;
}
-void ka_DropEvent(entity player) // runs any time that a player is supposed to lose the ball
+void ka_DropBall(entity player, vector org, vector velo) // runs any time that a player is supposed to lose the ball
{
entity ball = player.ballcarried;
// reset the ball
setattachment(ball, NULL, "");
set_movetype(ball, MOVETYPE_BOUNCE);
- ball.wait = time + autocvar_g_keepawayball_wait;
+ ball.wait = time + autocvar_g_keepawayball_pickup_delay;
settouch(ball, ka_TouchEvent);
setthink(ball, ka_RespawnBall);
ball.nextthink = time + autocvar_g_keepawayball_respawntime;
ball.damagedbycontents = true;
IL_PUSH(g_damagedbycontents, ball);
ball.effects &= ~EF_NODRAW;
- setorigin(ball, player.origin + '0 0 10');
- ball.velocity = '0 0 200' + '0 100 0'*crandom() + '100 0 0'*crandom();
+ setorigin(ball, org);
+ ball.velocity = velo;
ball.owner = NULL;
navigation_dynamicgoal_set(ball, player);
ka_PlayerReset(player);
}
+void ka_DropEvent(entity player) {
+ ka_DropBall(player, player.origin + '0 0 10', '0 0 200' + '0 100 0'*crandom() + '100 0 0'*crandom());
+}
+
.bool pushable;
MODEL(KA_BALL, "models/orbs/orbblue.md3");
GameRules_scoring_add(frag_attacker, SCORE, autocvar_g_keepaway_score_killac);
}
- if(frag_target.ballcarried) { ka_DropEvent(frag_target); } // a player with the ball has died, drop it
+ if(frag_target.ballcarried) // a player with the ball has died, drop it
+ ka_DropEvent(frag_target);
}
MUTATOR_HOOKFUNCTION(ka, GiveFragsForKill)
if(MUTATOR_RETURNVALUE == 0)
if(player.ballcarried)
{
- ka_DropEvent(player);
+ ka_DropBall(player, player.origin + (v_forward * 100), '0 0 200' + (v_forward * 500));
return true;
}
}