Server: Add a utility function for weapons that require a tracefire

Util_WeaponFiresTraceshot() can be used to determine if a weapon is "standard"
requiring a tracefire for bullet impact/penetration.
This commit is contained in:
Ian 2022-11-17 21:34:46 -05:00
parent 68f66b4b7b
commit c109f1712a
2 changed files with 18 additions and 6 deletions

View file

@ -645,3 +645,19 @@ float(entity person, float comparison, float include_pap) Util_PlayerHasWeapon =
return 0; return 0;
}; };
//
// Util_WeaponFiresTraceshot(weapon)
// Simply returns true if given weapon's firetype requires a
// firetrace to be used properly.
//
float(float weapon) Util_WeaponFiresTraceshot =
{
float firetype = GetFiretype(weapon);
// Valid firetypes
if (firetype == 0 || firetype == 1 || firetype == 3)
return true;
return false;
}

View file

@ -3,7 +3,7 @@
weapon logic weapon logic
Copyright (C) 2021 NZ:P Team Copyright (C) 2021-2022 NZ:P Team
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -264,9 +264,6 @@ void() W_Switch =
UpdateVmodel(modelname, GetWepSkin(self.weapon)); UpdateVmodel(modelname, GetWepSkin(self.weapon));
//UpdateWeapons(1);
//if (self.weaponslot1.dualwield)
// Set_W2_Frame (self.weaponslot1.TakeWeaponStart, self.weaponslot1.TakeWeaponEnd, 0, 0, 0, SUB_Null, self.weaponslot1.v_model2, false);//FIXME
Set_W_Frame (startframe, endframe, 0, 0, 0, SUB_Null, modelname, false, S_BOTH);//FIXME Set_W_Frame (startframe, endframe, 0, 0, 0, SUB_Null, modelname, false, S_BOTH);//FIXME
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0; self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = 0;
@ -1538,8 +1535,7 @@ void(float side) W_Fire =
W_FireM2(); W_FireM2();
} }
// FIXME - clean this up lol if (Util_WeaponFiresTraceshot(self.weapon)) {
if (firetype == 1 || firetype == 0 || firetype == 3) {
FireTrace(shotcount, spread, damage, side); FireTrace(shotcount, spread, damage, side);
} }