]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an option to make Electro combos deal damage over time instead of instantly
authorMario <mario.mario@y7mail.com>
Sun, 12 Jan 2020 19:43:21 +0000 (05:43 +1000)
committerMario <mario.mario@y7mail.com>
Sun, 12 Jan 2020 19:43:21 +0000 (05:43 +1000)
bal-wep-mario.cfg
bal-wep-nexuiz25.cfg
bal-wep-samual.cfg
bal-wep-testing.cfg
bal-wep-xdf.cfg
bal-wep-xonotic.cfg
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/electro.qh
qcsrc/server/g_damage.qc

index d3270acc83acd29cf991d547f282a43eaa3c0482..73e4f4bbc258c2bfc6e8230e23ae4b325d71b629 100644 (file)
@@ -179,8 +179,10 @@ set g_balance_minelayer_weaponthrowable 1
 set g_balance_electro_combo_comboradius 300
 set g_balance_electro_combo_comboradius_thruwall 200
 set g_balance_electro_combo_damage 50
+set g_balance_electro_combo_duration 0
 set g_balance_electro_combo_edgedamage 25
 set g_balance_electro_combo_force 120
+set g_balance_electro_combo_power 3
 set g_balance_electro_combo_radius 150
 set g_balance_electro_combo_safeammocheck 1
 set g_balance_electro_combo_speed 2000
index c9d87fd0578f32daff8750b19727a8e76d2006dc..4f9aa792623de9cebee44c32852311d5f88f8075 100644 (file)
@@ -179,8 +179,10 @@ set g_balance_minelayer_weaponthrowable 1
 set g_balance_electro_combo_comboradius 0
 set g_balance_electro_combo_comboradius_thruwall 0
 set g_balance_electro_combo_damage 80
+set g_balance_electro_combo_duration 0
 set g_balance_electro_combo_edgedamage 0
 set g_balance_electro_combo_force 200
+set g_balance_electro_combo_power 3
 set g_balance_electro_combo_radius 250
 set g_balance_electro_combo_safeammocheck 0
 set g_balance_electro_combo_speed 2000
index e32b54ff4b17e3851896ec7a40839484b1be136c..c3007e015c690faf6ddcc9cf86e73fc5ca5f01b1 100644 (file)
@@ -179,8 +179,10 @@ set g_balance_minelayer_weaponthrowable 1
 set g_balance_electro_combo_comboradius 300
 set g_balance_electro_combo_comboradius_thruwall 200
 set g_balance_electro_combo_damage 50
+set g_balance_electro_combo_duration 0
 set g_balance_electro_combo_edgedamage 25
 set g_balance_electro_combo_force 120
+set g_balance_electro_combo_power 3
 set g_balance_electro_combo_radius 150
 set g_balance_electro_combo_safeammocheck 1
 set g_balance_electro_combo_speed 2000
index 5f62ae83c7d8c69ea1aa3cf39e0e5e131bdb3b78..4da4ab66d91cc6f29f67e9ab23e8d00077878dc0 100644 (file)
@@ -179,8 +179,10 @@ set g_balance_minelayer_weaponthrowable 1
 set g_balance_electro_combo_comboradius 300
 set g_balance_electro_combo_comboradius_thruwall 200
 set g_balance_electro_combo_damage 50
+set g_balance_electro_combo_duration 0
 set g_balance_electro_combo_edgedamage 25
 set g_balance_electro_combo_force 120
+set g_balance_electro_combo_power 3
 set g_balance_electro_combo_radius 150
 set g_balance_electro_combo_safeammocheck 1
 set g_balance_electro_combo_speed 2000
index 1fe4044cab7f25ce1e1a624e1c895680224ed668..7280c5bdb471db3469e3a2e487df25c247b6f3b8 100644 (file)
@@ -179,8 +179,10 @@ set g_balance_minelayer_weaponthrowable 1
 set g_balance_electro_combo_comboradius 275
 set g_balance_electro_combo_comboradius_thruwall 200
 set g_balance_electro_combo_damage 50
+set g_balance_electro_combo_duration 0
 set g_balance_electro_combo_edgedamage 25
 set g_balance_electro_combo_force 120
+set g_balance_electro_combo_power 3
 set g_balance_electro_combo_radius 175
 set g_balance_electro_combo_safeammocheck 1
 set g_balance_electro_combo_speed 2000
index 52d63dfa2bbcd26332d1d551b05778f8a536cd67..5f9f754c27288ea429f00a79de65148ee42fa1d4 100644 (file)
@@ -179,8 +179,10 @@ set g_balance_minelayer_weaponthrowable 1
 set g_balance_electro_combo_comboradius 300
 set g_balance_electro_combo_comboradius_thruwall 200
 set g_balance_electro_combo_damage 50
+set g_balance_electro_combo_duration 0
 set g_balance_electro_combo_edgedamage 25
 set g_balance_electro_combo_force 120
+set g_balance_electro_combo_power 3
 set g_balance_electro_combo_radius 150
 set g_balance_electro_combo_safeammocheck 1
 set g_balance_electro_combo_speed 2000
index 2ba6b5da18628bc669f6de77668c32c23738ea11..f1cc5ba153cd7494ec83b48f8421ed504b575262 100644 (file)
@@ -49,12 +49,50 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own)
        }
 }
 
