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