]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reduce the number of weapon impulses by recycling machinegun, vortex and shotgun... terencehill/overkill_weapon_aliases 1497/head
authorterencehill <piuntn@gmail.com>
Sat, 26 Apr 2025 00:15:46 +0000 (02:15 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 26 Apr 2025 00:16:49 +0000 (02:16 +0200)
The weapon aliases created obviously aren't unique, they are only in Overkill where only the Overkill weapons are allowed.

Thanks to this change the Ball Stealer alias has been restored and 2 impulses are now free.

qcsrc/common/mutators/mutator/overkill/okmachinegun.qh
qcsrc/common/mutators/mutator/overkill/oknex.qh
qcsrc/common/mutators/mutator/overkill/okshotgun.qh
qcsrc/common/weapons/all.qh

index 2c5eb35bf90ac077aa4e4b926977d557188f75e1..12360f21d4e702975842f3bb0573edc3cba0fcf4 100644 (file)
@@ -12,6 +12,7 @@ CLASS(OverkillMachineGun, Weapon)
 /* spawnfunc */ ATTRIB(OverkillMachineGun, m_canonical_spawnfunc, string, "weapon_okmachinegun");
 /* ammotype  */ ATTRIB(OverkillMachineGun, ammo_type, Resource, RES_BULLETS);
 /* impulse   */ ATTRIB(OverkillMachineGun, impulse, int, 3);
+/* unique imp*/ ATTRIB(OverkillMachineGun, m_unique_impulse, int, 3); // same as impulse to avoid running out of impulses
 /* flags     */ ATTRIB(OverkillMachineGun, spawnflags, int, WEP_FLAG_HIDDEN | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS | WEP_FLAG_MUTATORBLOCKED);
 /* rating    */ ATTRIB(OverkillMachineGun, bot_pickupbasevalue, float, 7000);
 /* color     */ ATTRIB(OverkillMachineGun, m_color, vector, '0.678 0.886 0.267');
index ce45c0556e79250bcc16f58070aa085923190572..25077c5fd723e4a04b56dc46aeda99dfb42c2b34 100644 (file)
@@ -14,6 +14,7 @@ CLASS(OverkillNex, Weapon)
 /* spawnfunc */ ATTRIB(OverkillNex, m_canonical_spawnfunc, string, "weapon_oknex");
 /* ammotype  */ ATTRIB(OverkillNex, ammo_type, Resource, RES_CELLS);
 /* impulse   */ ATTRIB(OverkillNex, impulse, int, 7);
+/* unique imp*/ ATTRIB(OverkillNex, m_unique_impulse, int, 7); // same as impulse to avoid running out of impulses
 /* flags     */ ATTRIB(OverkillNex, spawnflags, int, WEP_FLAG_HIDDEN | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_MUTATORBLOCKED);
 /* rating    */ ATTRIB(OverkillNex, bot_pickupbasevalue, float, 8000);
 /* color     */ ATTRIB(OverkillNex, m_color, vector, '0.459 0.765 0.835');
index c837425c652ba4d1fb309a45d9b87c97a8d83396..c46f571122d0815bce0aab5c278c67f4ba1b014b 100644 (file)
@@ -10,6 +10,7 @@ CLASS(OverkillShotgun, Weapon)
 /* spawnfunc */ ATTRIB(OverkillShotgun, m_canonical_spawnfunc, string, "weapon_okshotgun");
 /* ammotype  */ ATTRIB(OverkillShotgun, ammo_type, Resource, RES_SHELLS);
 /* impulse   */ ATTRIB(OverkillShotgun, impulse, int, 2);
+/* unique imp*/ ATTRIB(OverkillShotgun, m_unique_impulse, int, 2); // same as impulse to avoid running out of impulses
 /* flags     */ ATTRIB(OverkillShotgun, spawnflags, int, WEP_FLAG_HIDDEN | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_MUTATORBLOCKED);
 /* rating    */ ATTRIB(OverkillShotgun, bot_pickupbasevalue, float, 6000);
 /* color     */ ATTRIB(OverkillShotgun, m_color, vector, '0.518 0.608 0.659');
index 85b95243f2e9e84a1d41aa9fc164630c40567090..264c308d012d6375a3fe8077bb70f8efe29335c9 100644 (file)
@@ -344,8 +344,14 @@ STATIC_INIT(register_weapons_done)
                if (it.spawnflags & WEP_FLAG_SUPERWEAPON) WEPSET_SUPERWEAPONS |= set;
                if (it == WEP_Null) continue;
                if (it.spawnflags & WEP_FLAG_SPECIALATTACK) continue;
-               // TODO: this exists to filter out the Ball Stealer, otherwise we run out of impulses
-               if ((it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && (it.spawnflags & WEP_TYPE_OTHER)) continue;
+
+               if ((it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && it.m_unique_impulse)
+               {
+                       // this mutator weapon recycles an impulse of a weapon group to reduce the number of impulses used,
+                       // which are very limited. The impulse number must be unique in the mutator
+                       localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", it.netname, it.m_unique_impulse));
+                       continue;
+               }
 
                it.m_unique_impulse = imp;
                if (imp <= WEP_IMPULSE_END)