+void W_Electro_ExplodeComboThink(entity this)
+{
+       float dt = time - this.teleport_time;
+       float dmg_remaining_next = (bound(0, 1 - dt / this.dmg_duration, 1) ** this.dmg_power);
+
+       float f = this.dmg_last - dmg_remaining_next;
+       this.dmg_last = dmg_remaining_next;
+
+       RadiusDamage(this, this.realowner, this.dmg * f, this.dmg_edge * f, this.dmg_radius, NULL, NULL, this.dmg_force * f, this.projectiledeathtype, this.weaponentity_fld, NULL);
+       this.projectiledeathtype |= HITTYPE_BOUNCE; // ensure it doesn't spam its effect
+
+       if(dt < this.dmg_duration)
+               this.nextthink = time + 0.05; // soon
+       else
+               delete(this);
+}
+
 void W_Electro_ExplodeCombo(entity this)
 {
        W_Electro_TriggerCombo(this.origin, WEP_CVAR(electro, combo_comboradius), this.realowner);
 
        this.event_damage = func_null;
 
+       if(WEP_CVAR(electro, combo_duration))
+       {
+               this.projectiledeathtype = WEP_ELECTRO.m_id | HITTYPE_SPLASH;
+               this.event_damage = func_null;
+               settouch(this, func_null);
+               this.effects |= EF_NODRAW;
+
+               setthink(this, W_Electro_ExplodeComboThink);
+               this.nextthink = time;
+               this.dmg = WEP_CVAR(electro, combo_damage);
+               this.dmg_edge = WEP_CVAR(electro, combo_edgedamage);
+               this.dmg_radius = WEP_CVAR(electro, combo_radius);
+               this.dmg_force = WEP_CVAR(electro, combo_force);
+               this.dmg_power = WEP_CVAR(electro, combo_power);
+               this.dmg_duration = WEP_CVAR(electro, combo_duration);
+               this.teleport_time = time;
+               this.dmg_last = 1;
+               set_movetype(this, MOVETYPE_NONE);
+               return;
+       }
+
        RadiusDamage(
                this,
                this.realowner,
@@ -551,7 +589,14 @@ METHOD(Electro, wr_impacteffect, void(entity thiswep, entity actor))
     }
     else
     {
-        if(w_deathtype & HITTYPE_BOUNCE)
+       if(w_deathtype & HITTYPE_SPLASH)
+       {
+               org2 = w_org + w_backoff * 2;
+            pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
+            if(!w_issilent)
+                sound(actor, CH_SHOTS, SND_ELECTRO_IMPACT_COMBO, VOL_BASE, ATTEN_NORM);
+       }
+        else if(w_deathtype & HITTYPE_BOUNCE)
         {
             // this is sent as "primary (w_deathtype & HITTYPE_BOUNCE)" to distinguish it from (w_deathtype & HITTYPE_SECONDARY) bounced balls
             pointparticles(EFFECT_ELECTRO_COMBO, org2, '0 0 0', 1);
index 7dbed189b095e297a6a2805f1df2dda980c36045..d081f15bf0dd051820412dcb9b7a0c022e7195f5 100644 (file)
@@ -4,7 +4,7 @@ CLASS(Electro, Weapon)
 /* spawnfunc */ ATTRIB(Electro, m_canonical_spawnfunc, string, "weapon_electro");
 /* ammotype  */ ATTRIB(Electro, ammo_type, int, RES_CELLS);
 /* impulse   */ ATTRIB(Electro, impulse, int, 5);
-/* flags     */ ATTRIB(Electro, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
+/* flags     */ ATTRIB(Electro, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(Electro, bot_pickupbasevalue, float, 5000);
 /* color     */ ATTRIB(Electro, wpcolor, vector, '0 0.5 1');
 /* modelname */ ATTRIB(Electro, mdl, string, "electro");
@@ -27,9 +27,11 @@ CLASS(Electro, Weapon)
                P(class, prefix, combo_comboradius, float, NONE) \
                P(class, prefix, combo_comboradius_thruwall, float, NONE) \
                P(class, prefix, combo_damage, float, NONE) \
+               P(class, prefix, combo_duration, float, NONE) \
                P(class, prefix, combo_edgedamage, float, NONE) \
                P(class, prefix, combo_force, float, NONE) \
                P(class, prefix, combo_radius, float, NONE) \
+               P(class, prefix, combo_power, float, NONE) \
                P(class, prefix, combo_safeammocheck, float, NONE) \
                P(class, prefix, combo_speed, float, NONE) \
                P(class, prefix, count, float, SEC) \
@@ -70,6 +72,14 @@ REGISTER_WEAPON(ELECTRO, electro, NEW(Electro));
 SPAWNFUNC_WEAPON(weapon_electro, WEP_ELECTRO)
 
 #ifdef SVQC
+.float dmg;
+.float dmg_edge;
+.float dmg_radius;
+.float dmg_force;
+.float dmg_power;
+.float dmg_duration;
+.float dmg_last;
+
 .float electro_count;
 .float electro_secondarytime;
 void W_Electro_ExplodeCombo(entity this);
index e14ecd6ce7808ebeeca7dd436dc1aa4d41db2127..ec89e3b3f5f43a667abe5d215664e2d7b0d30cb4 100644 (file)
@@ -887,7 +887,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
 
        total_damage_to_creatures = 0;
 
-       if(deathtype != (WEP_HOOK.m_id | HITTYPE_SECONDARY | HITTYPE_BOUNCE)) // only send gravity bomb damage once
+       if(deathtype != (WEP_HOOK.m_id | HITTYPE_SECONDARY | HITTYPE_BOUNCE) && deathtype != (WEP_ELECTRO.m_id | HITTYPE_BOUNCE | HITTYPE_SPLASH)) // only send damage over time bombs once
                if(DEATH_WEAPONOF(deathtype) != WEP_TUBA) // do not send tuba damage (bandwidth hog)
                {
                        force = inflictorvelocity;