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

◆ TryKillingTreesAboveIfTheyWouldBecomeInvalid()

static bool Terraria.WorldGen.TryKillingTreesAboveIfTheyWouldBecomeInvalid ( int i,
int j,
int newFloorType )
inlinestatic

Definition at line 46823 of file WorldGen.cs.

46824 {
46826 {
46827 return false;
46828 }
46829 if (!InWorld(i, j, 2))
46830 {
46831 return false;
46832 }
46833 Tile tile = Main.tile[i, j - 1];
46834 if (tile == null || !tile.active())
46835 {
46836 return false;
46837 }
46838 int type = tile.type;
46839 if (!IsTreeType(tile.type) && tile.type != 323)
46840 {
46841 return false;
46842 }
46843 bool flag = true;
46844 flag = type switch
46845 {
46846 72 => newFloorType == 70,
46849 };
46850 if (flag && GrowTreeSettings.Profiles.TryGetFromTreeId(type, out var profile))
46851 {
46852 flag = profile.GroundTest(newFloorType);
46853 }
46854 if (!flag)
46855 {
46856 KillTile(i, j - 1);
46857 if (Main.netMode == 1)
46858 {
46859 NetMessage.SendData(17, -1, -1, null, 0, i, j - 1);
46860 }
46861 }
46862 return true;
46863 }
static readonly ushort Count
Definition TileID.cs:1698
static bool IsTreeType(int tree)
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static bool InWorld(int x, int y, int fluff=0)
Definition WorldGen.cs:5816

References Terraria.Tile.active(), Terraria.ID.TileID.Count, Terraria.ID.TileID.Sets.Conversion.Grass, Terraria.ID.TileID.Sets.Conversion.JungleGrass, Terraria.Main.netMode, Terraria.ID.TileID.Sets.Conversion.Sand, Terraria.NetMessage.SendData(), Terraria.ID.TileID.Sets.Conversion.Snow, Terraria.Main.tile, Terraria.WorldGen.GrowTreeSettings.Profiles.TryGetFromTreeId(), System.type, and Terraria.Tile.type.