Updating HandleProjectileNew
Packet structure order is different in 1.4
This commit is contained in:
parent
b349da69b6
commit
9a05678933
1 changed files with 11 additions and 13 deletions
|
|
@ -2296,23 +2296,21 @@ namespace TShockAPI
|
||||||
private static bool HandleProjectileNew(GetDataHandlerArgs args)
|
private static bool HandleProjectileNew(GetDataHandlerArgs args)
|
||||||
{
|
{
|
||||||
short ident = args.Data.ReadInt16();
|
short ident = args.Data.ReadInt16();
|
||||||
var pos = new Vector2(args.Data.ReadSingle(), args.Data.ReadSingle());
|
Vector2 pos = args.Data.ReadVector2();
|
||||||
var vel = new Vector2(args.Data.ReadSingle(), args.Data.ReadSingle());
|
Vector2 vel = args.Data.ReadVector2();
|
||||||
float knockback = args.Data.ReadSingle();
|
|
||||||
short dmg = args.Data.ReadInt16();
|
|
||||||
byte owner = args.Data.ReadInt8();
|
byte owner = args.Data.ReadInt8();
|
||||||
short type = args.Data.ReadInt16();
|
short type = args.Data.ReadInt16();
|
||||||
BitsByte bits = args.Data.ReadInt8();
|
BitsByte bits = (BitsByte)args.Data.ReadByte();
|
||||||
//owner = (byte)args.Player.Index;
|
|
||||||
float[] ai = new float[Projectile.maxAI];
|
float[] ai = new float[Projectile.maxAI];
|
||||||
|
for (int i = 0; i < Projectile.maxAI; ++i)
|
||||||
|
ai[i] = !bits[i] ? 0.0f : args.Data.ReadSingle();
|
||||||
|
short dmg = bits[4] ? args.Data.ReadInt16() : (short)0;
|
||||||
|
float knockback = bits[5] ? args.Data.ReadSingle() : 0.0f;
|
||||||
|
short origDmg = bits[6] ? args.Data.ReadInt16() : (short)0;
|
||||||
|
short projUUID = bits[7] ? args.Data.ReadInt16() : (short)-1;
|
||||||
|
if (projUUID >= 1000)
|
||||||
|
projUUID = -1;
|
||||||
|
|
||||||
for (int i = 0; i < Projectile.maxAI; i++)
|
|
||||||
{
|
|
||||||
if (bits[i])
|
|
||||||
ai[i] = args.Data.ReadSingle();
|
|
||||||
else
|
|
||||||
ai[i] = 0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
var index = TShock.Utils.SearchProjectile(ident, owner);
|
var index = TShock.Utils.SearchProjectile(ident, owner);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue