diff --git a/source/server/player.qc b/source/server/player.qc index 0ca5a67..e46da90 100644 --- a/source/server/player.qc +++ b/source/server/player.qc @@ -527,10 +527,9 @@ void() PlayerPreThink = self.onfire = false; } - // refuel/cool flamethrowers + // Flamethrower-based weapon cooldown/refuel process. if (self.ltime < time) { - // FIXME: Weapon hardcode definition. - float weapon_slot = Weapon_PlayerHasWeapon(self, W_M2, true); + float weapon_slot = Weapon_PlayerHasWeaponWithFiretype(self, FIRETYPE_FLAME); if (weapon_slot == 0) return; diff --git a/source/server/utilities/weapon_utilities.qc b/source/server/utilities/weapon_utilities.qc index ed0eaaa..4643bce 100644 --- a/source/server/utilities/weapon_utilities.qc +++ b/source/server/utilities/weapon_utilities.qc @@ -80,7 +80,7 @@ void(entity person, float slot, float ammo) Weapon_SetPlayerAmmoInSlot = }; // -// Weapon_PlayerHasWeapon(peron, comparison, include_pap) +// Weapon_PlayerHasWeapon(person, comparison, include_pap) // Checks to see if the Player is holding a weapon in any // of their three slots. `include_pap` dictates whether to // consider Pack-A-Punch'd varients. Returns 1, 2, 3 depending @@ -107,6 +107,25 @@ float(entity person, float comparison, float include_pap) Weapon_PlayerHasWeapon return 0; }; +// +// Weapon_PlayerHasWeaponWithFiretype(person, comparison) +// Similar check to Weapon_PlayerHasWeapon, but returns +// an index to the first-found firetype instead. +// +float(entity person, float comparison) Weapon_PlayerHasWeaponWithFiretype = +{ + for (float i = 0; i < MAX_PLAYER_WEAPONS; i++) { + // Storage. + float weapon_firetype = GetFiretype(person.weapons[i].weapon_id); + + // Now do the comparison + if (weapon_firetype == comparison) + return i + 1; + } + + return 0; +}; + // // Weapon_IsSemiAutomatic(float weapon) // Checks weapon firetypes and returns true if intended