Better weapon damage reproduction
This commit is contained in:
parent
7f1891236d
commit
45f487c9f4
@ -70,8 +70,7 @@ namespace RageCoop.Client
|
|||||||
CreateProjectile();
|
CreateProjectile();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainProjectile.Position=Position;
|
MainProjectile.Velocity=Velocity+(Position+Networking.Latency*Velocity-MainProjectile.Position);
|
||||||
MainProjectile.Velocity=Velocity;
|
|
||||||
MainProjectile.Rotation=Rotation;
|
MainProjectile.Rotation=Rotation;
|
||||||
LastUpdated=Main.Ticked;
|
LastUpdated=Main.Ticked;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ namespace RageCoop.Client {
|
|||||||
_lastWeaponHash=weaponHash;
|
_lastWeaponHash=weaponHash;
|
||||||
}
|
}
|
||||||
if (!_weaponAsset.IsLoaded) { _weaponAsset.Request(); }
|
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;
|
Prop w;
|
||||||
if(((w = p.Weapons.CurrentWeaponObject) != null)&&(p.VehicleWeapon==VehicleWeaponHash.Invalid))
|
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
|
#endregion
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using GTA;
|
using GTA;
|
||||||
|
using GTA.Native;
|
||||||
using GTA.Math;
|
using GTA.Math;
|
||||||
|
|
||||||
namespace RageCoop.Client
|
namespace RageCoop.Client
|
||||||
@ -32,6 +33,33 @@ namespace RageCoop.Client
|
|||||||
return p.Bones[Bone.SkelRightHand].Position;
|
return p.Bones[Bone.SkelRightHand].Position;
|
||||||
}
|
}
|
||||||
static long BulletsShot=0;
|
static long BulletsShot=0;
|
||||||
|
|
||||||
|
public static float GetWeaponDamage(this Ped P, uint hash)
|
||||||
|
{
|
||||||
|
var comp = P.Weapons.Current.Components.GetSuppressorComponent();
|
||||||
|
return Function.Call<float>(Hash.GET_WEAPON_DAMAGE, hash, comp.Active ? comp.ComponentHash : WeaponComponentHash.Invalid);
|
||||||
|
|
||||||
|
/*
|
||||||
|
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;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
public static MuzzleInfo GetMuzzleInfo(this Vehicle v)
|
public static MuzzleInfo GetMuzzleInfo(this Vehicle v)
|
||||||
{
|
{
|
||||||
BulletsShot++;
|
BulletsShot++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user