From: LegendaryGuard Date: Tue, 2 May 2023 16:58:00 +0000 (+0000) Subject: New electricity effect X-Git-Tag: xonotic-v0.8.6~124^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c932f01f1839e1a0c79d75c6fb453f849cbe4076;p=xonotic%2Fxonotic-data.pk3dir.git New electricity effect --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 0565c9d86..78b84fdea 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -571,6 +571,11 @@ void CSQCModel_Effects_Apply(entity this) boxparticles(particleeffectnum(EFFECT_EF_FLAME), this, this.absmin, this.absmax, this.velocity, this.velocity, bound(0, frametime, 0.1), 0); //pointparticles(EFFECT_EF_FLAME, this.origin, '0 0 0', bound(0, frametime, 0.1)); } + if(eff & EF_SHOCK) + { + boxparticles(particleeffectnum(EFFECT_ARC_LIGHTNING), this, this.absmin, this.absmax, '0 0 0', '0 0 0', bound(0, frametime, 0.1), 0); + //pointparticles(EFFECT_ARC_LIGHTNING, this.origin, '0 0 0', bound(0, frametime, 0.1)); + } if(eff & EF_STARDUST) { boxparticles(particleeffectnum(EFFECT_EF_STARDUST), this, this.absmin, this.absmax, this.velocity, this.velocity, bound(0, frametime, 0.1), 0); diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index e0c17a7a1..18e4e6100 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -96,6 +96,9 @@ const int INITPRIO_DROPTOFLOOR = 20; const int INITPRIO_SETLOCATION = 90; const int INITPRIO_LINKDOORS = 91; const int INITPRIO_LAST = 99; + +// effects +const int EF_SHOCK = 262144; #endif #if defined(SVQC) diff --git a/qcsrc/common/effects/all.inc b/qcsrc/common/effects/all.inc index 60f33f38e..179d96224 100644 --- a/qcsrc/common/effects/all.inc +++ b/qcsrc/common/effects/all.inc @@ -252,6 +252,7 @@ EFFECT(0, SMOKE_RING, "smoke_ring") EFFECT(0, JUMPPAD, "jumppad_activate") EFFECT(1, BULLET, "tr_bullet") EFFECT(1, BULLET_WEAK, "tr_bullet_weak") +EFFECT(0, EF_SHOCK, "arc_lightning") EFFECT(0, EF_FLAME, "EF_FLAME") EFFECT(0, EF_STARDUST, "EF_STARDUST") EFFECT(0, TE_EXPLOSION, "TE_EXPLOSION") diff --git a/qcsrc/common/mutators/mutator/buffs/all.inc b/qcsrc/common/mutators/mutator/buffs/all.inc index 92602d892..a5127a153 100644 --- a/qcsrc/common/mutators/mutator/buffs/all.inc +++ b/qcsrc/common/mutators/mutator/buffs/all.inc @@ -80,21 +80,6 @@ CLASS(DisabilityBuff, Buff) ENDCLASS(DisabilityBuff) REGISTER_BUFF(DISABILITY, NEW(DisabilityBuff)); BUFF_SPAWNFUNCS(disability, BUFF_DISABILITY) -// status effect applied to targets by the disability buff -CLASS(Disabled, StatusEffects) - ATTRIB(Disabled, netname, string, "disabled"); -#if 0 - // NOTE: status effect name and icon disabled as they are not displayed - // re-enable if status effects are given a visual element - ATTRIB(Disabled, m_name, string, _("Disabled")); - ATTRIB(Disabled, m_icon, string, "buff_disability"); -#endif - ATTRIB(Disabled, m_color, vector, '0.94 0.3 1'); - ATTRIB(Disabled, m_hidden, bool, true); - ATTRIB(Disabled, m_lifetime, float, 10); - ATTRIB(Disabled, disabled_effect_time, float, 0); // TODO: handle this effect client side like EF_FLAME! -ENDCLASS(Disabled) -REGISTER_STATUSEFFECT(Disabled, NEW(Disabled)); CLASS(VengeanceBuff, Buff) ATTRIB(VengeanceBuff, m_name, string, _("Vengeance")); diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 6ce016e56..367277e7f 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -535,21 +535,6 @@ METHOD(Buff, m_remove, void(StatusEffects this, entity actor, int removal_type)) SUPER(Buff).m_remove(this, actor, removal_type); } -METHOD(Disabled, m_tick, void(StatusEffects this, entity actor)) -{ - if(time >= actor.disabled_effect_time) - { - Send_Effect(EFFECT_SMOKING, actor.origin + ((actor.mins + actor.maxs) * 0.5), '0 0 0', 1); - actor.disabled_effect_time = time + 0.5; - } - SUPER(Disabled).m_tick(this, actor); -} -METHOD(Disabled, m_remove, void(StatusEffects this, entity actor, int removal_type)) -{ - actor.disabled_effect_time = 0; - SUPER(Disabled).m_remove(this, actor, removal_type); -} - METHOD(AmmoBuff, m_apply, void(StatusEffects this, entity actor, float eff_time, float eff_flags)) { bool wasactive = (actor.statuseffects && (actor.statuseffects.statuseffect_flags[this.m_id] & STATUSEFFECT_FLAG_ACTIVE)); @@ -709,7 +694,7 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate) if(StatusEffects_active(BUFF_DISABILITY, frag_attacker)) if(frag_target != frag_attacker) - StatusEffects_apply(STATUSEFFECT_Disabled, frag_target, time + autocvar_g_buffs_disability_slowtime, 0); + StatusEffects_apply(STATUSEFFECT_Stunned, frag_target, time + autocvar_g_buffs_disability_slowtime, 0); if(StatusEffects_active(BUFF_INFERNO, frag_target)) { @@ -763,7 +748,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPhysics_UpdateStats) entity player = M_ARGV(0, entity); // these automatically reset, no need to worry - if(StatusEffects_active(STATUSEFFECT_Disabled, player)) + if(StatusEffects_active(STATUSEFFECT_Stunned, player)) STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_buffs_disability_speed; } @@ -780,7 +765,7 @@ MUTATOR_HOOKFUNCTION(buffs, MonsterMove) { entity mon = M_ARGV(0, entity); - if(StatusEffects_active(STATUSEFFECT_Disabled, mon)) + if(StatusEffects_active(STATUSEFFECT_Stunned, mon)) { M_ARGV(1, float) *= autocvar_g_buffs_disability_speed; // run speed M_ARGV(2, float) *= autocvar_g_buffs_disability_speed; // walk speed @@ -917,7 +902,7 @@ MUTATOR_HOOKFUNCTION(buffs, WeaponRateFactor) { entity player = M_ARGV(1, entity); - if(StatusEffects_active(STATUSEFFECT_Disabled, player)) + if(StatusEffects_active(STATUSEFFECT_Stunned, player)) M_ARGV(0, float) *= autocvar_g_buffs_disability_rate; } @@ -925,7 +910,7 @@ MUTATOR_HOOKFUNCTION(buffs, WeaponSpeedFactor) { entity player = M_ARGV(1, entity); - if(StatusEffects_active(STATUSEFFECT_Disabled, player)) + if(StatusEffects_active(STATUSEFFECT_Stunned, player)) M_ARGV(0, float) *= autocvar_g_buffs_disability_weaponspeed; } diff --git a/qcsrc/common/mutators/mutator/status_effects/status_effect/_mod.inc b/qcsrc/common/mutators/mutator/status_effects/status_effect/_mod.inc index 6fa2ed024..481f00daf 100644 --- a/qcsrc/common/mutators/mutator/status_effects/status_effect/_mod.inc +++ b/qcsrc/common/mutators/mutator/status_effects/status_effect/_mod.inc @@ -1,4 +1,5 @@ // generated file; do not modify #include #include +#include #include diff --git a/qcsrc/common/mutators/mutator/status_effects/status_effect/_mod.qh b/qcsrc/common/mutators/mutator/status_effects/status_effect/_mod.qh index feaa8a19d..07b825d4a 100644 --- a/qcsrc/common/mutators/mutator/status_effects/status_effect/_mod.qh +++ b/qcsrc/common/mutators/mutator/status_effects/status_effect/_mod.qh @@ -1,4 +1,5 @@ // generated file; do not modify #include #include +#include #include diff --git a/qcsrc/common/mutators/mutator/status_effects/status_effect/stunned.qc b/qcsrc/common/mutators/mutator/status_effects/status_effect/stunned.qc new file mode 100644 index 000000000..f16fb39a8 --- /dev/null +++ b/qcsrc/common/mutators/mutator/status_effects/status_effect/stunned.qc @@ -0,0 +1,27 @@ +#include "stunned.qh" + +#ifdef SVQC +METHOD(Stunned, m_remove, void(StatusEffects this, entity actor, int removal_type)) +{ + actor.effects &= ~EF_SHOCK; + SUPER(Stunned).m_remove(this, actor, removal_type); +} +#if 0 +// TODO: some infinite source of stunning? e.g. some electric current +METHOD(Stunned, m_persistent, bool(StatusEffects this, entity actor)) +{ + return true; +} +#endif +METHOD(Stunned, m_tick, void(StatusEffects this, entity actor)) +{ + if(STAT(FROZEN, actor)) + { + this.m_remove(this, actor, STATUSEFFECT_REMOVE_NORMAL); + return; + } + //Shock_ApplyDamage(actor); + actor.effects |= EF_SHOCK; + SUPER(Stunned).m_tick(this, actor); +} +#endif diff --git a/qcsrc/common/mutators/mutator/status_effects/status_effect/stunned.qh b/qcsrc/common/mutators/mutator/status_effects/status_effect/stunned.qh new file mode 100644 index 000000000..1acf49c12 --- /dev/null +++ b/qcsrc/common/mutators/mutator/status_effects/status_effect/stunned.qh @@ -0,0 +1,26 @@ +#pragma once + +#include + +#ifdef SVQC +//void Shock_ApplyDamage(entity e); +#endif +#ifdef GAMEQC +SOUND(Stunned_Remove, "onslaught/ons_spark1"); +#endif +CLASS(Stunned, StatusEffects) + ATTRIB(Stunned, netname, string, "stunned"); +#if 0 + // NOTE: status effect name and icon disabled as they are not displayed + // re-enable if status effects are given a visual element + ATTRIB(Stunned, m_name, string, _("Stunned")); + ATTRIB(Stunned, m_icon, string, "buff_disability"); +#endif + ATTRIB(Stunned, m_color, vector, '0.67 0.84 1'); + ATTRIB(Stunned, m_hidden, bool, true); + ATTRIB(Stunned, m_lifetime, float, 10); +#ifdef GAMEQC + ATTRIB(Stunned, m_sound_rm, Sound, SND_Stunned_Remove); +#endif +ENDCLASS(Stunned) +REGISTER_STATUSEFFECT(Stunned, NEW(Stunned));