X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmutators%2Fmutator%2Fnades%2Fnades.qc;h=dbd04a70acc9af324cdd06371a52768855e083ff;hb=cdfb5ccac250aac0633253e0f384e01f56a55bb6;hp=d1acb8b4dcab85789958ae9a05cfe56a0e09d7ba;hpb=224f6d8084e73e0e643cb2d9d58c466defa9d134;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 d1acb8b4d..dbd04a70a 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -38,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; @@ -50,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) @@ -98,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; @@ -372,11 +380,11 @@ void nade_napalm_boom(entity this) CSQCProjectile(fountain, true, PROJECTILE_NAPALM_FOUNTAIN, true); } -void nade_ice_freeze(entity freezefield, entity frost_target, float freeze_time) +void nade_ice_freeze(entity freezefield, entity frost_target, float freezetime) { frost_target.frozen_by = freezefield.realowner; Send_Effect(EFFECT_ELECTRO_IMPACT, frost_target.origin, '0 0 0', 1); - Freeze(frost_target, 1/freeze_time, 3, false); + Freeze(frost_target, 1 / freezetime, 3, false); Drop_Special_Items(frost_target); } @@ -667,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; @@ -707,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); @@ -738,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, @@ -1058,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), ""); @@ -1068,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; @@ -1208,7 +1253,7 @@ MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST) { entity player = M_ARGV(0, entity); - if (player.offhand != OFFHAND_NADE || (player.weapons & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) { + if (player.offhand != OFFHAND_NADE || (STAT(WEAPONS, player) & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) { nades_CheckThrow(player); return true; } @@ -1220,7 +1265,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) if (!IS_PLAYER(player)) { return; } - if (player.nade && (player.offhand != OFFHAND_NADE || (player.weapons & WEPSET(HOOK)))) OFFHAND_NADE.offhand_think(OFFHAND_NADE, player, player.nade_altbutton); + if (player.nade && (player.offhand != OFFHAND_NADE || (STAT(WEAPONS, player) & WEPSET(HOOK)))) OFFHAND_NADE.offhand_think(OFFHAND_NADE, player, player.nade_altbutton); entity held_nade = player.nade; if (held_nade) @@ -1273,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; @@ -1333,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) @@ -1406,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); @@ -1471,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");