From 5f162bcf43be1ac95f8fb28d52b63cdfd5131751 Mon Sep 17 00:00:00 2001 From: Zack Piispanen Date: Sat, 2 Jun 2012 22:15:26 -0400 Subject: [PATCH] Added fail boolean to the TileEdit event. --- TShockAPI/GetDataHandlers.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 50baf8d9..410e5cd5 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -81,13 +81,18 @@ namespace TShockAPI /// (KillTile = 0, PlaceTile = 1, KillWall = 2, PlaceWall = 3, KillTileNoItem = 4, PlaceWire = 5, KillWire = 6) /// public byte EditType { get; set; } + + /// + /// Did the tile get destroyed successfully. + /// + public bool Fail { get; set; } } /// /// TileEdit - called when a tile is placed or destroyed /// public static HandlerList TileEdit; - private static bool OnTileEdit(TSPlayer ply, int x, int y, byte type, byte editType) + private static bool OnTileEdit(TSPlayer ply, int x, int y, byte type, byte editType, bool fail) { if (TileEdit == null) return false; @@ -98,7 +103,8 @@ namespace TShockAPI X = x, Y = y, Type = type, - EditType = editType + EditType = editType, + Fail = fail }; TileEdit.Invoke(null, args); return args.Handled; @@ -1638,7 +1644,8 @@ namespace TShockAPI var tileX = args.Data.ReadInt32(); var tileY = args.Data.ReadInt32(); var tiletype = args.Data.ReadInt8(); - if (OnTileEdit(args.Player, tileX, tileY, tiletype, type)) + var fail = args.Data.ReadBoolean(); + if (OnTileEdit(args.Player, tileX, tileY, tiletype, type, fail)) return true; if (tileX < 0 || tileX >= Main.maxTilesX || tileY < 0 || tileY >= Main.maxTilesY) return false;