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

◆ Place3x3()

static void Terraria.WorldGen.Place3x3 ( int x,
int y,
ushort type,
int style = 0 )
inlinestatic

Definition at line 45220 of file WorldGen.cs.

45221 {
45222 bool flag = true;
45223 int num = 0;
45224 if (type == 106 || type == 212 || type == 219 || type == 220 || type == 228 || type == 231 || type == 243 || type == 247 || type == 283 || (type >= 300 && type <= 308) || type == 354 || type == 355 || type == 642)
45225 {
45226 num = -2;
45227 for (int i = x - 1; i < x + 2; i++)
45228 {
45229 for (int j = y - 2; j < y + 1; j++)
45230 {
45231 if (Main.tile[i, j] == null)
45232 {
45233 Main.tile[i, j] = new Tile();
45234 }
45235 if (Main.tile[i, j].active())
45236 {
45237 flag = false;
45238 }
45239 }
45240 }
45241 for (int k = x - 1; k < x + 2; k++)
45242 {
45243 if (Main.tile[k, y + 1] == null)
45244 {
45245 Main.tile[k, y + 1] = new Tile();
45246 }
45247 if (!SolidTile2(k, y + 1))
45248 {
45249 flag = false;
45250 break;
45251 }
45252 }
45253 }
45254 else
45255 {
45256 for (int l = x - 1; l < x + 2; l++)
45257 {
45258 for (int m = y; m < y + 3; m++)
45259 {
45260 if (Main.tile[l, m] == null)
45261 {
45262 Main.tile[l, m] = new Tile();
45263 }
45264 if (Main.tile[l, m].active())
45265 {
45266 flag = false;
45267 }
45268 }
45269 }
45270 if (Main.tile[x, y - 1] == null)
45271 {
45272 Main.tile[x, y - 1] = new Tile();
45273 }
45274 if (!Main.tile[x, y - 1].nactive() || !Main.tileSolid[Main.tile[x, y - 1].type] || Main.tileSolidTop[Main.tile[x, y - 1].type])
45275 {
45276 flag = false;
45277 }
45278 }
45279 if (flag)
45280 {
45281 int num2 = style * 18 * 3;
45282 Main.tile[x - 1, y + num].active(active: true);
45283 Main.tile[x - 1, y + num].frameY = 0;
45284 Main.tile[x - 1, y + num].frameX = (short)num2;
45285 Main.tile[x - 1, y + num].type = type;
45286 Main.tile[x, y + num].active(active: true);
45287 Main.tile[x, y + num].frameY = 0;
45288 Main.tile[x, y + num].frameX = (short)(num2 + 18);
45289 Main.tile[x, y + num].type = type;
45290 Main.tile[x + 1, y + num].active(active: true);
45291 Main.tile[x + 1, y + num].frameY = 0;
45292 Main.tile[x + 1, y + num].frameX = (short)(num2 + 36);
45293 Main.tile[x + 1, y + num].type = type;
45294 Main.tile[x - 1, y + 1 + num].active(active: true);
45295 Main.tile[x - 1, y + 1 + num].frameY = 18;
45296 Main.tile[x - 1, y + 1 + num].frameX = (short)num2;
45297 Main.tile[x - 1, y + 1 + num].type = type;
45298 Main.tile[x, y + 1 + num].active(active: true);
45299 Main.tile[x, y + 1 + num].frameY = 18;
45300 Main.tile[x, y + 1 + num].frameX = (short)(num2 + 18);
45301 Main.tile[x, y + 1 + num].type = type;
45302 Main.tile[x + 1, y + 1 + num].active(active: true);
45303 Main.tile[x + 1, y + 1 + num].frameY = 18;
45304 Main.tile[x + 1, y + 1 + num].frameX = (short)(num2 + 36);
45305 Main.tile[x + 1, y + 1 + num].type = type;
45306 Main.tile[x - 1, y + 2 + num].active(active: true);
45307 Main.tile[x - 1, y + 2 + num].frameY = 36;
45308 Main.tile[x - 1, y + 2 + num].frameX = (short)num2;
45309 Main.tile[x - 1, y + 2 + num].type = type;
45310 Main.tile[x, y + 2 + num].active(active: true);
45311 Main.tile[x, y + 2 + num].frameY = 36;
45312 Main.tile[x, y + 2 + num].frameX = (short)(num2 + 18);
45313 Main.tile[x, y + 2 + num].type = type;
45314 Main.tile[x + 1, y + 2 + num].active(active: true);
45315 Main.tile[x + 1, y + 2 + num].frameY = 36;
45316 Main.tile[x + 1, y + 2 + num].frameX = (short)(num2 + 36);
45317 Main.tile[x + 1, y + 2 + num].type = type;
45318 }
45319 }
static bool SolidTile2(Tile testTile)

References Terraria.DataStructures.Tile, Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, and System.type.