]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
New electricity effect
authorLegendaryGuard <rootuser999@gmail.com>
Tue, 2 May 2023 16:58:00 +0000 (16:58 +0000)
committerterencehill <piuntn@gmail.com>
Tue, 2 May 2023 16:58:00 +0000 (16:58 +0000)
qcsrc/client/csqcmodel_hooks.qc
qcsrc/common/constants.qh
qcsrc/common/effects/all.inc
qcsrc/common/mutators/mutator/buffs/all.inc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/status_effects/status_effect/_mod.inc
qcsrc/common/mutators/mutator/status_effects/status_effect/_mod.qh
qcsrc/common/mutators/mutator/status_effects/status_effect/stunned.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/status_effects/status_effect/stunned.qh [new file with mode: 0644]

index 0565c9d86630484edfb9f5a084e3798dab5f6e08..78b84fdea6f3da3801773ede0622c4bbd6207cb5 100644 (file)
@@ -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);
index e0c17a7a128a0e623be23e7048a6afd4bec0e108..18e4e6100142b9c4ee73c3fb27ab94ec61481db3 100644 (file)
@@ -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)
index 60f33f38ec4a5dfbc9e4bb1c500011a8685ae47b..179d96224ed5109a764cef8570e8217fab7a4f24 100644 (file)
@@ -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")
index 92602d892d03d290f052f92bbc06db0cf3254380..a5127a1539818e44d7c48e86cf244262b402d9dc 100644 (file)
@@ -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"));
index 6ce016e5681046730193233a5c281c1b7a835165..367277e7f2159acb1adfca535c686131a79a0e00 100644 (file)
@@ -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;
 }
 
index 6fa2ed024de20c8f200b2dbb0e721824eeba20a1..481f00daf9e791a6cdd2e80114e026545590f090 100644 (file)
@@ -1,4 +1,5 @@
 // generated file; do not modify
 #include <common/mutators/mutator/status_effects/status_effect/burning.qc>
 #include <common/mutators/mutator/status_effects/status_effect/spawnshield.qc>
+#include <common/mutators/mutator/status_effects/status_effect/stunned.qc>
 #include <common/mutators/mutator/status_effects/status_effect/superweapons.qc>
index feaa8a19d61b812ca1b4e68fcd65e1d0cd35f3b8..07b825d4a2e76c7b2856196816156dde0460d86b 100644 (file)
@@ -1,4 +1,5 @@
 // generated file; do not modify
 #include <common/mutators/mutator/status_effects/status_effect/burning.qh>
 #include <common/mutators/mutator/status_effects/status_effect/spawnshield.qh>
+#include <common/mutators/mutator/status_effects/status_effect/stunned.qh>
 #include <common/mutators/mutator/status_effects/status_effect/superweapons.qh>
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 (file)
index 0000000..f16fb39
--- /dev/null
@@ -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 (file)
index 0000000..1acf49c
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <common/mutators/mutator/status_effects/all.qh>
+
+#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));