diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e26688b..21ffffaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * `tshock.journey.biomespreadfreeze` * `tshock.journey.setspawnrate` * Changed default thresholds for some changes in the config file to accommodate new items & changes to Terraria. (@hakusaro) +* Store projectile type in `ProjectileStruct RecentlyCreatedProjectiles` to identify the recently created projectiles by type. Make `RecentlyCreatedProjectiles` and `ProjectileStruct` public for developers to access from plugins. ## TShock 4.4.0 (Pre-release 7 (Entangled)) * Fixed bed spawn issues when trying to remove spawn point in SSC. (@Olink) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 304de4e2..b5c9bbb0 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -2438,6 +2438,7 @@ namespace TShockAPI args.Player.RecentlyCreatedProjectiles.Add(new GetDataHandlers.ProjectileStruct() { Index = index, + Type = type, CreatedAt = DateTime.Now }); } @@ -3868,11 +3869,27 @@ namespace TShockAPI { {TileID.MinecartTrack, 3} }; - - internal struct ProjectileStruct + + /// + /// Contains brief information about a projectile + /// + public struct ProjectileStruct { + /// + /// Index inside Main.projectile + /// public int Index { get; set; } + /// + /// Projectile's type ID + /// + public short Type { get; set; } + /// + /// Time at which the projectile was created + /// public DateTime CreatedAt { get; set; } + /// + /// Whether or not the projectile has been killed + /// public bool Killed { get; internal set; } } diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 4a85f590..54be5041 100644 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -795,7 +795,7 @@ namespace TShockAPI /// Keeps track of recently created projectiles by this player. TShock.cs OnSecondUpdate() removes from this in an async task. /// Projectiles older than 5 seconds are purged from this collection as they are no longer "recent." /// - internal List RecentlyCreatedProjectiles = new List(); + public List RecentlyCreatedProjectiles = new List(); /// /// The current region this player is in, or null if none. diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 6d84817c..74e35636 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1654,6 +1654,7 @@ namespace TShockAPI player.RecentlyCreatedProjectiles.Add(new GetDataHandlers.ProjectileStruct() { Index = e.number, + Type = (short)projectile.type, CreatedAt = DateTime.Now }); }