Fix projectile issue.
This commit is contained in:
parent
1c981c331c
commit
7f1891236d
@ -13,13 +13,17 @@ namespace RageCoop.Client
|
||||
public SyncedProjectile(Projectile p)
|
||||
{
|
||||
ID=EntityPool.RequestNewID();
|
||||
IsMine=true;
|
||||
MainProjectile = p;
|
||||
Origin=p.Position;
|
||||
var shooter = EntityPool.GetPedByHandle((p.Owner?.Handle).GetValueOrDefault());
|
||||
if(shooter != null)
|
||||
{
|
||||
if (shooter.MainPed!=null && (p.AttachedEntity==shooter.MainPed.Weapons.CurrentWeaponObject || p.AttachedEntity== shooter.MainPed))
|
||||
{
|
||||
IsValid=false;
|
||||
}
|
||||
ShooterID=shooter.ID;
|
||||
IsMine=shooter.IsMine;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -34,14 +38,15 @@ namespace RageCoop.Client
|
||||
Main.Logger.Warning($"Could not find owner for projectile:{Hash}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public SyncedProjectile(int id)
|
||||
{
|
||||
ID= id;
|
||||
IsMine=false;
|
||||
}
|
||||
public new bool IsMine { get; private set; }
|
||||
public bool IsValid { get; private set; } = true;
|
||||
public new bool IsMine { get; private set; } = false;
|
||||
public bool Exploded { get; set; } = false;
|
||||
public Projectile MainProjectile { get; set; }
|
||||
public int ShooterID { get; set; }
|
||||
|
@ -226,6 +226,7 @@ namespace RageCoop.Client
|
||||
}
|
||||
public static void Add(SyncedProjectile p)
|
||||
{
|
||||
if (!p.IsValid) { return; }
|
||||
if (ID_Projectiles.ContainsKey(p.ID))
|
||||
{
|
||||
ID_Projectiles[p.ID]=p;
|
||||
|
Loading…
x
Reference in New Issue
Block a user