Merge pull request #1951 from Olink/fix-bugs

Fix rope coils.
This commit is contained in:
Lucas Nicodemus 2020-06-01 02:21:31 -07:00 committed by GitHub
commit 62ff490470
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 8 deletions

View file

@ -3,9 +3,11 @@
This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large.
## Upcoming release
* Fixed a longstanding issue with SendTileSquare that could result in desyncs and visual errors (@QuiCM)
* Fixed placement issues with Item Frames, Teleportation Pylons, etc (@QuiCM)
* Fix all rope coils. (@Olink)
* Fixed a longstanding issue with SendTileSquare that could result in desyncs and visual errors. (@QuiCM)
* Fixed placement issues with Item Frames, Teleportation Pylons, etc. (@QuiCM)
* Doors are good now for real probably (@QuiCM, @Hakusaro, @Olink)
* Bump default max damage received cap to 42,000 to accommodate the Empress of Light's instant kill death amount. (@hakusaro, @moisterrific, @Irethia, @Ayrawei)
## TShock 4.4.0 (Pre-release 9)
* Fixed pet licenses. (@Olink)
@ -34,9 +36,6 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* To add this command to your guest group, give them `tshock.synclocalarea`, with `/group addperm guest tshock.synclocalarea`.
* This command may be removed at any time in the future (and will likely be removed when send tile square handling is fixed).
* Fixed smart door automatic door desync and deletion issue. (@hakusaro)
* Bump default max damage received cap to 42,000 to accommodate the Empress of Light's instant kill death amount. (@hakusaro, @moisterrific, @Irethia, @Ayrawei)
## TShock 4.4.0 (Pre-release 8)
* Update for OTAPI 2.0.0.36 and Terraria 1.4.0.4. (@hakusaro, @Patrikkk, @DeathCradle)

View file

@ -300,6 +300,19 @@ namespace TShockAPI
{
args.Player.LastKilledProjectile = 0;
}
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))
{
TShock.Log.ConsoleDebug("Bouncer / OnTileEdit rejected from (inconceivable rope coil) {0} {1} {2}", args.Player.Name, action, editData);
args.Player.SendTileSquare(tileX, tileY, 1);
args.Handled = true;
return;
}
}
else if (action == EditAction.PlaceTile || action == EditAction.PlaceWall)
{
if ((action == EditAction.PlaceTile && TShock.Config.PreventInvalidPlaceStyle) &&

View file

@ -3727,7 +3727,20 @@ namespace TShockAPI
{ ProjectileID.EbonsandBallGun, TileID.Ebonsand },
{ ProjectileID.PearlSandBallGun, TileID.Pearlsand },
{ ProjectileID.CrimsandBallGun, TileID.Crimsand },
{ ProjectileID.MysticSnakeCoil, TileID.MysticSnakeRope }
{ ProjectileID.MysticSnakeCoil, TileID.MysticSnakeRope },
{ ProjectileID.RopeCoil, TileID.Rope },
{ ProjectileID.SilkRopeCoil, TileID.SilkRope },
{ ProjectileID.VineRopeCoil, TileID.VineRope },
{ ProjectileID.WebRopeCoil, TileID.WebRope }
};
internal static List<int> CoilTileIds = new List<int>()
{
TileID.MysticSnakeRope,
TileID.Rope,
TileID.SilkRope,
TileID.VineRope,
TileID.WebRope
};
internal static Dictionary<int, LiquidType> projectileCreatesLiquid = new Dictionary<int, LiquidType>

View file

@ -496,7 +496,7 @@ namespace TShockAPI
}
var response = NetCreativeUnlocksModule.SerializeItemSacrifice(i, amount);
NetManager.Instance.SendToClient(response, player.TPlayer.whoAmI);
NetManager.Instance.SendToClient(response, player.Index);
}
}
}

View file

@ -1639,7 +1639,8 @@ namespace TShockAPI
if (e.number >= 0 && e.number < Main.projectile.Length)
{
var projectile = Main.projectile[e.number];
if (projectile.active && projectile.owner >= 0 && GetDataHandlers.projectileCreatesLiquid.ContainsKey(projectile.type))
if (projectile.active && projectile.owner >= 0 &&
(GetDataHandlers.projectileCreatesLiquid.ContainsKey(projectile.type) || GetDataHandlers.projectileCreatesTile.ContainsKey(projectile.type)))
{
var player = Players[projectile.owner];
if (player != null)