Fix weird projectile shooting
This commit is contained in:
@ -16,7 +16,7 @@ using System.Resources;
|
|||||||
|
|
||||||
|
|
||||||
// Version informationr(
|
// Version informationr(
|
||||||
[assembly: AssemblyVersion("1.5.3.174")]
|
[assembly: AssemblyVersion("1.5.3.176")]
|
||||||
[assembly: AssemblyFileVersion("1.5.3.174")]
|
[assembly: AssemblyFileVersion("1.5.3.176")]
|
||||||
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
|
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
|
||||||
|
|
||||||
|
@ -19,12 +19,11 @@ namespace RageCoop.Client
|
|||||||
public SyncedEntity Shooter { get; set; }
|
public SyncedEntity Shooter { get; set; }
|
||||||
public bool Exploded => Flags.HasProjDataFlag(ProjectileDataFlags.Exploded);
|
public bool Exploded => Flags.HasProjDataFlag(ProjectileDataFlags.Exploded);
|
||||||
|
|
||||||
|
internal override Player Owner => Shooter.Owner;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invalid property for projectile.
|
/// Invalid property for projectile.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private new int OwnerID { set { } }
|
private new int OwnerID { set { } }
|
||||||
|
|
||||||
internal override Player Owner => Shooter.Owner;
|
|
||||||
public WeaponHash WeaponHash { get; set; }
|
public WeaponHash WeaponHash { get; set; }
|
||||||
private WeaponAsset Asset { get; set; }
|
private WeaponAsset Asset { get; set; }
|
||||||
public void ExtractData(ref Packets.ProjectileSync p)
|
public void ExtractData(ref Packets.ProjectileSync p)
|
||||||
@ -101,7 +100,7 @@ namespace RageCoop.Client
|
|||||||
CreateProjectile();
|
CreateProjectile();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MainProjectile.Velocity = Velocity + (Predict(Position) - MainProjectile.Position);
|
MainProjectile.Velocity = Velocity + 10*(Predict(Position) - MainProjectile.Position);
|
||||||
MainProjectile.Rotation = Rotation;
|
MainProjectile.Rotation = Rotation;
|
||||||
LastUpdated = Main.Ticked;
|
LastUpdated = Main.Ticked;
|
||||||
}
|
}
|
||||||
@ -115,14 +114,12 @@ namespace RageCoop.Client
|
|||||||
owner = (Shooter as SyncedPed)?.MainPed ?? (Entity)(Shooter as SyncedVehicle)?.MainVehicle;
|
owner = (Shooter as SyncedPed)?.MainPed ?? (Entity)(Shooter as SyncedVehicle)?.MainVehicle;
|
||||||
Position = (Owner.PacketTravelTime + 0.001f * LastSyncedStopWatch.ElapsedMilliseconds) * Shooter.Velocity + Position;
|
Position = (Owner.PacketTravelTime + 0.001f * LastSyncedStopWatch.ElapsedMilliseconds) * Shooter.Velocity + Position;
|
||||||
var end = Position + Velocity;
|
var end = Position + Velocity;
|
||||||
Function.Call(Hash.SHOOT_SINGLE_BULLET_BETWEEN_COORDS_IGNORE_ENTITY, Position.X, Position.Y, Position.Z, end.X, end.Y, end.Z, 0, 1, WeaponHash, owner?.Handle ?? 0, 1, 0, -1, owner);
|
Function.Call(Hash.SHOOT_SINGLE_BULLET_BETWEEN_COORDS_IGNORE_ENTITY, Position.X, Position.Y, Position.Z, end.X, end.Y, end.Z, 0, 1, WeaponHash, owner?.Handle ?? 0, 1, 0, -1);
|
||||||
var ps = World.GetAllProjectiles();
|
var ps = World.GetAllProjectiles();
|
||||||
MainProjectile = ps[ps.Length - 1];
|
MainProjectile = ps[ps.Length - 1];
|
||||||
MainProjectile.IsCollisionEnabled = false;
|
|
||||||
MainProjectile.Position = Position;
|
MainProjectile.Position = Position;
|
||||||
MainProjectile.Rotation = Rotation;
|
MainProjectile.Rotation = Rotation;
|
||||||
MainProjectile.Velocity = Velocity;
|
MainProjectile.Velocity = Velocity;
|
||||||
Main.Delay(() => MainProjectile.IsCollisionEnabled = true, 100);
|
|
||||||
EntityPool.Add(this);
|
EntityPool.Add(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user