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

◆ Place()

override bool Terraria.GameContent.Biomes.HiveBiome.Place ( Point origin,
StructureMap structures )
inline

Definition at line 11 of file HiveBiome.cs.

12 {
13 //IL_00ec: Unknown result type (might be due to invalid IL or missing references)
14 //IL_00f1: Unknown result type (might be due to invalid IL or missing references)
15 //IL_0139: Unknown result type (might be due to invalid IL or missing references)
16 //IL_013b: Unknown result type (might be due to invalid IL or missing references)
17 //IL_0150: Unknown result type (might be due to invalid IL or missing references)
18 //IL_0158: Unknown result type (might be due to invalid IL or missing references)
19 //IL_0165: Unknown result type (might be due to invalid IL or missing references)
20 //IL_016a: Unknown result type (might be due to invalid IL or missing references)
21 //IL_0178: Unknown result type (might be due to invalid IL or missing references)
22 //IL_017a: Unknown result type (might be due to invalid IL or missing references)
23 //IL_017f: Unknown result type (might be due to invalid IL or missing references)
24 //IL_018b: Unknown result type (might be due to invalid IL or missing references)
25 //IL_0247: Unknown result type (might be due to invalid IL or missing references)
26 //IL_0260: Unknown result type (might be due to invalid IL or missing references)
27 //IL_0262: Unknown result type (might be due to invalid IL or missing references)
28 //IL_0298: Unknown result type (might be due to invalid IL or missing references)
29 //IL_02a0: Unknown result type (might be due to invalid IL or missing references)
30 //IL_02b0: Unknown result type (might be due to invalid IL or missing references)
31 //IL_02b2: Unknown result type (might be due to invalid IL or missing references)
32 //IL_02c9: Unknown result type (might be due to invalid IL or missing references)
33 //IL_02d1: Unknown result type (might be due to invalid IL or missing references)
34 //IL_02ea: Unknown result type (might be due to invalid IL or missing references)
35 //IL_02f2: Unknown result type (might be due to invalid IL or missing references)
36 //IL_0308: Unknown result type (might be due to invalid IL or missing references)
37 if (!structures.CanPlace(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100)))
38 {
39 return false;
40 }
42 {
43 return false;
44 }
45 Ref<int> @ref = new Ref<int>(0);
46 Ref<int> ref2 = new Ref<int>(0);
47 Ref<int> ref3 = new Ref<int>(0);
48 WorldUtils.Gen(origin, new Shapes.Circle(15), Actions.Chain(new Modifiers.IsSolid(), new Actions.Scanner(@ref), new Modifiers.OnlyTiles(60, 59), new Actions.Scanner(ref2), new Modifiers.OnlyTiles(60), new Actions.Scanner(ref3)));
49 if ((double)ref2.Value / (double)@ref.Value < 0.75 || ref3.Value < 2)
50 {
51 return false;
52 }
53 int num = 0;
54 int[] array = new int[1000];
55 int[] array2 = new int[1000];
56 Vector2D val = origin.ToVector2D();
57 int num2 = WorldGen.genRand.Next(2, 5);
58 if (WorldGen.drunkWorldGen)
59 {
60 num2 += WorldGen.genRand.Next(7, 10);
61 }
62 else if (WorldGen.remixWorldGen)
63 {
64 num2 += WorldGen.genRand.Next(2, 5);
65 }
66 for (int i = 0; i < num2; i++)
67 {
68 Vector2D val2 = val;
69 int num3 = WorldGen.genRand.Next(2, 5);
70 for (int j = 0; j < num3; j++)
71 {
72 val2 = CreateHiveTunnel((int)val.X, (int)val.Y, WorldGen.genRand);
73 }
74 val = val2;
75 array[num] = (int)val.X;
76 array2[num] = (int)val.Y;
77 num++;
78 }
79 FrameOutAllHiveContents(origin, 50);
80 for (int k = 0; k < num; k++)
81 {
82 int num4 = array[k];
83 int y = array2[k];
84 int num5 = 1;
85 if (WorldGen.genRand.Next(2) == 0)
86 {
87 num5 = -1;
88 }
89 bool flag = false;
90 while (WorldGen.InWorld(num4, y, 10) && BadSpotForHoneyFall(num4, y))
91 {
92 num4 += num5;
93 if (Math.Abs(num4 - array[k]) > 50)
94 {
95 flag = true;
96 break;
97 }
98 }
99 if (!flag)
100 {
101 num4 += num5;
102 if (!SpotActuallyNotInHive(num4, y))
103 {
104 CreateBlockedHoneyCube(num4, y);
105 CreateDentForHoneyFall(num4, y, num5);
106 }
107 }
108 }
110 if (WorldGen.drunkWorldGen)
111 {
112 for (int l = 0; l < 1000; l++)
113 {
114 Vector2D val3 = val;
115 val3.X += WorldGen.genRand.Next(-50, 51);
116 val3.Y += WorldGen.genRand.Next(-50, 51);
117 if (WorldGen.InWorld((int)val3.X, (int)val3.Y) && Vector2D.Distance(val, val3) > 10.0 && !Main.tile[(int)val3.X, (int)val3.Y].active() && Main.tile[(int)val3.X, (int)val3.Y].wall == 86)
118 {
120 break;
121 }
122 }
123 }
124 structures.AddProtectedStructure(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100), 5);
125 return true;
126 }
static double Abs(double value)
static void CreateStandForLarva(Vector2D position)
Definition HiveBiome.cs:394
static void CreateDentForHoneyFall(int x, int y, int dir)
Definition HiveBiome.cs:324
static bool BadSpotForHoneyFall(int x, int y)
Definition HiveBiome.cs:385
static void FrameOutAllHiveContents(Point origin, int squareHalfWidth)
Definition HiveBiome.cs:128
static void CreateBlockedHoneyCube(int x, int y)
Definition HiveBiome.cs:345
static Vector2D CreateHiveTunnel(int i, int j, UnifiedRandom random)
Definition HiveBiome.cs:151
static bool SpotActuallyNotInHive(int x, int y)
Definition HiveBiome.cs:366
static bool TooCloseToImportantLocations(Point origin)
Definition HiveBiome.cs:295
static GenAction Chain(params GenAction[] actions)
Definition Actions.cs:470
void AddProtectedStructure(Rectangle area, int padding=0)
bool CanPlace(Rectangle area, int padding=0)
static bool Gen(Point origin, GenShape shape, GenAction action)
Definition WorldUtils.cs:17
static double Distance(Vector2D value1, Vector2D value2)
Definition Vector2D.cs:137

