From: terencehill Date: Sat, 26 Apr 2025 00:15:46 +0000 (+0200) Subject: Reduce the number of weapon impulses by recycling machinegun, vortex and shotgun... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2Fterencehill%2Foverkill_weapon_aliases;p=xonotic%2Fxonotic-data.pk3dir.git Reduce the number of weapon impulses by recycling machinegun, vortex and shotgun groups impulses for okmachinegun, oknex and okshotgun. 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. --- diff --git a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh index 2c5eb35bf9..12360f21d4 100644 --- a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh +++ b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qh @@ -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'); diff --git a/qcsrc/common/mutators/mutator/overkill/oknex.qh b/qcsrc/common/mutators/mutator/overkill/oknex.qh index ce45c0556e..25077c5fd7 100644 --- a/qcsrc/common/mutators/mutator/overkill/oknex.qh +++ b/qcsrc/common/mutators/mutator/overkill/oknex.qh @@ -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'); diff --git a/qcsrc/common/mutators/mutator/overkill/okshotgun.qh b/qcsrc/common/mutators/mutator/overkill/okshotgun.qh index c837425c65..c46f571122 100644 --- a/qcsrc/common/mutators/mutator/overkill/okshotgun.qh +++ b/qcsrc/common/mutators/mutator/overkill/okshotgun.qh @@ -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'); diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index 85b95243f2..264c308d01 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -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)