FishOutNPC - Fix some rods not fishing out NPCs.

I was wrong, not all bobbers are named "Bobber".
Just found that Projectile now has an extra field which determines if the given type is a bobber. This field is set in Projectile.SetDefaults method in the following logic
`((type >= 360 && type <= 366) || type == 381 || type == 382 || type == 760 || type == 775)`
I think it is reasonable to use the bobber field, as it would be updateproof too.
Tested and working. Fixes #1985
This commit is contained in:
Patrikkk 2020-06-06 22:28:37 +02:00
parent 31e79a3918
commit 156cf4930b
2 changed files with 3 additions and 2 deletions

View file

@ -1906,8 +1906,8 @@ namespace TShockAPI
/// <param name="args"></param>
internal void OnFishOutNPC(object sender, GetDataHandlers.FishOutNPCEventArgs args)
{
/// Getting recent projectiles of the player which are named Bobber. All bobbers have the same Name.
var projectile = args.Player.RecentlyCreatedProjectiles.FirstOrDefault(p => Main.projectile[p.Index].Name == "Bobber");
/// Getting recent projectiles of the player and selecting the first that is a bobber.
var projectile = args.Player.RecentlyCreatedProjectiles.FirstOrDefault(p => Main.projectile[p.Index].bobber);
if (!FishingRodItemIDs.Contains(args.Player.SelectedItem.type))
{