- if(self.kaballcarried) {
- entity ball;
- ball = self.kaballcarried;
-
- setattachment(ball, world, "");
- ball.movetype = MOVETYPE_BOUNCE;
- ball.solid = SOLID_TRIGGER;
- ball.wait = time + 1;
- ball.ctf_droptime = time;
- ball.think = ka_SpawnBall;
- ball.nextthink = time + cvar("g_keepawayball_respawntime");
- ball.touch = ka_TouchEvent;
- self.effects = EF_LOWPRECISION;
- self.alpha = 1.0;
- ball.alpha = 1.0;
- setorigin(ball, self.origin + '0 0 10'); // FIX ME: If a player becomes spectator, the hook function is given AFTER this happens, which means the origin given is after they already moved to another position, not where they died!
- ball.velocity = '0 0 200' + '0 100 0'*crandom() + '100 0 0'*crandom();
-
- bprint(self.netname, "^7 has dropped the ball!\n");
- WriteByte(MSG_BROADCAST, SVC_CENTERPRINT);
- WriteString(MSG_BROADCAST, strcat("\n\n", self.netname, "^7 has dropped the ball!\n"));
- sound(other, CHAN_AUTO, "keepaway/dropped.wav", VOL_BASE, ATTN_NORM);
-
- PlayerScore_Add(self, SP_KEEPAWAY_DROPS, 1);
-
- // todo
- WaypointSprite_AttachCarrier("nb-ball", ball);
- WaypointSprite_Kill(self.waypointsprite_attachedforcarrier);
-
- ball.owner.kaballcarried = world;
- ball.owner = world;
- }
- return 1;
-}