Add a projectile tracker, so that we can allow fluid bombs.

This commit is contained in:
Olink 2020-05-24 03:48:08 -04:00
parent ae87f242d7
commit 965361c406
4 changed files with 68 additions and 7 deletions

View file

@ -44,6 +44,7 @@ using Microsoft.Xna.Framework;
using TShockAPI.Sockets;
using TShockAPI.CLI;
using TShockAPI.Localization;
using System.Threading.Tasks;
namespace TShockAPI
{
@ -1064,6 +1065,18 @@ namespace TShockAPI
}
}
}
Task.Run(() =>
{
if (player != null && player.TPlayer.whoAmI >= 0)
{
var threshold = DateTime.Now.AddSeconds(-5);
lock (player.RecentlyCreatedProjectiles)
{
player.RecentlyCreatedProjectiles = player.RecentlyCreatedProjectiles.Where(s => s.CreatedAt > threshold).ToList();
}
}
});
}
Utils.SetConsoleTitle(false);
}