References System.Math.Abs(), Terraria.WorldBuilding.StructureMap.AddProtectedStructure(), System.array, Terraria.GameContent.Biomes.HiveBiome.BadSpotForHoneyFall(), Terraria.WorldBuilding.StructureMap.CanPlace(), Terraria.WorldBuilding.Actions.Chain(), Terraria.GameContent.Biomes.HiveBiome.CreateBlockedHoneyCube(), Terraria.GameContent.Biomes.HiveBiome.CreateDentForHoneyFall(), Terraria.GameContent.Biomes.HiveBiome.CreateHiveTunnel(), Terraria.GameContent.Biomes.HiveBiome.CreateStandForLarva(), ReLogic.Utilities.Vector2D.Distance(), Terraria.WorldGen.drunkWorldGen, Terraria.GameContent.Biomes.HiveBiome.FrameOutAllHiveContents(), Terraria.WorldBuilding.WorldUtils.Gen(), Terraria.WorldGen.genRand, Terraria.WorldGen.InWorld(), Terraria.WorldGen.remixWorldGen, Terraria.GameContent.Biomes.HiveBiome.SpotActuallyNotInHive(), Terraria.Main.tile, Terraria.GameContent.Biomes.HiveBiome.TooCloseToImportantLocations(), Terraria.Ref< T >.Value, Microsoft.Xna.Framework.Point.X, ReLogic.Utilities.Vector2D.X, Microsoft.Xna.Framework.Point.Y, and ReLogic.Utilities.Vector2D.Y.