From: Mario Date: Fri, 13 Mar 2015 18:06:01 +0000 (+1100) Subject: Swapper buff: press dropweapon to swap places with a nearby enemy. Icon by Melanosuchus X-Git-Tag: xonotic-v0.8.1~18^2~18 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ec0035789475e48a58a22df279c7cb1099454afd;p=xonotic%2Fxonotic-data.pk3dir.git Swapper buff: press dropweapon to swap places with a nearby enemy. Icon by Melanosuchus --- 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 000000000..d0fbc0c01 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 index 000000000..d0fbc0c01 Binary files /dev/null and b/models/relics/sign_swapper_glow.tga differ 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 + } +}