update PlayerUpdate packet process
This commit is contained in:
parent
6fe4f7fe85
commit
e93af1a3f9
3 changed files with 61 additions and 3 deletions
|
|
@ -338,6 +338,7 @@ namespace TShockAPI
|
|||
/// Velocity of the player.
|
||||
/// </summary>
|
||||
public Vector2 Velocity { get; set; }
|
||||
public ushort? MountType { get; set; }
|
||||
/// <summary>
|
||||
/// Original position of the player when using Potion of Return.
|
||||
/// </summary>
|
||||
|
|
@ -346,6 +347,7 @@ namespace TShockAPI
|
|||
/// Home Position of the player for Potion of Return.
|
||||
/// </summary>
|
||||
public Vector2? HomePos { get; set; }
|
||||
public Vector2? NetCameraTarget { get; set; }
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
|
|
@ -363,8 +365,10 @@ namespace TShockAPI
|
|||
byte selectedItem,
|
||||
Vector2 position,
|
||||
Vector2 velocity,
|
||||
ushort? mountType,
|
||||
Vector2? originalPos,
|
||||
Vector2? homePos)
|
||||
Vector2? homePos,
|
||||
Vector2? netCameraTarget)
|
||||
{
|
||||
if (PlayerUpdate == null)
|
||||
return false;
|
||||
|
|
@ -381,8 +385,10 @@ namespace TShockAPI
|
|||
SelectedItem = selectedItem,
|
||||
Position = position,
|
||||
Velocity = velocity,
|
||||
MountType = mountType,
|
||||
OriginalPos = originalPos,
|
||||
HomePos = homePos
|
||||
HomePos = homePos,
|
||||
NetCameraTarget = netCameraTarget
|
||||
};
|
||||
PlayerUpdate.Invoke(null, args);
|
||||
return args.Handled;
|
||||
|
|
@ -2826,7 +2832,15 @@ namespace TShockAPI
|
|||
|
||||
Vector2 velocity = Vector2.Zero;
|
||||
if (miscData1.HasVelocity)
|
||||
{
|
||||
velocity = args.Data.ReadVector2();
|
||||
}
|
||||
|
||||
ushort? mountType = null;
|
||||
if (miscData1.IsMountActive)
|
||||
{
|
||||
mountType = args.Data.ReadUInt16();
|
||||
}
|
||||
|
||||
Vector2? originalPosition = new Vector2?();
|
||||
Vector2? homePosition = Vector2.Zero;
|
||||
|
|
@ -2837,7 +2851,13 @@ namespace TShockAPI
|
|||
TShock.Log.ConsoleDebug(GetString("GetDataHandlers / HandlePlayerUpdate home position delta {0}", args.Player.Name));
|
||||
}
|
||||
|
||||
if (OnPlayerUpdate(args.Player, args.Data, playerID, controls, miscData1, miscData2, miscData3, selectedItem, position, velocity, originalPosition, homePosition))
|
||||
Vector2? netCameraTarget = null;
|
||||
if (miscData3.HasNetCameraTarget)
|
||||
{
|
||||
netCameraTarget = args.Data.ReadVector2();
|
||||
}
|
||||
|
||||
if (OnPlayerUpdate(args.Player, args.Data, playerID, controls, miscData1, miscData2, miscData3, selectedItem, position, velocity, mountType, originalPosition, homePosition, netCameraTarget))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -75,6 +75,12 @@ namespace TShockAPI.Models.PlayerUpdate
|
|||
set => bitsbyte[6] = value;
|
||||
}
|
||||
|
||||
public bool IsMountActive
|
||||
{
|
||||
get => bitsbyte[7];
|
||||
set => bitsbyte[7] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance of MiscDataSet1 with the given backing BitsByte
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,38 @@ namespace TShockAPI.Models.PlayerUpdate
|
|||
set => bitsbyte[0] = value;
|
||||
}
|
||||
|
||||
public bool AutoReuseAllWeapons
|
||||
{
|
||||
get => bitsbyte[1];
|
||||
set => bitsbyte[1] = value;
|
||||
}
|
||||
public bool ControlDownHold
|
||||
{
|
||||
get => bitsbyte[2];
|
||||
set => bitsbyte[2] = value;
|
||||
}
|
||||
|
||||
public bool IsOperatingAnotherEntity
|
||||
{
|
||||
get => bitsbyte[3];
|
||||
set => bitsbyte[3] = value;
|
||||
}
|
||||
public bool ControlUseTile
|
||||
{
|
||||
get => bitsbyte[4];
|
||||
set => bitsbyte[4] = value;
|
||||
}
|
||||
public bool HasNetCameraTarget
|
||||
{
|
||||
get => bitsbyte[5];
|
||||
set => bitsbyte[5] = value;
|
||||
}
|
||||
public bool LastItemUseAttemptSuccess
|
||||
{
|
||||
get => bitsbyte[6];
|
||||
set => bitsbyte[6] = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance of MiscDataSet3 with the given backing BitsByte
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue