REGISTER_BUFF(_("Flight"),flight,FLIGHT,11,'1 0.2 0.5');
REGISTER_BUFF(_("Invisible"),invisible,INVISIBLE,12,'0.9 0.9 0.9');
REGISTER_BUFF(_("Inferno"),inferno,INFERNO,16,'2 0 0');
+REGISTER_BUFF(_("Swapper"),swapper,SWAPPER,17,'0.59 0 0.95');
#undef REGISTER_BUFF
#ifdef SVQC
BUFF_SPAWNFUNCS(flight, BUFF_FLIGHT)
BUFF_SPAWNFUNCS(invisible, BUFF_INVISIBLE)
BUFF_SPAWNFUNCS(inferno, BUFF_INFERNO)
+BUFF_SPAWNFUNCS(swapper, BUFF_SWAPPER)
BUFF_SPAWNFUNCS(random, 0)
BUFF_SPAWNFUNC_Q3TA_COMPAT(doubler, BUFF_MEDIC)
return false;
}
+MUTATOR_HOOKFUNCTION(buffs_PlayerThrowKey)
+{
+ if(MUTATOR_RETURNVALUE || gameover) { return false; }
+
+ if(self.buffs & BUFF_SWAPPER)
+ {
+ float best_distance = autocvar_g_buffs_swapper_range;
+ entity closest = world;
+ entity player;
+ FOR_EACH_PLAYER(player)
+ if(DIFF_TEAM(self, player))
+ if(player.deadflag == DEAD_NO && !player.frozen && !player.vehicle)
+ if(vlen(self.origin - player.origin) <= best_distance)
+ {
+ best_distance = vlen(self.origin - player.origin);
+ closest = player;
+ }
+
+ if(closest)
+ {
+ vector my_org, my_vel, my_ang, their_org, their_vel, their_ang;
+
+ my_org = self.origin;
+ my_vel = self.velocity;
+ my_ang = self.angles;
+ their_org = closest.origin;
+ their_vel = closest.velocity;
+ their_ang = closest.angles;
+
+ if(closest.ballcarried)
+ if(g_keepaway) { ka_DropEvent(closest); }
+ else { DropBall(closest.ballcarried, closest.origin, closest.velocity);}
+ if(closest.flagcarried) { ctf_Handle_Throw(closest, world, DROP_THROW); }
+ if(closest.nade) { toss_nade(closest, '0 0 0', time + 0.05); }
+
+ MUTATOR_CALLHOOK(PortalTeleport); // initiate flag dropper
+
+ setorigin(self, their_org);
+ setorigin(closest, my_org);
+
+ closest.velocity = my_vel;
+ closest.angles = my_ang;
+ closest.fixangle = true;
+ closest.oldorigin = my_org;
+ closest.oldvelocity = my_vel;
+ self.velocity = their_vel;
+ self.angles = their_ang;
+ self.fixangle = true;
+ self.oldorigin = their_org;
+ self.oldvelocity = their_vel;
+
+ // set pusher so self gets the kill if they fall into void
+ closest.pusher = self;
+ closest.pushltime = time + autocvar_g_maxpushtime;
+ closest.istypefrag = closest.BUTTON_CHAT;
+
+ pointparticles(particleeffectnum("electro_combo"), their_org, '0 0 0', 1);
+ pointparticles(particleeffectnum("electro_combo"), my_org, '0 0 0', 1);
+
+ sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NORM);
+ sound(closest, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NORM);
+
+ // TODO: add a counter to handle how many times one can teleport, and a delay to prevent spam
+ self.buffs = 0;
+ return true;
+ }
+ }
+ return false;
+}
+
MUTATOR_HOOKFUNCTION(buffs_RemovePlayer)
{
if(self.buff_model)
MUTATOR_HOOK(PlayerRegen, buffs_PlayerRegen, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerDies, buffs_PlayerDies, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerUseKey, buffs_PlayerUseKey, CBC_ORDER_FIRST);
+ MUTATOR_HOOK(ForbidThrowCurrentWeapon, buffs_PlayerThrowKey, CBC_ORDER_ANY);
MUTATOR_HOOK(MakePlayerObserver, buffs_RemovePlayer, CBC_ORDER_ANY);
MUTATOR_HOOK(ClientDisconnect, buffs_RemovePlayer, CBC_ORDER_ANY);
MUTATOR_HOOK(OnEntityPreSpawn, buffs_OnEntityPreSpawn, CBC_ORDER_ANY);