Added fail boolean to the TileEdit event.
This commit is contained in:
parent
a1b8e169f3
commit
5f162bcf43
1 changed files with 10 additions and 3 deletions
|
|
@ -81,13 +81,18 @@ namespace TShockAPI
|
||||||
/// (KillTile = 0, PlaceTile = 1, KillWall = 2, PlaceWall = 3, KillTileNoItem = 4, PlaceWire = 5, KillWire = 6)
|
/// (KillTile = 0, PlaceTile = 1, KillWall = 2, PlaceWall = 3, KillTileNoItem = 4, PlaceWire = 5, KillWire = 6)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte EditType { get; set; }
|
public byte EditType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Did the tile get destroyed successfully.
|
||||||
|
/// </summary>
|
||||||
|
public bool Fail { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TileEdit - called when a tile is placed or destroyed
|
/// TileEdit - called when a tile is placed or destroyed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static HandlerList<TileEditEventArgs> TileEdit;
|
public static HandlerList<TileEditEventArgs> 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)
|
if (TileEdit == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -98,7 +103,8 @@ namespace TShockAPI
|
||||||
X = x,
|
X = x,
|
||||||
Y = y,
|
Y = y,
|
||||||
Type = type,
|
Type = type,
|
||||||
EditType = editType
|
EditType = editType,
|
||||||
|
Fail = fail
|
||||||
};
|
};
|
||||||
TileEdit.Invoke(null, args);
|
TileEdit.Invoke(null, args);
|
||||||
return args.Handled;
|
return args.Handled;
|
||||||
|
|
@ -1638,7 +1644,8 @@ namespace TShockAPI
|
||||||
var tileX = args.Data.ReadInt32();
|
var tileX = args.Data.ReadInt32();
|
||||||
var tileY = args.Data.ReadInt32();
|
var tileY = args.Data.ReadInt32();
|
||||||
var tiletype = args.Data.ReadInt8();
|
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;
|
return true;
|
||||||
if (tileX < 0 || tileX >= Main.maxTilesX || tileY < 0 || tileY >= Main.maxTilesY)
|
if (tileX < 0 || tileX >= Main.maxTilesX || tileY < 0 || tileY >= Main.maxTilesY)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue