]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an option for Electro combos to deal damage over time
authorMario <mario.mario@y7mail.com>
Sat, 30 Nov 2024 10:04:31 +0000 (10:04 +0000)
committerterencehill <piuntn@gmail.com>
Sat, 30 Nov 2024 10:04:31 +0000 (10:04 +0000)
Minor tweak to the combo particle effect to give it a more pronounced border

.gitlab-ci.yml
bal-wep-mario.cfg
bal-wep-nexuiz25.cfg
bal-wep-samual.cfg
bal-wep-xdf.cfg
bal-wep-xonotic.cfg
effectinfo.txt
qcsrc/common/effects/effectinfo.inc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/electro.qh
testing.cfg

index ce1123086c1f4a1c3a176d38ea4f2add5037f739..48674649a0124bd09d60271f76a0c413ce26447d 100644 (file)
@@ -36,7 +36,7 @@ test_compilation_units:
 test_sv_game:
   stage: test
   script:
-    - export EXPECT=4e959184d76f77e368ab5bf445c63cc9
+    - export EXPECT=ee6d65824c57cb6d83cba31481a21822
     - qcsrc/tools/sv_game-hashtest.sh
     - exit $?
 
index 6a2462d33534da2164a367b58bb07c358fd72c1d..52064e643fb6670ca5ae6523ff467b03e37f1cd4 100644 (file)
@@ -180,6 +180,7 @@ 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 1.5
 set g_balance_electro_combo_edgedamage 25
 set g_balance_electro_combo_force 120
 set g_balance_electro_combo_radius 150
index bfd58cf1769c09ee0e7069aa86ee3a171b8974b1..ac371ae2942a93556ab38191320579837983af6f 100644 (file)
@@ -180,6 +180,7 @@ 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_radius 250
index dd555810a2f35eb65a07cc666995696d5bb2f882..802e531786fadf95afde17029fef52d5e7a67983 100644 (file)
@@ -180,6 +180,7 @@ 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_radius 150
index 0782260f44139370ff6a0b385790fd13dfc5e437..aaf84f179481c3ac542e4616cfa137e55a5b233f 100644 (file)
@@ -180,6 +180,7 @@ 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_radius 175
index e049ad22b3d263312a8ef2a659458f62dd446891..ffce5ece723874d1600ae700289eb48065a00486 100644 (file)
@@ -180,6 +180,7 @@ 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_radius 150
index da8070787f82a6b2ee47574e1174fbb10761a7b3..8e3230d66464afc4ed03dc3a49b79183b97737c2 100644 (file)
@@ -1318,7 +1318,7 @@ effect electro_combo
 effect electro_combo
        type static
        airfriction 6
-       alpha 156 156 156
+       alpha 156 156 100
        bounce 2
        color 0x2030FF 0x80C0FF
        count 5
@@ -1329,17 +1329,17 @@ effect electro_combo
        velocityjitter 512 512 512
 effect electro_combo
        type spark
-       alpha 444 512 700
+       alpha 444 512 500
        bounce 1.600000
        color 0xa9cacf 0x0054ff
        count 32
-       gravity 0.300000
        originjitter 1 1 1
        size 2 4
        stretchfactor 2
        tex 41 41
-       velocityjitter 312 312 312
-       velocitymultiplier 3
+       velocityjitter 128 128 128
+       velocitymultiplier 0.300000
+       rotate -180 180 4000 -4000
 effect electro_combo
        type smoke
        alpha 256 256 256
@@ -1351,11 +1351,10 @@ effect electro_combo
        velocityjitter 32 32 32
 effect electro_combo
        type smoke
-       alpha 40 40 100
+       alpha 64 64 40
        color 0xa9cacf 0x0054ff
        countabsolute 1
-       sizeincrease 600
-       size 30 30
+       size 120 120
        tex 33 33
        velocitymultiplier 0.300000
 effect crylink_muzzleflash
