ProjectileStruct - Adding extra data

Can we store the type of the recent projectile as well? This could be used in my upcoming PR regarding the golf packet where I check for recently created projectiles, and their types. Having only the index is not useful in this scenario, because the projectile can already be killed, so cannot access the Main.projectile array to get the projectile type.

Can this be public instead of internal? Developers could make good use of it, instead of having to implement their own version of RecentProjectiles in their plugins.
This commit is contained in:
Patrikkk 2020-05-30 11:22:50 +02:00
parent 791a6be831
commit 9934a3935d
3 changed files with 5 additions and 2 deletions

View file

@ -2398,6 +2398,7 @@ namespace TShockAPI
args.Player.RecentlyCreatedProjectiles.Add(new GetDataHandlers.ProjectileStruct()
{
Index = index,
Type = type,
CreatedAt = DateTime.Now
});
}
@ -3770,9 +3771,10 @@ namespace TShockAPI
{TileID.MinecartTrack, 3}
};
internal struct ProjectileStruct
public struct ProjectileStruct
{
public int Index { get; set; }
public short Type { get; set; }
public DateTime CreatedAt { get; set; }
public bool Killed { get; internal set; }
}