From ec0035789475e48a58a22df279c7cb1099454afd Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 14 Mar 2015 05:06:01 +1100 Subject: [PATCH] Swapper buff: press dropweapon to swap places with a nearby enemy. Icon by Melanosuchus --- models/relics/relic.md3_17.skin | 3 ++ models/relics/sign_swapper.tga | Bin 0 -> 65580 bytes models/relics/sign_swapper_glow.tga | Bin 0 -> 65580 bytes mutators.cfg | 1 + qcsrc/common/buffs.qh | 2 + qcsrc/server/autocvars.qh | 1 + qcsrc/server/mutators/mutator_buffs.qc | 71 +++++++++++++++++++++++++ scripts/relics.shader | 9 ++++ 8 files changed, 87 insertions(+) create mode 100644 models/relics/relic.md3_17.skin create mode 100644 models/relics/sign_swapper.tga create mode 100644 models/relics/sign_swapper_glow.tga diff --git a/models/relics/relic.md3_17.skin b/models/relics/relic.md3_17.skin new file mode 100644 index 000000000..30fba072e --- /dev/null +++ b/models/relics/relic.md3_17.skin @@ -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 index 0000000000000000000000000000000000000000..d0fbc0c01274346b8a583e7167c54128220f0f3b GIT binary patch literal 65580 zcmeI4{d3bs8pj<%!b`8mwZ{R4LP9WUN+4WQjt(yY%FuQ?2jxAG!exvh32DG-(^7{3 zDJ>8uT3MDY%d(}FY=<&8y=kvE{DrrAvt`FGS|ynh^Xw0{v|8=%_p>j0_C@mfntcV= zf00e*l5C8%|00;m9 zAOHk_01yBIKmZ5;0U!VbfB+Bx0zd!=00AHX1b_e#00KY&2mk>f00e*l5C8%|00;m9 zAOHk_01yBIKmZ5;0U!VbfB+D9JqYZ1|Mk#WP2~@>)vml2{#ylc+iM}TipbNdcBaau z*TK7WN|x`hc^#Bi)_6eTIQeMhYmMdGR8dY)V_EG+#Y>fMs2Fr5cm}>{S(weYBO=R+ zGk;llrDc3@q325W3H(0Uz99ccwJ6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u$ zE4cbRPQi_v10tkO6uij6#~3q63Ol_T;CRC`A)1{l-GkSsfBsJY`prK}1Rh|r(d1LB zM<}_nf=}9$NnAcO{TrLq^(T?Fv&WX#7S=>Zld!#4^#6g(^V?(=yVMP4b^XTdZpnq# zoB6EyL@e=M$tU5L{R?}vZrudnaD~C%xt9-Dvf71t@2#}^bj=j8ccf>EM?A;z+-2E&4?n)~KD_s-h9|!;eAOHk_01yBIKmZ5;0U!VbfB+Bx0zd!=00AHX z1b_e#00KY&2mk>f00e*l5C8%|00;m9AOHk_01yBIKmZ5;0U!VbfB+Bx0zd!=00AHX z1b_e#00KY&2mk>f00e*l5C8%|00;m9AOHk_01yBIKmZ5;0U!VbfB+Bx0zd!=0D&?B Zmo8lXr2q4apP&6=-_=h)KmAFM@BcpFq_F@1 literal 0 HcmV?d00001 diff --git a/models/relics/sign_swapper_glow.tga b/models/relics/sign_swapper_glow.tga new file mode 100644 index 0000000000000000000000000000000000000000..d0fbc0c01274346b8a583e7167c54128220f0f3b GIT binary patch literal 65580 zcmeI4{d3bs8pj<%!b`8mwZ{R4LP9WUN+4WQjt(yY%FuQ?2jxAG!exvh32DG-(^7{3 zDJ>8uT3MDY%d(}FY=<&8y=kvE{DrrAvt`FGS|ynh^Xw0{v|8=%_p>j0_C@mfntcV= zf00e*l5C8%|00;m9 zAOHk_01yBIKmZ5;0U!VbfB+Bx0zd!=00AHX1b_e#00KY&2mk>f00e*l5C8%|00;m9 zAOHk_01yBIKmZ5;0U!VbfB+D9JqYZ1|Mk#WP2~@>)vml2{#ylc+iM}TipbNdcBaau z*TK7WN|x`hc^#Bi)_6eTIQeMhYmMdGR8dY)V_EG+#Y>fMs2Fr5cm}>{S(weYBO=R+ zGk;llrDc3@q325W3H(0Uz99ccwJ6I*wY~)xc7|V$Ebv^>9v#USk)ARIYr_g+StLI! z{|IH*(-*1t$^x(O)6Qf}Ngpp2;TL(9I9~LZ`X3i%KG9L?x6;oxJQ0~>_L}4Cqdwnx zRhLhCz>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V?(=yVMP4b^XTdZpnq# zoB6EyL@e=M$tU5L{R?}vZrudnaD~C%xt9-Dvf71t@2#}^bj=j8ccf>EM?A;z+-2E&4?n)~KD_s-h9|!;eAOHk_01yBIKmZ5;0U!VbfB+Bx0zd!=00AHX z1b_e#00KY&2mk>f00e*l5C8%|00;m9AOHk_01yBIKmZ5;0U!VbfB+Bx0zd!=00AHX z1b_e#00KY&2mk>f00e*l5C8%|00;m9AOHk_01yBIKmZ5;0U!VbfB+Bx0zd!=0D&?B Zmo8lXr2q4apP&6=-_=h)KmAFM@BcpFq_F@1 literal 0 HcmV?d00001 diff --git a/mutators.cfg b/mutators.cfg index b28c359d1..5bc4c5706 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -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" diff --git a/qcsrc/common/buffs.qh b/qcsrc/common/buffs.qh index c888d27fe..685e88652 100644 --- a/qcsrc/common/buffs.qh +++ b/qcsrc/common/buffs.qh @@ -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) diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index dc8a01308..1e31cafa8 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -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 diff --git a/qcsrc/server/mutators/mutator_buffs.qc b/qcsrc/server/mutators/mutator_buffs.qc index b7d725ec7..6fda5d39f 100644 --- a/qcsrc/server/mutators/mutator_buffs.qc +++ b/qcsrc/server/mutators/mutator_buffs.qc @@ -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); diff --git a/scripts/relics.shader b/scripts/relics.shader index 1ebd9c49d..368df1919 100644 --- a/scripts/relics.shader +++ b/scripts/relics.shader @@ -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 + } +} -- 2.39.2