index 7e8a06365941a8493cbaf67d6cb25b6b7d5dafe5..ad2800bb82fa83032bce5537827d29ee64ab7799 100644 (file)
@@ -2203,12 +2203,11 @@ SUB(electro_combo) {
 SUB(electro_combo) {
        MY(alpha_min) = 444;
        MY(alpha_max) = 512;
-       MY(alpha_fade) = 700;
+       MY(alpha_fade) = 500;
        MY(bounce) = 1.600000;
        MY(color_min) = "0xa9cacf";
        MY(color_max) = "0x0054ff";
        MY(count) = 32;
-       MY(gravity) = 0.300000;
        MY(originjitter) = '1.0 1.0 1.0';
        MY(size_min) = 2;
        MY(size_max) = 4;
@@ -2216,8 +2215,8 @@ SUB(electro_combo) {
        MY(tex_min) = 41;
        MY(tex_max) = 41;
        MY(type) = "spark";
-       MY(velocityjitter) = '312.0 312.0 312.0';
-       MY(velocitymultiplier) = 3;
+       MY(velocityjitter) = '128.0 128.0 128.0';
+       MY(velocitymultiplier) = 0.300000;
 }
 // inner cloud of smoke
 SUB(electro_combo) {
@@ -2236,15 +2235,14 @@ SUB(electro_combo) {
 }
 // shockwave
 SUB(electro_combo) {
-       MY(alpha_min) = 40;
-       MY(alpha_max) = 40;
-       MY(alpha_fade) = 100;
+       MY(alpha_min) = 64;
+       MY(alpha_max) = 64;
+       MY(alpha_fade) = 40;
        MY(color_min) = "0xa9cacf";
        MY(color_max) = "0x0054ff";
        MY(countabsolute) = 1;
-       MY(sizeincrease) = 600;
-       MY(size_min) = 30;
-       MY(size_max) = 30;
+       MY(size_min) = 120;
+       MY(size_max) = 120;
        MY(tex_min) = 33;
        MY(tex_max) = 33;
        MY(type) = "smoke";
index 8d4b85628808aa47903760a9a4187c9ef97a6fe2..cf67708f4bdf971eb43fc73023fc8e7f92f64b43 100644 (file)
@@ -1,5 +1,76 @@
 #include "electro.qh"
 
+#ifdef GAMEQC
+
+#ifdef CSQC
+
+.float ltime;
+void electro_orb_draw(entity this)
+{
+       float dt = time - this.move_time;
+       this.move_time = time;
+       if(dt <= 0)
+               return;
+
+       float myscale = bound(0, (this.ltime - time) * 4, 1);
+       this.scale = (WEP_CVAR(WEP_ELECTRO, combo_radius) * 0.05) * myscale;
+       this.angles = this.angles + dt * this.avelocity;
+}
+
+void electro_orb_setup(entity e)
+{
+       setmodel(e, MDL_PROJECTILE_ELECTRO);
+       setsize(e, '-4 -4 -4', '4 4 4');
+
+       setorigin(e, e.origin);
+
+       e.draw = electro_orb_draw;
+       IL_PUSH(g_drawables, e);
+       SetResourceExplicit(e, RES_HEALTH, 255);
+       set_movetype(e, MOVETYPE_NONE);
+       e.solid = SOLID_NOT;
+       e.avelocity = '7 0 11';
+       e.drawmask = MASK_NORMAL;
+       e.alpha = 0.7;
+}
+#endif
+
+REGISTER_NET_LINKED(Electro_Orb)
+
+#ifdef CSQC
+NET_HANDLE(Electro_Orb, bool isNew)
+{
+       Net_Accept(Electro_Orb);
+       int sf = ReadByte();
+       if (sf & 1) {
+               this.origin = ReadVector();
+               setorigin(this, this.origin);
+               this.ltime = time + ReadByte()/10.0;
+               // this.ltime = time + this.orb_lifetime;
+               electro_orb_setup(this);
+       }
+       return true;
+}
+#endif
+
+#ifdef SVQC
+bool electro_orb_send(entity this, entity to, int sf)
+{
+       int channel = MSG_ENTITY;
+       WriteHeader(channel, Electro_Orb);
+       WriteByte(channel, sf);
+       if (sf & 1) {
+               WriteVector(channel, this.origin);
+
+               // round time delta to a 1/10th of a second
+               WriteByte(channel, (this.ltime - time)*10.0+0.5);
+       }
+       return true;
+}
+#endif
+
+#endif
+
 #ifdef SVQC
 #include <common/effects/qc/_mod.qh>
 
@@ -51,6 +122,48 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own)
        }
 }
 
+void W_Electro_ExplodeComboThink(entity this)
+{
+       if(time >= this.ltime)
+       {
+               delete(this);
+               return;
+       }
+
+       this.nextthink = time;
+
+       float damage = WEP_CVAR(WEP_ELECTRO, combo_damage) * PHYS_INPUT_TIMELENGTH;
+       float edgedamage = WEP_CVAR(WEP_ELECTRO, combo_edgedamage) * PHYS_INPUT_TIMELENGTH;
+
+       RadiusDamage(this, this.realowner, damage, edgedamage, WEP_CVAR(WEP_ELECTRO, combo_radius), NULL, NULL, 0, this.projectiledeathtype, this.weaponentity_fld, NULL);
+       this.projectiledeathtype |= HITTYPE_SPAM; // ensure it doesn't spam its effect
+}
+
+void W_Electro_Orb_ExplodeOverTime(entity this)
+{
+       entity newproj = spawn();
+       newproj.classname = this.classname;
+       newproj.solid = this.solid;
+       setorigin(newproj, this.origin);
+       setmodel(newproj, MDL_PROJECTILE_ELECTRO);
+       setsize(newproj, this.mins, this.maxs);
+       newproj.owner = this.owner;
+       newproj.realowner = this.realowner;
+       newproj.weaponentity_fld = this.weaponentity_fld;
+       newproj.projectiledeathtype = WEP_ELECTRO.m_id | HITTYPE_BOUNCE; // use THIS type for a combo because primary can't bounce
+
+       setthink(newproj, W_Electro_ExplodeComboThink);
+       newproj.nextthink = time;
+       newproj.ltime = time + WEP_CVAR(WEP_ELECTRO, combo_duration);
+       set_movetype(newproj, MOVETYPE_NONE);
+
+       Net_LinkEntity(newproj, true, 0, electro_orb_send);
+       newproj.SendFlags |= 1;
+
+       // fire the first damage tick immediately
+       getthink(newproj)(newproj);
+}
+
 void W_Electro_ExplodeCombo(entity this)
 {
        W_Electro_TriggerCombo(this.origin, WEP_CVAR(WEP_ELECTRO, combo_comboradius), this.realowner);
@@ -59,6 +172,14 @@ void W_Electro_ExplodeCombo(entity this)
        if (!this.velocity)
                this.velocity = this.movedir; // .velocity must be != '0 0 0' for particle fx and decal to work
 
+       if(WEP_CVAR(WEP_ELECTRO, combo_duration))
+       {
+               W_Electro_Orb_ExplodeOverTime(this);
+
+               delete(this);
+               return;
+       }
+
        RadiusDamage(
                this,
                this.realowner,
index fe9199b8f9665fe0bb4c5b96e0491f57fa793b2e..e7df4e039036a69e61f19c529d52a2fb44c5ff07 100644 (file)
@@ -4,7 +4,7 @@ CLASS(Electro, Weapon)
 /* spawnfunc */ ATTRIB(Electro, m_canonical_spawnfunc, string, "weapon_electro");
 /* ammotype  */ ATTRIB(Electro, ammo_type, Resource, 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");
@@ -29,6 +29,7 @@ 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) \
index 8469b63186586a11d0a89f3a91807642df234872..a862ffe4928fdd9214226250f4d50de69f6e101b 100644 (file)
@@ -14,7 +14,10 @@ alias test_arc_bounce_burst "settemp g_balance_arc_bolt_bounce_count 1 ; settemp
 alias test_ctf_stalemate90 "settemp g_ctf_stalemate_time 90"
 alias test_ctf_stalemate120 "settemp g_ctf_stalemate_time 120"
 
-alias _testing_list "$1 test_blaster_switch ; $1 test_crylink_sec_horizontal ; $1 test_rocket_flying ; $1 test_ctf_stalemate90 ; $1 test_ctf_stalemate120 ; $1 test_arc_bounce ; $1 test_arc_bounce_burst"
+// https://gitlab.com/xonotic/xonotic-data.pk3dir/-/merge_requests/1067
+alias test_electro_combo_over_time "settemp g_balance_electro_combo_duration 1.5"
+
+alias _testing_list "$1 test_blaster_switch ; $1 test_crylink_sec_horizontal ; $1 test_rocket_flying ; $1 test_ctf_stalemate90 ; $1 test_ctf_stalemate120 ; $1 test_arc_bounce ; $1 test_arc_bounce_burst ; $1 test_electro_combo_over_time"
 
 // defer addvote and delvote execution because program commands can't be executed if testing_disable
 // and testing_enable are executed at startup (no program is loaded yet)