]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Swapper buff: press dropweapon to swap places with a nearby enemy. Icon by Melanosuchus
authorMario <zacjardine@y7mail.com>
Fri, 13 Mar 2015 18:06:01 +0000 (05:06 +1100)
committerMario <zacjardine@y7mail.com>
Fri, 13 Mar 2015 18:06:01 +0000 (05:06 +1100)
models/relics/relic.md3_17.skin [new file with mode: 0644]
models/relics/sign_swapper.tga [new file with mode: 0644]
models/relics/sign_swapper_glow.tga [new file with mode: 0644]
mutators.cfg
qcsrc/common/buffs.qh
qcsrc/server/autocvars.qh
qcsrc/server/mutators/mutator_buffs.qc
scripts/relics.shader

diff --git a/models/relics/relic.md3_17.skin b/models/relics/relic.md3_17.skin
new file mode 100644 (file)
index 0000000..30fba07
--- /dev/null
@@ -0,0 +1,3 @@
+ring,models/relics/relic_ring
+mesh,models/relics/relic
+sign,models/relics/sign_swapper
\ No newline at end of file
diff --git a/models/relics/sign_swapper.tga b/models/relics/sign_swapper.tga
new file mode 100644 (file)
index 0000000..d0fbc0c
Binary files /dev/null and b/models/relics/sign_swapper.tga differ
diff --git a/models/relics/sign_swapper_glow.tga b/models/relics/sign_swapper_glow.tga
new file mode 100644 (file)
index 0000000..d0fbc0c
Binary files /dev/null and b/models/relics/sign_swapper_glow.tga differ
index b28c359d13fb4e80a8d9c7853ff00de8b89f5e14..5bc4c5706133915bc38a0c6daf884cc70913d203 100644 (file)
@@ -338,3 +338,4 @@ set g_buffs_inferno_burntime_factor 2 "burn time logarithm base. 0 < x < 1: incr
 set g_buffs_inferno_burntime_min_time 0.5 "minimum seconds of burn time"
 set g_buffs_inferno_burntime_target_damage 150 "damage required for g_buffs_inferno_burntime_target_time seconds of burn"
 set g_buffs_inferno_burntime_target_time 5 "seconds of burn given g_buffs_inferno_burntime_target_damage damage"
+set g_buffs_swapper_range 1500 "maximum range of swapping with enemy"
index c888d27fed5f43c8b9f72779af2f3fc12056053c..685e886525df80fc5e6d5772a661c962bcd84c84 100644 (file)
@@ -66,6 +66,7 @@ REGISTER_BUFF(_("Jump"),jump,JUMP,10,'0.7 0.2 1');
 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
@@ -94,6 +95,7 @@ BUFF_SPAWNFUNCS(jump,                 BUFF_JUMP)
 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)
index dc8a013080b0759a6255ba827a7973f1a8650919..1e31cafa848b9d9820a0534ea6c9d512feb470bb 100644 (file)
@@ -890,4 +890,5 @@ float autocvar_g_buffs_inferno_burntime_min_time;
 float autocvar_g_buffs_inferno_burntime_target_damage;
 float autocvar_g_buffs_inferno_burntime_target_time;
 float autocvar_g_buffs_inferno_damagemultiplier;
+float autocvar_g_buffs_swapper_range;
 #endif
index b7d725ec76608d35babdb63f0e2f6b7adcdd515c..6fda5d39f1dfa484d9b60f6d1f3cd077138c4049 100644 (file)
@@ -563,6 +563,76 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerUseKey)
        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)
@@ -848,6 +918,7 @@ MUTATOR_DEFINITION(mutator_buffs)
        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);
index 1ebd9c49ddcdd412e1f0b9c6f1201e471091b15c..368df1919974300a5697e1b6bde7f302b29a901d 100644 (file)
@@ -167,3 +167,12 @@ models/relics/sign_inferno
                rgbgen lightingDiffuse
        }
 }
+models/relics/sign_swapper
+{
+       cull none
+       {
+               map models/relics/sign_swapper
+               blendfunc add
+               rgbgen lightingDiffuse
+       }
+}