Merge branch 'general-devel' into addpersonalstoragecheck

This commit is contained in:
Patrikkk 2020-06-12 14:29:39 +02:00 committed by GitHub
commit 6bad423d6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View file

@ -319,12 +319,14 @@ namespace TShockAPI
}
else if (CoilTileIds.Contains(editData))
{
//projectile should be the same X coordinate as all tile places
if (!args.Player.RecentlyCreatedProjectiles.Any(p => GetDataHandlers.projectileCreatesTile.ContainsKey(Main.projectile[p.Index].type) &&
Math.Abs((int)(Main.projectile[p.Index].position.X / 16f) - tileX) <= Math.Abs(Main.projectile[p.Index].velocity.X) &&
GetDataHandlers.projectileCreatesTile[Main.projectile[p.Index].type] == editData))
/// Handle placement if the user is placing rope that comes from a ropecoil,
/// but have not created the ropecoil projectile recently or the projectile was not at the correct coordinate, or the tile that the projectile places does not match the rope it is suposed to place
/// projectile should be the same X coordinate as all tile places (Note by @Olink)
if (ropeCoilPlacements.ContainsKey(selectedItem.netID) &&
!args.Player.RecentlyCreatedProjectiles.Any(p => GetDataHandlers.projectileCreatesTile.ContainsKey(p.Type) && GetDataHandlers.projectileCreatesTile[p.Type] == editData &&
!p.Killed && Math.Abs((int)(Main.projectile[p.Index].position.X / 16f) - tileX) <= Math.Abs(Main.projectile[p.Index].velocity.X)))
{
TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (inconceivable rope coil) {0} {1} {2}", args.Player.Name, action, editData);
TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (inconceivable rope coil) {0} {1} {2} selectedItem:{3} itemCreateTile:{4}", args.Player.Name, action, editData, selectedItem.netID, selectedItem.createTile);
args.Player.SendTileSquare(tileX, tileY, 1);
args.Handled = true;
return;