X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Fnades%2Fnades.qc;h=9e0f50d925875eca3575cd78d9993b58d4ef6bdc;hb=f41f81f37e3ecf5a2d14f7bc7ffd7bbf09fff32e;hp=24149ad7fce9430ca89000e777d20a3939f25fe6;hpb=0d38479326431a2dacf0b20112d89f95904f78b5;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 24149ad7f..9e0f50d92 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -1,5 +1,7 @@ #include "nades.qh" +#include "../overkill/okmachinegun.qh" + #ifdef SVQC bool autocvar_g_nades_nade_small; float autocvar_g_nades_spread = 0.04; @@ -36,6 +38,7 @@ entity Nade_TrailEffect(int proj, int nade_team) REGISTER_MUTATOR(cl_nades, true); MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay) { + // TODO: make a common orb state! if (STAT(HEALING_ORB) > time) { M_ARGV(0, vector) = NADE_TYPE_HEAL.m_color; @@ -48,6 +51,12 @@ MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay) M_ARGV(1, float) = STAT(ENTRAP_ORB_ALPHA); return true; } + if (STAT(VEIL_ORB) > time) + { + M_ARGV(0, vector) = NADE_TYPE_VEIL.m_color; + M_ARGV(1, float) = STAT(VEIL_ORB_ALPHA); + return true; + } return false; } MUTATOR_HOOKFUNCTION(cl_nades, Ent_Projectile) @@ -96,6 +105,7 @@ MUTATOR_HOOKFUNCTION(cl_nades, EditProjectile) settouch(proj, func_null); proj.scale = 1.5; proj.avelocity = randomvec() * 720; + proj.alphamod = nade_type.m_alpha; if (nade_type == NADE_TYPE_TRANSLOCATE || nade_type == NADE_TYPE_SPAWN) proj.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP; @@ -665,6 +675,35 @@ void nade_monster_boom(entity this) e.monster_skill = MONSTER_SKILL_INSANE; } +void nade_veil_touch(entity this, entity toucher) +{ + if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) || IS_MONSTER(toucher) ) + { + entity show_tint = (IS_VEHICLE(toucher)) ? toucher.owner : toucher; + + float tint_alpha = 0.75; + if(SAME_TEAM(toucher, this.realowner)) + { + tint_alpha = 0.45; + if(!STAT(VEIL_ORB, show_tint)) + { + toucher.nade_veil_prevalpha = toucher.alpha; + toucher.alpha = -1; + } + } + STAT(VEIL_ORB, show_tint) = time + 0.1; + STAT(VEIL_ORB_ALPHA, show_tint) = tint_alpha * (this.ltime - time) / this.orb_lifetime; + } +} + +void nade_veil_boom(entity this) +{ + entity orb = nades_spawn_orb(this.owner, this.realowner, this.origin, autocvar_g_nades_veil_time, autocvar_g_nades_veil_radius); + + settouch(orb, nade_veil_touch); + orb.colormod = NADE_TYPE_VEIL.m_color; +} + void nade_boom(entity this) { entity expef = NULL; @@ -705,6 +744,11 @@ void nade_boom(entity this) expef = EFFECT_SPAWN_YELLOW; break; + case NADE_TYPE_VEIL: + nade_blast = false; + expef = EFFECT_SPAWN_NEUTRAL; + break; + default: case NADE_TYPE_NORMAL: expef = EFFECT_NADE_EXPLODE(this.realowner.team); @@ -736,6 +780,7 @@ void nade_boom(entity this) case NADE_TYPE_HEAL: nade_heal_boom(this); break; case NADE_TYPE_MONSTER: nade_monster_boom(this); break; case NADE_TYPE_ENTRAP: nade_entrap_boom(this); break; + case NADE_TYPE_VEIL: nade_veil_boom(this); break; } IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this, @@ -838,12 +883,12 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i force *= 0.5; // too much damage = 0; } - else if(DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER)) + else if(DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER) || DEATH_ISWEAPON(deathtype, WEP_OVERKILL_NEX)) { force *= 6; damage = this.max_health * 0.55; } - else if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN)) + else if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN) || DEATH_ISWEAPON(deathtype, WEP_OVERKILL_MACHINEGUN)) damage = this.max_health * 0.1; else if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN)) // WEAPONTODO { @@ -1056,6 +1101,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin n.projectiledeathtype = DEATH_NADE.m_id; n.weaponentity_fld = weaponentity; n.nade_lifetime = ntime; + n.alpha = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_alpha; setmodel(fn, MDL_NADE_VIEW); setattachment(fn, player.(weaponentity), ""); @@ -1066,6 +1112,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin setthink(fn, SUB_Remove); fn.nextthink = n.wait; fn.weaponentity_fld = weaponentity; + fn.alpha = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_alpha; player.nade = n; player.fake_nade = fn; @@ -1271,6 +1318,15 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) { STAT(NADE_BONUS, player) = STAT(NADE_BONUS_SCORE, player) = 0; } + + if(STAT(VEIL_ORB, player) && STAT(VEIL_ORB, player) <= time) + { + STAT(VEIL_ORB, player) = 0; + if(player.vehicle) + player.vehicle.alpha = player.vehicle.nade_veil_prevalpha; + else + player.alpha = player.nade_veil_prevalpha; + } } int n = 0; @@ -1331,6 +1387,12 @@ MUTATOR_HOOKFUNCTION(nades, MonsterMove) M_ARGV(1, float) *= autocvar_g_nades_entrap_speed; // run speed M_ARGV(2, float) *= autocvar_g_nades_entrap_speed; // walk speed } + + if (STAT(VEIL_ORB, mon) && STAT(VEIL_ORB, mon) <= time) + { + mon.alpha = mon.nade_veil_prevalpha; + STAT(VEIL_ORB, mon) = 0; + } } MUTATOR_HOOKFUNCTION(nades, PlayerSpawn) @@ -1404,10 +1466,7 @@ MUTATOR_HOOKFUNCTION(nades, Damage_Calculate) entity frag_target = M_ARGV(2, entity); float frag_deathtype = M_ARGV(3, float); - if(STAT(FROZEN, frag_target)) - if(autocvar_g_freezetag_revive_nade) - if(frag_attacker == frag_target) - if(frag_deathtype == DEATH_NADE.m_id) + if(autocvar_g_freezetag_revive_nade && STAT(FROZEN, frag_target) && frag_attacker == frag_target && frag_deathtype == DEATH_NADE.m_id) if(time - frag_inflictor.toss_time <= 0.1) { Unfreeze(frag_target); @@ -1469,6 +1528,8 @@ MUTATOR_HOOKFUNCTION(nades, SpectateCopy) STAT(HEALING_ORB_ALPHA, client) = STAT(HEALING_ORB_ALPHA, spectatee); STAT(ENTRAP_ORB, client) = STAT(ENTRAP_ORB, spectatee); STAT(ENTRAP_ORB_ALPHA, client) = STAT(ENTRAP_ORB_ALPHA, spectatee); + STAT(VEIL_ORB, client) = STAT(VEIL_ORB, spectatee); + STAT(VEIL_ORB_ALPHA, client) = STAT(VEIL_ORB_ALPHA, spectatee); } REPLICATE(cvar_cl_nade_type, int, "cl_nade_type");