Merge remote-tracking branch 'drunderscore/fix/bunny-cannon-quick-action' into general-devel
This commit is contained in:
commit
9258ee77d4
2 changed files with 39 additions and 4 deletions
|
|
@ -58,6 +58,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
|
||||||
* Removed the config options `TileRectangleSizeThreshold` and `KickOnTileRectangleSizeThresholdBroken` because they are made obsolete by the new system, which will only allow valid rectangle sizes (at a maximum of only 4 by 4 tiles in 1.4.3.6). (@punchready)
|
* Removed the config options `TileRectangleSizeThreshold` and `KickOnTileRectangleSizeThresholdBroken` because they are made obsolete by the new system, which will only allow valid rectangle sizes (at a maximum of only 4 by 4 tiles in 1.4.3.6). (@punchready)
|
||||||
* Bumped Newtonsoft Json to 13.0.1. (@dependabot)
|
* Bumped Newtonsoft Json to 13.0.1. (@dependabot)
|
||||||
* Allow the Cool Whip to apply `CoolWhipNPCDebuff` for `240` ticks, fixing abnormal NPC buff add rejects in Bouncer. (@drunderscore)
|
* Allow the Cool Whip to apply `CoolWhipNPCDebuff` for `240` ticks, fixing abnormal NPC buff add rejects in Bouncer. (@drunderscore)
|
||||||
|
* Fixed Bouncer rejecting Explosive Bunny critter release when using the Bunny Cannon, if the player had since stopped selecting the Explosive Bunny. (@drunderscore)
|
||||||
|
|
||||||
## TShock 4.5.17
|
## TShock 4.5.17
|
||||||
* Fixed duplicate characters (twins) after repeatedly logging in as the same character due to connection not being immediately closed during `NetHooks_NameCollision`. (@PotatoCider)
|
* Fixed duplicate characters (twins) after repeatedly logging in as the same character due to connection not being immediately closed during `NetHooks_NameCollision`. (@PotatoCider)
|
||||||
|
|
|
||||||
|
|
@ -1899,15 +1899,49 @@ namespace TShockAPI
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if released npc not from its item (from crafted packet)
|
void rejectForCritterNotReleasedFromItem()
|
||||||
// e.g. using bunny item to release golden bunny
|
|
||||||
if (args.Player.TPlayer.lastVisualizedSelectedItem.makeNPC != type && args.Player.TPlayer.lastVisualizedSelectedItem.placeStyle != style)
|
|
||||||
{
|
{
|
||||||
TShock.Log.ConsoleDebug("Bouncer / OnReleaseNPC released different critter from {0}", args.Player.Name);
|
TShock.Log.ConsoleDebug("Bouncer / OnReleaseNPC released different critter from {0}", args.Player.Name);
|
||||||
args.Player.Kick("Released critter was not from its item.", true);
|
args.Player.Kick("Released critter was not from its item.", true);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if released npc not from its item (from crafted packet)
|
||||||
|
// e.g. using bunny item to release golden bunny
|
||||||
|
if (args.Player.TPlayer.lastVisualizedSelectedItem.makeNPC != type || args.Player.TPlayer.lastVisualizedSelectedItem.placeStyle != style)
|
||||||
|
{
|
||||||
|
// If the critter is an Explosive Bunny, check if we've recently created an Explosive Bunny projectile.
|
||||||
|
// If we have, check if the critter we are trying to create is within range of the projectile
|
||||||
|
// If we have at least one of those, then this wasn't a crafted packet, but simply a delayed critter release from an
|
||||||
|
// Explosive Bunny projectile.
|
||||||
|
if (type == NPCID.ExplosiveBunny)
|
||||||
|
{
|
||||||
|
bool areAnyBunnyProjectilesInRange;
|
||||||
|
|
||||||
|
lock (args.Player.RecentlyCreatedProjectiles)
|
||||||
|
{
|
||||||
|
areAnyBunnyProjectilesInRange = args.Player.RecentlyCreatedProjectiles.Any(projectile =>
|
||||||
|
{
|
||||||
|
if (projectile.Type != ProjectileID.ExplosiveBunny)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var projectileInstance = Main.projectile[projectile.Index];
|
||||||
|
return projectileInstance.active && projectileInstance.WithinRange(new Vector2(args.X, args.Y), 32.0f);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!areAnyBunnyProjectilesInRange)
|
||||||
|
{
|
||||||
|
rejectForCritterNotReleasedFromItem();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rejectForCritterNotReleasedFromItem();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (args.Player.IsBouncerThrottled())
|
if (args.Player.IsBouncerThrottled())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue