]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add g_balance_electro_secondary_limit setting to allow controlling the maximum number...
authorMario <mario.mario@y7mail.com>
Mon, 16 Nov 2020 03:17:39 +0000 (13:17 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 16 Nov 2020 03:17:39 +0000 (13:17 +1000)
bal-wep-mario.cfg
bal-wep-nexuiz25.cfg
bal-wep-samual.cfg
bal-wep-xdf.cfg
bal-wep-xonotic.cfg
qcsrc/common/effects/qc/_mod.inc
qcsrc/common/effects/qc/_mod.qh
qcsrc/common/effects/qc/rubble.qc [new file with mode: 0644]
qcsrc/common/effects/qc/rubble.qh
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/electro.qh

index 640ce27209e6a0ea53af3d7cdf6a3afb2f5dad8b..1026700fc36ab0d026853d7b7442f4f3a0941070 100644 (file)
@@ -216,6 +216,7 @@ set g_balance_electro_secondary_edgedamage 15
 set g_balance_electro_secondary_force 50
 set g_balance_electro_secondary_health 5
 set g_balance_electro_secondary_lifetime 4
+set g_balance_electro_secondary_limit 0
 set g_balance_electro_secondary_radius 150
 set g_balance_electro_secondary_refire 0.2
 set g_balance_electro_secondary_refire2 1.6
index 1cbfe88e9801504a1c1daa8e1880e2f68408003b..d82db5a1545c761c6644db9ec564bd221374aef9 100644 (file)
@@ -216,6 +216,7 @@ set g_balance_electro_secondary_edgedamage 0
 set g_balance_electro_secondary_force 200
 set g_balance_electro_secondary_health 5
 set g_balance_electro_secondary_lifetime 5
+set g_balance_electro_secondary_limit 0
 set g_balance_electro_secondary_radius 150
 set g_balance_electro_secondary_refire 0.3
 set g_balance_electro_secondary_refire2 0
index 055afcc2a38c299a254f8de33b9a619ae2e12423..8a1e40c299b03dbacc57616a1e912df55602b065 100644 (file)
@@ -216,6 +216,7 @@ set g_balance_electro_secondary_edgedamage 20
 set g_balance_electro_secondary_force 50
 set g_balance_electro_secondary_health 5
 set g_balance_electro_secondary_lifetime 4
+set g_balance_electro_secondary_limit 0
 set g_balance_electro_secondary_radius 150
 set g_balance_electro_secondary_refire 0.2
 set g_balance_electro_secondary_refire2 1.6
index a1fea0c38726e2dd3042ecabcdeca6ad491b4b73..611f67bcebcf4da5bf997e3f956d048d62f1bd42 100644 (file)
@@ -216,6 +216,7 @@ set g_balance_electro_secondary_edgedamage 15
 set g_balance_electro_secondary_force 200
 set g_balance_electro_secondary_health 5
 set g_balance_electro_secondary_lifetime 3
+set g_balance_electro_secondary_limit 0
 set g_balance_electro_secondary_radius 150
 set g_balance_electro_secondary_refire 0.2
 set g_balance_electro_secondary_refire2 1.5
index 647fb2290727424f03e92d624da2c5787724649e..5f27b7ebf110099d1e74c3f4fc56235b191f052e 100644 (file)
@@ -216,6 +216,7 @@ set g_balance_electro_secondary_edgedamage 15
 set g_balance_electro_secondary_force 50
 set g_balance_electro_secondary_health 5
 set g_balance_electro_secondary_lifetime 4
+set g_balance_electro_secondary_limit 0
 set g_balance_electro_secondary_radius 150
 set g_balance_electro_secondary_refire 0.2
 set g_balance_electro_secondary_refire2 1.6
index 8df95b821ae2ea07cec594230396235d74fb2529..069ec0796f6b9ab47126d7a848a223326ba04a4f 100644 (file)
@@ -5,3 +5,4 @@
 #include <common/effects/qc/globalsound.qc>
 #include <common/effects/qc/lightningarc.qc>
 #include <common/effects/qc/modeleffects.qc>
+#include <common/effects/qc/rubble.qc>
index 3f6387f0eb21a179d6a259466c914dfbb6cc4d19..124299ad7432081ac3023294233c4016f85c34a0 100644 (file)
@@ -5,3 +5,4 @@
 #include <common/effects/qc/globalsound.qh>
 #include <common/effects/qc/lightningarc.qh>
 #include <common/effects/qc/modeleffects.qh>
+#include <common/effects/qc/rubble.qh>
diff --git a/qcsrc/common/effects/qc/rubble.qc b/qcsrc/common/effects/qc/rubble.qc
new file mode 100644 (file)
index 0000000..27dd7d4
--- /dev/null
@@ -0,0 +1,40 @@
+#include "rubble.qh"
+
+#ifdef GAMEQC
+void RubbleLimit(string cname, int limit, void(entity) deleteproc)
+{
+       // remove rubble of the same type if it's at the limit
+       // remove multiple rubble if the limit has been decreased
+       while (1)
+       {
+               // walk the list and count the entities, find the oldest
+               // initialize our search with the first entity
+               int c = 0;
+               entity oldest = NULL;
+               float oldesttime = 0;
+               // compare to all other matching entities
+               IL_EACH(g_rubble, it.classname == cname,
+               {
+                       ++c;
+                       if(!oldest || oldesttime > it.creationtime)
+                       {
+                               oldest = it;
+                               oldesttime = it.creationtime;
+                       }
+               });
+
+               // stop if there are less than the limit already
+               if (c <= limit) break;
+
+               // delete this oldest one and search again
+               deleteproc(oldest);
+       }
+}
+
+entity RubbleNew(entity e)
+{
+       e.creationtime = time;
+       IL_PUSH(g_rubble, e);
+       return e;
+}
+#endif
index 83f0ce855eda15d8371d10c1c49376bca57d60bb..406d602c145d2359a6dd4d52fa324640f9e0857b 100644 (file)
@@ -1,48 +1,13 @@
 #pragma once
 
-#ifdef CSQC
-
+#ifdef GAMEQC
 entityclass(Rubble);
 classfield(Rubble).float creationtime;
 
 IntrusiveList g_rubble;
 STATIC_INIT(g_rubble) { g_rubble = IL_NEW(); }
 
-void RubbleLimit(string cname, int limit, void(entity) deleteproc)
-{
-       // remove rubble of the same type if it's at the limit
-       // remove multiple rubble if the limit has been decreased
-       while (1)
-       {
-               // walk the list and count the entities, find the oldest
-               // initialize our search with the first entity
-               int c = 0;
-               entity oldest = NULL;
-               float oldesttime = 0;
-               // compare to all other matching entities
-               IL_EACH(g_rubble, it.classname == cname,
-               {
-                       ++c;
-                       if(!oldest || oldesttime > it.creationtime)
-                       {
-                               oldest = it;
-                               oldesttime = it.creationtime;
-                       }
-               });
-
-               // stop if there are less than the limit already
-               if (c <= limit) break;
-
-               // delete this oldest one and search again
-               deleteproc(oldest);
-       }
-}
-
-entity RubbleNew(entity e)
-{
-       e.creationtime = time;
-       IL_PUSH(g_rubble, e);
-       return e;
-}
+void RubbleLimit(string cname, int limit, void(entity) deleteproc);
 
+entity RubbleNew(entity e);
 #endif
index 10005f22e541eb41f8e472ad9ca307fe1e0cecc7..21a2f9b0128723b4d719acc46d3d20f852e2a569 100644 (file)
@@ -1,6 +1,7 @@
 #include "electro.qh"
 
 #ifdef SVQC
+#include <common/effects/qc/_mod.qh>
 
 void W_Electro_TriggerCombo(vector org, float rad, entity own)
 {
@@ -295,6 +296,13 @@ void W_Electro_Orb_Stick(entity this, entity to)
        IL_PUSH(g_projectiles, newproj);
        IL_PUSH(g_bot_dodge, newproj);
 
+       // check if limits are enabled (we can tell by checking if the original orb is listed) and push it to the list if so
+       if(IL_CONTAINS(g_rubble, this))
+       {
+               newproj.creationtime = this.creationtime;
+               IL_PUSH(g_rubble, newproj);
+       }
+
        delete(this);
 
        if(to)
@@ -413,6 +421,12 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity)
        proj.bouncestop = WEP_CVAR_SEC(electro, bouncestop);
        proj.missile_flags = MIF_SPLASH | MIF_ARC;
 
+       if(WEP_CVAR_SEC(electro, limit) > 0)
+       {
+               RubbleNew(proj);
+               RubbleLimit("electro_orb", WEP_CVAR_SEC(electro, limit), adaptor_think2use_hittype_splash);
+       }
+
        CSQCProjectile(proj, true, PROJECTILE_ELECTRO, false); // no culling, it has sound
 
        MUTATOR_CALLHOOK(EditProjectile, actor, proj);
index 9583bc9f262624adf61e9a7ec71f3b0760d6ce8b..2f38024de0f74f233bee7209c9c9ea5773e1f18d 100644 (file)
@@ -42,6 +42,7 @@ CLASS(Electro, Weapon)
                P(class, prefix, force, float, BOTH) \
                P(class, prefix, health, float, SEC) \
                P(class, prefix, lifetime, float, BOTH) \
+               P(class, prefix, limit, float, SEC) \
                P(class, prefix, midaircombo_enemy, bool, PRI) \
                P(class, prefix, midaircombo_explode, float, PRI) \
                P(class, prefix, midaircombo_interval, float, PRI) \