Better weapon damage reproduction

This commit is contained in:
Sardelka
2022-06-17 11:08:49 +08:00
parent 7f1891236d
commit 45f487c9f4
3 changed files with 30 additions and 24 deletions

View File

@ -189,7 +189,7 @@ namespace RageCoop.Client {
_lastWeaponHash=weaponHash;
}
if (!_weaponAsset.IsLoaded) { _weaponAsset.Request(); }
World.ShootBullet(start, end, p, _weaponAsset, p.GetWeaponDamage(weaponHash));
World.ShootBullet(start, end, p, _weaponAsset, (int)p.GetWeaponDamage(weaponHash));
Prop w;
if(((w = p.Weapons.CurrentWeaponObject) != null)&&(p.VehicleWeapon==VehicleWeaponHash.Invalid))
{
@ -268,27 +268,6 @@ namespace RageCoop.Client {
}
}
}
public static int GetWeaponDamage(this Ped p,uint hash)
{
if(p.IsInVehicle() && (hash!=(uint)p.Weapons.Current.Hash))
{
// This is a vehicle weapon
p.VehicleWeapon=(VehicleWeaponHash)hash;
return 100;
}
switch (p.Weapons.Current.Group)
{
case WeaponGroup.Pistol: return 30;
case WeaponGroup.AssaultRifle: return 30;
case WeaponGroup.SMG: return 20;
case WeaponGroup.MG: return 40;
case WeaponGroup.Shotgun: return 30;
case WeaponGroup.Sniper: return 200;
case WeaponGroup.Heavy: return 30;
}
return 0;
}
#endregion