forked from UnrealMultiple/TShockPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFixHalves.cs
More file actions
36 lines (33 loc) · 731 Bytes
/
Copy pathFixHalves.cs
File metadata and controls
36 lines (33 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using Terraria;
using TShockAPI;
namespace WorldEdit.Commands;
public class FixHalves : WECommand
{
public FixHalves(int x, int y, int x2, int y2, TSPlayer plr)
: base(x, y, x2, y2, plr)
{
}
public override void Execute()
{
if (!CanUseCommand())
{
return;
}
Tools.PrepareUndo(x, y, x2, y2, plr);
int fixedHalfBlockCount = 0;
for (int tileX = x; tileX <= x2; tileX++)
{
for (int tileY = y; tileY <= y2; tileY++)
{
ITile tile = Main.tile[tileX, tileY];
if (tile.halfBrick() && TileSolid(tileX, tileY - 1))
{
tile.halfBrick(false);
fixedHalfBlockCount++;
}
}
}
ResetSection();
plr.SendSuccessMessage(GetString("Fixed half blocks. ({0})"), fixedHalfBlockCount);
}
}