Merge pull request #1962 from Pryaxis/projectilestruct-addition

Projectilestruct addition
This commit is contained in:
Chris 2020-06-01 19:19:22 +09:30 committed by GitHub
commit 8d26b3816e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 3 deletions

View file

@ -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)

View file

@ -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
/// <summary>
/// Contains brief information about a projectile
/// </summary>
public struct ProjectileStruct
{
/// <summary>
/// Index inside Main.projectile
/// </summary>
public int Index { get; set; }
/// <summary>
/// Projectile's type ID
/// </summary>
public short Type { get; set; }
/// <summary>
/// Time at which the projectile was created
/// </summary>
public DateTime CreatedAt { get; set; }
/// <summary>
/// Whether or not the projectile has been killed
/// </summary>
public bool Killed { get; internal set; }
}

View file

@ -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."
/// </summary>
internal List<TShockAPI.GetDataHandlers.ProjectileStruct> RecentlyCreatedProjectiles = new List<TShockAPI.GetDataHandlers.ProjectileStruct>();
public List<TShockAPI.GetDataHandlers.ProjectileStruct> RecentlyCreatedProjectiles = new List<TShockAPI.GetDataHandlers.ProjectileStruct>();
/// <summary>
/// The current region this player is in, or null if none.

View file

@ -1654,6 +1654,7 @@ namespace TShockAPI
player.RecentlyCreatedProjectiles.Add(new GetDataHandlers.ProjectileStruct()
{
Index = e.number,
Type = (short)projectile.type,
CreatedAt = DateTime.Now
});
}