Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ SmoothSlope()

static void Terraria.Tile.SmoothSlope ( int x,
int y,
bool applyToNeighbors = true,
bool sync = false )
inlinestatic

Definition at line 759 of file Tile.cs.

760 {
761 if (applyToNeighbors)
762 {
763 SmoothSlope(x + 1, y, applyToNeighbors: false, sync);
764 SmoothSlope(x - 1, y, applyToNeighbors: false, sync);
765 SmoothSlope(x, y + 1, applyToNeighbors: false, sync);
766 SmoothSlope(x, y - 1, applyToNeighbors: false, sync);
767 }
768 Tile tile = Main.tile[x, y];
769 if (!WorldGen.CanPoundTile(x, y) || !WorldGen.SolidOrSlopedTile(x, y))
770 {
771 return;
772 }
773 bool flag = !WorldGen.TileEmpty(x, y - 1);
774 bool flag2 = !WorldGen.SolidOrSlopedTile(x, y - 1) && flag;
775 bool flag3 = WorldGen.SolidOrSlopedTile(x, y + 1);
776 bool flag4 = WorldGen.SolidOrSlopedTile(x - 1, y);
777 bool flag5 = WorldGen.SolidOrSlopedTile(x + 1, y);
778 int num = ((flag ? 1 : 0) << 3) | ((flag3 ? 1 : 0) << 2) | ((flag4 ? 1 : 0) << 1) | (flag5 ? 1 : 0);
779 bool flag6 = tile.halfBrick();
780 int num2 = tile.slope();
781 switch (num)
782 {
783 case 10:
784 if (!flag2)
785 {
786 tile.halfBrick(halfBrick: false);
787 tile.slope(3);
788 }
789 break;
790 case 9:
791 if (!flag2)
792 {
793 tile.halfBrick(halfBrick: false);
794 tile.slope(4);
795 }
796 break;
797 case 6:
798 tile.halfBrick(halfBrick: false);
799 tile.slope(1);
800 break;
801 case 5:
802 tile.halfBrick(halfBrick: false);
803 tile.slope(2);
804 break;
805 case 4:
806 tile.slope(0);
807 tile.halfBrick(halfBrick: true);
808 break;
809 default:
810 tile.halfBrick(halfBrick: false);
811 tile.slope(0);
812 break;
813 }
814 if (sync)
815 {
816 int num3 = tile.slope();
817 bool flag7 = flag6 != tile.halfBrick();
818 bool flag8 = num2 != num3;
819 if (flag7 && flag8)
820 {
821 NetMessage.SendData(17, -1, -1, null, 23, x, y, num3);
822 }
823 else if (flag7)
824 {
825 NetMessage.SendData(17, -1, -1, null, 7, x, y, 1f);
826 }
827 else if (flag8)
828 {
829 NetMessage.SendData(17, -1, -1, null, 14, x, y, num3);
830 }
831 }
832 }
static void SmoothSlope(int x, int y, bool applyToNeighbors=true, bool sync=false)
Definition Tile.cs:759
bool halfBrick()
Definition Tile.cs:650

References Terraria.WorldGen.CanPoundTile(), Terraria.Tile.halfBrick(), Terraria.NetMessage.SendData(), Terraria.Tile.slope(), Terraria.Tile.SmoothSlope(), Terraria.WorldGen.SolidOrSlopedTile(), Terraria.Main.tile, and Terraria.WorldGen.TileEmpty().

Referenced by Terraria.WorldBuilding.Actions.Smooth.Apply(), Terraria.GameContent.Biomes.Desert.DesertHive.PlaceClusters(), Terraria.GameContent.Biomes.DunesBiome.PlaceCurvedLine(), Terraria.GameContent.Biomes.GraniteBiome.PlaceDecorations(), Terraria.GameContent.Generation.TrackGenerator.PlacePath(), Terraria.GameContent.Biomes.MarbleBiome.PlaceSlab(), Terraria.Tile.SmoothSlope(), and Terraria.Mount.UseDrill().